|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpds.label.PDSElement
public class PDSElement
PDSElement is a class that contains a single definition or line as specified in the PDS Object Definition Language (ODL). In this context a line may be an simple line of text, a block of commented text, or a keyword/value pair. A value may extend over more than one physical line if it is quoted or part of a value set.
Field Summary | |
---|---|
String |
mComment
The comment text found within the element. |
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. |
boolean |
mSyntaxError
Indicates whether a syntax error occurred will parsing or reading a line. |
int |
mType
The basic type of the value. |
ArrayList<PDSValue> |
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 Summary | |
---|---|
PDSElement()
Creates an instance of a PDSElement |
|
PDSElement(int line)
Creates an instance of a PDSElement |
Method Summary | |
---|---|
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(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(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 Definition Language (ODL). |
boolean |
parseValue(String buffer)
Parses a string as a value according to the PDS Object Definition 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(PrintStream out,
int indent,
int equal,
int level)
Print the element according to PDS specifications for label files. |
void |
printSpaces(PrintStream out,
int count)
Print a string of spaces to an output stream. |
char[] |
readLine(BufferedReader reader)
Read the next element definition from an input file stream. |
boolean |
setValue(String buffer)
Sets the value of an element. |
boolean |
setValue(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)
|
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. |
String |
units(int index)
Returns the units associated with the value item in the value array that is associated with the given index. |
String |
value(int index)
Returns the value associated with the value item in the value array that is associated with the given index. |
ArrayList<String> |
valueList(boolean plain)
Create an ArrayList of string representation of all values assigned to the element. |
int |
valueSize()
Returns the number of values in the value list. |
String |
valueString()
Create a string representation of the value. |
String |
valueString(boolean plain)
Create a string representation of the value. |
String |
valueString(boolean plain,
boolean odl)
Create a string representation of the value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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 String mKeyword
public ArrayList<PDSValue> mValue
public int mType
public String mComment
public char[] mRaw
public int mMaxLength
public int mLineCount
public boolean mSyntaxError
Constructor Detail |
---|
public PDSElement()
public PDSElement(int line)
Method Detail |
---|
public void clear()
public boolean parse(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
FileInputStream
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(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
FileInputStream
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
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 boolean setValue(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(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(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 String value(int index)
index
- the index of the value to return.
public 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(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 String valueString()
public String valueString(boolean plain)
plain
- flag indicating if the value is not to be adorned
with appropriate quotation marks.
public ArrayList<String> valueList(boolean plain)
plain
- flag indicating if the value is not to be adorned
with appropriate quotation marks.
public 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(PrintStream out)
out
- the stream to print the element to.public void printSpaces(PrintStream out, int count)
out
- the stream to print the element to.count
- the number of spaces to print.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |