anvil.annot
Interface Track

All Superinterfaces:
AnnotationNode

public interface Track
extends AnnotationNode

Tracks contain track elements, the basic units of annotation. Tracks cannot contain other tracks (use group nodes for that).


Method Summary
 boolean addElement(anvil.annot.AnnotationElement el)
          Adds element to track.
 void addObserver(java.util.Observer obs)
          Observer is notified of each track change.
 void elementChanged()
          Called by track elements when they change.
 java.util.List findContainedElements(javax.media.Time start, javax.media.Time end)
          Finds all elements contained in the given time span.
 anvil.annot.TrackElement findElement(javax.media.Time time)
          Finds element that contains the given time point.
 anvil.annot.TrackElement findElement(anvil.annot.TimeInterval itv)
          Finds element that contains the given time interval.
 anvil.annot.TrackElement findNextAfter(javax.media.Time time)
          Finds element that either contains the given time or is the next after it.
 anvil.annot.TrackElement findNextBefore(javax.media.Time time)
          Finds element that either contains the given time or is the next after it.
 java.util.List findTrackAncestry()
          Returns list of tracks that this track depends on.
 anvil.annot.TrackElement firstElement()
          Returns first element or null.
 anvil.annot.Annotation getAnnotation()
          Returns annotation object that contains this track.
 java.util.List getAttributeNames()
          Returns ordered list of all attribute names.
 anvil.annot.valuetype.ValueType getAttributeType(java.lang.String attrName)
          Returns the value type of an attribute or null.
 java.util.SortedSet getElements()
          Returns all elements in temporal order.
 javax.media.Time getMaxEndTime()
          Returns end time of the last element in the track.
 int getNumOfElements()
          Returns total number of elements.
 anvil.annot.ContainerSpec getSpec()
          Returns specification object for this track.
 java.lang.String getTypeName()
          Returns type of track as a lower-case String (primary, singleton, span).
 boolean isEmpty()
          Returns whether track is empty, i.e. contains no elements.
 anvil.annot.TrackElement lastElement()
          Returns last element or null.
 anvil.annot.TrackElement nextElement(anvil.annot.TrackElement el)
          Returns next element after el in this track or null.
 anvil.annot.TrackElement previousElement(anvil.annot.TrackElement el)
          Returns previous element before el in this track or null.
 void print()
          Prints contents of the track to standard output.
 boolean removeElement(anvil.annot.AnnotationElement el)
          Removes track element plus every element that directly or indirectly points to it (dependent elements), also taking care of pointers in attributes (inlinks and outlinks).
 int replaceAttributeValue(java.lang.String attr, java.lang.String oldValue, java.lang.String newValue)
          In all elements of this track, replaces values of attribute attr that match oldValue with newValue.
 
Methods inherited from interface anvil.annot.AnnotationNode
getFirstHidden, getName, getParent, getShortName, isOpen, isVisible, setOpen, setVisible
 

Method Detail

addObserver

public void addObserver(java.util.Observer obs)
Observer is notified of each track change.


addElement

public boolean addElement(anvil.annot.AnnotationElement el)
Adds element to track.

Returns:
true if element did not already exist in this track

findNextAfter

public anvil.annot.TrackElement findNextAfter(javax.media.Time time)
Finds element that either contains the given time or is the next after it.

Returns:
found element or null if there is no element on or after time point

findNextBefore

public anvil.annot.TrackElement findNextBefore(javax.media.Time time)
Finds element that either contains the given time or is the next after it.

Returns:
found element or null if there is no element on or before time point

findTrackAncestry

public java.util.List findTrackAncestry()
Returns list of tracks that this track depends on. If this track is primary then the list is empty. If it is secondary it contains all "higher level" track up to a primary track which occupies the first place in the list.


firstElement

public anvil.annot.TrackElement firstElement()
Returns first element or null.


getAnnotation

public anvil.annot.Annotation getAnnotation()
Returns annotation object that contains this track.


getAttributeNames

public java.util.List getAttributeNames()
Returns ordered list of all attribute names.


getAttributeType

public anvil.annot.valuetype.ValueType getAttributeType(java.lang.String attrName)
                                                 throws anvil.annot.NoSuchAttributeException
Returns the value type of an attribute or null.

Parameters:
attrName - name of the attribute
Throws:
anvil.annot.NoSuchAttributeException - thrown when no such attribute exists

getElements

public java.util.SortedSet getElements()
Returns all elements in temporal order.


getNumOfElements

public int getNumOfElements()
Returns total number of elements.


findContainedElements

public java.util.List findContainedElements(javax.media.Time start,
                                            javax.media.Time end)
Finds all elements contained in the given time span.

Returns:
List of found elements

findElement

public anvil.annot.TrackElement findElement(javax.media.Time time)
Finds element that contains the given time point.

Returns:
found element or null

findElement

public anvil.annot.TrackElement findElement(anvil.annot.TimeInterval itv)
Finds element that contains the given time interval.

Returns:
found element or null

getMaxEndTime

public javax.media.Time getMaxEndTime()
Returns end time of the last element in the track. If there are no elements in this track, zero time is returned.


getSpec

public anvil.annot.ContainerSpec getSpec()
Returns specification object for this track.


getTypeName

public java.lang.String getTypeName()
Returns type of track as a lower-case String (primary, singleton, span).


isEmpty

public boolean isEmpty()
Returns whether track is empty, i.e. contains no elements.


lastElement

public anvil.annot.TrackElement lastElement()
Returns last element or null.


nextElement

public anvil.annot.TrackElement nextElement(anvil.annot.TrackElement el)
Returns next element after el in this track or null.


previousElement

public anvil.annot.TrackElement previousElement(anvil.annot.TrackElement el)
Returns previous element before el in this track or null.


print

public void print()
Prints contents of the track to standard output.


removeElement

public boolean removeElement(anvil.annot.AnnotationElement el)
Removes track element plus every element that directly or indirectly points to it (dependent elements), also taking care of pointers in attributes (inlinks and outlinks).

Parameters:
el - element to be removed
Returns:
true if operation was successful

replaceAttributeValue

public int replaceAttributeValue(java.lang.String attr,
                                 java.lang.String oldValue,
                                 java.lang.String newValue)
                          throws anvil.annot.NoSuchAttributeException,
                                 anvil.annot.WrongValueTypeException
In all elements of this track, replaces values of attribute attr that match oldValue with newValue.

Returns:
number of modified elements
anvil.annot.NoSuchAttributeException
anvil.annot.WrongValueTypeException

elementChanged

public void elementChanged()
Called by track elements when they change.