uk.ac.man.cs.rainbow.datamodel
Class Type.Tuple

java.lang.Object
  |
  +--uk.ac.man.cs.rainbow.datamodel.Type
        |
        +--uk.ac.man.cs.rainbow.datamodel.Type.Tuple
All Implemented Interfaces:
Argument, Data.List.T, Serializable, Type
Enclosing class:
Type

public static class Type.Tuple
extends Type
implements Data.List.T

The class of types of tuples/records/bundles.

See Also:
Data.List, Serialized Form

Inner classes inherited from class uk.ac.man.cs.rainbow.datamodel.Type
Type.Boolean, Type.Enum, Type.Integer, Type.Tuple, Type.Union, Type.Vector
 
Field Summary
protected  Hashtable tagmap
           
protected  String[] tags
           
protected  Type[] types
           
 
Constructor Summary
Type.Tuple(Type[] types)
           
Type.Tuple(Type[] types, String[] fieldNames)
           
 
Method Summary
 boolean equals(Type t)
          Test for equality between types.
 int getIndex(String fieldName)
          Convert a field name into an integer index into the type.
 Type index(int idx)
          Get the type of the idxth value.
 int length()
          Get the number of values that the type requires the list to have.
 String render(Expression[] contents)
          Render a list, given the values that the list is defined by.
 String toString()
          Render the type as a string.
 
Methods inherited from class uk.ac.man.cs.rainbow.datamodel.Type
compatableWith, equals, parse, parse, subst
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

types

protected Type[] types

tags

protected String[] tags

tagmap

protected transient Hashtable tagmap
Constructor Detail

Type.Tuple

public Type.Tuple(Type[] types,
                  String[] fieldNames)

Type.Tuple

public Type.Tuple(Type[] types)
Method Detail

toString

public String toString()
Description copied from class: Type
Render the type as a string. Must be specified by real types.
Overrides:
toString in class Type

render

public String render(Expression[] contents)
Description copied from interface: Data.List.T
Render a list, given the values that the list is defined by.
Specified by:
render in interface Data.List.T

index

public Type index(int idx)
Description copied from interface: Data.List.T
Get the type of the idxth value.
Specified by:
index in interface Data.List.T

length

public int length()
Description copied from interface: Data.List.T
Get the number of values that the type requires the list to have.
Specified by:
length in interface Data.List.T

equals

public boolean equals(Type t)
Description copied from class: Type
Test for equality between types.
Overrides:
equals in class Type

getIndex

public int getIndex(String fieldName)
             throws TypeException
Convert a field name into an integer index into the type. Supports the fieldN naming scheme as well as that which is due to the tags supplied in the type.
Throws:
TypeException - If the field name is not known in the type.