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.
 void addGlobal(java.lang.String s, java.lang.Object f)
          Adds a set of features with the given name to the global features.
 boolean contains(java.lang.String trackName)
          Returns true if this FeatureSet stores a track with the given name.
 boolean containsGlobal(java.lang.String s)
          Returns true if this FeatureSet stores a global feature 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.
 java.lang.Object getGlobal(java.lang.String s)
          Gets the global features for the given name.
 void printGlobalFeatures()
           
 void refresh()
          Rereads the data from the stored file.
 java.util.Map<java.lang.String,FeatureTrack> tracks()
          Returns the 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.

addGlobal

public void addGlobal(java.lang.String s,
                      java.lang.Object f)
Adds a set of features with the given name to the global features.

Parameters:
s - the name used to identify the feature set.
f - the features.

getGlobal

public java.lang.Object getGlobal(java.lang.String s)
Gets the global features for the given name.

Parameters:
s - the name.
Returns:
the features.

containsGlobal

public boolean containsGlobal(java.lang.String s)
Returns true if this FeatureSet stores a global feature with the given name.

Parameters:
feature - name to check.
Returns:
true if feature 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()
Returns the tracks.

Returns:
A Map structure.

printGlobalFeatures

public void printGlobalFeatures()