EDU.bmrb.starlibj
Class DataItemNode

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

public class DataItemNode
extends StarNode

Holds a single "free" tag and value pair. Can be found inside SaveFrameNodes and BlockNodes


Field Summary
protected  DataNameNode myDataName
           
protected  DataValueNode myDataValue
           
 
Fields inherited from class EDU.bmrb.starlibj.StarNode
colNum, lineNum, parent, preComment
 
Constructor Summary
DataItemNode(DataItemNode copyMe)
          copy constructor:
DataItemNode(DataNameNode name, DataValueNode value)
          This constructor makes a new item with the given name and value.
DataItemNode(java.lang.String name, java.lang.String value)
          This constructor makes a new item with the given name and string value, giving it the default delimiter type of DataValueNode::NON.
DataItemNode(java.lang.String name, java.lang.String value, short delim)
          Make a new item given the name and value and delimiter type.
 
Method Summary
 java.lang.Object clone()
          Allocates a new copy of me and returns a reference to it.
 short getDelimType()
          Returns the delimiter type of the value in this item.
 java.lang.String getLabel()
          Gets the String tag name of this item.
 DataNameNode getNameNode()
          Gets the entire DataNameNode inside this item (as opposed to just the string name like getLabel() does.)
 java.lang.String getValue()
          Gets the String value of this item.
 DataValueNode getValueNode()
          getValueNode() is like getValue(), but it returns the whole DataValueNode, not just the string inside it.
 VectorCheckType searchByName(java.lang.String searchFor)
          Included for orthogonality with StarNode.
 VectorCheckType searchByTagValue(java.lang.String tag, java.lang.String value)
          Included for orthogonality with StarNode.
 VectorCheckType searchForType(java.lang.Class type, short delim)
          Included for orthogonality with StarNode.
 void setDelimType(short delim)
          Sets the delimiter type of the value in this item.
 void setLabel(java.lang.String name)
          Sets the String tag name of this item - it's an exception if the name does not begin with an underscore.
 void setValue(java.lang.String val)
          Sets the string value of this item.
 void setValue(java.lang.String val, short delim)
          Sets the String value and delimiter of this item together.
 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, searchForTypeByName, searchForTypeByTagValue, setColNum, setLineNum, setParent, setPeer, setPreComment
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myDataName

protected DataNameNode myDataName

myDataValue

protected DataValueNode myDataValue
Constructor Detail

DataItemNode

public DataItemNode(DataNameNode name,
                    DataValueNode value)
             throws NameViolatesStarSyntax
This constructor makes a new item with the given name and value. It makes a copy of the value passed, not a reference to it.
Throws:
NameViolatesStarSyntax - if the tag name is not valid star syntax for a tag name.

DataItemNode

public DataItemNode(java.lang.String name,
                    java.lang.String value)
             throws NameViolatesStarSyntax,
                    BadValueForDelimiter
This constructor makes a new item with the given name and string value, giving it the default delimiter type of DataValueNode::NON. Copies of the strings are made, not references.
Throws:
NameViolatesStarSyntax - if the tag name is not valid star syntax for a tag name.
BadValueForDelimiter - if the value for the node won't be valid syntax given the kind of delimiter the node has.

DataItemNode

public DataItemNode(java.lang.String name,
                    java.lang.String value,
                    short delim)
             throws NameViolatesStarSyntax,
                    BadValueForDelimiter
Make a new item given the name and value and delimiter type. Note that no checking is done to ensure that the delimiter type given is appropriate for the value given. (It is possible to make a value with spaces and tell it to be nonquoted, for example.)

Copies of the strings are made, not references.

Throws:
NameViolatesStarSyntax - if the tag name is not valid star syntax for a tag name.
BadValueForDelimiter - if the value for the node won't be valid syntax given the kind of delimiter the node has.

DataItemNode

public DataItemNode(DataItemNode copyMe)
copy constructor:
Method Detail

clone

public java.lang.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
Following copied from class: EDU.bmrb.starlibj.StarNode
See Also:
StarFileNode

getDelimType

public short getDelimType()
Returns the delimiter type of the value in this item.
See Also:
, , , ,

setDelimType

public void setDelimType(short delim)
                  throws BadValueForDelimiter
Sets the delimiter type of the value in this item. Note that no checks are done to ensure that the delimiter type given is valid for the string in this class.
Throws:
BadValueForDelimiter - if the value for the node won't be valid syntax given the kind of delimiter the node has.
See Also:
, , , ,

getValue

public java.lang.String getValue()
Gets the String value of this item.

getValueNode

public DataValueNode getValueNode()
getValueNode() is like getValue(), but it returns the whole DataValueNode, not just the string inside it.
Returns:
the DataValueNode inside this item

setValue

public void setValue(java.lang.String val)
              throws BadValueForDelimiter
Sets the string value of this item.
Throws:
BadValueForDelimiter - if the value for the node won't be valid syntax given the kind of delimiter the node has.

setValue

public void setValue(java.lang.String val,
                     short delim)
              throws BadValueForDelimiter
Sets the String value and delimiter of this item together.
Throws:
BadValueForDelimiter - if the value for the node won't be valid syntax given the kind of delimiter the node has.

getLabel

public java.lang.String getLabel()
Gets the String tag name of this item.

getNameNode

public DataNameNode getNameNode()
Gets the entire DataNameNode inside this item (as opposed to just the string name like getLabel() does.)
Returns:
the DataNameNode

setLabel

public void setLabel(java.lang.String name)
              throws NameViolatesStarSyntax
Sets the String tag name of this item - it's an exception if the name does not begin with an underscore.
Throws:
BadValueForDelimiter - if the value for the node won't be valid syntax given the kind of delimiter the node has.

searchByName

public VectorCheckType searchByName(java.lang.String searchFor)
Included for orthogonality with StarNode. Not really very useful at this scope. The search for names is case insensitive
Overrides:
searchByName in class StarNode
Following copied from class: EDU.bmrb.starlibj.StarNode
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.

searchByTagValue

public VectorCheckType searchByTagValue(java.lang.String tag,
                                        java.lang.String value)
Included for orthogonality with StarNode. Not really very useful at this scope. The search for names is case insensitive, but the search for values is case-sensitive.
Overrides:
searchByTagValue in class StarNode
Following copied from class: EDU.bmrb.starlibj.StarNode
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.

searchForType

public VectorCheckType searchForType(java.lang.Class type,
                                     short delim)
Included for orthogonality with StarNode. Not really very useful at this scope.
Overrides:
searchForType in class StarNode
Following copied from class: EDU.bmrb.starlibj.StarNode
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.

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