viper.descriptors
Class DescSingle

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

public class DescSingle
extends Descriptor

This class represents a Descriptor of a given visual element in a video file. There are three types: FILE, CONTENT, and OBJECT.


Field Summary
 
Fields inherited from class viper.descriptors.Descriptor
attributes, composable, croppingType, span
 
Constructor Summary
DescSingle(java.lang.String category)
          Constructs a new object with the given category.
DescSingle(java.lang.String category, java.lang.String name)
          Constructs a new descriptor with the given category and type name.
 
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)
          Composes this descriptor with the given descriptor under the given set of scope and composition rules.
 Descriptor crop(FrameSpan span)
          Like clone, but only clones a subset of this descriptor.
 FrameSpan getBrokenFrameSpan()
          Breaks the combined frame span of the attributes.
 FrameSpan getFrameSpan()
          Gets the descriptor's frame span.
 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()
          Returns the number of Identification numbers in this descriptor.
 void setAttribute(java.lang.String name, Attribute attribute)
          Sets the named attribute to the given value
 void setFrameSpan(FrameSpan span)
          changes the framespan.
 void setID(int id)
          Sets the id number of the descriptor.
 
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

DescSingle

public DescSingle(java.lang.String category)
           throws BadDataException
Constructs a new object with the given category.

Parameters:
category - the category, e.g. "CONTENT"
Throws:
BadDataException

DescSingle

public DescSingle(java.lang.String category,
                  java.lang.String name)
           throws BadDataException
Constructs a new descriptor with the given category and type name.

Parameters:
category - the category, e.g. "CONTENT"
name - the name of the descriptor type, e.g. "Person"
Throws:
BadDataException
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

setID

public void setID(int id)
Sets the id number of the descriptor. This is used to uniquely identify the instance among others of its type on the same source file.

Parameters:
id -

numIDs

public int numIDs()
Description copied from class: Descriptor
Returns the number of Identification numbers in this descriptor. Prototypes or empty descriptors have none, while aggregate descriptors have as many as there are descriptors inside.

Specified by:
numIDs in class Descriptor
Returns:
one

getBrokenFrameSpan

public FrameSpan getBrokenFrameSpan()
Breaks the combined frame span of the attributes.

Returns:
the attributes frame span, if any attributes are dynamic. Otherwise, returns the descriptor's frame span.

getFrameSpan

public FrameSpan getFrameSpan()
Gets the descriptor's frame span.

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)
changes the framespan. If an attribute is dynamic, then it will be set to null for all frames that it were not included in the previous span. All static attributes will remain the same.

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

compose

public Descriptor compose(Descriptor D,
                          EvaluationParameters.ScopeRules scope)
                   throws BadDataException,
                          UncomposableException
Description copied from class: Descriptor
Composes this descriptor with the given descriptor under the given set of scope and composition rules. It returns a new copy of this descriptor, leaving it unmodified.

Specified by:
compose in class Descriptor
Parameters:
D - the descriptor to compose with
scope - rules for the composition
Returns:
a new descriptor representing both this descriptor and the other one
Throws:
BadDataException
UncomposableException
See Also:
DescAggregate

getXMLFormat

public org.w3c.dom.Element getXMLFormat(org.w3c.dom.Document root)
Gets an XML representation of the descriptor.

Specified by:
getXMLFormat in class Descriptor
Parameters:
root - used to create the returned elements
Returns:
an xml element describing this descriptor

setAttribute

public void setAttribute(java.lang.String name,
                         Attribute attribute)
                  throws BadDataException
Sets the named attribute to the given value

Parameters:
name - the name of the attribute
attribute - the value of the attribute
Throws:
BadDataException - when trying to set the wrong type - ie dyanmic to static or bbox to circle. It does not currently check to make sure that there are the proper number of frames in a dynamic attribute, however.

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