EDU.bmrb.starlibj
Class DataLoopNameListNode

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

public class DataLoopNameListNode
extends StarNode
implements java.lang.Cloneable

This class contains the list of lists of names that represents all the tag names for a loop. This class mimics the functionality of java.util.vector, so that programmers can learn it easier. Each element in this 'vector' is a LoopNameListNode (described elsewhere), which is a list of tagnames. Each element in this 'vector' is therefore one of the the nesting levels of the loop's names. Here is an example. Assume the original star file contained the following piece of text:

            loop_
                _tag_I  _tag_II  _tag_III
                loop_
                    _tag_A  _tag_B
                    loop_
                        _tag1 _tag2 _tag3 _tag4

           ... loop values ... 
 
Then the DataLoopNameListNode to store those tag names would look like this:
index contains
0 a LoopNameListNode which in turn contains "_tag_I", "_tag_II", and "_tagIII"
1 a LoopNameListNode which in turn contains "_tag_A" and "_tag_B"
2 a LoopNameListNode which in turn contains "_tag_1", "_tag_2", "_tag3", and "_tag_4"

See Also:
LoopNameListNode

Fields inherited from class EDU.bmrb.starlibj.StarNode
colNum, lineNum, parent, preComment
 
Constructor Summary
DataLoopNameListNode()
          no-arg constructor
DataLoopNameListNode(DataLoopNameListNode copyMe)
          copy constructor
DataLoopNameListNode(NameListVector copyMe)
          Copy a vector of LoopNameListNodes
 
Method Summary
 void addElement(LoopNameListNode row)
          Just like the Vector method of the same name.
 int capacity()
          Just like the Vector method of the same name.
 java.lang.Object clone()
          Allocates a new copy (clone) of this StarNode and returns a reference to it.
 boolean contains(LoopNameListNode row)
          Just like the Vector method of the same name.
 LoopNameListNode elementAt(int index)
          Just like the Vector method of the same name.
 java.util.Enumeration elements()
          Just like the Vector method of the same name.
 LoopNameListNode firstElement()
          Just like the Vector method of the same name.
 java.lang.String getLabel()
          Returns the name of the first tag in the list, which is sometimes used to refer to the whole loop list.
 int indexOf(LoopNameListNode row)
          Just like the Vector method of the same name.
 int indexOf(LoopNameListNode row, int index)
          Just like the Vector method of the same name.
 void insertElementAt(LoopNameListNode row, int index)
          Just like the Vector method of the same name.
 boolean isEmpty()
          Just like the Vector method of the same name.
 LoopNameListNode lastElement()
          Just like the Vector method of the same name.
 int lastIndexOf(LoopNameListNode row)
          Just like the Vector method of the same name.
 int lastIndexOf(LoopNameListNode row, int index)
          Just like the Vector method of the same name.
 boolean removeElement(LoopNameListNode row)
          Just like the Vector method of the same name.
 void removeElementAt(int index)
          Just like the Vector method of the same name.
 VectorCheckType searchByName(java.lang.String searchFor)
          Find the name given in this name list.
 VectorCheckType searchForType(java.lang.Class type)
          Find the type given in this name list.
 void setElementAt(LoopNameListNode row, int index)
          Just like the Vector method of the same name.
 void setSize(int newSize)
          Just like the Vector method of the same name.
 int size()
          Just like the Vector method of the same name.
 void tagPositionDeep(java.lang.String tagName, RemoteInt nestLevel, RemoteInt column)
          Get the index of the given name.
 
Methods inherited from class EDU.bmrb.starlibj.StarNode
getColNum, getLineNum, getParallelCopy, getParent, getPreComment, searchByTagValue, searchForType, searchForTypeByName, searchForTypeByTagValue, setColNum, setLineNum, setParent, setPeer, setPreComment, Unparse
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataLoopNameListNode

public DataLoopNameListNode()
no-arg constructor

DataLoopNameListNode

public DataLoopNameListNode(DataLoopNameListNode copyMe)
copy constructor

DataLoopNameListNode

public DataLoopNameListNode(NameListVector copyMe)
Copy a vector of LoopNameListNodes
Method Detail

clone

public java.lang.Object clone()
Description copied from class: StarNode
Allocates a new copy (clone) of this StarNode and returns a reference to it. The copy is deep, meaning that the children are also copied (rather than linked). Thus copying a StarFileNode results in a new copy of the whole treee.
Overrides:
clone in class StarNode
Following copied from class: EDU.bmrb.starlibj.StarNode
See Also:
StarFileNode

setSize

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

capacity

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

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

elements

public java.util.Enumeration elements()
Just like the Vector method of the same name.
See Also:
VectorCheckType.Enumeration

contains

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

indexOf

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

indexOf

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

lastIndexOf

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

lastIndexOf

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

elementAt

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

firstElement

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

lastElement

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

setElementAt

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

removeElementAt

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

insertElementAt

public void insertElementAt(LoopNameListNode row,
                            int index)
Just like the Vector method of the same name.
See Also:
VectorCheckType.insertElementAt

addElement

public void addElement(LoopNameListNode row)
Just like the Vector method of the same name.
See Also:
VectorCheckType.addElement

removeElement

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

getLabel

public java.lang.String getLabel()
Returns the name of the first tag in the list, which is sometimes used to refer to the whole loop list.
Returns:
null if the list is empty (which should only happen when the list is still in creation.)

searchByName

public VectorCheckType searchByName(java.lang.String searchFor)
Find the name given in this name list. The search for names is case-insensitive.
Overrides:
searchByName in class StarNode
Parameters:
searchFor - look for this tag name, case insensitively.

searchForType

public VectorCheckType searchForType(java.lang.Class type)
Find the type given in this name list.
Parameters:
searchFor - look for this tag name.

tagPositionDeep

public void tagPositionDeep(java.lang.String tagName,
                            RemoteInt nestLevel,
                            RemoteInt column)
Get the index of the given name. Returns the nest depth and the column index within that nest depth. (indexes start counting at zero, negative numbers returned mean the tag was not found.)

Note that the search for tag names is always case-insensitive, as per the STAR syntax.

Parameters:
tagName - The tag to look for.
nestLevel - (out) - Returns the nesting level. The use of the trivial "RemoteInt" class is required because Java can only pass an int by value, and the class "Integer" doesn't have any methods for setting the value after construction.
column - (out) - Returns the nesting level. The use of the trivial "RemoteInt" class is required because Java can only pass an int by value, and the class "Integer" doesn't have any methods for setting the value after construction.