EDU.bmrb.starlibj
Class LoopRowNode

java.lang.Object
  |
  +--EDU.bmrb.starlibj.StarNode
        |
        +--EDU.bmrb.starlibj.LoopRowNode
All Implemented Interfaces:
java.lang.Cloneable

public class LoopRowNode
extends StarNode
implements java.lang.Cloneable

A LoopRowNode is a single tuple of values for a loop, like a 'row' in a table. It behaves like a VectorCheckType class, implementing most of the same API as VectorCheckType.

See Also:
VectorCheckType

Fields inherited from class EDU.bmrb.starlibj.StarNode
colNum, lineNum, parent, preComment
 
Constructor Summary
LoopRowNode()
          Default constructor
LoopRowNode(LoopRowNode copyMe)
          copy constructor
 
Method Summary
 void addElement(DataValueNode val)
          Just like the Vector method of the same name, but It will refuse to work if this row is already inside a DataLoopNode, and it will generate an exception.
 int capacity()
          Return the max number of characters that this row can hold before it needs to allocate a bigger chunk of heap memory.
 java.lang.Object clone()
          clone - make a deep copy of me and return a reference to it.
 DataValueNode elementAt(int index)
          Just like the Vector method of the same name.
 void ensureCapacity(int newCap)
          Enlarge capacity of the stringbuffer so that it can hold newCap characters.
 DataValueNode firstElement()
          Just like the Vector method of the same name.
 LoopTableNode getInnerLoop()
          Returns a reference to the inner loop that is under this row.
 void insertElementAt(DataValueNode val, int index)
          Just like the Vector method of the same name, but It will refuse to work if this row is already inside a DataLoopNode, and it will generate an exception.
 boolean isEmpty()
          Just like the Vector method of the same name.
 DataValueNode lastElement()
          Just like the Vector method of the same name.
 void removeElementAt(int index)
          Similar to the Vector method of the same name, however It will refuse to work if this row is already inside a DataLoopNode, and it will generate an exception.
 void removeInnerLoop()
          De-links the inner loop from this row.
 VectorCheckType searchForType(java.lang.Class type)
          Find all values of the type given in this table - this is fairly nonsensical because all values in the table are of type DataValueNode, but this function is here for orthogonality with the base class StarNode.
 VectorCheckType searchForType(java.lang.Class type, short delim)
          Find the type given in this row - Return all the matching values that meet the criteria given in the parameters.
 void setElementAt(DataValueNode val, int index)
          Just like the Vector method of the same name.
 void setInnerLoop(LoopTableNode l)
          Allows the user to set the inner loop under this row.
 int size()
          Just like the Vector method of the same name.
 void Unparse(int indent)
          Unparse prints the contents of the StarNode object out to the given stream.
 
Methods inherited from class EDU.bmrb.starlibj.StarNode
getColNum, getLineNum, getParallelCopy, getParent, getPreComment, searchByName, searchByTagValue, searchForTypeByName, searchForTypeByTagValue, setColNum, setLineNum, setParent, setPeer, setPreComment
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoopRowNode

public LoopRowNode()
Default constructor

LoopRowNode

public LoopRowNode(LoopRowNode copyMe)
copy constructor
Method Detail

clone

public java.lang.Object clone()
clone - make a deep copy of me and return a reference to it.
Overrides:
clone in class StarNode
Following copied from class: EDU.bmrb.starlibj.StarNode
See Also:
StarFileNode

ensureCapacity

public void ensureCapacity(int newCap)
Enlarge capacity of the stringbuffer so that it can hold newCap characters. This is not necessary to call this method, but if you know roughly how many total characters will be in a row of values ahead of time, calling this method can make things run a bit faster.

capacity

public int capacity()
Return the max number of characters that this row can hold before it needs to allocate a bigger chunk of heap memory. This is not a hard limit - if it needs to it will expand this number. It is just here for help with performance tuning. (Using this you can know when to manually expand the memory when you wish instead of relying on the library to do it when the string runs out of room.) Example:
      if( numberOfCharactersIKnowINeed > row.capacity() )
          row.ensureCapacity( numberOfCharactersIKnowINeed );
 

size

public int size()
Just like the Vector method of the same name.
See Also:
VectorCheckType.size

isEmpty

public boolean isEmpty()
Just like the Vector method of the same name.
See Also:
VectorCheckType.isEmpty

elementAt

public DataValueNode elementAt(int index)
Just like the Vector method of the same name.
See Also:
VectorCheckType.elementAt

firstElement

public DataValueNode firstElement()
Just like the Vector method of the same name.
See Also:
VectorCheckType.firstElement

lastElement

public DataValueNode lastElement()
Just like the Vector method of the same name.
See Also:
VectorCheckType.lastElement

setElementAt

public void setElementAt(DataValueNode val,
                         int index)
Just like the Vector method of the same name.
See Also:
VectorCheckType.setElementAt

removeElementAt

public void removeElementAt(int index)
                     throws OperationCausesMismatchedLoopData
Similar to the Vector method of the same name, however It will refuse to work if this row is already inside a DataLoopNode, and it will generate an exception.
See Also:
VectorCheckType.removeElementAt

insertElementAt

public void insertElementAt(DataValueNode val,
                            int index)
                     throws OperationCausesMismatchedLoopData
Just like the Vector method of the same name, but It will refuse to work if this row is already inside a DataLoopNode, and it will generate an exception.
See Also:
VectorCheckType.insertElementAt

addElement

public void addElement(DataValueNode val)
                throws OperationCausesMismatchedLoopData
Just like the Vector method of the same name, but It will refuse to work if this row is already inside a DataLoopNode, and it will generate an exception.
See Also:
VectorCheckType.addElement

getInnerLoop

public LoopTableNode getInnerLoop()
Returns a reference to the inner loop that is under this row. This will return nil if there is no inner loop under this row.
Returns:
null if no inner loop.

setInnerLoop

public void setInnerLoop(LoopTableNode l)
                  throws OperationCausesMismatchedLoopData
Allows the user to set the inner loop under this row. (TODO: need to throw exceptions here. Not implemented yet, just a placeholder.)
Throws:
OperationCausesMismatchedLoopData - when the new row does not match the tagnames for this loop. If this row is not in a loop yet, then this check is not performed, obviously.

removeInnerLoop

public void removeInnerLoop()
De-links the inner loop from this row.

searchForType

public VectorCheckType searchForType(java.lang.Class type)
Find all values of the type given in this table - this is fairly nonsensical because all values in the table are of type DataValueNode, but this function is here for orthogonality with the base class StarNode.
Parameters:
type - look for this type.

searchForType

public VectorCheckType searchForType(java.lang.Class type,
                                     short delim)
Find the type given in this row - Return all the matching values that meet the criteria given in the parameters.
Overrides:
searchForType in class StarNode
Parameters:
type - look for this type
delim - Look for this delimiter type.
See Also:

Unparse

public void Unparse(int indent)
Unparse prints the contents of the StarNode object out to the given stream. This is essentially the inverse of the CS term to "parse", hence the name "Unparse". The parameter given is the indentation level to print things.
Overrides:
Unparse in class StarNode