I'm reasonably certain you need to modify BaseType.java to add a new type to the type lattice.
In November, 2003, Stephen Neuendorffer wrote: > To speed up type comparisons, the TypeLattice keeps a cache of > comparison information in a 2D array. The 2D array is preallocated in > the TypeLattice class of size Type.HASH_MAX. You have to change that > value when adding a new type. (or simply implement the getTypeHash > method to return HASH_INVALID (as the documentation suggests). > > Note, however that it is not necessary to add new types to the type > lattice, as long as they are not comparable with existing types (other > than UNKNOWN and GENERAL. Simply having the type class is enough to > get the type system to check types for you. There is an example of > how to do this in data/type/test/TestToken.java See ptolemy.actor.lib.security.KeyToken, which includes a static inner class KeyType, which implements the Type interface. Doing something like what KeyToken does might help you, though I'm not so sure KeyToken.KeyType is in the Type lattice. I suppose you could initialize a new type at runtime by following the pattern in KeyToken.KeyType. _Christopher Christopher Brooks (cxh at eecs berkeley edu) University of California Programmer/Analyst Chess/Ptolemy/Trust US Mail: 558 Cory Hall #1770 ph: 510.643.9841 fax:510.642.2739 Berkeley, CA 94720-1770 home: (F-Tu) 707.665.0131 (W-F) 510.655.5480 (office: 400A Cory) -------- Hi, I want to extend Ptolemy by new data types. I have already created a type class and a corresponding token class, and every thing works fine if I add the type to the BaseType class, but I don't want to change the codebase of Ptolemy. Are there any alternatives to initialize the new type? Is it also possible to initialize a new type at runtime? Thanks Stephan Fabrizek --------------------------------------------------------------------------- - Posted to the ptolemy-hackers mailing list. Please send administrative mail for this list to: [EMAIL PROTECTED] -------- ---------------------------------------------------------------------------- Posted to the ptolemy-hackers mailing list. Please send administrative mail for this list to: [EMAIL PROTECTED]