public class ArrayType extends ConstructedType
| Constructor and Description |
|---|
ArrayType()
Constructs a polymorphic array type; i.e., one whose base type is a type
parameter.
|
ArrayType(Type baseType)
Constructs an array type with the specified base type.
|
ArrayType(Type baseType,
Type indexSetType)
Constructs an array type with the specified base type and index-set type.
|
| Modifier and Type | Method and Description |
|---|---|
Type |
baseType()
Returns the base type's value.
|
void |
checkOccurrence(TypeParameter parameter,
Type context,
TypeChecker typeChecker)
Throws a FailedUnificationException if the specified type parameter occurs
in this type.
|
Type |
copy(java.util.HashMap parameters)
Returns a copy of this type with a consistent renaming of all free type
parameters, and identyfing bound type parameters with their values.
|
int |
dimension()
Returns the number of dimensions of this array type; i.e., the number of
indices needed to dereference to the innermost component.
|
Type |
dimension(int n)
Returns the type of the n-th dimension, counting from 0.
|
int |
eqCode()
Returns a hash code for this type - the reason for using the name eqCode
(rather than overriding hashCode), is that it is important to preserve
the implementation of java.lang.Object.hashCode for type parameters (to
be compatible with ==).
|
Type |
flatten()
Returns a flattened form of this type by uncurrying all the domains of all
function types that occur in it.
|
java.util.HashSet |
getParameters(java.util.HashSet set)
Returns the specified set augmented with all the unbound type parameters that
occur in this type.
|
Type |
indexSetType()
Returns the index-set type's value.
|
Type |
indexType()
Returns the index type's value; i.e., this is the type that an actual index
will have.
|
Type |
innermostType()
Returns the innermost type.
|
Type |
innerType(int depth)
Returns the inner type up to depth n.
|
Type |
instantiate(java.util.HashMap substitution)
Returns a copy of this type with all free type parameters bound as per the
specified type substitution.
|
boolean |
isEqualTo(Type type)
Returns true iff this type is structurally isomorphic to the
specified type.
|
boolean |
isEqualTo(Type type,
java.util.HashMap parameters)
Returns true iff this type is structurally isomorphic to the
specified type, under the renaming of type parameters specified
by the given HashMap.
|
boolean |
isMap()
Returns true iff this array type is that of an indexed map.
|
boolean |
isPolymorphic()
Returns true iff this array type's base type is polymorphic.
|
byte |
kind()
Returns the constant identifying array types; i.e., Type.ARRAY.
|
int |
numberOfTypeComponents()
Returns the number of type components making up this type.
|
Type |
projection(int n)
Returns the type obtained after projecting out the first n indices.
|
void |
setTypeRefComponent(int n,
Type type)
Sets the n-th undereferenced type component of this type to the specified type;
throws a NoSuchTypeComponentException otherwise.
|
java.lang.String |
toString() |
Type |
typeRefComponent(int n)
Returns the n-th undereferenced type component in this type, if any; throws a
NoSuchTypeComponentException otherwise.
|
boolean |
unify(Type type)
This unifies this type with the specified type with no possibility of undoing any
effects.
|
void |
unify(Type type,
TypeChecker typeChecker)
Unifies this array type against the specifed type in the context of the given type
checker.
|
actualType, array, array, baseTypeRef, BOOLEAN, BOXED_BOOLEAN, BOXED_CHAR, BOXED_INT, BOXED_REAL, boxSort, CHAR, copy, curry, equals, findValue, getParameters, getValue, INT, is, isBag, isBoolean, isBoxedType, isChar, isCollection, isGlobalUnsafe, isInt, isList, isPrimitive, isReal, isSet, isString, isVoid, kindString, rank, REAL, resetNames, setBoxed, shadowType, sort, standardize, toFullString, toQuantifiedString, toQuantifiedString, typeComponent, unwrapper, value, wrapperpublic ArrayType()
public ArrayType(Type baseType)
public final int numberOfTypeComponents()
TypenumberOfTypeComponents in class Typepublic final Type typeRefComponent(int n) throws NoSuchTypeComponentException
TypetypeRefComponent in class TypeNoSuchTypeComponentExceptionpublic final void setTypeRefComponent(int n,
Type type)
throws NoSuchTypeComponentException
TypesetTypeRefComponent in class TypeNoSuchTypeComponentExceptionpublic final byte kind()
public final Type baseType()
public final Type indexSetType()
public final boolean isMap()
public final Type indexType()
public final boolean isPolymorphic()
isPolymorphic in class Typepublic final Type innermostType()
public final Type innerType(int depth)
public final int dimension()
public final Type dimension(int n)
public final Type projection(int n)
public final Type flatten()
TypeN.B.: The following definition specifies only the default behavior for this method. Specific subclasses are generally expected to override this method.
public final Type copy(java.util.HashMap parameters)
TypeN.B.: The following definition specifies only the default behavior for this method. Specific subclasses are generally expected to override this method.
public Type instantiate(java.util.HashMap substitution)
TypeN.B.: The following definition specifies only the default behavior for this method. Specific subclasses are generally expected to override this method.
instantiate in class Typepublic final void unify(Type type, TypeChecker typeChecker) throws FailedUnificationException
unify in class TypeFailedUnificationExceptionpublic final boolean unify(Type type)
Typepublic final void checkOccurrence(TypeParameter parameter, Type context, TypeChecker typeChecker) throws FailedUnificationException
TypeN.B.: The following definition specifies only the default behavior for this method. Specific subclasses are generally expected to override this method.
checkOccurrence in class TypeFailedUnificationExceptionpublic final java.util.HashSet getParameters(java.util.HashSet set)
TypegetParameters in class Typepublic final int eqCode()
Typepublic final boolean isEqualTo(Type type)
public final boolean isEqualTo(Type type, java.util.HashMap parameters)
public final java.lang.String toString()
toString in class java.lang.Object