All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class EDU.bmrb.starlibj.LoopTableNode

java.lang.Object
   |
   +----EDU.bmrb.starlibj.StarNode
           |
           +----EDU.bmrb.starlibj.LoopTableNode

public class LoopTableNode
extends StarNode
implements Cloneable
A LoopTableNode is a 'table' of values in a loop. It is a vector of LoopRowNodes. Every DataLoopNode has at least one LoopTableNode for the outermost loop. Each nested subtable is represented by another LoopTableNode.

It is possible for a LoopRowNode to contain a LoopTableNode under it. This is how nested loops are linked together. At the outermost level, there is a LoopTableNode containing LoopRowNodes. Each of these LoopRowNodes could have a LoopTableNode under it, which in turn is a collection of LoopRowNodes which could have LoopTableNodes under them, and so on.


Variable Index

 o myIndentFlag
 o myRows
 o myRowsPerLine
 o myTabFlag

Constructor Index

 o LoopTableNode()
default constructor - makes a loop with indent, linear.
 o LoopTableNode(boolean)
 o LoopTableNode(boolean, boolean, int)
 o LoopTableNode(LoopTableNode)
copy constructor - deep copy.

Method Index

 o addElement(LoopRowNode)
Just like the Vector method of the same name, but it will throw an exception when invalid insertions are attempted.
 o calcPrintSizes(Vector, Vector)
Calcualte the sizes to print this table in.
 o capacity()
Just like the Vector method of the same name.
 o clone()
clone - make a deep copy of me and return a reference to it.
 o contains(LoopRowNode)
Just like the Vector method of the same name.
 o elementAt(int)
Just like the Vector method of the same name.
 o elements()
Just like the Vector method of the same name.
 o firstElement()
Just like the Vector method of the same name.
 o getIndentFlag()
Gets the indentation Unparse flag for this table.
 o getMaxDepth()
 o getMyDepth()
 o getRowsPerLine()
Gets the number of rows to be Unparsed on one line when in tabular mode.
 o getTabFlag()
Gets the tabulation Unparse flag for this table.
 o indexOf(LoopRowNode)
Just like the Vector method of the same name.
 o indexOf(LoopRowNode, int)
Just like the Vector method of the same name.
 o insertElementAt(LoopRowNode, int)
Just like the Vector method of the same name, but it will throw an exception when invalid insertions are attempted.
 o isEmpty()
Just like the Vector method of the same name.
 o isInLoop()
isInLoop: Returns true if this LoopTableNode is inside a DataLoopNode, or false if it is not.
 o lastElement()
Just like the Vector method of the same name.
 o lastIndexOf(LoopRowNode)
Just like the Vector method of the same name.
 o lastIndexOf(LoopRowNode, int)
Just like the Vector method of the same name.
 o removeElement(LoopRowNode)
Just like the Vector method of the same name, but it makes this table go away if the row removed was the last one.
 o removeElementAt(int)
Similar to the Vector method of the same name.
 o searchForType(Class)
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.
 o searchForType(Class, short)
Find the type given in this row - Return all the matching values that meet the criteria given in the parameters.
 o searchForValsInColumn(int, int, String)
Look for the value in the nest level/column given.
 o setElementAt(LoopRowNode, int)
Just like the Vector method of the same name, except that it throws an exception if the number of values in the row is incorrect for the number of names in the list of names in this DataLoopNode.
 o setIndentFlag(boolean)
Sets the indentation Unparse flag for this table.
 o setRowsPerLine(int)
Sets the number of rows Unparsed per line when in tabular mode.
 o setSize(int)
Just like the Vector method of the same name.
 o setTabFlag(boolean)
Sets the tabulation Unparse flag for this table.
 o size()
Just like the Vector method of the same name.
 o truncateNestLevel(int)
 o Unparse(int)
Unparse prints the contents of the StarNode object out to the given stream.

Variables

 o myTabFlag
 protected boolean myTabFlag
 o myRows
 protected LoopRowsVector myRows
 o myIndentFlag
 protected boolean myIndentFlag
 o myRowsPerLine
 protected int myRowsPerLine

Constructors

 o LoopTableNode
 public LoopTableNode()
default constructor - makes a loop with indent, linear.

 o LoopTableNode
 public LoopTableNode(boolean tabFlag)
Parameters:
tabFlag - set to true for a tabularly printed loop, or false for a linearly printed loop. This only affects output with Unparse() and nothing else.
 o LoopTableNode
 public LoopTableNode(boolean tabFlag,
                      boolean indentFl,
                      int rowsPerLn)
Parameters:
tabFlag - set to true for a tabularly printed loop, or false for a linearly printed loop. This only affects output with Unparse() and nothing else.
indentFl - set to true if this loop should be output indented.
rowsPerLn - set to the number of rows to include on one line of text. Only has meaning if tabFlag is true.
 o LoopTableNode
 public LoopTableNode(LoopTableNode copyMe)
copy constructor - deep copy.

Methods

 o clone
 public Object clone()
clone - make a deep copy of me and return a reference to it.

Overrides:
clone in class StarNode
 o setSize
 public void setSize(int newSize)
Just like the Vector method of the same name.

See Also:
setSize
 o capacity
 public int capacity()
Just like the Vector method of the same name.

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

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

See Also:
isEmpty
 o elements
 public Enumeration elements()
Just like the Vector method of the same name.

See Also:
Enumeration
 o contains
 public boolean contains(LoopRowNode row)
Just like the Vector method of the same name.

