|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--pds.label.PDSLabel
PDSLabel is a class that contians all information regarding a PDS label entity. A PDS label entity consists of one or more elements as specified in the PDS Object Defnition Language (ODL). Each element may be a simple line of text, a block of commented text, or a keyword/value pair. Comments and values may extend over more than one physical line.
Field Summary | |
java.util.ArrayList |
mElement
The list of elements in the label |
java.lang.String |
mPathName
The path and file name used when loading a label from a file. |
Constructor Summary | |
PDSLabel()
Creates an instance of a PDSLabel |
Method Summary | |
void |
add(pds.label.PDSElement element)
Add an element to the end of a label. |
void |
add(pds.label.PDSLabel label)
Add a label to the end of a label. |
pds.label.PDSLabel |
extract(pds.label.PDSItem item)
Extract a portion of a label into a new instance of label. |
java.util.ArrayList |
filePointers()
Search the label and return a list to all points to files. |
pds.label.PDSItem |
findElement(java.lang.String name)
Find the element with the given name. |
pds.label.PDSItem |
findElement(java.lang.String name,
int startAt,
int endAt)
Find the element with the given name constrained to some portion of the label. |
pds.label.PDSItem |
findElement(java.lang.String name,
pds.label.PDSItem item)
Find the element with the given name constrained to some portion of the label. |
pds.label.PDSItem |
findNextElement(java.lang.String name,
pds.label.PDSItem item)
Find the next element with the given name starting at some point within the label. |
pds.label.PDSItem |
findObject(java.lang.String name)
Find the object with the given name. |
pds.label.PDSItem |
findObject(java.lang.String name,
int startAt,
int endAt)
Find the object with the given name within a partion of a label. |
pds.label.PDSItem |
findObject(java.lang.String name,
pds.label.PDSItem item)
Find the object with the given name within a partion of a label. |
pds.label.PDSElement |
getElement(pds.label.PDSItem item)
Return the element data associated with an item. |
java.lang.String |
getElementValue(java.lang.String name)
Find the value assocated with an element with the given name. |
void |
insertAfter(pds.label.PDSItem item,
pds.label.PDSElement element)
Insert an element after another element in this label. |
void |
insertAfter(pds.label.PDSItem item,
pds.label.PDSLabel label)
Insert a label after another element in this label. |
void |
insertBefore(pds.label.PDSItem item,
pds.label.PDSElement element)
Insert an element before another element in this label. |
void |
insertBefore(pds.label.PDSItem item,
pds.label.PDSLabel label)
Insert a label before another element in this label. |
boolean |
isLabel(java.lang.String pathName)
Determines if a file contains a PDS label. |
pds.label.PDSItem |
nextElement(pds.label.PDSItem item)
Find the next element after the given item. |
boolean |
parse(java.io.FileInputStream file)
Parses a file containing a PDS label into its constitute elments. |
boolean |
parse(java.lang.String pathName)
Parses a file containing a PDS label into its constitute elments. |
java.lang.String |
path()
Returns the path portion of the fully qualified name of the file which was parsed. |
void |
print()
Print all elements in the label according to PDS specifications for label files using default indent and equal sign placement. |
void |
print(java.io.PrintStream out)
Print all elements in the label according to PDS specifications for label files using default indent and equal sign placement. |
void |
print(java.io.PrintStream out,
int indent,
int equal)
Print all elements in the label according to PDS specifications for label files. |
void |
print(java.io.PrintStream out,
int indent,
int equal,
int startAt,
int endAt)
Print a range of elements in the label according to PDS specifications for label files. |
void |
print(java.io.PrintStream out,
int indent,
int equal,
pds.label.PDSItem item)
Print a range of elements in the label according to PDS specifications for label files. |
void |
print(java.lang.String pathName)
Print all elements in the label according to PDS specifications for label files using default indent and equal sign placement. |
void |
print(java.lang.String pathName,
int indent,
int equal)
Print all elements in the label according to PDS specifications for label files using default indent and equal sign placement. |
void |
remove(pds.label.PDSItem item)
Remove a range of elements from the label. |
void |
replace(pds.label.PDSItem item,
pds.label.PDSLabel label)
Replace an item in a label with another label. |
void |
reset()
Reset all internal variables to the initial state. |
java.lang.String |
version()
Returns a string with the release information for this compilation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public java.util.ArrayList mElement
public java.lang.String mPathName
Constructor Detail |
public PDSLabel()
Method Detail |
public java.lang.String version()
public void reset()
public boolean isLabel(java.lang.String pathName)
pathName
- the fully qualified path and name of the file to parse.
true
if the file contains a label.
false
otherwise.public boolean parse(java.lang.String pathName)
pathName
- the fully qualified path and name of the file to parse.
true
if the file could be opened;
false
otherwise.public boolean parse(java.io.FileInputStream file)
file
- a connection to a pre-opened file.
true
if the file could be read;
false
otherwise.public java.lang.String path()
public pds.label.PDSItem findObject(java.lang.String name)
name
- the name of the object to find. This can contain regular expressions.
PDSItem
the indicates the start and end of the object within
the label.public pds.label.PDSItem findObject(java.lang.String name, pds.label.PDSItem item)
PDSItem
and extends to the last.
name
- the name of the element to find. This can contain regular expressions.item
- the item the search is to constrained within. If item is null then the
search will span the entire label.
PDSItem
the indicates the start and end of the object within
the label.public pds.label.PDSItem findObject(java.lang.String name, int startAt, int endAt)
name
- the name of the element to find. This can contain regular expressions.startAt
- the index of the element at which to start the search.endAt
- the index of the element at which to end the search.
PDSItem
the indicates the start and end of the object within
the label.public java.lang.String getElementValue(java.lang.String name)
name
- the name of the element to find. This can contain regular expressions.
String
containing the first value associated with the
named element. If the element was not found the value returned is empty.public pds.label.PDSItem findElement(java.lang.String name)
name
- the name of the element to find. This can contain regular expressions.
PDSItem
the indicates the start and end of the object within
the label.public pds.label.PDSItem findElement(java.lang.String name, pds.label.PDSItem item)
PDSItem
and extends to the last item.
name
- the name of the element to find. This can contain regular expressions.item
- a PDSItem
to limit the search within. If item is null
then search the entire label.
PDSItem
that indicates the location of the element
within the label.public pds.label.PDSItem findElement(java.lang.String name, int startAt, int endAt)
PDSItem
and extends to the last item.
name
- the name of the element to find. This can contain regular expressions.startAt
- the index of the element to begin the search. If startAt
is -1 then search from the beginning of the label.endAt
- the index of the element to end the search. If endAt
is -1 then search to the end of the label.
PDSItem
that indicates the location of the element
within the label.public pds.label.PDSItem findNextElement(java.lang.String name, pds.label.PDSItem item)
PDSItem
and
extends to the end of the label.
name
- the name of the element to find. This can contain regular expressions.item
- a PDSItem
indicating where to begin the search.
PDSItem
the indicates the start and end of the object within
the label.public pds.label.PDSItem nextElement(pds.label.PDSItem item)
item
- a PDSItem
indicating where to begin the search.
PDSItem
the indicates the start and end of the object within
the label.public pds.label.PDSElement getElement(pds.label.PDSItem item)
item
- a PDSItem
to return the element data for. The data associated with the
first element of the item is returned.
PDSElement
associated witht he first element of the item.
the label. If no element is associated with the item null
is returned.public void replace(pds.label.PDSItem item, pds.label.PDSLabel label)
item
- a PDSItem
indicating the elements to replace.label
- the label to place where item is currently.public void add(pds.label.PDSElement element)
element
- the element to add to the end of the label.public void add(pds.label.PDSLabel label)
label
- the label to add to the end of the label.public void insertBefore(pds.label.PDSItem item, pds.label.PDSLabel label)
item
- the location of the element before which the label is inserted.label
- the label to place before the passed item.public void insertAfter(pds.label.PDSItem item, pds.label.PDSLabel label)
item
- the location of the element after which the label is inserted.label
- the label to place after the passed item.public void insertBefore(pds.label.PDSItem item, pds.label.PDSElement element)
item
- the location of the element before which the element is inserted.element
- the element to place before the passed item.public void insertAfter(pds.label.PDSItem item, pds.label.PDSElement element)
item
- the location of the element after which the element is inserted.element
- the element to place after the passed item.public void remove(pds.label.PDSItem item)
item
- the location of the elements to remove.public pds.label.PDSLabel extract(pds.label.PDSItem item)
PDSItem
item
- the location of the elements to extract.public java.util.ArrayList filePointers()
ArrayList
of
String
objects. If no pointers are found then
null
is returned.public void print()
public void print(java.lang.String pathName)
pathName
- the path and name of the file to write the output to.public void print(java.lang.String pathName, int indent, int equal)
pathName
- the path and name of the file to write the output to.indent
- the number of spaces to indent each line at each level.equal
- the position to align equal signs following keywords.public void print(java.io.PrintStream out)
out
- the stream to print the element to.public void print(java.io.PrintStream out, int indent, int equal)
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.public void print(java.io.PrintStream out, int indent, int equal, pds.label.PDSItem item)
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.item
- the item to output.public void print(java.io.PrintStream out, int indent, int equal, int startAt, int endAt)
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.startAt
- the first element to output.endAt
- the last element to output.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |