anvil.annot
Class AnvilTrack

java.lang.Object
  |
  +--java.util.Observable
        |
        +--anvil.annot.AnvilAnnotationNode
              |
              +--anvil.annot.AnnotationContainer
                    |
                    +--anvil.annot.AnvilTrack
All Implemented Interfaces:
AnnotationNode, GraphicalTrack, Track
Direct Known Subclasses:
PrimaryTrack, SecondaryTrack

public abstract class AnvilTrack
extends AnnotationContainer
implements Track, GraphicalTrack

Anvil's implementation of a track.


Field Summary
static int PER_MINUTE
           
static int PER_SECOND
           
protected  java.lang.String typeName
           
 
Fields inherited from class anvil.annot.AnnotationContainer
elements, index2el
 
Fields inherited from class anvil.annot.AnvilAnnotationNode
annotation, name, open, parent, spec, visible
 
Constructor Summary
AnvilTrack(Annotation annot, GroupNode parent, NodeSpec spec)
           
 
Method Summary
 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.
 TrackElement findElement(javax.media.Time time)
          Finds element that contains the given time point.
 TrackElement findElement(TimeInterval itv)
          Finds element that contains the given time interval.
 TrackElement findNextAfter(javax.media.Time time)
          Finds element that either contains the given time or is the next after it.
 TrackElement findNextBefore(javax.media.Time time)
          Finds element that either contains the given time or is the next after it.
abstract  java.util.List findTrackAncestry()
          Returns list of tracks that this track depends on.
 TrackElement firstElement()
          Returns first element or null.
 javax.media.Time getElementCoverage()
          Returns total amount of time covered by the elements in this track.
 double getElementRate(javax.media.Time duration, int unit, boolean net)
          Computes element rate per second/minute.
 java.util.SortedSet getElements()
          Returns all elements in temporal order.
 float getHeightFactor()
          Returns height factor for GUI.
 javax.media.Time getMaxEndTime()
          Returns end time of the last element in the track.
static java.lang.String[] getTypeArray()
          Returns all available track types as an array of strings.
 java.lang.String getTypeName()
          Returns type of track as a lower-case String (primary, singleton, span).
 TrackElement lastElement()
          Returns last element or null.
 TrackElement nextElement(TrackElement el)
          Returns next element after el in this track or null.
 TrackElement previousElement(TrackElement el)
          Returns previous element before el in this track or null.
 void print()
          Prints contents of the track to stdout.
 java.lang.String toString()
           
 
Methods inherited from class anvil.annot.AnnotationContainer
addElement, getAnnotation, getAttributeNames, getAttributeType, getElementCollection, getNumOfElements, getReciprocalLinkAttributes, getSpec, indexElements, isEmpty, query, removeElement, replaceAttributeValue, setName, unlinkElement, writeAnvilFile
 
Methods inherited from class anvil.annot.AnvilAnnotationNode
getFirstHidden, getName, getParent, getShortName, isOpen, isVisible, setOpen, setVisible
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface anvil.annot.Track
addElement, addObserver, getAnnotation, getAttributeNames, getAttributeType, getNumOfElements, getSpec, isEmpty, removeElement, replaceAttributeValue
 
Methods inherited from interface anvil.annot.AnnotationNode
getFirstHidden, getName, getParent, getShortName, isOpen, isVisible, setOpen, setVisible
 

Field Detail

PER_SECOND

public static final int PER_SECOND
See Also:
Constant Field Values

PER_MINUTE

public static final int PER_MINUTE
See Also:
Constant Field Values

typeName

protected java.lang.String typeName
Constructor Detail

AnvilTrack

public AnvilTrack(Annotation annot,
                  GroupNode parent,
                  NodeSpec spec)
Method Detail

getTypeArray

public static java.lang.String[] getTypeArray()
Returns all available track types as an array of strings.


getHeightFactor

public float getHeightFactor()
Description copied from interface: GraphicalTrack
Returns height factor for GUI.

Specified by:
getHeightFactor in interface GraphicalTrack

getTypeName

public java.lang.String getTypeName()
Description copied from interface: Track
Returns type of track as a lower-case String (primary, singleton, span).

Specified by:
getTypeName in interface Track

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

elementChanged

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

Specified by:
elementChanged in interface Track
Overrides:
elementChanged in class AnnotationContainer

getElements

public java.util.SortedSet getElements()
Description copied from interface: Track
Returns all elements in temporal order.

Specified by:
getElements in interface Track

getMaxEndTime

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

Specified by:
getMaxEndTime in interface Track

firstElement

public TrackElement firstElement()
Description copied from interface: Track
Returns first element or null.

Specified by:
firstElement in interface Track

lastElement

public TrackElement lastElement()
Description copied from interface: Track
Returns last element or null.

Specified by:
lastElement in interface Track

nextElement

public TrackElement nextElement(TrackElement el)
Description copied from interface: Track
Returns next element after el in this track or null.

Specified by:
nextElement in interface Track

previousElement

public TrackElement previousElement(TrackElement el)
Description copied from interface: Track
Returns previous element before el in this track or null.

Specified by:
previousElement in interface Track

getElementCoverage

public javax.media.Time getElementCoverage()
Returns total amount of time covered by the elements in this track.


getElementRate

public double getElementRate(javax.media.Time duration,
                             int unit,
                             boolean net)
Computes element rate per second/minute. Net rate means that only the time covered by elements is taken (i.e. pauses are deducted).

Parameters:
net - true if you want the net rat (pauses not counted)

findTrackAncestry

public abstract java.util.List findTrackAncestry()
Description copied from interface: Track
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.

Specified by:
findTrackAncestry in interface Track

findNextAfter

public TrackElement findNextAfter(javax.media.Time time)
Description copied from interface: Track
Finds element that either contains the given time or is the next after it.

Specified by:
findNextAfter in interface Track
Returns:
found element or null if there is no element on or after time point

findNextBefore

public TrackElement findNextBefore(javax.media.Time time)
Description copied from interface: Track
Finds element that either contains the given time or is the next after it.

Specified by:
findNextBefore in interface Track
Returns:
found element or null if there is no element on or before time point

findContainedElements

public java.util.List findContainedElements(javax.media.Time start,
                                            javax.media.Time end)
Description copied from interface: Track
Finds all elements contained in the given time span.

Specified by:
findContainedElements in interface Track
Returns:
List of found elements

findElement

public TrackElement findElement(javax.media.Time time)
Description copied from interface: Track
Finds element that contains the given time point.

Specified by:
findElement in interface Track
Returns:
found element or null

findElement

public TrackElement findElement(TimeInterval itv)
Description copied from interface: Track
Finds element that contains the given time interval.

Specified by:
findElement in interface Track
Returns:
found element or null

print

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

Specified by:
print in interface Track
Specified by:
print in class AnnotationContainer