All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class EDU.bmrb.starlibj.DataValueNode

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

public class DataValueNode
extends StarNode
implements Cloneable
DataValueNode is the class that stores a single value from the STAR tree. It is used for both loop values and the values associated with tags outside of loops. Making this a class instead of just a string allows for the handling of the delimiter type.


Variable Index

 o delimType
 o DONT_CARE
delimiter type that indicates that you don't care about the delimiter type - only used for searches such as searchForType()
 o DOUBLE
delimiter type that indicates that this is a doublequoted value (")
 o FRAMECODE
delimiter type that indicates that this is a framecode value
 o myStrVal
 o NON
delimiter type that indicates that this is a nonquoted value.
 o SEMICOLON
delimiter type that indicates that this is semicolon demilited (;)
 o SINGLE
delimiter type that indicates that this is a singlequoted value (')

Constructor Index

 o DataValueNode(DataValueNode)
Constructor - copy another DataValueNode.
 o DataValueNode(String)
Constructor - all DataValueNodes must have a string value, so no provisions are made for a 'default' no-args constructor.
 o DataValueNode(String, short)
Constructor - all DataValueNodes must have a string value, so no provisions are made for a 'default' no-args constructor.

Method Index

 o clone()
Allocates a new copy of me and returns a reference to it.
 o getDelimType()
Returns the delimiter type of this value.
 o getLabel()
Alias for getValue
 o getValue()
Returns the string containing the value of this node.
 o myLongestStr()
Useful for printing.
 o setDelimType(short)
Sets the delimiter type of this value.
 o setValue(String)
Sets the string value for this node.
 o setValue(String, short)
Sets the string for this value, and the delimiter.
 o Unparse(int)
Unparse prints the contents of the StarNode object out to the given stream.

Variables

 o DONT_CARE
 public static short DONT_CARE
delimiter type that indicates that you don't care about the delimiter type - only used for searches such as searchForType()

See Also:
getDelimType
 o NON
 public static short NON
delimiter type that indicates that this is a nonquoted value.

See Also:
getDelimType
 o DOUBLE
 public static short DOUBLE
delimiter type that indicates that this is a doublequoted value (")

See Also:
getDelimType
 o SINGLE
 public static short SINGLE
delimiter type that indicates that this is a singlequoted value (')

See Also:
getDelimType
 o SEMICOLON
 public static short SEMICOLON
delimiter type that indicates that this is semicolon demilited (;)

See Also:
getDelimType
 o FRAMECODE
 public static short FRAMECODE
delimiter type that indicates that this is a framecode value

See Also:
getDelimType
 o myStrVal
 protected String myStrVal
 o delimType
 protected short delimType

Constructors

 o DataValueNode
 public DataValueNode(String str) throws BadValueForDelimiter
Constructor - all DataValueNodes must have a string value, so no provisions are made for a 'default' no-args constructor. The delimiter type will be chosen as the first delimiter type that is valid for the string value. It will try all the types of delimiter until a valid type is found, using the following order to try them in:
  1. NON
  2. DOUBLE
  3. SINGLE
  4. SEMICOLON

Throws: BadValueForDelimiter
(Should theoretically never be thrown, since a Semicolon string should accept any data and it should at least be able to use a semicolon delimiter for everything. If you ever see this exception, it indicates a programming error within the starlibj itself.)
 o DataValueNode
 public DataValueNode(String str,
                      short delim) throws BadValueForDelimiter
Constructor - all DataValueNodes must have a string value, so no provisions are made for a 'default' no-args constructor.

Parameters:
str - The string to set the value to.
delim - The delimiter type to set the value to.
 o DataValueNode
 public DataValueNode(DataValueNode copyMe)
Constructor - copy another DataValueNode.

Methods

 o getDelimType
 public short getDelimType()
Returns the delimiter type of this value. Note that the delimiter type of this value determines what kind of delimiter is used by this value. The delimiter itself is not inlcuded as part of the value string. So a value that appears as "sample value" in the STAR file will contain sample value in the string, and will be of delimiter type DOUBLE. This is true for all the value types, including framecodes (the dollarsign is not part of the string value itself).

Returns:
NON, DOUBLE, SINGLE, SEMICOLON, or FRAMECODE
 o setDelimType
 public void setDelimType(short setTo) throws BadValueForDelimiter
Sets the delimiter type of this value. Lets the programmer choose a delimiter type for this value.

Throws: BadValueForDelimiter
Throws this exception if the delimiter type is incorrect for the given type of string (for example, if a string with whitespace is given a delimiter type of "NON", that's an error.)
 o getValue
 public String getValue()
Returns the string containing the value of this node. All values are stored as strings, even numbers. If you desire to look at the value as a number, there are many Java methods that will let you convert strings to numbers on-the-fly.

 o setValue
 public void setValue(String newVal) throws BadValueForDelimiter
Sets the string value for this node.

Throws: BadValueForDelimiter
The string value is not acceptable for the delimiter the value has. If you are intending to change the delimiter too in the next statement, try changing the delimiter *first*, or use the method to change both at once setValAndDelim
See Also:
setValAndDelim
 o setValue
 public void setValue(String newVal,
                      short newDelim) throws BadValueForDelimiter
Sets the string for this value, and the delimiter.

Throws: BadValueForDelimiter
The string value is not acceptable for the delimiter given..
 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 getLabel
 public String getLabel()
Alias for getValue

 o 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
 o myLongestStr
 public int myLongestStr()
Useful for printing.


All Packages  Class Hierarchy  This Package  Previous  Next  Index