To add the new type WORD, I think you need to do the following:

(1) Add a new type WORD in BaseType.java.
(2) In TypeLattice.java, add the new type WORD to the lattice,
remove the edge from INT to DOUBLE, and add the edges from INT
to WORD, and from WORD to DOUBLE.
(3) Modify DoubleToken.convert() so that this method can convert
an instance of WordToken to DoubleToken. And in WordToken.conert(),
convert an instance of IntToken to WordToken.

I realize that it is not ideal that you have to modify the source
code to add a new type. But I'm not sure how much automation can
be done with respect to type conversion. If you have any problem,
please let me know.

-Yuhong

On Mon, 22 Apr 2002, Bill Wood wrote:

> I want to define a new Token type, Word, that has no more precision than
> Double;
> for inheritance purposes I can subclass DoubleToken.  My question is,
> what do I
> have to do to make the new type comparable with other types for lossless
> type
> conversion.  Do I just live with CPO.INCOMPARABLE, or do I have to
> modify some
> of the Type classes, such as BaseType, as well?  My intent is that Word
> would
> simply sit between Int and Double in the type lattice.
>
> Thanks,
>
>  -- Bill Wood
>
> ----------------------------------------------------------------------------
> 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]

Reply via email to