TypeConstant (API documentation of hlt.language packages)
Date: 2013-01-30

hlt.language.design.types

## Class TypeConstant

- java.lang.Object
- - hlt.language.design.types.Type
  - - hlt.language.design.types.StaticType
    - - hlt.language.design.types.NamedType
      - - hlt.language.design.types.TypeConstant

- All Implemented Interfaces:
    Valuable
  Direct Known Subclasses:
    CollectionTypeConstant

      public class TypeConstant
      extends NamedType

- - ### Field Summary

    - ### Fields inherited from class hlt.language.design.types.Type

      `ARRAY, BAG, BOOLEAN, BOXABLE, CHAR, CLASS, COLLECTION, CONSTANT, DEFINED, FUNCTION, INT, INT_RANGE, INT_SORT, LIST, NAMED_TUPLE, OBJECT_SORT, PARAMETER, REAL, REAL_RANGE, REAL_SORT, SET, STRING, TUPLE, VOID, VOID_SORT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TypeConstant(java.lang.String name)`
    `TypeConstant(java.lang.String name, byte sort)`
    `TypeConstant(java.lang.String name, byte sort, boolean isBoxedType)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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 constant and the specified type are identical objects (i.e., same pointers).
    `boolean` | `isEqualTo(Type type, java.util.HashMap parameters)` Returns true iff this type constant and the specified type are identical objects (i.e., same pointers).
    `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.
    `void` | `setShadowType(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.
    `Type` | `shadowType()` This is used in `Homomorphism` for typing irregular monoid operations in the absence of a real mechanism for subtyping.
    `byte` | `sort()` This returns the runtime sort for this type (`OBJECT_SORT` by default - overridden by `TypeConstant`).
    `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)` This unifies this type with the specified type in the context of the specified `TypeChecker`.

    - ### Methods inherited from class hlt.language.design.types.NamedType

      `eqCode, name, setName`

    - ### Methods inherited from class hlt.language.design.types.Type

      `actualType, array, array, baseType, baseTypeRef, BOOLEAN, BOXED_BOOLEAN, BOXED_CHAR, BOXED_INT, BOXED_REAL, boxSort, CHAR, checkOccurrence, copy, copy, curry, equals, findValue, flatten, getParameters, getParameters, getValue, instantiate, INT, is, isBag, isBoolean, isChar, isCollection, isGlobalUnsafe, isInt, isList, isPolymorphic, isPrimitive, isReal, isSet, isString, isVoid, kindString, rank, REAL, resetNames, setBoxed, standardize, toFullString, toQuantifiedString, toQuantifiedString, typeComponent, unwrapper, value, wrapper`

    - ### Methods inherited from class java.lang.Object

      `getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### TypeConstant

          public TypeConstant(java.lang.String name)

    - #### TypeConstant

          public TypeConstant(java.lang.String name,
                      byte sort)

    - #### TypeConstant

          public TypeConstant(java.lang.String name,
                      byte sort,
                      boolean isBoxedType)

  - ### Method Detail

    - #### shadowType

          public final Type shadowType()

      Description copied from class: `Type`
      This is used in `Homomorphism` for typing irregular monoid operations in the absence of a real mechanism for subtyping. Returns this type's value by default. Only a `TypeConstant` may redefine its shadow type.
      Overrides:
        `shadowType` in class `Type`

    - #### setShadowType

          public final void setShadowType(Type type)

    - #### numberOfTypeComponents

          public int numberOfTypeComponents()

      Description copied from class: `Type`
      Returns the number of type components making up this type.
      Specified by:
        `numberOfTypeComponents` in class `Type`

    - #### typeRefComponent

          public Type typeRefComponent(int n)
                                throws NoSuchTypeComponentException

      Description copied from class: `Type`
      Returns the `n`-th undereferenced type component in this type, if any; throws a `NoSuchTypeComponentException` otherwise.
      Specified by:
        `typeRefComponent` in class `Type`
      Throws:
        `NoSuchTypeComponentException`

    - #### setTypeRefComponent

          public void setTypeRefComponent(int n,
                                 Type type)
                                   throws NoSuchTypeComponentException

      Description copied from class: `Type`
      Sets the `n`-th undereferenced type component of this type to the specified type; throws a `NoSuchTypeComponentException` otherwise.
      Specified by:
        `setTypeRefComponent` in class `Type`
      Throws:
        `NoSuchTypeComponentException`

    - #### kind

          public byte kind()

      Description copied from class: `Type`
      This returns the value identifying what kind of type this is.
      Specified by:
        `kind` in class `Type`

    - #### sort

          public final byte sort()

      Description copied from class: `Type`
      This returns the runtime sort for this type (`OBJECT_SORT` by default - overridden by `TypeConstant`).

      N.B.: The following definition specifies only the default behavior for this method. Specific subclasses are generally expected to override this method.

      Overrides:
        `sort` in class `Type`

    - #### isBoxedType

          public final boolean isBoxedType()

      Description copied from class: `Type`
      This returns `true` iff this type has been marked as boxed (`true` by default - overridden by `TypeConstant`).

      N.B.: The following definition specifies only the default behavior for this method. Specific subclasses are generally expected to override this method.

      Overrides:
        `isBoxedType` in class `Type`

    - #### unify

          public void unify(Type type,
                   TypeChecker typeChecker)
                     throws FailedUnificationException

      Description copied from class: `Type`
      This unifies this type with the specified type in the context of the specified `TypeChecker`.
      Specified by:
        `unify` in class `Type`
      Throws:
        `FailedUnificationException`

    - #### unify

          public boolean unify(Type type)

      Description copied from class: `Type`
      This unifies this type with the specified type with no possibility of undoing any effects. This method is meant to be used on types that are fresh copies independent of any type-checker because it will side-effect the structures it traverses. It returns `true` iff unification succeeds. NB: This method does not perform the "occurs-check" test.
      Specified by:
        `unify` in class `Type`

    - #### isEqualTo

          public final boolean isEqualTo(Type type)

      Returns true iff this type constant and the specified type are identical objects (i.e., same pointers).
      Specified by:
        `isEqualTo` in class `Type`

    - #### isEqualTo

          public final boolean isEqualTo(Type type,
                          java.util.HashMap parameters)

      Returns true iff this type constant and the specified type are identical objects (i.e., same pointers).
      Specified by:
        `isEqualTo` in class `Type`

    - #### toString

          public final java.lang.String toString()

      Overrides:
        `toString` in class `NamedType`