com.ibm.carma.model
Class VariableType

java.lang.Object
  extended by org.eclipse.emf.common.util.AbstractEnumerator
      extended by com.ibm.carma.model.VariableType
All Implemented Interfaces:
org.eclipse.emf.common.util.Enumerator

public final class VariableType
extends org.eclipse.emf.common.util.AbstractEnumerator

A representation of the literals of the enumeration 'Variable Type', and utility methods for working with them. Supported conversions:

CARMA Type Java Type
STRING String
BOOLEAN Boolean
BYTE Byte
CHAR Character
DOUBLE Double
FLOAT Float
INT Integer
LONG Long

See Also:
ModelPackage.getVariableType()

Field Summary
static int BOOLEAN
          The 'BOOLEAN' literal value.
static VariableType BOOLEAN_LITERAL
          The 'BOOLEAN' literal object.
static int BYTE
          The 'BYTE' literal value.
static VariableType BYTE_LITERAL
          The 'BYTE' literal object.
static int CHAR
          The 'CHAR' literal value.
static VariableType CHAR_LITERAL
          The 'CHAR' literal object.
static java.lang.String copyright
           
static int DOUBLE
          The 'DOUBLE' literal value.
static VariableType DOUBLE_LITERAL
          The 'DOUBLE' literal object.
static int FLOAT
          The 'FLOAT' literal value.
static VariableType FLOAT_LITERAL
          The 'FLOAT' literal object.
static int INT
          The 'INT' literal value.
static VariableType INT_LITERAL
          The 'INT' literal object.
static int LONG
          The 'LONG' literal value.
static VariableType LONG_LITERAL
          The 'LONG' literal object.
static int STRING
          The 'STRING' literal value.
static VariableType STRING_LITERAL
          The 'STRING' literal object.
static java.util.List VALUES
          A public read-only list of all the 'Variable Type' enumerators.
 
Method Summary
 boolean checkVariableLength(java.lang.Object value, int length)
          Check that the variable value matches the length contraint for the variable type
 boolean checkVariableValue(java.lang.Object value)
          Performs a check that the given value is compatible with the variable type
 java.lang.Object convertToVaribableType(java.lang.String toConvert)
          Converts the string value to the appropriate object type expected by the CARMA system based on the VariableType.
static VariableType get(int value)
          Returns the 'Variable Type' literal with the specified integer value.
static VariableType get(java.lang.Object value)
          Returns the 'Variable Type' literal for the type of the object value.
static VariableType get(java.lang.String literal)
          Returns the 'Variable Type' literal with the specified literal value.
static VariableType getByName(java.lang.String name)
          Returns the 'Variable Type' literal with the specified name.
 java.lang.Class<?> getClassType()
          The Java class associated with the given variable
 
Methods inherited from class org.eclipse.emf.common.util.AbstractEnumerator
getLiteral, getName, getValue, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

copyright

public static final java.lang.String copyright

See Also:
Constant Field Values

STRING

public static final int STRING
The 'STRING' literal value. STRING type value

See Also:
STRING_LITERAL, Constant Field Values

INT

public static final int INT
The 'INT' literal value. Integer type value

See Also:
INT_LITERAL, Constant Field Values

FLOAT

public static final int FLOAT
The 'FLOAT' literal value. Float type value

See Also:
FLOAT_LITERAL, Constant Field Values

BYTE

public static final int BYTE
The 'BYTE' literal value. byte type value

See Also:
BYTE_LITERAL, Constant Field Values

DOUBLE

public static final int DOUBLE
The 'DOUBLE' literal value. double type value

See Also:
DOUBLE_LITERAL, Constant Field Values

CHAR

public static final int CHAR
The 'CHAR' literal value. character type value

See Also:
CHAR_LITERAL, Constant Field Values

LONG

public static final int LONG
The 'LONG' literal value. long type value

See Also:
LONG_LITERAL, Constant Field Values

BOOLEAN

public static final int BOOLEAN
The 'BOOLEAN' literal value. boolean type value

See Also:
BOOLEAN_LITERAL, Constant Field Values

STRING_LITERAL

public static final VariableType STRING_LITERAL
The 'STRING' literal object.

See Also:
STRING

INT_LITERAL

public static final VariableType INT_LITERAL
The 'INT' literal object.

See Also:
INT

FLOAT_LITERAL

public static final VariableType FLOAT_LITERAL
The 'FLOAT' literal object.

See Also:
FLOAT

BYTE_LITERAL

public static final VariableType BYTE_LITERAL
The 'BYTE' literal object.

See Also:
BYTE

DOUBLE_LITERAL

public static final VariableType DOUBLE_LITERAL
The 'DOUBLE' literal object.

See Also:
DOUBLE

CHAR_LITERAL

public static final VariableType CHAR_LITERAL
The 'CHAR' literal object.

See Also:
CHAR

LONG_LITERAL

public static final VariableType LONG_LITERAL
The 'LONG' literal object.

See Also:
LONG

BOOLEAN_LITERAL

public static final VariableType BOOLEAN_LITERAL
The 'BOOLEAN' literal object.

See Also:
BOOLEAN

VALUES

public static final java.util.List VALUES
A public read-only list of all the 'Variable Type' enumerators.

Method Detail

get

public static VariableType get(java.lang.String literal)
Returns the 'Variable Type' literal with the specified literal value.


getByName

public static VariableType getByName(java.lang.String name)
Returns the 'Variable Type' literal with the specified name.


get

public static VariableType get(int value)
Returns the 'Variable Type' literal with the specified integer value.


getClassType

public java.lang.Class<?> getClassType()
The Java class associated with the given variable

Returns:
Returns the classType.

get

public static VariableType get(java.lang.Object value)
Returns the 'Variable Type' literal for the type of the object value.

Parameters:
value - the object to inspect and determine the type of
Returns:
the VariableType of the given object

convertToVaribableType

public java.lang.Object convertToVaribableType(java.lang.String toConvert)
                                        throws ConversionException
Converts the string value to the appropriate object type expected by the CARMA system based on the VariableType. Inspect the list of convertions supported by the class for conversion types.

Parameters:
toConvert - the string representation of the variable value
Returns:
the object type representation of the variable value
Throws:
ConversionException - could not perform the conversion. The value is not properly formatted for the expected type.

checkVariableValue

public boolean checkVariableValue(java.lang.Object value)
Performs a check that the given value is compatible with the variable type

Parameters:
value - the value of the variable to check that the value is appropriate
Returns:
true if the value meets the type constraints for the variable type

checkVariableLength

public boolean checkVariableLength(java.lang.Object value,
                                   int length)
Check that the variable value matches the length contraint for the variable type

Parameters:
value - the variable value
length - the length contstraint for the value
Returns:
true if the value meets the length constraint