edu.ksu.cis.projects.bogor.ast
Class VirtualTableDefinition

java.lang.Object
  extended by edu.ksu.cis.projects.bogor.ast.Node
      extended by edu.ksu.cis.projects.bogor.ast.SystemMember
          extended by edu.ksu.cis.projects.bogor.ast.Definition
              extended by edu.ksu.cis.projects.bogor.ast.VirtualTableDefinition
All Implemented Interfaces:
Disposable, Serializable, Cloneable

public final class VirtualTableDefinition
extends Definition

Virtual table definition AST.

Version:
CVS $Revision: 1.7 $ $Date: 2005/05/06 17:25:17 $
Author:
Robby
See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.ksu.cis.projects.bogor.ast.Node
ILLEGAL_LOCAL_ID_CHAR
 
Constructor Summary
VirtualTableDefinition(String id, List<String> keys, List<String> data)
          Default constructor.
 
Method Summary
 VirtualTableDefinition clone()
          Clones this object (deep clone); including location info.
 void dispose()
          Removes reference to id, keys, and data.
 String getDatum(int index)
          Gets a datum at a specified index.
 String getEnumId()
          Gets the optional enum id.
 String getId()
          Gets the virtual table id.
 String getKey(int index)
          Gets a key at a specified index.
 int getMappingCount()
          Gets the number of mapping
 boolean isOnEnum()
          Checks whether the key of the table is an enum.
 void setEnumId(String newEnumId)
          Sets the enum id.
 void setId(String newId)
          Sets the virtual table id.
 void setMapping(List<String> newKeys, List<String> newData)
          Sets the mapping.
 String toString()
          Returns the string representation of this object.
 void visit(ASTVisitor visitor)
           
 
Methods inherited from class edu.ksu.cis.projects.bogor.ast.SystemMember
getParent, setParent
 
Methods inherited from class edu.ksu.cis.projects.bogor.ast.Node
getLocationInfo, getProperty, putProperty, setLocationInfo
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VirtualTableDefinition

public VirtualTableDefinition(String id,
                              List<String> keys,
                              List<String> data)
Default constructor.

Parameters:
id - The virtual table id. Must be non-null.
keys - The keys vector. Each element must be instance of String.
data - The data vector. Each element must be instance of String. Must have the same number of elements as newKeys.
Method Detail

getDatum

public String getDatum(int index)
Gets a datum at a specified index.

Parameters:
index - The index of the datum. Must be within the array bound of data.
Returns:
The datum at the specified index.

setEnumId

public void setEnumId(String newEnumId)
Sets the enum id.

Parameters:
newEnumId - The new enum id. Must be non-null.

getEnumId

public String getEnumId()
Gets the optional enum id.

Returns:
The optional enum id. Non-null if the key of the table is an enum.

setId

public void setId(String newId)
Sets the virtual table id.

Parameters:
newId - The new virtual table id. Must be non-null.

getId

public String getId()
Gets the virtual table id.

Returns:
The virtual table id. Non-null.

getKey

public String getKey(int index)
Gets a key at a specified index.

Parameters:
index - The index of the key. Must be within the array bound of keys.
Returns:
The key at the specified index.

setMapping

public void setMapping(List<String> newKeys,
                       List<String> newData)
Sets the mapping.

Parameters:
newKeys - The new keys vector. Each element must be instance of String. The number of element must be greater than zero.
newData - The new data vector. Each element must be instance of String. Must have the same number of elements as newKeys.

getMappingCount

public int getMappingCount()
Gets the number of mapping

Returns:
The number of mapping.

isOnEnum

public boolean isOnEnum()
Checks whether the key of the table is an enum.

Returns:
True, if the key of the table is an enum. False, otherwise.

clone

public VirtualTableDefinition clone()
Clones this object (deep clone); including location info.

Specified by:
clone in class Definition
Returns:
The clone of this object. Non-null.

dispose

public void dispose()
Removes reference to id, keys, and data. Once called, avoid using this object.

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

toString

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

Specified by:
toString in class Node
Returns:
"virtual id { ( mapping )* };".

visit

public void visit(ASTVisitor visitor)
Specified by:
visit in class Node