[kepler-dev] difference between moml class and entity

Chad Berkley berkley at nceas.ucsb.edu
Fri Dec 9 15:08:18 PST 2005


exportMoML() is what i meant by serialize.  When i'm adding a moml class 
to the library, i get a class exported, but that seems problematic 
because the class is actually an instance (if that makes any sense). 
The question i've been wondering about is, why is Sinewave declared (in 
the actor library) as an entity when it is, in fact, defined as a class 
(in it's moml definition); and how can i programatically do that if that 
is required to create an instance?

I feel like i'm missing something here, but I'm not sure what.

chad

Edward A. Lee wrote:
> 
> 
> I'm confused... What do you mean by "serialize"?
> If I do exportMoML() on an instance, I will get an instance.
> If I do exportMoML() on a class, I will get a class...
> 
> Seems right to me...
> 
> Edward
> 
> 
> At 10:24 AM 12/9/2005 -0800, Chad Berkley wrote:
> 
>> Hi,
>>
>> I've run into a problem when trying to differentiate whether a composite
>> should be serialized to moml as a <class> or as an <entity>.  In PTII, a
>> Composite is defined as a <class> within its own moml file.  Take
>> Sinewave (ptolemy/actor/lib/Sinewave.xml) for example:
>>
>> <class name="Sinewave" extends="ptolemy.actor.TypedCompositeActor">
>> ....</class>
>>
>> However, within the actor library CompositeEntity, Sinewave is refered
>> to as an entity (/ptolemy/actor/lib/sequencesources.xml):
>>
>> <entity name="Sinewave" class="ptolemy.actor.lib.Sinewave"/>
>>
>> Programmatically, if I serialize Sinewave's moml, the momlParser returns
>> a class element.  This is problematic because I'm altering the actor
>> library programmatically.  When I do a
>> Sinewave.setContainer("actorLibrary"), it serializes as a class.  This
>> wouldn't be bad, except that when you drag it onto the canvas, it is
>> then interpreted as a class that needs to be instantiated instead of as
>> an instance (i.e. the purple box is drawn around it).
>>
>> Is there a way to tell it to give me the instance moml instead of the
>> class moml?
>>
>> thanks,
>> chad
>> _______________________________________________
>> Kepler-dev mailing list
>> Kepler-dev at ecoinformatics.org
>> http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/kepler-dev
> 
> 
> ------------
> Edward A. Lee
> Professor, Chair of the EE Division, Associate Chair of EECS
> 231 Cory Hall, UC Berkeley, Berkeley, CA 94720
> phone: 510-642-0253 or 510-642-0455, fax: 510-642-2845
> eal at eecs.Berkeley.EDU, http://ptolemy.eecs.berkeley.edu/~eal 
> 


More information about the Kepler-dev mailing list