viper.descriptors
Interface DescriptorList

All Superinterfaces:
java.lang.Cloneable, java.util.Collection
All Known Implementing Classes:
DescVector

public interface DescriptorList
extends java.lang.Cloneable, java.util.Collection

A DescriptorList contains all Descriptors associated with a given file.


Method Summary
 void addDescriptor(Descriptor desc)
          Adds a new descriptor to this set.
 java.lang.Object clone()
          Makes a copy of this list.
 java.util.Iterator cropNodesToSpan(FrameSpan span)
          Like getNodesByFrame, but instead, the Iterator returns copies of the Descriptor objects contained here, each cropped to contain no frames beyond the specified FrameSpan.
 java.lang.Object get(int i)
          Get the i th descriptor in the list.
 java.util.Collection getAllDescriptors()
          Get a collection of all of the descriptors declared for this source file.
 CanonicalFileDescriptor getFileInformation()
          Gets file information.
 int getHighestFrame()
          Returns the greatest frame index of all Descriptor objects.
 java.util.List getIds()
          Gets all id numbers currently in use.
 int getLowestFrame()
          Returns the least frame index of all Descriptor objects.
 Equivalencies getMap()
          Gets the Equivalency map for this list.
 Descriptor getNodeByID(java.lang.String type, java.lang.String name, int idNumber)
          Returns the Descriptor with the given id number and type.
 java.util.Iterator getNodesByFrame(FrameSpan subspan)
          Returns descriptors that contain the subspan, or some of the subspan, with their framespan set to the subspan intersected with the span.
 java.util.Iterator getNodesByID(int idNumber)
          Returns all Descriptors with the given id number.
 java.util.Iterator getNodesByType(java.lang.String type, java.lang.String name)
          Returns the first Descriptor in the list with the specified category and title.
 DescriptorData getParent()
          Gets the parent set of descriptor lists.
 org.w3c.dom.Element getXMLFormat(org.w3c.dom.Document root)
          Returns an XML tree that is a list of Descriptors in XML format.
 boolean hasDescriptor(java.lang.String type, java.lang.String name)
          Checks to see if a Descriptor with this category and title is in the list.
 void setFileInformation(CanonicalFileDescriptor cfd)
          Will try to set the canonical file descriptor.
 void setMap(Equivalencies map)
          Sets the equivalency map of the list.
 int size()
          Gets the number of descriptors currently held by this list.
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, toArray, toArray
 

Method Detail

setMap

public void setMap(Equivalencies map)
Sets the equivalency map of the list.

Parameters:
map - the new equivalency map of the list.

getMap

public Equivalencies getMap()
Gets the Equivalency map for this list.

Returns:
the equivalency map of the list.

hasDescriptor

public boolean hasDescriptor(java.lang.String type,
                             java.lang.String name)
Checks to see if a Descriptor with this category and title is in the list.

Parameters:
type - the category of the Descriptor
name - the name of the Descriptor
Returns:
true if one or more are found

getNodesByType

public java.util.Iterator getNodesByType(java.lang.String type,
                                         java.lang.String name)
Returns the first Descriptor in the list with the specified category and title. Returns null if none is found.

Parameters:
type - the category of the Descriptor
name - the name of the Descriptor
Returns:
a Descriptor with the specified type and title

getNodesByID

public java.util.Iterator getNodesByID(int idNumber)
Returns all Descriptors with the given id number.

Parameters:
idNumber - the number to look for
Returns:
the descriptors with the given id. Note that there can only be one of each declared descriptor type

getNodeByID

public Descriptor getNodeByID(java.lang.String type,
                              java.lang.String name,
                              int idNumber)
Returns the Descriptor with the given id number and type.

Parameters:
type - the type of the descriptor
name - the name of the descriptor
idNumber - the id number of the descriptor
Returns:
the descriptor, if it exists. Otherwise, null.

getNodesByFrame

public java.util.Iterator getNodesByFrame(FrameSpan subspan)
Returns descriptors that contain the subspan, or some of the subspan, with their framespan set to the subspan intersected with the span.

Parameters:
subspan - the span to check
Returns:
all descriptors that intersect with the span

cropNodesToSpan

public java.util.Iterator cropNodesToSpan(FrameSpan span)
Like getNodesByFrame, but instead, the Iterator returns copies of the Descriptor objects contained here, each cropped to contain no frames beyond the specified FrameSpan.

Parameters:
span - the span to get values cropped to
Returns:
cropped copies of the descriptors in the span

getHighestFrame

public int getHighestFrame()
Returns the greatest frame index of all Descriptor objects.

Returns:
the last frame index of all Descriptor objects

getLowestFrame

public int getLowestFrame()
Returns the least frame index of all Descriptor objects.

Returns:
the first frame index of all Descriptor objects

getIds

public java.util.List getIds()
Gets all id numbers currently in use.

Returns:
the id number list

getXMLFormat

public org.w3c.dom.Element getXMLFormat(org.w3c.dom.Document root)
Returns an XML tree that is a list of Descriptors in XML format.

Parameters:
root - The document that will contain the tree
Returns:
A w3c Element node with lots of children

addDescriptor

public void addDescriptor(Descriptor desc)
                   throws java.lang.UnsupportedOperationException
Adds a new descriptor to this set. Unlike a simple call to add, this will reset the object ID to be unique to this list.

Parameters:
desc - the descriptor to add
Throws:
java.lang.UnsupportedOperationException

size

public int size()
Gets the number of descriptors currently held by this list.

Specified by:
size in interface java.util.Collection
Returns:
number of elements in list

get

public java.lang.Object get(int i)
Get the i th descriptor in the list.

Parameters:
i - the offset into the list
Returns:
Descriptor i
Throws:
java.lang.IndexOutOfBoundsException - if there are not at least i+1 elements in the list

getParent

public DescriptorData getParent()
Gets the parent set of descriptor lists.

Returns:
the parent holder

getAllDescriptors

public java.util.Collection getAllDescriptors()
Get a collection of all of the descriptors declared for this source file.

Returns:
Collectionof Descriptors

getFileInformation

public CanonicalFileDescriptor getFileInformation()
Gets file information. See all of the caveats therein -- it may be null, or it may not have any useful values.

Returns:
the canonical file descriptor associated with this metadata

setFileInformation

public void setFileInformation(CanonicalFileDescriptor cfd)
Will try to set the canonical file descriptor. Note that any attributes that are not in the prototype that was parsed from file (or added later) should not be set. The policy on how to treat the SOURCEFILES attribute may be implementation dependent (use it for ordering, although it may also be used to remove files if you wish).

Parameters:
cfd - the new canonical file descriptor

clone

public java.lang.Object clone()
Makes a copy of this list.

Returns:
a copy of this list