See Also:
contains
 o indexOf
 public int indexOf(LoopRowNode val)
Just like the Vector method of the same name.

See Also:
indexOf
 o indexOf
 public int indexOf(LoopRowNode row,
                    int index)
Just like the Vector method of the same name.

See Also:
indexOf
 o lastIndexOf
 public int lastIndexOf(LoopRowNode row)
Just like the Vector method of the same name.

See Also:
lastIndexOf
 o lastIndexOf
 public int lastIndexOf(LoopRowNode row,
                        int index)
Just like the Vector method of the same name.

See Also:
lastIndexOf
 o elementAt
 public LoopRowNode elementAt(int index)
Just like the Vector method of the same name.

See Also:
elementAt
 o firstElement
 public LoopRowNode firstElement()
Just like the Vector method of the same name.

See Also:
firstElement
 o lastElement
 public LoopRowNode lastElement()
Just like the Vector method of the same name.

See Also:
lastElement
 o setElementAt
 public void setElementAt(LoopRowNode row,
                          int index) throws OperationCausesMismatchedLoopData
Just like the Vector method of the same name, except that it throws an exception if the number of values in the row is incorrect for the number of names in the list of names in this DataLoopNode. (If this table is not inside a DataLoopNode, then this exception is never thrown.

See Also:
setElementAt
 o removeElementAt
 public void removeElementAt(int index)
Similar to the Vector method of the same name. If this is the last row in te table, and if this table is nested inside a LoopRowNode, then it will unlink itself from the parent LoopRowNode (which should make this table go away at garbage collection time.)

See Also:
removeElementAt
 o insertElementAt
 public void insertElementAt(LoopRowNode row,
                             int index)
Just like the Vector method of the same name, but it will throw an exception when invalid insertions are attempted.

An invalid insertion is one with the following conditions: 1 - This table is already inside a DataLoopNode (and not 'free floating'.), and
2 - The row being inserted has the wrong number of values. (The number of values in the row must match the number of names in the loop header.)

See Also:
insertElementAt
 o addElement
 public void addElement(LoopRowNode row)
Just like the Vector method of the same name, but it will throw an exception when invalid insertions are attempted.

An invalid insertion is one with the following conditions: 1 - This table is already inside a DataLoopNode (and not 'free floating'.), and
2 - The row being inserted has the wrong number of values. (The number of values in the row must match the number of names in the loop header.)

See Also:
addElement
 o removeElement
 public boolean removeElement(LoopRowNode row)
Just like the Vector method of the same name, but it makes this table go away if the row removed was the last one.

If this is the last row in the table, and if this table is nested inside a LoopRowNode, then it will unlink itself from the parent LoopRowNode (which should make this table go away at garbage collection time.)

See Also:
removeElement
 o isInLoop
 public int isInLoop()
isInLoop: Returns true if this LoopTableNode is inside a DataLoopNode, or false if it is not. (In a complete STAR tree it is always true, but when building up a loop piece by piece an LoopTableNode might not have been attached to a loop yet.)

The value returned is an integer. It is a count of how many nesting levels deep this is in the loop that it was found it. Thus if it is zero (false) it was not found in a loop, and if it is 1 then it was found in nesting level 1 of a loop, 2 = nesting level 2, etc.

Note that this is off-by-one with the index used in the [] operator, which starts counting at zero. This was done so that this method could be used like a boolean. (zero means not found, nonzero means found).

 o 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
 o setTabFlag
 public void setTabFlag(boolean tabFlag)
Sets the tabulation Unparse flag for this table.

Parameters:
tabFlag - true for tabular, false for linear.
 o getTabFlag
 public boolean getTabFlag()
Gets the tabulation Unparse flag for this table.

Returns:
true = tabular, false = linear
 o setIndentFlag
 public void setIndentFlag(boolean tabFlag)
Sets the indentation Unparse flag for this table.

Parameters:
tabFlag - true for indented from margin (norma), false for up-against-margin.
 o getIndentFlag
 public boolean getIndentFlag()
Gets the indentation Unparse flag for this table.

Returns:
true for indented from margin (norma), false for up-against-margin.
 o setRowsPerLine
 public void setRowsPerLine(int setTo)
Sets the number of rows Unparsed per line when in tabular mode. if getIndentFlag() is false, then this is meaningless.

Parameters:
setTo - the number of rows per line.
 o getRowsPerLine
 public int getRowsPerLine()
Gets the number of rows to be Unparsed on one line when in tabular mode.

Returns:
the number of rows per line.
 o searchForType
 public VectorCheckType searchForType(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.
 o searchForType
 public VectorCheckType searchForType(Class type,
                                      short delim)
Find the type given in this row - Return all the matching values that meet the criteria given in the parameters.

Parameters:
type - look for this type
delim - Look for this delimiter type.
Overrides:
searchForType in class StarNode
See Also:
DataValueNode::NON
 o getMyDepth
 protected int getMyDepth()
 o getMaxDepth
 protected int getMaxDepth()
 o truncateNestLevel
 protected void truncateNestLevel(int depth)
 o searchForValsInColumn
 protected VectorCheckType searchForValsInColumn(int searchNest,
                                                 int searchCol,
                                                 String value)
Look for the value in the nest level/column given. nest level and column both start counting at zero.

 o calcPrintSizes
 protected void calcPrintSizes(Vector preSizes,
                               Vector postSizes)
Calcualte the sizes to print this table in.


All Packages  Class Hierarchy  This Package  Previous  Next  Index