All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class EDU.bmrb.starlibj.DataLoopNode

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

public class DataLoopNode
extends StarNode
implements Cloneable
A DataLoopNode holds one loop from the Star file tree. The loop can be nested. A DataLoopNode is mostly just a pairing of a LoopTableNode with its associated DataLoopNameListNode. Most of the interesting methods are contained in one of those two types.


Variable Index

 o myNames
 o myVals
 o parseMismatchFlag

Constructor Index

 o DataLoopNode()
constructor - makes empty DataLoopNode.
 o DataLoopNode(boolean)
constructor - makes a loop with the given tabulation setting.
 o DataLoopNode(boolean, boolean, int)
constructor - makes a loop with the given settings.
 o DataLoopNode(DataLoopNameListNode, LoopTableNode)
Constructor, given the name list and table.
 o DataLoopNode(DataLoopNode)
copy constructor - deep copy.

Method Index

 o clone()
clone - allocate a copy of me and return it
 o getNames()
return a reference to the DataLoopNameList of names in me.
 o getTabFlag()
Get the tabulation flag for this loop:
 o getVals()
return a reference to the LoopTableNode of values in me.
 o searchByName(String)
searchByName() will generate a list of all the places a particular name exists in this Star object.
 o searchByTagValue(String, String)
Given a tag name and a value, find the DataValueNodes from inside this loop that match the criteria.
 o searchForType(Class, short)
This method returns a vector of all the nodes of the given type.
 o setTabFlag(boolean)
Set the tabulation flag for this loop:

Variables

 o myNames
 protected DataLoopNameListNode myNames
 o myVals
 protected LoopTableNode myVals
 o parseMismatchFlag
 protected boolean parseMismatchFlag

Constructors

 o DataLoopNode
 public DataLoopNode()
constructor - makes empty DataLoopNode. Defaults its loop format to 'linear'.

 o DataLoopNode
 public DataLoopNode(boolean tab)
constructor - makes a loop with the given tabulation setting.

Parameters:
tab - true = loop will print tabularly, false = linearly
 o DataLoopNode
 public DataLoopNode(boolean tab,
                     boolean indent,
                     int rowsPerLine)
constructor - makes a loop with the given settings.

Parameters:
tab - true = loop will print tabularly, false = linearly
indent - true = loop body will be indented (normal), false = not indented.
rowsPerLine - integer number of rows printed in a line of text. Normally you set it to 1.
 o DataLoopNode
 public DataLoopNode(DataLoopNameListNode names,
                     LoopTableNode table)
Constructor, given the name list and table. Typically only used by the parser.

 o DataLoopNode
 public DataLoopNode(DataLoopNode copyMe)
copy constructor - deep copy.

Methods

 o clone
 public Object clone()
clone - allocate a copy of me and return it

Overrides:
clone in class StarNode
 o getVals
 public LoopTableNode getVals()
return a reference to the LoopTableNode of values in me.

 o getNames
 public DataLoopNameListNode getNames()
return a reference to the DataLoopNameList of names in me.

 o getTabFlag
 public boolean getTabFlag()
Get the tabulation flag for this loop:

Returns:
the tab flag
 o setTabFlag
 public void setTabFlag(boolean fl)
Set the tabulation flag for this loop:

Parameters:
fl - the tab flag to set it to.
 o searchByName
 public VectorCheckType searchByName(String searchFor)
searchByName() will generate a list of all the places a particular name exists in this Star object. This name will match tag names in this DataLoopNode. The full tag name must be passed, so to look for a tag called foo, you need to use the underscore in the name: "_foo". Also, to look for a saveframe called foo, you need the save_ prefix, like this: "save_foo". This search is an exact string match, and it is case-sensitive.

The returned results are DataNameNodes when looking in a DataLoopNode like this.

It should be noted that this algorithm, and the other search algorithms that follow, are simple linear searches with no indexing. So they are computationally slow. So far the need has not yet surfaced for a faster indexed search technique, although one could be added behind the scenes without changing the interface.

The search for names is case-insensitive.

Parameters:
searchFor - the string name to look for.
Returns:
A VectorCheckType containing the StarNodes that matched. This vector will have a size of zero if there are no matches.
Overrides:
searchByName in class StarNode
 o searchByTagValue
 public VectorCheckType searchByTagValue(String tag,
                                         String value)
Given a tag name and a value, find the DataValueNodes from inside this loop that match the criteria. More than one DataValueNode could be returned from the same DataLoopNode if the value being looked-for appears more than once in the column for a tag name.

The search for tag names is case-insensitive.

The search for values, however is case-sensitive.

Parameters:
tag - - Look for this tag...
value - - Where it has this value.
Returns:
A java.util.vector containing the matching StarNodes. This vector will have a size of zero if there are no matches.
Overrides:
searchByTagValue in class StarNode
 o searchForType
 public VectorCheckType searchForType(Class type,
                                      short delim)
This method returns a vector of all the nodes of the given type. It is much like searchByName() in that it heirarchically walks the STAR tree and calls the searchForType() functions of the subtrees within the tree. In this way it is possible to call this function at any level of the STAR file.

The second parameter is optional and is only useful when you are searching for DataValueNodes. It determines the kind of DataValueNode you are searching for, by delimiter type. For example, you could search for only those DataValueNodes that are semicolon-delimited by passing DataValueNode::SEMICOLON as the second argument. Or you could look for just framecodes by passing DataValueNode::FRAMECODE as the second parameter. Passing a negative number says you want all the DataValueNodes, regardless of their delimiter type.

If the search is for some ASTtype other than DataValueNode, then it is irrelevant what the second parameter of this function is, as it will never be used - You can just leave it off and accept the default.

Parameters:
type - - type to search for
delim - - DataValueNode::ValType to look for. Default = "dont-care".
Returns:
A java.util.vector containing the matching StarNodes. This vector will have a size of zero if there are no matches.
Overrides:
searchForType in class StarNode

All Packages  Class Hierarchy  This Package  Previous  Next  Index