public abstract class ProtoType extends Type
Note to myself: This class does not make any sense and BTW it is not used anywhere! For it to be of any utility, it should be extended by the Type class and used as a superclass of all classes that extend Type instead of Type (exactly in the same way the class ProtoExpression is defined as as subclass of Expression and extended by expression classes rather than Expression.
| Constructor and Description |
|---|
ProtoType() |
| Modifier and Type | Method and Description |
|---|---|
Type |
baseType()
Returns the value of this when this does not have a base type; or that of
its base type otherwise.
|
Type |
baseTypeRef()
Returns this when this does not have a base type; or the (undereferenced)
base type otherwise.
|
void |
checkOccurrence(TypeParameter parameter,
Type context,
TypeChecker typeChecker)
Throws a FailedUnificationException if the specified type parameter occurs
in this type.
|
Type |
copy()
Returns a copy of this type with an empty renaming.
|
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.
|
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 ==).
|
boolean |
equals(java.lang.Object object) |
Type |
findValue()
This returns the type value this is bound to and side-effects the binding
chains by shortening them (i.e., like the FIND operation of
the UNION/FIND algorithm (returns itself by default - overridden
by TypeParameter).
|
Type |
flatten()
Returns a flattened form of this type by uncurrying all the domains of all
function types that occur in it.
|
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 |
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() |
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.
|
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)
This unifies this type with the specified type in the context
of the specified TypeChecker.
|
actualType, array, array, BOOLEAN, BOXED_BOOLEAN, BOXED_CHAR, BOXED_INT, BOXED_REAL, boxSort, CHAR, getParameters, 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 int numberOfTypeComponents()
TypenumberOfTypeComponents in class Typepublic Type typeRefComponent(int n) throws NoSuchTypeComponentException
TypetypeRefComponent in class TypeNoSuchTypeComponentExceptionpublic void setTypeRefComponent(int n,
Type type)
throws NoSuchTypeComponentException
TypesetTypeRefComponent in class TypeNoSuchTypeComponentExceptionpublic Type baseTypeRef()
TypebaseTypeRef in class Typepublic Type baseType()
Typepublic boolean isPolymorphic()
isPolymorphic in class Typepublic Type findValue()
Typepublic 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 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 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 byte kind()
Typepublic void unify(Type type, TypeChecker typeChecker) throws FailedUnificationException
Typeunify in class TypeFailedUnificationExceptionpublic boolean unify(Type type)
Typepublic 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 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 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 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 copy()
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 int eqCode()
Typepublic boolean isEqualTo(Type type)
Type