public class DefinedType extends TypeTerm
Look in Tables for the methods that will define a new opaque type (DefineNewType(...)).
TypeDefinition,
Tables| Constructor and Description |
|---|
DefinedType(java.lang.String name,
Type definition)
Constructs a non-polymorphic defined type with the specified name and
definition.
|
DefinedType(java.lang.String name,
Type definition,
java.util.AbstractList arguments) |
DefinedType(java.lang.String name,
Type definition,
Type[] arguments)
Constructs a polymorphic defined type with the specified name, definition,
and type parameters.
|
| Modifier and Type | Method and Description |
|---|---|
Type |
actualType()
Returns the value of this when this does not have a defining type; or that of
its defining type otherwise.
|
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.
|
void |
curry(int depth,
TypeChecker typeChecker)
If this this a function type, transforms the type by splitting the
domains at the specified depth, and records the old form in the
appropriate trail of the specified type-checker for undoing
purposes.
|
Type |
definition() |
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 |
isBoxedType()
This returns true iff this type has been marked as boxed
(true by default - overridden by
TypeConstant).
|
boolean |
isPolymorphic() |
byte |
kind()
This returns the value identifying what kind of type this is.
|
int |
numberOfTypeComponents()
Returns the number of type components making up this type.
|
Type |
setBoxed(boolean flag)
With true (resp.
|
DefinedType |
setDefinition(Type 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.
|
byte |
sort()
This returns the runtime sort for this type (OBJECT_SORT
by default - overridden by TypeConstant).
|
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)
Normally, a defined type can only unify against a type parameter or itself.
|
argument, arguments, arity, isEqualTo, isEqualTo, setArguments, setArguments, toStringarray, array, baseType, baseTypeRef, BOOLEAN, BOXED_BOOLEAN, BOXED_CHAR, BOXED_INT, BOXED_REAL, boxSort, CHAR, copy, equals, findValue, getParameters, getValue, INT, is, isBag, isBoolean, isChar, isCollection, isGlobalUnsafe, isInt, isList, isPrimitive, isReal, isSet, isString, isVoid, kindString, rank, REAL, resetNames, shadowType, standardize, toFullString, toQuantifiedString, toQuantifiedString, typeComponent, unwrapper, value, wrapperpublic DefinedType(java.lang.String name,
Type definition)
public DefinedType(java.lang.String name,
Type definition,
Type[] arguments)
public DefinedType(java.lang.String name,
Type definition,
java.util.AbstractList arguments)
public int numberOfTypeComponents()
TypenumberOfTypeComponents in class TypeTermpublic Type typeRefComponent(int n) throws NoSuchTypeComponentException
TypetypeRefComponent in class TypeTermNoSuchTypeComponentExceptionpublic void setTypeRefComponent(int n,
Type type)
throws NoSuchTypeComponentException
TypesetTypeRefComponent in class TypeTermNoSuchTypeComponentExceptionpublic final Type actualType()
TypeactualType in class Typepublic final Type definition()
public final DefinedType setDefinition(Type type)
public final byte kind()
Typepublic final boolean isPolymorphic()
isPolymorphic in class TypeTermpublic final byte sort()
TypeN.B.: The following definition specifies only the default behavior for this method. Specific subclasses are generally expected to override this method.
public final boolean isBoxedType()
TypeN.B.: The following definition specifies only the default behavior for this method. Specific subclasses are generally expected to override this method.
isBoxedType in class Typepublic final Type setBoxed(boolean flag)
TypeN.B.: The following definition specifies only the default behavior for this method. Specific subclasses are generally expected to override this method.
public final void unify(Type type, TypeChecker typeChecker) throws FailedUnificationException
unify in class TypeTermFailedUnificationExceptionpublic 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 TypeTermFailedUnificationExceptionpublic final java.util.HashSet getParameters(java.util.HashSet set)
TypegetParameters in class TypeTermpublic final void curry(int depth,
TypeChecker typeChecker)
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 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 TypeTermpublic final int eqCode()
Type