viper.descriptors
Class DescAggregate

java.lang.Object
  extended byviper.descriptors.Descriptor
      extended byviper.descriptors.DescAggregate
All Implemented Interfaces:
java.lang.Cloneable

public class DescAggregate
extends Descriptor

Acts as a composition of Descriptors.


Field Summary
 
Fields inherited from class viper.descriptors.Descriptor
attributes, composable, croppingType, span
 
Constructor Summary
DescAggregate(DescSingle D)
          Constructs a new aggregate descriptor that contains the contents of the given single descriptor.
DescAggregate(java.lang.String designation)
          Constructs a new aggregate descriptor with the given category, e.g.
 
Method Summary
 java.lang.Object clone()
          Generates a new Descriptor Object sharing none of the references of the original but containing identical data.
 Descriptor compose(Descriptor D, EvaluationParameters.ScopeRules scope)
          Returns a new descriptor eqiuvalent to this+D.
 Descriptor crop(FrameSpan span)
          Like clone, but only clones a subset of this descriptor.
 FrameSpan getFrameSpan()
          Gets the frames where the descriptor exists.
 java.lang.Object getID()
          Returns the ID number of the descriptor.
 org.w3c.dom.Element getXMLFormat(org.w3c.dom.Document root)
          Gets an XML representation of the descriptor.
 void moveFrame(int offset)
          Shifts the descriptor by the given offset.
 int numIDs()
          Gets the number of descriptor ids associated with this aggregate descriptor.
 void setFrameSpan(FrameSpan span)
          Replaces the frame span.
 
Methods inherited from class viper.descriptors.Descriptor
compareTo, composeThese, endFrame, equals, getAttribute, getAttribute, getAttributeIndex, getAttributeIndex, getAttributeNames, getAttributesOfType, getCategory, getFilterable, getFullName, getHighestFrame, getName, getType, hasAttrib, hasAttribute, hashCode, isCategory, isComposable, isRoc, named, parseDescriptorConfig, parseDescriptorConfig, printSelf, printSelf, rawFormat, rocAttributeName, sameCategoryAs, setCategory, setName, startFrame, startsWithCategory, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DescAggregate

public DescAggregate(java.lang.String designation)
              throws BadDataException
Constructs a new aggregate descriptor with the given category, e.g. "CONTENT".

Parameters:
designation - the descriptor type, e.g. "CONTENT"
Throws:
BadDataException - if the designation is invalid.

DescAggregate

public DescAggregate(DescSingle D)
              throws BadDataException
Constructs a new aggregate descriptor that contains the contents of the given single descriptor.

Parameters:
D - the descriptor
Throws:
BadDataException - from parent constructor
Method Detail

clone

public java.lang.Object clone()
Generates a new Descriptor Object sharing none of the references of the original but containing identical data.

Specified by:
clone in class Descriptor
Returns:
new Descriptor initialized with this Descriptor's data

getID

public java.lang.Object getID()
Returns the ID number of the descriptor.

Specified by:
getID in class Descriptor
Returns:
the ID number of the descriptor

numIDs

public int numIDs()
Gets the number of descriptor ids associated with this aggregate descriptor. This is equal to the number of single descriptors this aggregate contains.

Specified by:
numIDs in class Descriptor
Returns:
the number of ids

getFrameSpan

public FrameSpan getFrameSpan()
Description copied from class: Descriptor
Gets the frames where the descriptor exists.

Specified by:
getFrameSpan in class Descriptor
Returns:
the valid frames of the descriptor

moveFrame

public void moveFrame(int offset)
Description copied from class: Descriptor
Shifts the descriptor by the given offset.

Specified by:
moveFrame in class Descriptor
Parameters:
offset - the number of frames to shift the descriptor.

setFrameSpan

public void setFrameSpan(FrameSpan span)
Description copied from class: Descriptor
Replaces the frame span. Probably doesn't modify any of the attributes.

Specified by:
setFrameSpan in class Descriptor
Parameters:
span - the new span

compose

public Descriptor compose(Descriptor D,
                          EvaluationParameters.ScopeRules scope)
                   throws BadDataException,
                          UncomposableException
Returns a new descriptor eqiuvalent to this+D. Remember, composition is not commutative for all attributes, and may not exist for some. To compose, remember to call first and try both A.compose (B) and B.compose (A).

Specified by:
compose in class Descriptor
Parameters:
D - The Descriptor to compose with this Descriptor.
scope - The attribute scope and mapping.
Returns:
A new Descriptor that is equivalent to the composition of this and the argument D.
Throws:
BadDataException - if the compose semantics are not correct.
UncomposableException - this instance of the descriptor cannot be composed. Check isComposable!
See Also:
DescAggregate

getXMLFormat

public org.w3c.dom.Element getXMLFormat(org.w3c.dom.Document root)
Gets an XML representation of the descriptor. FIXME :: Right now, just throws Unsupported Exception.

Specified by:
getXMLFormat in class Descriptor
Parameters:
root - The DOM Document to attach the element to.
Returns:
A DOM Element node representing the descriptor.
Throws:
java.lang.UnsupportedOperationException
See Also:
Descriptor.getXMLFormat(Document)

crop

public Descriptor crop(FrameSpan span)
Description copied from class: Descriptor
Like clone, but only clones a subset of this descriptor.

Specified by:
crop in class Descriptor
Parameters:
span - the new span
Returns:
the cropped descriptor