public class PDSElement
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
java.lang.String |
mComment
The comment text found within the element.
|
java.lang.String |
mKeyword
The text found before the equal sign of an element.
|
int |
mLineCount
The count of the number of physical lines parsed into this element
|
int |
mMaxLength
Maximum line length when printing.
|
char[] |
mRaw
The raw line as read from the file.
|
java.lang.String |
mSource |
boolean |
mSyntaxError
Indicates whether a symtax error occurred will parsing or reading a line.
|
int |
mType
The basic type of the value.
|
java.util.ArrayList |
mValue
An array containing a PDSValue object for each value following
the equal sign in the element.
|
static int |
TYPE_BLANK_LINE
A blank line
|
static int |
TYPE_COMMENT
A comment
|
static int |
TYPE_NONE
Unspecified grouping type.
|
static int |
TYPE_ORDERED
Ordered list of values.
|
static int |
TYPE_UNORDERED
An unordered list of values.
|
Constructor and Description |
---|
PDSElement()
Creates an instance of a PDSElement
|
PDSElement(int line)
Creates an instance of a PDSElement
|
PDSElement(int line,
java.lang.String source) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears an element and set it to an initial state
|
PDSElement |
copy()
Create a copy of the element and return a new instance
of a PDSElement.
|
void |
deleteString(char[] cbuff,
int start,
int end) |
void |
dump(java.io.PrintStream out)
Dump all information about an element.
|
int |
indexOf(char[] cbuff,
char c) |
boolean |
isObject()
Determines if an element is an "OBJECT".
|
boolean |
isSpace(int c)
Determines if a character is a white space character.
|
boolean |
parse(java.io.BufferedReader reader)
Parses the next element from a file stream.
|
boolean |
parseValue(char[] cbuff,
int startAt)
Parses a string as a value according to the PDS
Object Defnition Language (ODL).
|
boolean |
parseValue(java.lang.String buffer)
Parses a string as a value according to the PDS
Object Defnition Language (ODL).
|
void |
print(int indent,
int equal,
int level)
Print the element according to PDS specifications for label
files to Syste.out.
|
void |
print(java.io.PrintStream out,
int indent,
int equal,
int level)
Print the element according to PDS specifications for label
files.
|
void |
printSpaces(java.io.PrintStream out,
int count)
Print a string of spaces to an output stream.
|
char[] |
readLine(java.io.BufferedReader reader)
Read the next element definition from an input file stream.
|
boolean |
setValue(java.lang.String buffer)
Sets the value of an element.
|
boolean |
setValue(java.lang.String buffer,
int type)
Sets the value of an element and set the type of the value.
|
int |
strlen(char[] cbuff) |
int |
strlen(char[] cbuff,
int startAt) |
java.lang.String |
toString()
Returns the keyword name if any and the first value.
|
void |
trimSpace(char[] cbuff)
Trims the leading and trailing white space from a character array.
|
void |
trimSpace(char[] cbuff,
int startAt)
Trims the leading and trailing white space from a character array.
|
java.lang.String |
units(int index)
Returns the units associated with the value item in the
value array that is assocaited with the given index.
|
java.lang.String |
value(int index)
Returns the value associated with the value item in the
value array that is assocaited with the given index.
|
int |
valueSize()
Returns the number of values in the value list.
|
java.lang.String |
valueString()
Create a string representation of the value.
|
java.lang.String |
valueString(boolean plain)
Create a string representation of the value.
|
java.lang.String |
valueString(boolean plain,
boolean odl)
Create a string representation of the value.
|
public static final int TYPE_NONE
public static final int TYPE_ORDERED
public static final int TYPE_UNORDERED
public static final int TYPE_BLANK_LINE
public static final int TYPE_COMMENT
public java.lang.String mKeyword
public java.util.ArrayList mValue
public int mType
public java.lang.String mComment
public char[] mRaw
public int mMaxLength
public int mLineCount
public java.lang.String mSource
public boolean mSyntaxError
public PDSElement()
public PDSElement(int line)
public PDSElement(int line, java.lang.String source)
public void clear()
public boolean parse(java.io.BufferedReader reader) throws PDSException
reader
- the input file stream.true
if an element was parsed from the stream;
false
if the end of file or an error was encountered.PDSException
public int indexOf(char[] cbuff, char c)
public void deleteString(char[] cbuff, int start, int end)
public int strlen(char[] cbuff)
public int strlen(char[] cbuff, int startAt)
public char[] readLine(java.io.BufferedReader reader) throws PDSException
reader
- the input file stream.true
if an element was parsed from the stream;
false
if the end of file or an error was encountered.PDSException
public void trimSpace(char[] cbuff)
cbuff
- the character array to trim.public void trimSpace(char[] cbuff, int startAt)
cbuff
- the character array to trim.public boolean isSpace(int c)
c
- the character to check.true
if the character is white space;
false
otherwise.public boolean isObject()
true
if element is an OBJECT;
false
otherwise.public boolean parseValue(char[] cbuff, int startAt) throws PDSException
cbuff
- the string to parse as a value.true
if an value was parsed from properly;
false
if the an error was encountered.PDSException
public boolean setValue(java.lang.String buffer) throws PDSException
buffer
- the string to use as a value.true
if an value was parsed from properly;
false
if the an error was encountered.PDSException
public boolean setValue(java.lang.String buffer, int type) throws PDSException
buffer
- the string to use as a value.type
- the type of the value.true
if an value was parsed from properly;
false
if the an error was encountered.PDSException
public boolean parseValue(java.lang.String buffer) throws PDSException
buffer
- the string to parse as a value.true
if an value was parsed from properly;
false
if the an error was encountered.PDSException
public int valueSize()
public java.lang.String value(int index)
index
- the index of the value to return.public java.lang.String units(int index)
index
- the index of the value to return.public PDSElement copy()
public void print(int indent, int equal, int level)
indent
- the number of spaces to indent for each level.equal
- the number of spaces from the end of the indent
to align the equal sign for elements which have
a keyword and value.level
- the current level of indenting. The number of spaces
the element will be indented is level*indentpublic void print(java.io.PrintStream out, int indent, int equal, int level)
out
- the stream to print the element to.indent
- the number of spaces to indent for each level.equal
- the number of spaces from the end of the indent
to align the equal sign for elements which have
a keyword and value.level
- the current level of indenting. The number of spaces
the element will be indented is level*indentpublic java.lang.String valueString()
public java.lang.String valueString(boolean plain)
plain
- flag indicating if the value is not to be adorned
with appropriate quotation marks.public java.lang.String valueString(boolean plain, boolean odl)
plain
- flag indicating if the value is not to be adorned
with appropriate quotation marks.odl
- flag indicating if the value is to be formated with
ODL syntax for lists.public void dump(java.io.PrintStream out)
out
- the stream to print the element to.public void printSpaces(java.io.PrintStream out, int count)
out
- the stream to print the element to.count
- the number of spaces to print.public java.lang.String toString()
toString
in class java.lang.Object