[kepler-dev] difference between moml class and entity

Chad Berkley berkley at nceas.ucsb.edu
Fri Dec 9 10:24:09 PST 2005


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


More information about the Kepler-dev mailing list