edu.ksu.cis.projects.bogor.type
Class RecordType

java.lang.Object
  extended by edu.ksu.cis.projects.bogor.type.Type
      extended by edu.ksu.cis.projects.bogor.type.NonPrimitiveType
          extended by edu.ksu.cis.projects.bogor.type.LockType
              extended by edu.ksu.cis.projects.bogor.type.RecordType
All Implemented Interfaces:
Disposable, Serializable

public final class RecordType
extends LockType

Represents a record type.

Version:
CVS $Revision: 1.6 $ $Date: 2005/05/26 15:30:43 $
Author:
Robby
See Also:
Serialized Form

Field Summary
protected  BitSet transientFlags
          A set of flags indicating whether each field (indexed by their order of appearance in the value array which would instantiate a record of this type) is elided from the state vector.
 
Fields inherited from class edu.ksu.cis.projects.bogor.type.Type
hashCode, typeId
 
Method Summary
 void addField(String name, Type type, boolean isTransient)
          Adds a field.
 void dispose()
          Removes references to id and clears fieldTable.
 boolean equals(Object o)
          Checks whether this object is equal to another object.
 int getFieldCount()
          Gets the number of fields.
 int getFieldIndex(String fieldName)
          Gets the index of a field.
 String getFieldName(int fieldIndex)
          Gets the name of a field.
 Iterator<String> getFieldNameIterator()
          Gets field name iterator.
 Type getFieldType(int fieldIndex)
          Gets the type of a field.
 Type getFieldType(String fieldName)
          Gets the type of a field.
 String getId()
          Gets the id.
 boolean getThrowable()
          Gets the throwable.
 BitSet getTransientFlags()
           
 boolean hasField(String fieldName)
          Determines whether a field name is declared in the record.
 void makeThrowable()
          Makes this record a throwable
 ASTType toASTType()
          Get a newly constructed (unowned) syntax tree node suitable for declaring this type statically.
 String toString()
          Returns the string representation of this object.
 String toVerboseString()
          Returns the verbose string representation of this object.
 
Methods inherited from class edu.ksu.cis.projects.bogor.type.Type
getTypeId, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

transientFlags

protected BitSet transientFlags
A set of flags indicating whether each field (indexed by their order of appearance in the value array which would instantiate a record of this type) is elided from the state vector. Non-null.

Method Detail

getFieldCount

public int getFieldCount()
Gets the number of fields.

Returns:
The number of fields. Greater than or equal to zero.

getFieldIndex

public int getFieldIndex(String fieldName)
Gets the index of a field.

Parameters:
fieldName - The field name. Must be non-null. Must be a field of this record.
Returns:
The index of the field.

getFieldName

public String getFieldName(int fieldIndex)
Gets the name of a field.

Parameters:
fieldIndex - The field name. Must be non-null. Must be a field of this record.
Returns:
The name of the field. Non-null.

getFieldNameIterator

public Iterator<String> getFieldNameIterator()
Gets field name iterator.

Returns:
The field name iterator. Non-null.

getFieldType

public Type getFieldType(String fieldName)
Gets the type of a field.

Parameters:
fieldName - The field name. Must be non-null. Must be a field of this record.
Returns:
The type of the field.

getFieldType

public Type getFieldType(int fieldIndex)
Gets the type of a field.

Parameters:
fieldIndex - The field index. Must be greater or equal to zero and less than the the field count.
Returns:
The type of the field.

getId

public String getId()
Gets the id.

Returns:
The id. Non-null.

getThrowable

public boolean getThrowable()
Gets the throwable.

Returns:
True, if this record is throwable. False, otherwise.

addField

public void addField(String name,
                     Type type,
                     boolean isTransient)
Adds a field.

Parameters:
name - The name of the field. Must be non-null. The record must not already contain a field named name.
type - The type of the field. Must be non-null. Must not be instance of VoidType or UnknownType.
isTransient - True if the declaration of the field indicates that it should be omitted from a state vector.

dispose

public void dispose()
Removes references to id and clears fieldTable. Once called, avoid using this object.

Specified by:
dispose in interface Disposable
Overrides:
dispose in class LockType

equals

public boolean equals(Object o)
Checks whether this object is equal to another object.

Overrides:
equals in class LockType
Parameters:
o - Another object to check equality to.
Returns:
True, if the names are the same. False, otherwise.

hasField

public boolean hasField(String fieldName)
Determines whether a field name is declared in the record.

Parameters:
fieldName - The field name. Must be non-null.
Returns:
True, if the field is declared in this record. False, otherwise.

makeThrowable

public void makeThrowable()
Makes this record a throwable


toString

public String toString()
Returns the string representation of this object.

Overrides:
toString in class LockType
Returns:
"id".

toVerboseString

public String toVerboseString()
Returns the verbose string representation of this object.

Returns:
"record id { ( types names ; )* }".

toASTType

public ASTType toASTType()
Get a newly constructed (unowned) syntax tree node suitable for declaring this type statically.

Overrides:
toASTType in class LockType
Returns:
the node, or null if the type is undeclarable

getTransientFlags

public BitSet getTransientFlags()