Re: Adding a new type to BaseType

2003-11-05 Thread Stephen Andrew Neuendorffer
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

Steve

At 06:49 PM 11/4/2003 -0800, Efrat Jaeger wrote:
Hi,

I'm adding a new type to BaseType.java; a database connection type which 
would be passed between actors in a workflow to keep the DB Connection 
variable.

I've changed the following files:
TypeLattice - added nodeweight and edges (to general and unknown).
Constants - added the new type to the hash table.
BaseType - added the type in a similar manner as the other types.
I also created a DBConToken class which contains all the methods as 
ObjectToken (changed for this purpose).

I get an exception: ArrayIndexOutOfBound in the compare method of 
TypeLattice (exception 14). I saw that this exception occurs for 
MatrixTokens (which isn't the case here). Please let me know if there is 
anything else I should change in order to prevent this exception (I assume 
that this type should be added in a similar way to ObjectType, since it's 
a private case of it). I tried to solve it by changing the 
ConversionsUtility file as well, but it wasn't very helpful.

Thank you,

Efrat





Posted to the ptolemy-hackers mailing list.  Please send administrative
mail for this list to: [EMAIL PROTECTED]


Adding a new type to BaseType

2003-11-04 Thread Efrat Jaeger



Hi,
 
I'm adding a new type to BaseType.java; a 
database connection type which would be passed between actors in a workflow to 
keep the DB Connection variable.
 
I've changed the following files: 
TypeLattice - added nodeweight and edges (to 
general and unknown).
Constants - added the new type to the hash 
table.
BaseType - added the type in a similar manner as 
the other types.
 
I also created a DBConToken class which contains 
all the methods as ObjectToken (changed for this purpose).
 
I get an exception: ArrayIndexOutOfBound in the 
compare method of TypeLattice (exception 14). I saw that this exception occurs 
for MatrixTokens (which isn't the case here). Please let me know if there is anything else I should change in order to 
prevent this exception (I assume that this type should be added in a similar way 
to ObjectType, since it's a private case of it). I tried to solve it by changing 
the ConversionsUtility file as well, but it wasn't very helpful.
 
Thank you,
 
Efrat