pds.label
Class PDSLabel

java.lang.Object
  extended by pds.label.PDSLabel

public class PDSLabel
extends java.lang.Object

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.

Since:
1.0

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

mElement

public java.util.ArrayList mElement
The list of elements in the label


mPathName

public java.lang.String mPathName
The path and file name used when loading a label from a file.

Constructor Detail

PDSLabel

public PDSLabel()
Creates an instance of a PDSLabel


PDSLabel

public PDSLabel(java.io.PrintStream log)
Creates an instance of a PDSLabel

Method Detail

version

public java.lang.String version()
Returns a string with the release information for this compilation.

Returns:
a string contining the release information for this compilation.
Since:
1.0

reset

public void reset()
Reset all internal variables to the initial state.

Since:
1.0

main

public static void main(java.lang.String[] args)
Entry point for testing


isLabel

public boolean isLabel(java.lang.String pathName)
Determines if a file contains a PDS label. If the first 14 characters are either "PDS_VERSION_ID" or "CCSD3ZF0000100" then the file is considered to contain a PDS label.

Parameters:
pathName - the fully qualified path and name of the file to parse.
Returns:
true if the file contains a label. false otherwise.
Since:
1.0

isValidItem

public boolean isValidItem(PDSItem item)
Determines if an item is a valid.

Parameters:
item - the item to check.
Returns:
true if the item is valid. false otherwise.
Since:
1.0

parse

public boolean parse(java.lang.String pathName)
              throws PDSException
Parses a file containing a PDS label into its constitute elments. The path and name of the file are passed to the method which is opened and parsed.

Parameters:
pathName - the fully qualified path and name of the file to parse.
Returns:
true if the file could be opened; false otherwise.
Throws:
PDSException
Since:
1.0

parse

public boolean parse(java.io.InputStream stream)
              throws PDSException
Parses a file containing a PDS label into its constitute elments. The file to parse must be previously opened and a InputStream pointing to the file is passed.

Parameters:
reader - a connection to a pre-opened file.
Returns:
true if the file could be read; false otherwise.
Throws:
PDSException
Since:
1.0

parse

public boolean parse(java.io.BufferedReader reader)
              throws PDSException
Parses a file containing a PDS label into its constitute elments. The file to parse must be previously opened and a BufferedReader pointing to the file is passed.

Parameters:
reader - a connection to a pre-opened file.
Returns:
true if the file could be read; false otherwise.
Throws:
PDSException
Since:
1.0

parseXML

public boolean parseXML(java.lang.String pathName)
                 throws PDSException
Parses a file containing XML into its constitute elments. The path and name of the file are passed to the method which is opened and parsed.

Parameters:
pathName - the fully qualified path and name of the file to parse.
Returns:
true if the file could be opened; false otherwise.
Throws:
PDSException
Since:
1.0

parseXML

public boolean parseXML(java.io.InputStream stream)
                 throws PDSException
Parses a file containing XML into its constitute elments. The file to parse must be previously opened and a InputStream pointing to the file is passed.

Parameters:
reader - a connection to a pre-opened file.
Returns:
true if the file could be read; false otherwise.
Throws:
PDSException
Since:
1.0

pushNode

public boolean pushNode(org.w3c.dom.Node node,
                        PDSElement parentElement)
                 throws PDSException
Pushes a DOM node as a label Element. If the node has children all children are also pushed. To push an entire DOM pass the root node. The following rules are applied in the conversion:

Returns:
true if the push was successful, false otherwise.
Throws:
PDSException
Since:
1.0

pathName

public java.lang.String pathName()
Returns the fully qualified path and name of the file which was parsed.

Returns:
the path and file name to the file most recently parsed. The returned value will be blank if no file has been parsed or if a FileInputStream was used when parsing the file.
Since:
1.0

path

public java.lang.String path()
Returns the path portion of the fully qualified name of the file which was parsed.

Returns:
the path to the file most recently parsed. The returned value will be blank if no file has been parsed or if a FileInputStream was used when parsing the file.
Since:
1.0

