try {
if (tokenClass.equals(ptolemy.data.Token.class)) {
return BaseType.GENERAL;
} else if (ptolemy.data.ArrayToken.class
.isAssignableFrom(tokenClass)) {
Type type = new ArrayType(BaseType.GENERAL);
return type;
} else if (ptolemy.data.RecordToken.class
.isAssignableFrom(tokenClass)) {
Type type = new RecordType(new String[0], new Type[0]);
return type;
} else if (ptolemy.data.Token.class.isAssignableFrom(tokenClass)) {
Type type = BaseType.forClassName(tokenClass.getName());
if (type == null) {
throw new IllegalActionException(
"Could not return type for class " + tokenClass);
}
return type;
} else if (tokenClass.equals(Boolean.class)
|| tokenClass.equals(Boolean.TYPE)) {
return BaseType.BOOLEAN;
} else if (tokenClass.equals(Byte.class)
|| tokenClass.equals(Byte.TYPE)) {
return BaseType.UNSIGNED_BYTE;
} else if (tokenClass.equals(Short.class)
|| tokenClass.equals(Short.TYPE)) {
return BaseType.SHORT;
} else if (tokenClass.equals(Integer.class)
|| tokenClass.equals(Integer.TYPE)) {
return BaseType.INT;
} else if (tokenClass.equals(Long.class)
|| tokenClass.equals(Long.TYPE)) {
return BaseType.LONG;
} else if (tokenClass.equals(Double.class)
|| tokenClass.equals(Double.TYPE)) {
return BaseType.DOUBLE;
} else if (tokenClass.equals(Float.class)
|| tokenClass.equals(Float.TYPE)) {
return BaseType.FLOAT;
} else if (tokenClass.equals(Complex.class)) {
return BaseType.COMPLEX;
} else if (tokenClass.equals(FixPoint.class)) {
return BaseType.UNSIZED_FIX;
} else if (tokenClass.equals(String.class)) {
return BaseType.STRING;
} else if (tokenClass.equals(Class.forName("[[Z"))) {
return BaseType.BOOLEAN_MATRIX;
} else if (tokenClass.equals(Class.forName("[[I"))) {
return BaseType.INT_MATRIX;
} else if (tokenClass.equals(Class.forName("[[J"))) {
return BaseType.LONG_MATRIX;
} else if (tokenClass.equals(Class.forName("[[D"))) {
return BaseType.DOUBLE_MATRIX;
} else if (tokenClass.equals(Class
.forName("[[Lptolemy.math.Complex;"))) {
return BaseType.COMPLEX_MATRIX;
} else if (tokenClass.equals(Class
.forName("[[Lptolemy.math.FixPoint;"))) {
return BaseType.FIX_MATRIX;
} else if (tokenClass.isArray()) {
return new ArrayType(convertJavaTypeToTokenType(tokenClass
.getComponentType()));
} else if (java.lang.Object.class.isAssignableFrom(tokenClass)) {
return BaseType.OBJECT;
} else {
// This should really never happen, since every class