be.hogent.tarsos.sampled.pitch
Class AnnotationTree

java.lang.Object
  extended by be.hogent.tarsos.sampled.pitch.AnnotationTree

public final class AnnotationTree
extends java.lang.Object

Annotation tree can be used for range selection on a list of annotations. To make the range search efficient it backed by a KD-tree. One dimension is time, the second dimension pitch and the third dimension is salience. The unit of pitch is defined during the construction phase.


Constructor Summary
AnnotationTree(PitchUnit pitchUnit)
          Create a new annotation tree.
 
Method Summary
 void add(Annotation annotation)
          Add one annotation to the tree.
 void add(java.util.List<Annotation> annotations)
          Add a list of annotations to the KD-tree.
 java.util.List<Annotation> select(AnnotationSelection selection)
          Select a subset of all annotations within a pitch - time range.
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationTree

public AnnotationTree(PitchUnit pitchUnit)
Create a new annotation tree.

Parameters:
pitchUnit - The pitch unit. The pitch unit needs to be defined here to be able to do range selection in a certain unit.
Method Detail

add

public void add(java.util.List<Annotation> annotations)
Add a list of annotations to the KD-tree.

Parameters:
annotations - The annotations to add to the tree.

select

public java.util.List<Annotation> select(AnnotationSelection selection)
Select a subset of all annotations within a pitch - time range.

Parameters:
selection - A selection defines a pitch-time range.
Returns:
A range selection of annotations.

size

public int size()

add

public void add(Annotation annotation)
Add one annotation to the tree.

Parameters:
annotation - The annotation to add.