public abstract class CollectionType extends ConstructedType implements Collection
| Constructor and Description |
|---|
CollectionType() |
| Modifier and Type | Method and Description |
|---|---|
Type |
baseType()
Returns the base type's value; that is, the current type binding of the
collection's elements.
|
Type |
baseTypeRef()
Returns the undereferenced base type.
|
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 |
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 |
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 |
isPolymorphic()
Returns true iff this collection type's base type is polymorphic.
|
abstract CollectionType |
newCollectionType(Type baseType)
Returns a new collection type of same kind with the specified base type.
|
int |
numberOfTypeComponents()
Returns the number of type components making up this type.
|
void |
setTypeRefComponent(int n,
Type type)
Sets the n-th undereferenced type component of this type to the specified type;
throws a NoSuchTypeComponentException otherwise.
|
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 collection type against the specifed type in the context of the given type checker.
|
actualType, array, array, 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, kind, kindString, rank, REAL, resetNames, setBoxed, shadowType, sort, standardize, toFullString, toQuantifiedString, toQuantifiedString, typeComponent, unwrapper, value, wrapperpublic abstract CollectionType newCollectionType(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 Type baseTypeRef()
baseTypeRef in interface CollectionbaseTypeRef in class Typepublic final Type baseType()
baseType in interface CollectionbaseType in class Typepublic final boolean isPolymorphic()
isPolymorphic in class Typepublic 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 final 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)