findObject

public PDSItem findObject(java.lang.String name)
Find the object with the given name. Looks for elements with the keyword "OBJECT" and a value of the given name. If such an element is found then the corresponding element with the keyword "END_OBJECT" is located. The passed name can contain regular expressions. Any occurance of a "*" in the string is converted to the regular expression ".*" to match any number of characters. The search begins at the first element in the label and extends to the last.

Parameters:
name - the name of the object to find. This can contain regular expressions.
Returns:
a PDSItem the indicates the start and end of the object within the label.
Since:
1.0

findObject

public PDSItem findObject(java.lang.String name,
                          PDSItem item)
Find the object with the given name within a partion of a label. Looks for elements with the keyword "OBJECT" and a value of the given name. If such an element is found then the corresponding element with the keyword "END_OBJECT" is located. The passed name can contain regular expressions. Any occurance of a "*" in the string is converted to the regular expression ".*" to match any number of characters. The search begins at the first element indicated the PDSItem and extends to the last.

Parameters:
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.
Returns:
a PDSItem the indicates the start and end of the object within the label.
Since:
1.0

findNextObject

public PDSItem findNextObject(java.lang.String name,
                              PDSItem item)
Find the next object with the given name ocurring after the passed item. Looks for elements with the keyword "OBJECT" and a value of the given name. If such an element is found then the corresponding element with the keyword "END_OBJECT" is located. The passed name can contain regular expressions. Any occurance of a "*" in the string is converted to the regular expression ".*" to match any number of characters. The search begins at the element at the endAt position in the list and extends to the end of the label.

Parameters:
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.
Returns:
a PDSItem the indicates the start and end of the object within the label.
Since:
1.0

findNextObject

public 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. Looks for elements with the keyword "OBJECT" and a value of the given name. If such an element is found then the corresponding element with the keyword "END_OBJECT" is located. The passed name can contain regular expressions. Any occurance of a "*" in the string is converted to the regular expression ".*" to match any number of characters. The search begins at the element at the endAt position in the list and extends to the end of the label.

Parameters:
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.
Returns:
a PDSItem the indicates the start and end of the object within the label.
Since:
1.0

findObject

public PDSItem findObject(java.lang.String name,
                          int startAt,
                          int endAt)
Find the object with the given name within a partion of a label. Looks for elements with the keyword "OBJECT" and a value of the given name. If such an element is found then the corresponding element with the keyword "END_OBJECT" is located. The passed name can contain regular expressions. Any occurance of a "*" in the string is converted to the regular expression ".*" to match any number of characters. The search begins at the element at the startAt position in the list and extends to the element at the endAt position.

Parameters:
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.
Returns:
a PDSItem the indicates the start and end of the object within the label.
Since:
1.0

getElementValue

public java.lang.String getElementValue(java.lang.String name)
Find the value assocated with an element with the given name. The passed name can contain regular expressions. Any occurance of a "*" in the string is converted to the regular expression ".*" to match any number of characters. Also any occurance of "^" is converted to a literal "^" since it is a valid character in keywords. The search begins at the first element in the label and extends to the last.

Parameters:
name - the name of the element to find. This can contain regular expressions.
Returns:
a String containing the value associated with the named element. If the element was not found the value returned is empty.
Since:
1.0

getElementValue

public java.lang.String getElementValue(java.lang.String name,
                                        boolean plain)
Find the value assocated with an element with the given name. The passed name can contain regular expressions. Any occurance of a "*" in the string is converted to the regular expression ".*" to match any number of characters. Also any occurance of "^" is converted to a literal "^" since it is a valid character in keywords. The search begins at the first element in the label and extends to the last.

Parameters:
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.
Returns:
a String containing the value associated with the named element. If the element was not found the value returned is empty.
Since:
1.0

getElementValue

public 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. The passed name can contain regular expressions. Any occurance of a "*" in the string is converted to the regular expression ".*" to match any number of characters. Also any occurance of "^" is converted to a literal "^" since it is a valid character in keywords. The search begins at the first element in the label and extends to the last.

