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

hlt.language.design.kernel

## Class NamedTuple

- java.lang.Object
- - hlt.language.design.kernel.Expression
  - - hlt.language.design.kernel.ProtoExpression
    - - hlt.language.design.kernel.Tuple
      - - hlt.language.design.kernel.NamedTuple

- All Implemented Interfaces:
    Locatable

      public class NamedTuple
      extends Tuple

  This is the class representing tuples whose components are identified by field names. It derives from `Tuple`, and in addition keeps an array of `TupleFieldName`s recording the names. The reason for using `TupleFieldName`s rather than `String`s is so that the array of field names may be sorted lexicographically for the purpose of normalizing all named tuples and named tuple types, while recording their original indices for displaying components in their "original" order. Note that this notion is rather fuzzy as it corresponds to the ordering of components found by the constructor (which is meant to be used by a parser) and can only be that of a specific written named tuple (type) occurrence. Thus, this order may only be one among many if distinct occurrences of this type, or tuples of this type, are written using differring orders of components. Nevertheless, for consistently written tuples, the components will be displayed in the expected order.

  N.B.: the names in a named tuple may not be overloaded (i.e., the same name cannot appear more than once in a named tuple with distinct types.

- - ### Field Summary

    - ### Fields inherited from class hlt.language.design.kernel.Tuple

      `EMPTY`

    - ### Fields inherited from class hlt.language.design.kernel.Expression

      `VOID_ASSIGNMENTS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NamedTuple(java.util.AbstractList components, java.util.AbstractList names)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Expression` | `copy()` Returns a deep copy of this expression.
    `TupleFieldName` | `field(int n)` Returns the field name originally in the specified position; `null` if position is not legal.
    `TupleFieldName[]` | `fields()`
    `java.lang.String` | `toString()`
    `void` | `typeCheck(TypeChecker typeChecker)` This method type-checks this expression in the context of the specified `TypeChecker`.
    `Expression` | `typedCopy()` Returns a deep copy of this expression this and all its subexpressions share the same type as their copy's counterparts.

    - ### Methods inherited from class hlt.language.design.kernel.Tuple

      `compile, component, dimension, newTuple, numberOfSubexpressions, setCheckedType, setSubexpression, subexpression`

    - ### Methods inherited from class hlt.language.design.kernel.ProtoExpression

      `checkedType, setCheckedType, setType, type, typeRef`

    - ### Methods inherited from class hlt.language.design.kernel.Expression

      `addType, addTypes, boxSort, containsFreeName, enclosingScope, extent, getEnd, getStart, isConstant, isEquality, isFalse, isHiddenSlicing, isNull, isSelector, isSlicing, isTrue, isVoid, locationString, otherTypes, parameters, sanitizeNames, sanitizeSorts, setCheckedTypeLocked, setEnd, setExtent, setOtherTypes, setStart, shiftOffsets, shiftOffsets, sort, substitute, typeCheck, typeCheck, typeCheckLocked`

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

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

- - ### Constructor Detail

    - #### NamedTuple

          public NamedTuple(java.util.AbstractList components,
                    java.util.AbstractList names)

  - ### Method Detail

    - #### copy

          public final Expression copy()

      Description copied from class: `Expression`
      Returns a deep copy of this expression. The types are not not copied. NB: This is a convenience for building expressions that should be used exclusively before any processing (in particular sanitizing), is done on this expression.
      Overrides:
        `copy` in class `Tuple`

    - #### typedCopy

          public final Expression typedCopy()

      Description copied from class: `Expression`
      Returns a deep copy of this expression this and all its subexpressions share the same type as their copy's counterparts. NB: This is a convenience for building expressions that should be used exclusively before any processing (in particular sanitizing), is done on this expression.
      Overrides:
        `typedCopy` in class `Tuple`

    - #### fields

          public final TupleFieldName[] fields()

    - #### field

          public final TupleFieldName field(int n)

      Returns the field name originally in the specified position; `null` if position is not legal.

    - #### typeCheck

          public final void typeCheck(TypeChecker typeChecker)
                               throws TypingErrorException

      Description copied from class: `Expression`
      This method type-checks this expression in the context of the specified `TypeChecker`.
      Overrides:
        `typeCheck` in class `Tuple`
      Throws:
        `TypingErrorException`

    - #### toString

          public final java.lang.String toString()

      Overrides:
        `toString` in class `Tuple`