All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class EDU.bmrb.starlibj.StarFileNode

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

public class StarFileNode
extends StarNode
implements Cloneable
StarFileNode is the mother of all STAR nodes (literally). This node is the root of the whole star tree for a star file. If a star file is parsed in with the parser, it produces an object of this type, which in turn contains the rest of the tree.


Variable Index

 o myStarList

Constructor Index

 o StarFileNode()
Constructor - makes an empty star file:
 o StarFileNode(StarFileNode)
Copy Constructor - makes a copy of an existing tree:

Method Index

 o addElement(Object)
Just like the Vector method of the same name.
 o clone()
Allocates a new copy of me and returns a reference to it.
 o contains(Object)
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 indexOf(Object)
Just like the Vector method of the same name.
 o indexOf(Object, int)
Just like the Vector method of the same name.
 o insertElementAt(Object, int)
Just like the Vector method of the same name.
 o isEmpty()
Just like the Vector method of the same name.
 o lastElement()
Just like the Vector method of the same name.
 o lastIndexOf(Object)
Just like the Vector method of the same name.
 o lastIndexOf(Object, int)
Just like the Vector method of the same name.
 o removeElement(Object)
Just like the Vector method of the same name.
 o removeElementAt(int)
Similar to the Vector method of the same name.
 o searchByName(String)
Given a tag name, find the AST object it resides in.
 o searchByTagValue(String, String)
Given a tag name and a value, find the AST object that that particular tag and value pair resides in.
 o searchForType(Class, short)
This method returns a vector of all the nodes of the given type.
 o setElementAt(Object, int)
Just like the Vector method of the same name.
 o setSize(int)
Just like the Vector method of the same name.
 o size()
Just like the Vector method of the same name.

Variables

 o myStarList
 protected StarListVector myStarList

Constructors

 o StarFileNode
 public StarFileNode()
Constructor - makes an empty star file:

 o StarFileNode
 public StarFileNode(StarFileNode copyMe)
Copy Constructor - makes a copy of an existing tree:

Methods

 o 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:
setSize
 o size
 public int size()
Just like the Vector method of the same name. Returns the number of block elements in this Star File.

See Also:
size
 o isEmpty
 public boolean isEmpty()
Just like the Vector method of the same name. True if the star file has nothing in it.

See Also:
isEmpty
 o elements
 public Enumeration elements()
Just like the Vector method of the same name. Gives an enumeration over the blocks in the star file.

See Also:
Enumeration
 o contains
 public boolean contains(Object obj)
Just like the Vector method of the same name. True if the node given is a BlockNode inside this StarFileNode.

Parameters:
obj - The BlockNode to look for.
See Also:
contains
 o indexOf
 public int indexOf(Object obj)
Just like the Vector method of the same name. Returns the integer index of the Given BlockNode inside this StarFileNode.

Parameters:
obj - The BlockNode to look for.
See Also:
indexOf
 o indexOf
 public int indexOf(Object obj,
                    int index)
Just like the Vector method of the same name. Returns the integer index of the next BlockNode inside this StarFileNode, starting at the index given.

Parameters:
obj - The BlockNode to look for.
index - Start searching at this point in the vector.
See Also:
indexOf
 o lastIndexOf
 public int lastIndexOf(Object obj)
Just like the Vector method of the same name. Returns the lastmost integer index of the given BlockNode.

Parameters:
obj - The BlockNode to look for.
See Also:
lastIndexOf
 o lastIndexOf
 public int lastIndexOf(Object obj,
                        int index)
Just like the Vector method of the same name. Returns the lastmost integer index of the given BlockNode, but going no higher than the given index.

Parameters:
obj - The BlockNode to look for.
index - Start searching back from this point in the vector.
See Also:
lastIndexOf
 o elementAt
 public BlockNode elementAt(int index)
Just like the Vector method of the same name. Returns the BlockNode object at the given index.

Parameters:
index - The index to return the BlockNode at.
Returns:
The Returned Object is a BlockNode and can be safely casted to BlockNode.
See Also:
elementAt
 o firstElement
 public BlockNode firstElement()
Just like the Vector method of the same name. Returns the first BlockNode object in the file.

Returns:
The Returned Object is a BlockNode and can be safely casted to BlockNode.
See Also:
firstElement
 o lastElement
 public BlockNode lastElement()
Just like the Vector method of the same name. Returns the last Blocknode object in the file.

Returns:
The Returned Object is a BlockNode and can be safely casted to BlockNode.
See Also:
lastElement
 o setElementAt
 public void setElementAt(Object obj,
                          int index) throws WrongElementType
Just like the Vector method of the same name. Clobbers the BlockNode at the given index with the blocknode given.

Parameters:
obj - The BlockNode to set it to.
index - the position to replace.
See Also:
setElementAt
 o removeElementAt
 public void removeElementAt(int index)
Similar to the Vector method of the same name. Deletes the BlockNode at the given index from the star file node.

Parameters:
index - the position to remove.
See Also:
removeElementAt
 o insertElementAt
 public void insertElementAt(Object obj,
                             int index) throws WrongElementType
Just like the Vector method of the same name. Inserts a Blocknode.

Parameters:
obj - The BlockNode to insert.
index - the position to insert before.
See Also:
insertElementAt
 o addElement
 public void addElement(Object obj) throws WrongElementType
Just like the Vector method of the same name. Adds a BlockNode to the end of the list.

Parameters:
obj - The BlockNode to add.
See Also:
addElement
 o removeElement
 public boolean removeElement(Object obj)
Just like the Vector method of the same name. Removes the Blocknode matching the one given.

Parameters:
obj - The BlockNode to remove.
See Also:
removeElement
 o clone
 public Object clone()
Allocates a new copy of me and returns a reference to it. This is a deep copy, meaning that all children are copied instead of linked.

Overrides:
clone in class StarNode
 o searchByName
 public VectorCheckType searchByName(String searchFor)
Given a tag name, find the AST object it resides in. It returns a reference to the lowest level AST object that the tag resides in. The caller needs to use the type-aware features of Java to discover what the object's type really is.

The search for names is case-insensitive.

Parameters:
searchFor - - Look for this string as the tag name.
Overrides:
searchByName in class StarNode
 o searchByTagValue
 public VectorCheckType searchByTagValue(String tag,
                                         String value)
Given a tag name and a value, find the AST object that that particular tag and value pair resides in. This is like performing an SQL search: WHERE tag = value.

Only searches starting at the node it was called from, and its children. Recurses downward, but does not recurse upward. This function is only capable of returning one answer, so it cannot be called at the same levels where searchByTag() can be called (see above).

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