Parameters:
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.
Returns:
a String containing the value associated with the named element. If the element was not found the value returned is empty.
Since:
1.0

getElementValueInObject

public 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. The passed name can contain regular expressions. Any occurance of a "*" in the string is converted to the regular expression ".*" to match any number of characters. Also any occurance of "^" is converted to a literal "^" since it is a valid character in keywords. The search begins at the first element in the label and extends to the last.

Parameters:
name - the name of the element to find. This can contain regular expressions.
Returns:
a String containing the value associated with the named element. If the element was not found the value returned is empty.
Since:
1.0

getElementValueInObject

public 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. The passed name can contain regular expressions. Any occurance of a "*" in the string is converted to the regular expression ".*" to match any number of characters. Also any occurance of "^" is converted to a literal "^" since it is a valid character in keywords. The search begins at the first element in the label and extends to the last.

Parameters:
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.
Returns:
a String containing the value associated with the named element. If the element was not found the value returned is empty.
Since:
1.0

findItem

public PDSItem findItem(java.lang.String name)
Find the item with the given name. The passed name can contain regular expressions. Any occurance of a "*" in the string is converted to the regular expression ".*" to match any number of characters. Also any occurance of "^" is converted to a literal "^" since it is a valid character in keywords. The search begins at the first element in the label and extends to the last.

Parameters:
name - the name of the item to find. This can contain regular expressions.
Returns:
a PDSItem the indicates the start and end of the object within the label. If there is no other objects the PDSItem is invalid.
Since:
1.0

findNextItemInObject

public 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. The passed name can contain regular expressions. Any occurance of a "*" in the string is converted to the regular expression ".*" to match any number of characters. Also any occurance of "^" is converted to a literal "^" since it is a valid character in keywords. The search begins at the first element in the label and extends to the last.

Parameters:
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.
Returns:
a PDSItem the indicates the start and end of the object within the label. If there is no other objects the PDSItem is invalid.
Since:
1.0

findItemInObject

public PDSItem findItemInObject(java.lang.String name,
                                PDSItem context)
Find the item with the given name in the object containing the passed item. The passed name can contain regular expressions. Any occurance of a "*" in the string is converted to the regular expression ".*" to match any number of characters. Also any occurance of "^" is converted to a literal "^" since it is a valid character in keywords. The search begins at the first element in the label and extends to the last.

Parameters:
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.
Returns:
a PDSItem the indicates the start and end of the object within the label. If there is no other objects the PDSItem is invalid.
Since:
1.0

findItem

public PDSItem findItem(java.lang.String name,
                        PDSItem item)
Find the item with the given name constrained to some portion of the label. The passed name can contain regular expressions. Any occurance of a "*" in the string is converted to the regular expression ".*" to match any number of characters. Also any occurance of "^" is converted to a literal "^" since it is a valid character in keywords. The search begins at the first element indicated in the passed PDSItem and extends to the last item.

Parameters:
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.
Returns:
a PDSItem that indicates the location of the item within the label. If there is no other objects the PDSItem is invalid.
Since:
1.0

findItem

public PDSItem findItem(java.lang.String name,
                        int startAt,
                        int endAt)
Find the item with the given name constrained to some portion of the label. The passed name can contain regular expressions. Any occurance of a "*" in the string is converted to the regular expression ".*" to match any number of characters. Also any occurance of "^" is converted to a literal "^" since it is a valid character in keywords. The search begins at the first element indicated in the passed PDSItem and extends to the last item.

Parameters:
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.
Returns:
a PDSItem that indicates the location of the item within the label. If there is no other objects the PDSItem is invalid.
Since:
1.0

findItem

public 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. The passed name can contain regular expressions. Any occurance of a "*" in the string is converted to the regular expression ".*" to match any number of characters. Also any occurance of "^" is converted to a literal "^" since it is a valid character in keywords. The search begins at the first element indicated in the passed PDSItem and extends to the last item.

Parameters:
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
Returns:
a PDSItem that indicates the location of the item within the label. If there is no other objects the PDSItem is invalid.
Since:
1.0

findNextItem

public PDSItem findNextItem(java.lang.String name,
                            PDSItem item)
Find the next item with the given name starting at some point within the label. The passed name can contain regular expressions. Any occurance of a "*" in the string is converted to the regular expression ".*" to match any number of characters. Also any occurance of "^" is converted to a literal "^" since it is a valid character in keywords. The search begins at the first element indicated in the passed PDSItem and extends to the end of the label.

Parameters:
name - the name of the item to find. This can contain regular expressions.
item - a PDSItem indicating where to begin the search.
Returns:
a PDSItem the indicates the start and end of the object within the label. If there is no other objects the PDSItem is invalid.
Since:
1.0

nextItem

public PDSItem nextItem(PDSItem item)
Return the next item after the given item.

Parameters:
item - a PDSItem indicating where to begin the search.
Returns:
a PDSItem the indicates the start and end of the object within the label. If there is no other objects the PDSItem is invalid.
Since:
1.0

getElement

public PDSElement getElement(PDSItem item)
Return the element data associated with an item.

Parameters:
item - a PDSItem to return the element data for. The data associated with the first element of the item is returned.
Returns:
a PDSElement associated with the first element of the item. the label. If no element is associated with the item null is returned.
Since:
1.0

getElement

public PDSElement getElement(java.lang.String name)
Find the element with the given name. The passed name can contain regular expressions. Any occurance of a "*" in the string is converted to the regular expression ".*" to match any number of characters. Also any occurance of "^" is converted to a literal "^" since it is a valid character in keywords. The search begins at the first element in the label and extends to the last.

Parameters:
name - the name of the element to find. This can contain regular expressions.
Returns:
a PDSElement associated with the first element of the item. the label. If no element is associated with the item null is returned.
Since:
1.0

getElement

public PDSElement getElement(java.lang.String name,
                             PDSItem section)
Find the element with the given name within a section (usually an object). The passed name can contain regular expressions. Any occurance of a "*" in the string is converted to the regular expression ".*" to match any number of characters. Also any occurance of "^" is converted to a literal "^" since it is a valid character in keywords. The search begins at the first element in the label and extends to the last.

Parameters:
name - the name of the element to find. This can contain regular expressions.
section - the item defining the section to search.
Returns:
a PDSElement associated with the first element of the item. the label. If no element is associated with the item null is returned.
Since:
1.0

replace

public void replace(PDSItem item,
                    PDSLabel label)
Replace an item in a label with another label.

Parameters:
item - a PDSItem indicating the elements to replace.
label - the label to place where item is currently.
Since:
1.0

add

public void add(PDSElement element)
Add an element to the end of a label.

Parameters:
element - the element to add to the end of the label.
Since:
1.0

add

public void add(PDSLabel label)
Add a label to the end of a label.

Parameters:
label - the label to add to the end of the label.
Since:
1.0

insertBefore

public void insertBefore(PDSItem item,
                         PDSLabel label)
Insert a label before another element in this label. If the element location is invalid nothing is done.

Parameters:
item - the location of the element before which the label is inserted.
label - the label to place before the passed item.
Since:
1.0

insertAfter

public void insertAfter(PDSItem item,
                        PDSLabel label)
Insert a label after another element in this label. If the location of the element is passed the end of this label the label is appended to this label. If the element location is invalid nothing is done.

Parameters:
item - the location of the element after which the label is inserted.
label - the label to place after the passed item.
Since:
1.0

insertBefore

public void insertBefore(PDSItem item,
                         PDSElement element)
Insert an element before another element in this label. If the element location is invalid nothing is done.

Parameters:
item - the location of the element before which the element is inserted.
element - the element to place before the passed item.
Since:
1.0

insertAfter

public void insertAfter(PDSItem item,
                        PDSElement element)
Insert an element after another element in this label. If the location of the element is passed the end of this label the label is appended to this label. If the element location is invalid nothing is done.

Parameters:
item - the location of the element after which the element is inserted.
element - the element to place after the passed item.
Since:
1.0

remove

public void remove(PDSItem item)
Remove a range of elements from the label. If the range of elements in the passed item is invalid nothing is done.

Parameters:
item - the location of the elements to remove.
Since:
1.0

extract

public PDSLabel extract(PDSItem item)
Extract a portion of a label into a new instance of label. The range of elements to extract is given in a PDSItem

Parameters:
item - the location of the elements to extract.
Since:
1.0

filePointers

public java.util.ArrayList filePointers()
Search the label and return a list to all points to files. A pointer to a file is defined as any pointer keyword. The first element of the value is treated as a file name.

Returns:
a list of file names pointed to within the label. The list is in the form of an ArrayList of String objects. If no pointers are found then null is returned.
Since:
1.0

print

public void print()
Print all elements in the label according to PDS specifications for label files using default indent and equal sign placement.

Since:
1.0

print

public 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.

Parameters:
pathName - the path and name of the file to write the output to.
Since:
1.0

print

public 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.

Parameters:
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.
Since:
1.0

print

public 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.

Parameters:
out - the stream to print the element to.
Since:
1.0

print

public void print(java.io.PrintStream out,
                  int indent,
                  int equal)
Print all elements in the label according to PDS specifications for label files. Each line that is output can be indented with the equal sign (when present) placed at a fixed position. Output printed to System.out. Each occurance of an OBJECT is indented on level.

Parameters:
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.
Since:
1.0

print

public 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. Each line that is output can be indented with the equal sign (when present) placed at a fixed position. Output is printed to the print stream. Each occurance of an OBJECT is indented on level.

Parameters:
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.
Since:
1.0

print

public 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. Each line that is output can be indented with the equal sign (when present) placed at a fixed position. Output is printed to the print stream. Each occurance of an OBJECT is indented on level.

Parameters:
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.
Since:
1.0

printVariable

public void printVariable(java.io.PrintStream out)
Prints out the label as a set of variable definition in the PPI Ruleset lanaguage. Each keyword is preceeded by a "$" to make it a variable definition and given a suffix corresponding to the sequential order of the object that contains it. For exmaple the keyword "DESCRIPTION" in the first object will have the variable definition of "$DESCRIPTION_1", the occurance in the second object with have a definition of "$DESCRIPTION_2". The "OBJECT" and "END_OBJECT" elements are not printed. There is an implicit "FILE" around any label defnition, so keywords appearing outside any explicit object have the suffix of "_1", the first explicit object will have a suffix of "_2".

Parameters:
out - the stream to print the element to.
Since:
1.0

printMessage

public void printMessage(java.lang.String text)
Display the passed text as a message to System.out Preceeds the text with a stanard phrase.

Parameters:
text - the variable portion of the message text.
Since:
1.0

setLog

public void setLog(java.io.PrintStream stream)
Set the log print stream

Parameters:
stream - the print stream.
Since:
1.0

getDocument

public org.w3c.dom.Document getDocument()
Creates a DOM (Document Object Model) representation of the label. Keywords in the label are elements in the DOM. Values in the label are placed between the element tags. Units are made attributes of the element.

Returns:
A Document object containing a representation of the label.
Since:
1.0

printXML

public void printXML(java.io.PrintStream out)
Generates an XML representation of the label and streams it to the print stream.

Parameters:
out - the stream to print the element to.
Since:
1.0

getDefaultStyleSheet

public javax.xml.transform.stream.StreamSource getDefaultStyleSheet()
Obtain a StreamSource to the default XML Style Sheet.

Returns:
a StreamSource which can be used to read the default style sheet.
Since:
1.0

pushObject

public 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). The index of the first element of of the object is passed. PDS Label elements are added until an END_OBJECT is encounter with the given "name" or the end of list in reached. The index of the last element pushed is returned. This permits the calling method to walk through element list for the PDS label and create the proper hiearchy.

Parameters:
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.
Returns:
the index of the last element added to the document.
Since:
1.0