net.beadsproject.beads.analysis
Class FeatureSet

java.lang.Object
  extended by net.beadsproject.beads.analysis.FeatureSet

public class FeatureSet
extends java.lang.Object

FeatureSet is a set of named FeatureTracks associated with some audio data. FeatureSet provides methods for reading and writing feature data to/from files.


Constructor Summary
FeatureSet()
          Instantiates a new empty FeatureSet.
FeatureSet(java.io.File file)
          Instantiates a new FeatureSet from the given file.
 
Method Summary
 void add(java.lang.String trackName, FeatureTrack track)
          Adds the given FeatureTrack with the given name, writing over a previously stored FeatureTrack with the same name.
 boolean contains(java.lang.String trackName)
          Returns true if this FeatureSet stores a track with the given name.
static FeatureSet forSample(Sample s)
          Tries to locate the FeatureSet for the given Sample.
 FeatureTrack get(java.lang.String trackName)
          Gets the FeatureTrack with the given name.
 void refresh()
          Rereads the data from the stored file.
 java.util.Map<java.lang.String,FeatureTrack> tracks()
           
 void write()
          Writes to a file.
 void write(java.io.File file)
          Writes the data to the given File and keeps the file ref for future use.
 void write(java.lang.String fn)
          Writes the data to the named file, and keeps a file ref for future use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeatureSet

public FeatureSet()
Instantiates a new empty FeatureSet.


FeatureSet

public FeatureSet(java.io.File file)
Instantiates a new FeatureSet from the given file.

Parameters:
file - the File.
Method Detail

forSample

public static FeatureSet forSample(Sample s)
Tries to locate the FeatureSet for the given Sample. Assumes that the features are stored in a file next to the Sample's file but with the ending ".features".

Parameters:
s - the Sample
Returns:
the FeatureSet or null if unsuccessful.

get

public FeatureTrack get(java.lang.String trackName)
Gets the FeatureTrack with the given name.

Parameters:
trackName - the track name.
Returns:
the FeatureTrack, or null if unsuccessful.

add

public void add(java.lang.String trackName,
                FeatureTrack track)
Adds the given FeatureTrack with the given name, writing over a previously stored FeatureTrack with the same name.

Parameters:
trackName - the track name.
track - the track.

contains

public boolean contains(java.lang.String trackName)
Returns true if this FeatureSet stores a track with the given name.

Parameters:
trackName - name to check.
Returns:
true if track name is found.

write

public void write()
Writes to a file. Assumes file has already been specified by write(File) or FeatureSet(File).


refresh

public void refresh()
Rereads the data from the stored file. Assumes the file has been specified in the constructor.


write

public void write(java.io.File file)
Writes the data to the given File and keeps the file ref for future use.

Parameters:
file - the file.

write

public void write(java.lang.String fn)
Writes the data to the named file, and keeps a file ref for future use.

Parameters:
fn - the file name.

tracks

public java.util.Map<java.lang.String,FeatureTrack> tracks()