gov.llnl.babel.symbols
Class Type
The Type
class defines a SIDL type, such as a primitive
type (boolean, char, dcomplex, double, fcomplex, float, int, long, opaque,
and string), arrays, and user-defined types (enum, interface, or class).
A Type
object may also be created for a void return type
from a method.
Type(SymbolID id, Context context) - Create a new type given a user-defined symbol identifier.
|
Type(SymbolID id, int type, Type arr_type, int dim, int order, Context context) - Explicit constructor.
|
Type(Type type, int dim, Vector indices, Context context) - Create a new array provided the array type, dimension, and order.
|
Type(Type type, int dim, int order, Context context) - Create a new array.
|
Type(int type) - Create a new primitive type (boolean, char, dcomplex, double, fcomplex,
float, int, long, opaque, and string).
|
void | addArrayIndex(String s) - This adds an index variable on the end of the index vector.
|
void | addArrayIndex(AssertionExpression s) - This adds an index variable on the end of the index vector.
|
boolean | equals(Object object) - Return TRUE if the specified object is considered to be the same as this
object; otherwise, return FALSE.
|
void | freeze()
|
int | getArrayDimension() - If this type is an array, then return the dimension.
|
List | getArrayIndexExprs() - Return the list of rarray expressions.
|
Collection | getArrayIndices() - This returns the set of indices needed for this rarray.
|
int | getArrayOrder() - Return the storage order, if this is an array; otherwise, return zero.
|
Type | getArrayType() - If this is an array, return the array type.
|
String | getArrayTypeName() - Returns the array type name or the null string if not applicable.
|
int | getBasicType()
|
int | getDetailedType() - Return the integer that identifies the type of this type.
|
String | getIndexString() - Return a string representation of the list of index variables.
|
SymbolID | getSymbolID() - Return the symbol identifier if this is a symbol type; otherwise,
return null.
|
int | getType() - Return the integer that identifies the type of this type.
|
String | getTypeName() - Return the name of the type.
|
static String | getTypeName(int type) - Return the name of the type given the specified type value or, if
not recognized, simply a null string.
|
String | getTypeString() - Return a string representation of the type for printing out the
types in a method signature.
|
boolean | hasArrayOrderSpec() - Return
true if and only if the type is an array with an
ordering specification.
|
int | hashCode()
|
boolean | isArray() - Return TRUE if the type is an array; otherwise, return FALSE.
|
boolean | isGenericArray() - Return
true iff this type is a generic array type.
|
boolean | isNumericArray() - Return TRUE if the type is a numeric array; otherwise, return FALSE.
|
boolean | isPrimitive() - Return TRUE if the type is one of the standard primitive types,
including strings; otherwise, return FALSE.
|
boolean | isRarray() - Returns true if this Type is an rarray, false otherwise.
|
boolean | isString() - Return TRUE if the type is a string; otherwise, return FALSE.
|
boolean | isStruct() - Return TRUE if the type is an struct; otherwise, return FALSE.
|
boolean | isSymbol() - Return TRUE if the type is a symbol; otherwise, return FALSE.
|
ARRAY
public static final int ARRAY
BOOLEAN
public static final int BOOLEAN
CHAR
public static final int CHAR
CLASS
public static final int CLASS
COLUMN_MAJOR
public static final int COLUMN_MAJOR
DCOMPLEX
public static final int DCOMPLEX
DOUBLE
public static final int DOUBLE
ENUM
public static final int ENUM
FCOMPLEX
public static final int FCOMPLEX
FLOAT
public static final int FLOAT
INT
public static final int INT
INTERFACE
public static final int INTERFACE
LONG
public static final int LONG
MAX_TYPE_IND
public static final int MAX_TYPE_IND
MIN_TYPE_IND
public static final int MIN_TYPE_IND
OPAQUE
public static final int OPAQUE
PACKAGE
public static final int PACKAGE
ROW_MAJOR
public static final int ROW_MAJOR
STRING
public static final int STRING
STRUCT
public static final int STRUCT
SYMBOL
public static final int SYMBOL
UNSPECIFIED
public static final int UNSPECIFIED
VOID
public static final int VOID
s_names
public static final String[] s_names
Type
public Type(SymbolID id,
Context context)
Create a new type given a user-defined symbol identifier.
This symbol identifier will represent an enum, interface,
or class.
id
- The identifier of with this symbol object.
Type
public Type(SymbolID id,
int type,
Type arr_type,
int dim,
int order,
Context context)
Explicit constructor.
Type
public Type(Type type,
int dim,
Vector indices,
Context context)
Create a new array provided the array type, dimension, and order.
indices
- this can be a ArrayList of String's or
AssertionExpression's. Any String elements are converted
to AssertionExpression's.
Type
public Type(Type type,
int dim,
int order,
Context context)
Create a new array.
type
- The type of this array object.dim
- The dimension of this array.order
- The desired storage order of this array.
Type
public Type(int type)
Create a new primitive type (boolean, char, dcomplex, double, fcomplex,
float, int, long, opaque, and string). Use the other constructors to
create a symbol or array type.
type
- The value of this primitive type object.
addArrayIndex
public void addArrayIndex(String s)
This adds an index variable on the end of the index vector.
It converts it into an AssertionExpression.
addArrayIndex
public void addArrayIndex(AssertionExpression s)
This adds an index variable on the end of the index vector.
equals
public boolean equals(Object object)
Return TRUE if the specified object is considered to be the same as this
object; otherwise, return FALSE.
getArrayDimension
public int getArrayDimension()
If this type is an array, then return the dimension. A zero array
dimension indicates an array with no type, no dimension and no
ordering specified.
getArrayIndexExprs
public List getArrayIndexExprs()
Return the list of rarray expressions.
getArrayIndices
public Collection getArrayIndices()
This returns the set of indices needed for this rarray. (A set of Strings
corresponding to argument names of type int or long). If this Type is
not an rarray this function returns null.
- this returned list is a list of String objects.
getArrayOrder
public int getArrayOrder()
Return the storage order, if this is an array; otherwise, return zero.
getArrayType
public Type getArrayType()
If this is an array, return the array type. A null
array type means that this array is a generic array reference
with no dimension, no type and not ordering specified.
getArrayTypeName
public String getArrayTypeName()
Returns the array type name or the null string if not applicable.
getBasicType
public int getBasicType()
getDetailedType
public int getDetailedType()
Return the integer that identifies the type of this type.
If type == SYMBOL, this method will try to further refine
the type to one of (CLASS, INTERFACE, ENUM, STRUCT). This may,
in fact, fail if the type is undefined (via a forward reference)
and then SYMBOL is returned.
getIndexString
public String getIndexString()
Return a string representation of the list of index variables.
This string is the names of the index variables (in order) seperated
by commas.
getSymbolID
public SymbolID getSymbolID()
Return the symbol identifier if this is a symbol type; otherwise,
return null.
getType
public int getType()
Return the integer that identifies the type of this type.
If the type is ENUM, STRUCT, INTERFACE, or CLASS, it is returned
as the generic SYMBOL (for historical purposes).
getTypeName
public String getTypeName()
Return the name of the type.
Assumption:
1) The type attribute is valid and in range.
getTypeName
public static String getTypeName(int type)
Return the name of the type given the specified type value or, if
not recognized, simply a null string.
getTypeString
public String getTypeString()
Return a string representation of the type for printing out the
types in a method signature.
hasArrayOrderSpec
public boolean hasArrayOrderSpec()
Return true
if and only if the type is an array with an
ordering specification. For example, array<int,2,column-major>
would return true
; array<int, 2> would return
false
. For non-array types, this always returns
false
.
hashCode
public int hashCode()
isArray
public boolean isArray()
Return TRUE if the type is an array; otherwise, return FALSE.
isGenericArray
public boolean isGenericArray()
Return true
iff this type is a generic array type.
isNumericArray
public boolean isNumericArray()
Return TRUE if the type is a numeric array; otherwise, return FALSE.
isPrimitive
public boolean isPrimitive()
Return TRUE if the type is one of the standard primitive types,
including strings; otherwise, return FALSE.
isRarray
public boolean isRarray()
Returns true if this Type is an rarray, false otherwise.
isString
public boolean isString()
Return TRUE if the type is a string; otherwise, return FALSE.
isStruct
public boolean isStruct()
Return TRUE if the type is an struct; otherwise, return FALSE.
isSymbol
public boolean isSymbol()
Return TRUE if the type is a symbol; otherwise, return FALSE.