public class ArrayType extends StructuredType implements java.lang.Cloneable
| Modifier and Type | Field and Description |
|---|---|
static InequalityTerm |
ARRAY_BOTTOM
A term to use when declaring the type of some parameter or port
to be an array.
|
static InequalityTerm |
ARRAY_UNSIZED_BOTTOM
A term to use when declaring the type of some parameter or port
to be an array, with unknown length.
|
MAXDEPTHBOUNDHASH_INVALID| Constructor and Description |
|---|
ArrayType(Type elementType)
Construct a new ArrayType with the specified type for the array
elements.
|
ArrayType(Type elementType,
int length)
Construct a new ArrayType with the specified type for the array
elements.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
_compare(StructuredType type)
Compare this type with the specified type.
|
protected StructuredType |
_getRepresentative()
Return a static instance of ArrayType.
|
protected StructuredType |
_greatestLowerBound(StructuredType type)
Return the greatest lower bound of this type with the specified
type.
|
protected StructuredType |
_leastUpperBound(StructuredType type)
Return the least Upper bound of this type with the specified
type.
|
static InequalityTerm |
arrayOf(Typeable typeable)
Return a type constraint that can be used to constrain
another typeable object to have a type related to an
array whose element type is the type of the specified
typeable.
|
static InequalityTerm |
arrayOf(Typeable typeable,
int length)
Return a type constraint that can be used to constrain
another typeable object to have a type related to an
array whose element type is the type of the specified
typeable.
|
java.lang.Object |
clone()
Return a deep copy of this ArrayType if it is a variable, or
itself if it is a constant.
|
Token |
convert(Token token)
Convert the argument token into an ArrayToken having this
type, if lossless conversion can be done.
|
int |
depth()
Return the depth of an array type.
|
static InequalityTerm |
elementType(Typeable typeable)
Return a type constraint that can be used to constrain
another typeable object to have a type related to the
element type of the specified typeable.
|
boolean |
equals(java.lang.Object object)
Determine if the argument represents the same ArrayType as this
object.
|
Type |
getDeclaredElementType()
Return the declared type of the array elements.
|
Type |
getElementType()
Return the type of the array elements.
|
InequalityTerm |
getElementTypeTerm()
Return the InequalityTerm representing the element type.
|
java.lang.Class |
getTokenClass()
Return the class for tokens that this type represents.
|
int |
hashCode()
Return a hash code value for this object.
|
boolean |
hasKnownLength()
Return true if the length of this array type has been determined.
|
void |
initialize(Type t)
Set the elements that have declared type BaseType.UNKNOWN (the leaf
type variable) to the specified type.
|
boolean |
isAbstract()
Return true if this type does not correspond to a single token
class.
|
boolean |
isCompatible(Type type)
Test if the argument type is compatible with this type.
|
boolean |
isConstant()
Test if this ArrayType is a constant.
|
boolean |
isInstantiable()
Determine if this type corresponds to an instantiable token
class.
|
boolean |
isSubstitutionInstance(Type type)
Return true if the specified type is a substitution instance of this
type.
|
int |
length()
Return the length of this array type.
|
void |
setType(Type type)
Set the type to the specified type, which is required to be
an array type.
|
java.lang.String |
toString()
Return the string representation of this type.
|
void |
updateType(StructuredType newType)
Update this Type to the specified ArrayType.
|
add, divide, getTypeHash, modulo, multiply, one, subtract, zeropublic static final InequalityTerm ARRAY_BOTTOM
param.setTypeAtLeast(ArrayType.ARRAY_BOTTOM);
for a parameter "param".public static final InequalityTerm ARRAY_UNSIZED_BOTTOM
param.setTypeAtLeast(ArrayType.ARRAY_UNSIZED_BOTTOM);
for a parameter "param".public ArrayType(Type elementType)
elementType - The type of the array elements.java.lang.IllegalArgumentException - If the argument is null.public ArrayType(Type elementType, int length)
elementType - The type of the array elements.length - Then length of the array.java.lang.IllegalArgumentException - If the argument is null.public static InequalityTerm arrayOf(Typeable typeable) throws IllegalActionException
output.setTypeAtLeast(ArrayType.arrayOf(input));
where input and output are ports (this is the type
constraint of SequenceToArray, for example).typeable - A typeable.IllegalActionException - If the specified typeable
cannot be set to an array type.public static InequalityTerm arrayOf(Typeable typeable, int length) throws IllegalActionException
output.setTypeAtLeast(ArrayType.arrayOf(input, length));
where input and output are ports (this is the type
constraint of SequenceToArray, for example).typeable - A typeable.length - The length of array.IllegalActionException - If the specified typeable
cannot be set to an array type.public java.lang.Object clone()
clone in interface Typeclone in class StructuredTypepublic Token convert(Token token) throws IllegalActionException
convert in interface Typetoken - A token.IllegalActionException - If lossless conversion
cannot be done.public int depth()
depth in class StructuredTypepublic boolean equals(java.lang.Object object)
public static InequalityTerm elementType(Typeable typeable) throws IllegalActionException
output.setTypeAtLeast(ArrayType.elementType(input));
where input and output are ports. This forces the input
port to have an array type and the output port to have
a type at least that of the elements of input arrays.typeable - An array-valued typeable.IllegalActionException - If the specified typeable
cannot be set to an array type.public Type getDeclaredElementType()
public Type getElementType()
public InequalityTerm getElementTypeTerm()
InequalityTermpublic java.lang.Class getTokenClass()
getTokenClass in interface Typepublic int hashCode()
hashCode in class java.lang.Objectpublic boolean hasKnownLength()
public boolean isAbstract()
isAbstract in interface TypeisAbstract in class StructuredTypepublic void initialize(Type t)
initialize in class StructuredTypet - the type to set the leaf type variable to.public boolean isCompatible(Type type)
isCompatible in interface Typetype - A Type.convert(ptolemy.data.Token)public boolean isConstant()
isConstant in interface Typepublic boolean isInstantiable()
isInstantiable in interface Typepublic boolean isSubstitutionInstance(Type type)
isSubstitutionInstance in interface Typetype - A Type.Type.isSubstitutionInstance(ptolemy.data.type.Type)public int length()
java.lang.RuntimeException - If the length is not known.public void setType(Type type) throws IllegalActionException
type - The new type.IllegalActionException - If the specified type is not
an instance of ArrayType.public java.lang.String toString()
public void updateType(StructuredType newType) throws IllegalActionException
updateType in class StructuredTypenewType - A StructuredType.IllegalActionException - If the specified type is not an
ArrayType or it does not have the same structure as this one.protected int _compare(StructuredType type)
_compare in class StructuredTypetype - an ArrayType.java.lang.IllegalArgumentException - If the specified type is
not an ArrayType.protected StructuredType _getRepresentative()
_getRepresentative in class StructuredTypeprotected StructuredType _greatestLowerBound(StructuredType type)
_greatestLowerBound in class StructuredTypetype - an ArrayType.java.lang.IllegalArgumentException - If the specified type is
not an ArrayType.protected StructuredType _leastUpperBound(StructuredType type)
_leastUpperBound in class StructuredTypetype - an ArrayType.java.lang.IllegalArgumentException - If the specified type is
not an ArrayType.