|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pds.label.PDSLabel
public class 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 |
|
PDSLabel(java.io.PrintStream log)
Creates an instance of a PDSLabel |
Method Summary | |
---|---|
void |
add(PDSElement element)
Add an element to the end of a label. |
void |
add(PDSLabel label)
Add a label to the end of a label. |
PDSLabel |
extract(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. |
PDSItem |
findItem(java.lang.String name)
Find the item with the given name. |
PDSItem |
findItem(java.lang.String name,
int startAt,
int endAt)
Find the item with the given name constrained to some portion of the label. |
PDSItem |
findItem(java.lang.String name,
int startAt,
int endAt,
boolean global)
Find the item with the given name constrained to some portion of the label. |
PDSItem |
findItem(java.lang.String name,
PDSItem item)
Find the item with the given name constrained to some portion of the label. |
PDSItem |
findItemInObject(java.lang.String name,
PDSItem context)
Find the item with the given name in the object containing the passed item. |
PDSItem |
findNextItem(java.lang.String name,
PDSItem item)
Find the next item with the given name starting at some point within the label. |
PDSItem |
findNextItemInObject(java.lang.String name,
PDSItem item,
PDSItem section)
Find the item with the given name following the passed item in the in the object containing the passed item. |
PDSItem |
findNextObject(java.lang.String name,
PDSItem item)
Find the next object with the given name ocurring after the passed item. |
PDSItem |
findNextObject(java.lang.String name,
PDSItem item,
PDSItem object)
Find the next object with the given name ocurring after the passed item and within the passed object. |
PDSItem |
findObject(java.lang.String name)
Find the object with the given name. |
PDSItem |
findObject(java.lang.String name,
int startAt,
int endAt)
Find the object with the given name within a partion of a label. |
PDSItem |
findObject(java.lang.String name,
PDSItem item)
Find the object with the given name within a partion of a label. |
javax.xml.transform.stream.StreamSource |
getDefaultStyleSheet()
Obtain a StreamSource to the default XML Style Sheet. |
org.w3c.dom.Document |
getDocument()
Creates a DOM (Document Object Model) representation of the label. |
PDSElement |
getElement(PDSItem item)
Return the element data associated with an item. |
PDSElement |
getElement(java.lang.String name)
Find the element with the given name. |
PDSElement |
getElement(java.lang.String name,
PDSItem section)
Find the element with the given name within a section (usually an object). |
java.lang.String |
getElementValue(java.lang.String name)
Find the value assocated with an element with the given name. |
java.lang.String |
getElementValue(java.lang.String name,
boolean plain)
Find the value assocated with an element with the given name. |
java.lang.String |
getElementValue(java.lang.String name,
PDSItem section,
boolean plain)
Find the value assocated with an element with the given name within a section of the label. |
java.lang.String |
getElementValueInObject(java.lang.String name)
Find the value assocated with an element with the given name within implied object of the a label. |
java.lang.String |
getElementValueInObject(java.lang.String name,
PDSItem section,
boolean plain)
Find the value assocated with an element with the given name within a section of the label without decending into sub-objects. |
void |
insertAfter(PDSItem item,
PDSElement element)
Insert an element after another element in this label. |
void |
insertAfter(PDSItem item,
PDSLabel label)
Insert a label after another element in this label. |
void |
insertBefore(PDSItem item,
PDSElement element)
Insert an element before another element in this label. |
void |
insertBefore(PDSItem item,
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. |
boolean |
isValidItem(PDSItem item)
Determines if an item is a valid. |
static void |
main(java.lang.String[] args)
Entry point for testing |
PDSItem |
nextItem(PDSItem item)
Return the next item after the given item. |
boolean |
parse(java.io.BufferedReader reader)
Parses a file containing a PDS label into its constitute elments. |
boolean |
parse(java.io.InputStream stream)
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. |
boolean |
parseXML(java.io.InputStream stream)
Parses a file containing XML into its constitute elments. |
boolean |
parseXML(java.lang.String pathName)
Parses a file containing XML into its constitute elments. |
java.lang.String |
path()
Returns the path portion of the fully qualified name of the file which was parsed. |
java.lang.String |
pathName()
Returns the fully qualified path and 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,
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 |
printMessage(java.lang.String text)
Display the passed text as a message to System.out Preceeds the text with a stanard phrase. |
void |
printVariable(java.io.PrintStream out)
Prints out the label as a set of variable definition in the PPI Ruleset lanaguage. |
void |
printXML(java.io.PrintStream out)
Generates an XML representation of the label and streams it to the print stream. |
boolean |
pushNode(org.w3c.dom.Node node,
PDSElement parentElement)
Pushes a DOM node as a label Element. |
int |
pushObject(org.w3c.dom.Document doc,
org.w3c.dom.Element parent,
java.lang.String name,
int start)
Pushes (adds) a PDS label object to the document tree (DOM). |
void |
remove(PDSItem item)
Remove a range of elements from the label. |
void |
replace(PDSItem item,
PDSLabel label)
Replace an item in a label with another label. |
void |
reset()
Reset all internal variables to the initial state. |
void |
setLog(java.io.PrintStream stream)
Set the log print stream |
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()
public PDSLabel(java.io.PrintStream log)
Method Detail |
---|
public java.lang.String version()
public void reset()
public static void main(java.lang.String[] args)
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 isValidItem(PDSItem item)
item
- the item to check.
true
if the item is valid.
false
otherwise.public boolean parse(java.lang.String pathName) throws PDSException
pathName
- the fully qualified path and name of the file to parse.
true
if the file could be opened;
false
otherwise.
PDSException
public boolean parse(java.io.InputStream stream) throws PDSException
reader
- a connection to a pre-opened file.
true
if the file could be read;
false
otherwise.
PDSException
public boolean parse(java.io.BufferedReader reader) throws PDSException
reader
- a connection to a pre-opened file.
true
if the file could be read;
false
otherwise.
PDSException
public boolean parseXML(java.lang.String pathName) throws PDSException
pathName
- the fully qualified path and name of the file to parse.
true
if the file could be opened;
false
otherwise.
PDSException
public boolean parseXML(java.io.InputStream stream) throws PDSException
reader
- a connection to a pre-opened file.
true
if the file could be read;
false
otherwise.
PDSException
public boolean pushNode(org.w3c.dom.Node node, PDSElement parentElement) throws PDSException
PDSException
public java.lang.String pathName()
public java.lang.String path()
public 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 PDSItem findObject(java.lang.String name, 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 PDSItem findNextObject(java.lang.String name, PDSItem item)
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 PDSItem findNextObject(java.lang.String name, PDSItem item, PDSItem object)
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 object.object
- the object the search is to constrained within. If object is null then the
search will span the entire label.
PDSItem
the indicates the start and end of the object within
the label.public 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 value associated with the
named element. If the element was not found the value returned is empty.public java.lang.String getElementValue(java.lang.String name, boolean plain)
name
- the name of the element to find. This can contain regular expressions.plain
- flag indicating if the value is not to be adorned
with appropriate quotation marks.
String
containing the value associated with the
named element. If the element was not found the value returned is empty.public java.lang.String getElementValue(java.lang.String name, PDSItem section, boolean plain)
name
- the name of the element to find. This can contain regular expressions.section
- the section to search for the element.plain
- flag indicating if the value is not to be adorned
with appropriate quotation marks.
String
containing the value associated with the
named element. If the element was not found the value returned is empty.public java.lang.String getElementValueInObject(java.lang.String name)
name
- the name of the element to find. This can contain regular expressions.
String
containing the value associated with the
named element. If the element was not found the value returned is empty.public java.lang.String getElementValueInObject(java.lang.String name, PDSItem section, boolean plain)
name
- the name of the element to find. This can contain regular expressions.section
- the section to search for the element.plain
- flag indicating if the value is not to be adorned
with appropriate quotation marks.
String
containing the value associated with the
named element. If the element was not found the value returned is empty.public PDSItem findItem(java.lang.String name)
name
- the name of the item to find. This can contain regular expressions.
PDSItem
the indicates the start and end of the object within
the label. If there is no other objects the PDSItem is invalid.public PDSItem findNextItemInObject(java.lang.String name, PDSItem item, PDSItem section)
name
- the name of the item to find. This can contain regular expressions.item
- a PDSItem
that the search is to begin after. If item is null
then search the entire section.section
- a PDSItem
to limit the search within. If section is null
then search the entire label.
PDSItem
the indicates the start and end of the object within
the label. If there is no other objects the PDSItem is invalid.public PDSItem findItemInObject(java.lang.String name, PDSItem context)
name
- the name of the item to find. This can contain regular expressions.context
- a PDSItem
to limit the search within. If item is null
then search the entire label.
PDSItem
the indicates the start and end of the object within
the label. If there is no other objects the PDSItem is invalid.public PDSItem findItem(java.lang.String name, PDSItem item)
PDSItem
and extends to the last item.
name
- the name of the item 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 item
within the label. If there is no other objects the PDSItem is invalid.public PDSItem findItem(java.lang.String name, int startAt, int endAt)
PDSItem
and extends to the last item.
name
- the name of the item to find. This can contain regular expressions.startAt
- the index of the item to begin the search. If startAt
is -1 then search from the beginning of the label.endAt
- the index of the item to end the search. If endAt
is -1 then search to the end of the label.
PDSItem
that indicates the location of the item
within the label. If there is no other objects the PDSItem is invalid.public PDSItem findItem(java.lang.String name, int startAt, int endAt, boolean global)
PDSItem
and extends to the last item.
name
- the name of the item to find. This can contain regular expressions.startAt
- the index of the item to begin the search. If startAt
is -1 then search from the beginning of the label.endAt
- the index of the item to end the search. If endAt
is -1 then search to the end of the label.global
- controls whether the search is through all elements or constrained
to the containing object
PDSItem
that indicates the location of the item
within the label. If there is no other objects the PDSItem is invalid.public PDSItem findNextItem(java.lang.String name, PDSItem item)
PDSItem
and
extends to the end of the label.
name
- the name of the item 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. If there is no other objects the PDSItem is invalid.public PDSItem nextItem(PDSItem item)
item
- a PDSItem
indicating where to begin the search.
PDSItem
the indicates the start and end of the object within
the label. If there is no other objects the PDSItem is invalid.public PDSElement getElement(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 with the first element of the item.
the label. If no element is associated with the item null
is returned.public PDSElement getElement(java.lang.String name)
name
- the name of the element to find. This can contain regular expressions.
PDSElement
associated with the first element of the item.
the label. If no element is associated with the item null
is returned.public PDSElement getElement(java.lang.String name, PDSItem section)
name
- the name of the element to find. This can contain regular expressions.section
- the item defining the section to search.
PDSElement
associated with the first element of the item.
the label. If no element is associated with the item null
is returned.public void replace(PDSItem item, PDSLabel label)
item
- a PDSItem
indicating the elements to replace.label
- the label to place where item is currently.public void add(PDSElement element)
element
- the element to add to the end of the label.public void add(PDSLabel label)
label
- the label to add to the end of the label.public void insertBefore(PDSItem item, 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(PDSItem item, 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(PDSItem item, 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(PDSItem item, 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(PDSItem item)
item
- the location of the elements to remove.public PDSLabel extract(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, 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.public void printVariable(java.io.PrintStream out)
out
- the stream to print the element to.public void printMessage(java.lang.String text)
text
- the variable portion of the message text.public void setLog(java.io.PrintStream stream)
stream
- the print stream.public org.w3c.dom.Document getDocument()
Document
object containing a representation of the label.public void printXML(java.io.PrintStream out)
out
- the stream to print the element to.public javax.xml.transform.stream.StreamSource getDefaultStyleSheet()
StreamSource
which can be used to read the default
style sheet.public int pushObject(org.w3c.dom.Document doc, org.w3c.dom.Element parent, java.lang.String name, int start)
doc
- the Document
to add the elements to.parent
- the Element
in doc under which to add the elements.name
- the name to give the group of elements.start
- the index on the first element in PDS label element list to add.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |