public class Type extends ASTNode
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.Modifier and Type | Field and Description |
---|---|
static int |
ARRAY |
static int |
BOOLEAN |
static int |
CHAR |
static int |
CLASS |
static int |
COLUMN_MAJOR |
static int |
DCOMPLEX |
static int |
DOUBLE |
static int |
ENUM |
static int |
FCOMPLEX |
static int |
FLOAT |
static int |
INT |
static int |
INTERFACE |
static int |
LONG |
static int |
MAX_RARRAY_TYPE_IND |
static int |
MAX_TYPE_IND |
static int |
MIN_RARRAY_TYPE_IND |
static int |
MIN_TYPE_IND |
static int |
OPAQUE |
static int |
PACKAGE |
static int |
ROW_MAJOR |
static java.lang.String[] |
s_names |
static int |
STRING |
static int |
STRUCT |
static int |
SYMBOL |
static int |
UNSPECIFIED |
static int |
VOID |
Constructor and Description |
---|
Type(int type)
Create a new primitive type (boolean, char, dcomplex, double, fcomplex,
float, int, long, opaque, and string).
|
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,
int order,
Context context)
Create a new array.
|
Type(Type type,
int dim,
java.util.Vector indices,
Context context)
Create a new array provided the array type, dimension, and order.
|
Modifier and Type | Method and Description |
---|---|
void |
addArrayIndex(AssertionExpression s)
This adds an index variable on the end of the index vector.
|
void |
addArrayIndex(java.lang.String s)
This adds an index variable on the end of the index vector.
|
boolean |
equals(java.lang.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.
|
java.util.List |
getArrayIndexExprs()
Return the list of rarray expressions.
|
java.util.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.
|
java.lang.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.
|
java.lang.String |
getIndexString()
Return a string representation of the list of index variables.
|
Symbol |
getSymbol() |
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.
|
java.lang.String |
getTypeName()
Return the name of the type.
|
static java.lang.String |
getTypeName(int type)
Return the name of the type given the specified type value or, if
not recognized, simply a null string.
|
java.lang.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.
|
boolean |
similar(Type t1)
Used to detect overloading collisions.
|
checkFrozen, clone, protectCollection, protectList, protectMap, protectSet
public static final int VOID
public static final int BOOLEAN
public static final int CHAR
public static final int DCOMPLEX
public static final int DOUBLE
public static final int FCOMPLEX
public static final int FLOAT
public static final int INT
public static final int LONG
public static final int OPAQUE
public static final int STRING
public static final int ENUM
public static final int STRUCT
public static final int CLASS
public static final int INTERFACE
public static final int PACKAGE
public static final int SYMBOL
public static final int ARRAY
public static final int MIN_TYPE_IND
public static final int MAX_TYPE_IND
public static final int MIN_RARRAY_TYPE_IND
public static final int MAX_RARRAY_TYPE_IND
public static final java.lang.String[] s_names
public static final int UNSPECIFIED
public static final int COLUMN_MAJOR
public static final int ROW_MAJOR
public Type(int type)
type
- The value of this primitive type object.public Type(SymbolID id, Context context)
id
- The identifier of with this symbol object.public Type(Type type, int dim, int order, Context context)
type
- The type of this array object.dim
- The dimension of this array.order
- The desired storage order of this array.public Type(Type type, int dim, java.util.Vector indices, Context context)
indices
- this can be a ArrayList of String's or
AssertionExpression's. Any String elements are converted
to AssertionExpression's.public int getType()
public Symbol getSymbol()
public int getBasicType()
public java.lang.String getTypeName()
public static java.lang.String getTypeName(int type)
public int getDetailedType()
public boolean isPrimitive()
public boolean isString()
public boolean isSymbol()
public boolean isArray()
public boolean isStruct()
public int getArrayDimension()
public int getArrayOrder()
public boolean isGenericArray()
true
iff this type is a generic array type.public Type getArrayType()
null
array type means that this array is a generic array reference
with no dimension, no type and not ordering specified.public boolean isNumericArray()
public java.lang.String getArrayTypeName()
public void addArrayIndex(java.lang.String s)
public void addArrayIndex(AssertionExpression s)
public java.util.Collection getArrayIndices()
public java.util.List getArrayIndexExprs()
public boolean isRarray()
public boolean hasArrayOrderSpec()
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
.public int hashCode()
hashCode
in class java.lang.Object
public SymbolID getSymbolID()
public java.lang.String getTypeString()
public java.lang.String getIndexString()
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public boolean similar(Type t1)