All Packages Class Hierarchy This Package Previous Next Index
Class EDU.bmrb.starlibj.SaveFrameNode
java.lang.Object
|
+----EDU.bmrb.starlibj.StarNode
|
+----EDU.bmrb.starlibj.SaveFrameNode
- public class SaveFrameNode
- extends StarNode
- implements Cloneable
A SaveFrameNode contains the contents of a STAR file saveframe.
It has a name, available through "getLabel()" and "setLabel()". This
name must have a prefix of "save_". A SaveFrameNode behaves like
a vector (it implements StarVectorLike) that can contain
DataItemNodes and DataLoopNodes.
-
myDataList
-
-
myName
-
-
SaveFrameNode(SaveFrameNode)
- copy constructor - deep copy.
-
SaveFrameNode(String)
- constructor - Generates exception if the given
saveframe name is not a legal saveframe name
-
addElement(Object)
- Just like the Vector method of the same name.
-
clone()
- clone allocates a copy of me and returns a reference to it.
-
contains(Object)
- Just like the Vector method of the same name.
-
elementAt(int)
- Just like the Vector method of the same name.
-
elements()
- Just like the Vector method of the same name.
-
firstElement()
- Just like the Vector method of the same name.
-
getLabel()
- Gets the string name of this saveframe (save_whatever).
-
indexOf(Object)
- Just like the Vector method of the same name.
-
indexOf(Object, int)
- Just like the Vector method of the same name.
-
insertElementAt(Object, int)
- Just like the Vector method of the same name.
-
isEmpty()
- Just like the Vector method of the same name.
-
lastElement()
- Just like the Vector method of the same name.
-
lastIndexOf(Object)
- Just like the Vector method of the same name.
-
lastIndexOf(Object, int)
- Just like the Vector method of the same name.
-
removeElement(Object)
- Just like the Vector method of the same name.
-
removeElementAt(int)
- Similar to the Vector method of the same name.
-
searchByName(String)
- Given a tag name, find the AST object it resides in.
-
searchByTagValue(String, String)
- Given a tag name and a value, find the AST object that that
particular tag and value pair resides in.
-
searchForType(Class, short)
- This method returns a vector of all the nodes of the given type.
-
setElementAt(Object, int)
- Just like the Vector method of the same name.
-
setLabel(String)
- Sets the string name of this saveframe - generates an
exception if the name is invalid.
-
setSize(int)
- Just like the Vector method of the same name.
-
size()
- Just like the Vector method of the same name.
-
Unparse(int)
- Unparse prints the contents of the StarNode object out to the
given stream.
myName
protected String myName
myDataList
protected SaveListVector myDataList
SaveFrameNode
public SaveFrameNode(String name)
- constructor - Generates exception if the given
saveframe name is not a legal saveframe name
SaveFrameNode
public SaveFrameNode(SaveFrameNode copyMe)
- copy constructor - deep copy.
clone
public Object clone()
- clone allocates a copy of me and returns a reference to it.
- Overrides:
- clone in class StarNode
getLabel
public String getLabel()
- Gets the string name of this saveframe (save_whatever).
setLabel
public void setLabel(String newName) throws NameViolatesStarSyntax
- Sets the string name of this saveframe - generates an
exception if the name is invalid.
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
size
public int size()
- Just like the Vector method of the same name.
Returns the number of elements in this saveframe.
- See Also:
- size
isEmpty
public boolean isEmpty()
- Just like the Vector method of the same name.
True if this saveframe has no elements in it.
- See Also:
- isEmpty
elements
public Enumeration elements()
- Just like the Vector method of the same name.
Gives an enumeration over the loops and
data items in this block.
- See Also:
- Enumeration
contains
public boolean contains(Object obj)
- Just like the Vector method of the same name.
True if the node given is a loop or item
immediately inside this saveframe. This
is not a deep recursive search - it only
looks at the level immediately inside the saveframe.
- Parameters:
- obj - The loop or item to look for
- See Also:
- contains
indexOf
public int indexOf(Object obj)
- Just like the Vector method of the same name.
Returns the integer index of the given item or loop
inside this saveframe. This is
not a deep recursive search.
- Parameters:
- obj - The loop or item to look for.
- See Also:
- indexOf
indexOf
public int indexOf(Object obj,
int index)
- Just like the Vector method of the same name.
Returns the integer index of the next item or loop
inside this saveframe, starting at
the index given. This is not a deep recursive
search.
- Parameters:
- obj - The item or loop to look for.
- index - Start searching at this point in the vector.
- See Also:
- indexOf
lastIndexOf
public int lastIndexOf(Object obj)
- Just like the Vector method of the same name.
Returns the lastmost integer index of the given
item or loop.
- Parameters:
- obj - The item or loop to look for.
- See Also:
- lastIndexOf
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
item or loop but going no higher
than the given index.
- Parameters:
- obj - The item or loop to look for.
- index - Start searching back from this point in
the vector.
- See Also:
- lastIndexOf
elementAt
public StarNode elementAt(int index)
- Just like the Vector method of the same name.
Returns the item or loop object at the given index.
- Parameters:
- index - The index to return the item or loop at.
- Returns:
- The returned object is either an item or loop.
- See Also:
- elementAt
firstElement
public StarNode firstElement()
- Just like the Vector method of the same name.
Returns the first item or loop object in the file.
- Returns:
- The returned object is a item or loop.
- See Also:
- firstElement
lastElement
public StarNode lastElement()
- Just like the Vector method of the same name.
Returns the last item or loop in the saveframe.
- Returns:
- The returned object is a item or loop.
- See Also:
- lastElement
setElementAt
public void setElementAt(Object obj,
int index) throws WrongElementType
- Just like the Vector method of the same name.
Clobbers the item or loop at the given index
with the object given.
- Parameters:
- obj - The item or loop to set it to.
- index - the position to replace.
- See Also:
- setElementAt
removeElementAt
public void removeElementAt(int index)
- Similar to the Vector method of the same name.
Deletes the item or loop at the given index from the
saveframe.
- Parameters:
- index - the position to remove.
- See Also:
- removeElementAt
insertElementAt
public void insertElementAt(Object obj,
int index) throws WrongElementType
- Just like the Vector method of the same name.
Inserts an item or loop at the position given.
- Parameters:
- obj - The item or loopto insert.
- index - the position to insert it in from of.
- See Also:
- insertElementAt
addElement
public void addElement(Object obj) throws WrongElementType
- Just like the Vector method of the same name.
Adds an item or loop to the end of the saveframe.
- Parameters:
- obj - The item or loop to add.
- See Also:
- addElement
removeElement
public boolean removeElement(Object obj)
- Just like the Vector method of the same name.
Removes the item or loop matching the one given.
- Parameters:
- obj - The item or loop to remove.
- See Also:
- removeElement
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
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
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 StarNode 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. Set to
DataValueNode.DONT_CARE if it doesn't matter.
- 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
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
All Packages Class Hierarchy This Package Previous Next Index