|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.data.expr.ConversionUtilities
public class ConversionUtilities
This class contains a series of static methods that facilitate the runtime conversion of tokens to and from Java representations that are not tokens. One might call this "marshaling and unmarshaling" of tokens. Primarily this facility is used by the expression language to properly type references to Java methods, and later invoke those methods during expression evaluation. Generally speaking this is somewhat nasty from an Object-oriented point of view. The nastiness is fairly well encapsulated in this class. The mapping is summarized in the following table:
Token type Java type --------------------------------------------------- IntToken int DoubleToken double LongToken long StringToken java.lang.String BooleanToken boolean ComplexToken ptolemy.math.Complex FixToken ptolemy.math.FixPoint FixMatrixToken ptolemy.math.FixPoint[][] IntMatrixToken int[][] DoubleMatrixToken double[][] ComplexMatrixToken ptolemy.math.Complex[][] LongMatrixToken long[][] BooleanMatrixToken boolean[][] ArrayToken(FixToken) ptolemy.math.FixPoint[] ArrayToken(IntToken) int[] ArrayToken(LongToken) long[] ArrayToken(DoubleToken) double[] ArrayToken(ComplexToken) ptolemy.math.Complex[] ArrayToken(StringToken) java.lang.String[] ArrayToken(BooleanToken) boolean[] ArrayToken (*) Token[] --------------------------------------------------- (*) Only when converting from java to Token types
ASTPtRootNode
,
PtParser
,
Token
,
UtilityFunctions
,
Math
Constructor Summary | |
---|---|
ConversionUtilities()
|
Method Summary | |
---|---|
static Token |
convertJavaTypeToToken(java.lang.Object object)
Convert a java object to a corresponding Token. |
static Type |
convertJavaTypeToTokenType(java.lang.Class tokenClass)
Convert a java class, representing a Java type, to a corresponding instance of a ptolemy type object, as consistent with the convertJavaTypeToToken method. |
static java.lang.Object |
convertTokenToJavaType(Token token)
Convert a Token to a corresponding Java object. |
static java.lang.Class |
convertTokenTypeToJavaType(Type type)
Convert the given ptolemy type object to a java class representing a java type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConversionUtilities()
Method Detail |
---|
public static Token convertJavaTypeToToken(java.lang.Object object) throws IllegalActionException
IllegalActionException
- If the selected conversion fails.public static Type convertJavaTypeToTokenType(java.lang.Class tokenClass) throws IllegalActionException
IllegalActionException
- If the token class is not
recognized, or creating the type fails.public static java.lang.Object convertTokenToJavaType(Token token) throws IllegalActionException
IllegalActionException
- If the selected conversion fails.public static java.lang.Class convertTokenTypeToJavaType(Type type) throws IllegalActionException
IllegalActionException
- If the token class is not
recognized, or creating the type fails.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |