viper.descriptors
Class DescriptorConfigs

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.Vector
              extended byviper.descriptors.DescVector
                  extended byviper.descriptors.DescriptorConfigs
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, DescriptorList, java.util.List, java.util.RandomAccess, java.io.Serializable

public class DescriptorConfigs
extends DescVector

A collection of Descriptor Objects that supports various operations on them, such as comparison between to DescVector, collection of statistics, reading and printing from files, and various others. It extends Vector now, but could be made to extend some sorted list object without too much hassle.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
DescriptorConfigs(DescriptorData parent)
          Constructs an empty set of DescriptorConfigs.
 
Method Summary
 boolean addDesConfig(org.w3c.dom.Element configEl)
          Adds the descriptor prototype described by the given XML DOM node.
 boolean addDesConfig(org.xml.sax.InputSource input)
          Adds the descriptor schema from the given xml input source.
 boolean addDesConfig(VReader reader)
          Reads in Descriptor configuration information from the specified VReader.
 Descriptor addFromGtf(org.w3c.dom.Element curr, DescVector relativeVector)
          Parses the given descriptor instance element.
 Descriptor addFromGtf(VReader reader, DescVector relativeVector)
          Reads in the next Descriptor from a VReader.
 org.w3c.dom.Element getXMLFormat(org.w3c.dom.Document root)
          Returns a config tag with lots of children.
 void parseConfig(java.util.Vector allFiles)
          Reads in a set of Desxcriptor configuration information to this DescVector.
 void parseConfig(java.util.Vector allFiles, boolean all, boolean err, boolean warn, boolean bad, boolean totals)
          Reads in a set of Desxcriptor configuration information to this DescVector.
 void printConfig(java.io.PrintWriter output)
          Prints out all Descriptor objects in the list.
 void printOut(java.io.PrintWriter output)
          Prints the data out to a file in the specified format.
 java.lang.String toString()
          Prints the descriptors in .gtf style.
 
Methods inherited from class viper.descriptors.DescVector
addDescriptor, cropNodesToSpan, getAllDescriptors, getFileInformation, getHighestFrame, getIds, getInformation, getLowestFrame, getMap, getNodeByID, getNodesByFrame, getNodesByID, getNodesByType, getNodesByType, getParent, getSourcefileName, hasDescriptor, parseData, parseData, parseData, parseData, setFileInformation, setMap, setSourcefileName
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface viper.descriptors.DescriptorList
clone, get, size
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

DescriptorConfigs

public DescriptorConfigs(DescriptorData parent)
Constructs an empty set of DescriptorConfigs.

Parameters:
parent - the parent data
Method Detail

parseConfig

public void parseConfig(java.util.Vector allFiles)
Reads in a set of Desxcriptor configuration information to this DescVector.

Parameters:
allFiles - a Vector of Strings containing the names of the files to search for config information

parseConfig

public void parseConfig(java.util.Vector allFiles,
                        boolean all,
                        boolean err,
                        boolean warn,
                        boolean bad,
                        boolean totals)
Reads in a set of Desxcriptor configuration information to this DescVector.

Parameters:
allFiles - a Vector of Strings containing the names of the files to search for config information
all - print out all lines
err - print out error messages
warn - print out warning messages
bad - print out general errors
totals - print out error totals

addDesConfig

public boolean addDesConfig(VReader reader)
Reads in Descriptor configuration information from the specified VReader.

Parameters:
reader - - the VReader containing the config info
Returns:
true if some info was read in

addDesConfig

public boolean addDesConfig(org.w3c.dom.Element configEl)
Adds the descriptor prototype described by the given XML DOM node.

Parameters:
configEl - the dom node (a config node)
Returns:
the node was successfully parsed

addDesConfig

public boolean addDesConfig(org.xml.sax.InputSource input)
                     throws BadDataException,
                            java.io.IOException
Adds the descriptor schema from the given xml input source.

Parameters:
input - the input source
Returns:
if any descriptor definitions were found
Throws:
BadDataException
java.io.IOException

addFromGtf

public Descriptor addFromGtf(VReader reader,
                             DescVector relativeVector)
                      throws BadDataException,
                             EndOfBlockException,
                             ImproperDescriptorException
Reads in the next Descriptor from a VReader. Looks through and finds an appropriate Descriptor and returns a new Descriptor with the specified information.

Parameters:
reader - where to get the Descriptor from
relativeVector - constructs them using this
Returns:
a new Descriptor filled with data from the file
Throws:
BadDataException - if the data is in an incorrect format.
EndOfBlockException - if there is a data block overrun in the VReader
ImproperDescriptorException - if there is no such data found in the DescriptorConfigs

addFromGtf

public Descriptor addFromGtf(org.w3c.dom.Element curr,
                             DescVector relativeVector)
                      throws BadDataException,
                             ImproperDescriptorException
Parses the given descriptor instance element.

Parameters:
curr - the descriptor instance
relativeVector - the parent list
Returns:
the parsed descriptor
Throws:
BadDataException
ImproperDescriptorException

printConfig

public void printConfig(java.io.PrintWriter output)
Prints out all Descriptor objects in the list.

Parameters:
output - where to print the information

printOut

public void printOut(java.io.PrintWriter output)
Prints the data out to a file in the specified format.

Overrides:
printOut in class DescVector
Parameters:
output - - the PrintWriter to hand the data

toString

public java.lang.String toString()
Prints the descriptors in .gtf style.

Overrides:
toString in class DescVector
Returns:
the .gtf data. Contains newlines.

getXMLFormat

public org.w3c.dom.Element getXMLFormat(org.w3c.dom.Document root)
Returns a config tag with lots of children.

Specified by:
getXMLFormat in interface DescriptorList
Overrides:
getXMLFormat in class DescVector
Parameters:
root - The DOM root
Returns:
<config> element, with descriptor config children