org.norecess.citkit.tir.types
Class RecordTTIR

java.lang.Object
  extended by org.norecess.citkit.tir.types.RecordTTIR
All Implemented Interfaces:
java.lang.Iterable<IFieldTIR>, HobbesTIR, IRecordTTIR, TypeTIR

public class RecordTTIR
extends java.lang.Object
implements IRecordTTIR

The AST for a record type.

Author:
Jeremy D. Frens

Constructor Summary
RecordTTIR(IPosition position, java.util.List<IFieldTIR> fields)
          Constructs a record type.
RecordTTIR(java.util.List<IFieldTIR> fields)
          Basic constructor.
 
Method Summary
<T> T
accept(TypeTIRVisitor<T> visitor)
          Implements the visitor pattern with TypeTIRVisitor.
 boolean equals(java.lang.Object o)
           
 IFieldTIR getField(int index)
           
 java.util.List<IFieldTIR> getFields()
          Returns the list of fields in the record.
 IPosition getPosition()
          Retrieves the position of the code that generated the AST.
 int hashCode()
           
 java.util.Iterator<IFieldTIR> iterator()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RecordTTIR

public RecordTTIR(IPosition position,
                  java.util.List<IFieldTIR> fields)
Constructs a record type.

Parameters:
position - the position of the record type in the source code.
fields - a list of fields for the record type (see IFieldTIR).

RecordTTIR

public RecordTTIR(java.util.List<IFieldTIR> fields)
Basic constructor.

Parameters:
fields - the fields and their types of the record.
Method Detail

getPosition

public IPosition getPosition()
Retrieves the position of the code that generated the AST.

Specified by:
getPosition in interface HobbesTIR
Returns:
the position of the code in the source code.

getFields

public java.util.List<IFieldTIR> getFields()
Returns the list of fields in the record. (See the FieldTIR class.)

Specified by:
getFields in interface IRecordTTIR
Returns:
the list of fields in the record.

getField

public IFieldTIR getField(int index)
Specified by:
getField in interface IRecordTTIR

accept

public <T> T accept(TypeTIRVisitor<T> visitor)
Description copied from interface: TypeTIR
Implements the visitor pattern with TypeTIRVisitor.

Specified by:
accept in interface TypeTIR
Parameters:
visitor - the visitor object.
Returns:
the result of visiting the AST with the visitor.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

iterator

public java.util.Iterator<IFieldTIR> iterator()
Specified by:
iterator in interface java.lang.Iterable<IFieldTIR>