[kepler-dev] Casting IntToken into DoubleTokens

Edward A Lee eal at eecs.berkeley.edu
Wed Jul 28 13:41:15 PDT 2004


If you declare the type of the parameter to be double, then it will
always deliver a DoubleToken, and (in theory at least) the class cast
exception should never occur.  To make the declaration, after creating
the parameter in the actor, just do:

   param.setTypeEquals(BaseType.DOUBLE);

Edward

At 05:32 PM 7/27/2004 -0700, Efrat Jaeger wrote:
>Hi all,
>
>I'm casting a token consumed from a parameter as a DoubleToken. It works
>fine for double values, but whenever I feed the parameter with an integer I
>get a class cast exception. This class cast is valid for accessing int
>tokens via double typed ports and it seems to be consistent with the type
>lattice, so I was wondering if this is some sort of a bug in this case.
>
>Thanks,
>
>Efrat
>
>_______________________________________________
>kepler-dev mailing list
>kepler-dev at ecoinformatics.org
>http://www.ecoinformatics.org/mailman/listinfo/kepler-dev

------------
Edward A. Lee, Professor
518 Cory Hall, UC Berkeley, Berkeley, CA 94720
phone: 510-642-0455, fax: 510-642-2739
eal at eecs.Berkeley.EDU, http://ptolemy.eecs.berkeley.edu/~eal




More information about the Kepler-dev mailing list