EDU.bmrb.starlibj
Class LoopNameListNode

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

public class LoopNameListNode
extends StarNode
implements java.lang.Cloneable

Holds the list of tag names that represents one nesting level of the loop.

To keep the API familiar to the user, I have tried to mimic the methods in java.util.vector as closely as possible.


Fields inherited from class EDU.bmrb.starlibj.StarNode
colNum, lineNum, parent, preComment
 
Constructor Summary
LoopNameListNode()
          empty constructor
LoopNameListNode(LoopNameListNode copyMe)
          copy constructor
 
Method Summary
 void addElement(java.lang.Object obj)
          Just like the Vector method of the same name.
 void addElement(java.lang.Object obj, DataValueNode val)
          Just like the Vector method of the same name.
 java.lang.Object clone()
          From interface Cloneable.
 boolean contains(java.lang.Object obj)
          Just like the Vector method of the same name.
 DataNameNode 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.
 DataNameNode firstElement()
          Just like the Vector method of the same name.
 int getDepth()
          Get the depth of this name list in the loop it is in.
 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(java.lang.Object obj)
          Just like the Vector method of the same name.
 int indexOf(java.lang.Object obj, int index)
          Just like the Vector method of the same name.
 void insertElementAt(java.lang.Object obj, int index)
          Just like the Vector method of the same name.
 void insertElementAt(java.lang.Object obj, int index, DataValueNode val)
          Identical to the version above, except that the value to be padded into the loop values is chosen by the caller instead of being a dot ('.')
 boolean isEmpty()
          Just like the Vector method of the same name.
 DataNameNode lastElement()
          Just like the Vector method of the same name.
 int lastIndexOf(java.lang.Object obj)
          Just like the Vector method of the same name.
 int lastIndexOf(java.lang.Object obj, int index)
          Just like the Vector method of the same name.
 void removeElement(java.lang.Object obj)
          Just like the Vector method of the same name.
 void removeElementAt(int index)
          Similar to 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(java.lang.Object obj, 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 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, mySkips, searchByTagValue, searchForType, 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

LoopNameListNode

public LoopNameListNode()
empty constructor

LoopNameListNode

public LoopNameListNode(LoopNameListNode copyMe)
copy constructor
Method Detail

clone

public java.lang.Object clone()
From interface Cloneable.
Overrides:
clone in class StarNode

setSize

public void setSize(int newSize)
Just like the Vector method of the same name. Makes enough room so that there can be newSize elements in the node, without having to insert them manually one at a time. The nodes start out will a null value that can be replaced with setElementAt.
See Also:
VectorCheckType.setSize

size

public int size()
Just like the Vector method of the same name. Returns the number of names in this list
See Also:
java.util.Vector.size

isEmpty

public boolean isEmpty()
Just like the Vector method of the same name. True if this list has no names in it.
See Also:
java.util.Vector.isEmpty

elements

public java.util.Enumeration elements()
Just like the Vector method of the same name. Gives an enumeration over the names in this block.
See Also:
java.util.Vector.Enumeration

contains

public boolean contains(java.lang.Object obj)
Just like the Vector method of the same name. True if the node given is in this name list.
Parameters:
obj - The string name.
See Also:
java.util.Vector.contains

indexOf

public int indexOf(java.lang.Object obj)
Just like the Vector method of the same name. Returns the integer index of the given name inside this list.
Parameters:
obj - The name to look for.
See Also:
java.util.Vector.indexOf

indexOf

public int indexOf(java.lang.Object obj,
                   int index)
Just like the Vector method of the same name. Returns the integer index of the next occurrance of the given name afterthe given index.
Parameters:
obj - The name to look for.
index - Start searching at this point in the vector.
See Also:
java.util.Vector.indexOf

lastIndexOf

public int lastIndexOf(java.lang.Object obj)
Just like the Vector method of the same name. Returns the lastmost integer index of the given name
Parameters:
obj - The name to look for.
See Also:
java.util.Vector.lastIndexOf

lastIndexOf

public int lastIndexOf(java.lang.Object obj,
                       int index)
Just like the Vector method of the same name. Returns the lastmost integer index of the given name, but going no higher than the given index.
Parameters:
obj - The name to look for.
index - Start searching back from this point in the vector.
See Also:
java.util.Vector.lastIndexOf

elementAt

public DataNameNode elementAt(int index)
Just like the Vector method of the same name. Returns the name object at the given index.
Parameters:
index - The index to return the name for.
Returns:
The returned object is a string.
See Also:
java.util.Vector.elementAt

firstElement

public DataNameNode firstElement()
Just like the Vector method of the same name. Returns the first name in the list
Returns:
The returned object is a string.
See Also:
java.util.Vector.firstElement

lastElement

public DataNameNode lastElement()
Just like the Vector method of the same name. Returns the last name in the list.
Returns:
The returned object is a string.
See Also:
java.util.Vector.lastElement

setElementAt

public void setElementAt(java.lang.Object obj,
                         int index)
                  throws WrongElementType
Just like the Vector method of the same name. Clobbers the name at the index given with the new name.
Parameters:
obj - The name to replace it with.
index - the position to replace.
See Also:
java.util.Vector.setElementAt

removeElementAt

public void removeElementAt(int index)
Similar to the Vector method of the same name. Deletes the name. If this is contained inside a DataLoopNode, then it also removes all the values from the associated loop table that are under this name.
Parameters:
index - the position to remove.
See Also:
java.util.Vector.removeElementAt

insertElementAt

public void insertElementAt(java.lang.Object obj,
                            int index)
                     throws WrongElementType
Just like the Vector method of the same name. Inserts a name just in front of the index given.. If this is in a DataLoopNode, it also inserts all the appropriate columns into the data below so that it matches the newly inserted name. The new values will all be star nulls (single dot '.' values).
Parameters:
obj - The name to insert.
index - the position to insert it in from of.
See Also:
java.util.Vector.insertElementAt

insertElementAt

public void insertElementAt(java.lang.Object obj,
                            int index,
                            DataValueNode val)
                     throws WrongElementType
Identical to the version above, except that the value to be padded into the loop values is chosen by the caller instead of being a dot ('.')
Parameters:
obj - The name to insert.
index - the position to insert it in from of.
val - The value to insert in the columns below.
See Also:
java.util.Vector.insertElementAt

addElement

public void addElement(java.lang.Object obj)
                throws WrongElementType
Just like the Vector method of the same name. Adds a name to the end of the list. Also adds a default value into the loop in a column to match up with the new name if the loop is there. The default value is a single nonquoted dot (.).
Parameters:
obj - The name to add.
See Also:
java.util.Vector.addElement

addElement

public void addElement(java.lang.Object obj,
                       DataValueNode val)
                throws WrongElementType
Just like the Vector method of the same name. Adds a name to the end of the list. Also adds new DataValueNodes into the loop in a column to match up with the new name where needed. The default value is the value passed in the parameter
Parameters:
obj - The name to add.
val - the new DataValueNode to copy from if need be.
See Also:
java.util.Vector.addElement

removeElement

public void removeElement(java.lang.Object obj)
Just like the Vector method of the same name. Removes the name matching the one given.
Parameters:
obj - (string) The name to remove.
See Also:
java.util.Vector.removeElement

getDepth

public int getDepth()
Get the depth of this name list in the loop it is in. (The depth is the level of nesting. If this is the outermost list of names, it is at depth 'zero', if it is the next level in, is is depth 1, and so on...)
     loop_
         _tag1    # --.
         _tag2    #   |-- depth 0.
         _tag3    # --'
         loop_
             _tagA    # --- depth 1.
             loop_
                 _tagX    # --.__ depth 2.
                 _tagY    # --'
 
Returns:
depth - negative number if this is not inside a DataLoopNode.

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.

searchByName

public VectorCheckType searchByName(java.lang.String searchFor)
Find the name given in this name list.

The search for names is case-insensitive.

Parameters:
searchFor - look for this tag name.
Overrides:
searchByName in class StarNode

searchForType

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

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