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.
-
delimType
-
-
DONT_CARE
- delimiter type that indicates that you don't care about
the delimiter type - only used for searches such as
searchForType()
-
DOUBLE
- delimiter type that indicates that this is a doublequoted value (")
-
FRAMECODE
- delimiter type that indicates that this is a framecode value
-
myStrVal
-
-
NON
- delimiter type that indicates that this is a nonquoted value.
-
SEMICOLON
- delimiter type that indicates that this is semicolon demilited (;)
-
SINGLE
- delimiter type that indicates that this is a singlequoted value (')
-
DataValueNode(DataValueNode)
- Constructor - copy another DataValueNode.
-
DataValueNode(String)
- Constructor - all DataValueNodes must have a string value,
so no provisions are made for a 'default' no-args constructor.
-
DataValueNode(String, short)
- Constructor - all DataValueNodes must have a string value,
so no provisions are made for a 'default' no-args constructor.
-
clone()
- Allocates a new copy of me and returns a reference to it.
-
getDelimType()
- Returns the delimiter type of this value.
-
getLabel()
- Alias for getValue
-
getValue()
- Returns the string containing the value of this node.
-
myLongestStr()
- Useful for printing.
-
setDelimType(short)
- Sets the delimiter type of this value.
-
setValue(String)
- Sets the string value for this node.
-
setValue(String, short)
- Sets the string for this value, and the delimiter.
-
Unparse(int)
- Unparse prints the contents of the StarNode object out to the
given stream.
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
NON
public static short NON
- delimiter type that indicates that this is a nonquoted value.
- See Also:
- getDelimType
DOUBLE
public static short DOUBLE
- delimiter type that indicates that this is a doublequoted value (")
- See Also:
- getDelimType
SINGLE
public static short SINGLE
- delimiter type that indicates that this is a singlequoted value (')
- See Also:
- getDelimType
SEMICOLON
public static short SEMICOLON
- delimiter type that indicates that this is semicolon demilited (;)
- See Also:
- getDelimType
FRAMECODE
public static short FRAMECODE
- delimiter type that indicates that this is a framecode value
- See Also:
- getDelimType
myStrVal
protected String myStrVal
delimType
protected short delimType
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:
- NON
- DOUBLE
- SINGLE
- 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.)
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.
DataValueNode
public DataValueNode(DataValueNode copyMe)
- Constructor - copy another DataValueNode.
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
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.)
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.
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
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..
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
getLabel
public String getLabel()
- Alias for getValue
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
myLongestStr
public int myLongestStr()
- Useful for printing.
All Packages Class Hierarchy This Package Previous Next Index