com.phoenix_int.aserver.types
Class PHXTypeFactory

java.lang.Object
  extended by com.phoenix_int.aserver.types.PHXTypeFactory

public class PHXTypeFactory
extends java.lang.Object

A class for creating variables

See Also:
PHXSimpleType

Constructor Summary
PHXTypeFactory()
           
 
Method Summary
static void _verifyIsArrayType(java.lang.String type)
          utility function for verifying that a type string is an array type - it is in the form "XXXX[#]"
static PHXSimpleArray allocateArray(java.lang.String arrayType)
          creates an array from a type string.
static IPHXType2 allocateVariable(java.lang.String type)
          creates a variable from a type string
static java.lang.Class getClass(java.lang.String type)
          returns the class for the specified type.
static java.lang.String getVarType(java.lang.String className)
          Given the class name, determine what the corresponding type is.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PHXTypeFactory

public PHXTypeFactory()
Method Detail

allocateVariable

public static IPHXType2 allocateVariable(java.lang.String type)
                                  throws PHXInvalidTypeException
creates a variable from a type string

Parameters:
type - the type string, e.g. "double"
Returns:
the allocated variable
Throws:
PHXInvalidTypeException

allocateArray

public static PHXSimpleArray allocateArray(java.lang.String arrayType)
                                    throws PHXInvalidTypeException
creates an array from a type string. Creates the PHXSimpleArray type, although it overrides the default behaviour of having he PHXSimpleArray store primitives internally in favor of having it store the PHX type.

Parameters:
arrayType - the type string, e.g. "double[5]", "string[3][3]", etc.
Returns:
the allocated variable
Throws:
PHXInvalidTypeException

_verifyIsArrayType

public static void _verifyIsArrayType(java.lang.String type)
                               throws PHXInvalidTypeException
utility function for verifying that a type string is an array type - it is in the form "XXXX[#]"

Parameters:
type - the type string
Throws:
PHXInvalidTypeException

getClass

public static java.lang.Class getClass(java.lang.String type)
                                throws PHXInvalidTypeException
returns the class for the specified type. If the specified type is an array, the class of one of it's members is returned

Parameters:
type - the type string in format "double" or "double[5]"
Returns:
the class of the specified type
Throws:
PHXInvalidTypeException

getVarType

public static java.lang.String getVarType(java.lang.String className)
Given the class name, determine what the corresponding type is.

Parameters:
className - the class name of the variable, i.e. "PHXDouble", "PHXDoubleArray", etc.
Returns:
the variable name type, i.e. "double", "double[]", etc.