public class FeatureSet
extends java.lang.Object
FeatureTrack
s associated with some audio data. FeatureSet provides methods for
reading and writing feature data to/from files.Constructor and Description |
---|
FeatureSet()
Instantiates a new empty FeatureSet.
|
FeatureSet(java.io.File file)
Instantiates a new FeatureSet from the given file.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public FeatureSet()
public FeatureSet(java.io.File file)
file
- the File.public static FeatureSet forSample(Sample s)
Sample
. Assumes that the features are stored in a file next to the Sample's file
but with the ending ".features".s
- the Samplepublic FeatureTrack get(java.lang.String trackName)
FeatureTrack
with the given name.trackName
- the track name.public void add(java.lang.String trackName, FeatureTrack track)
FeatureTrack
with the given name, writing over a previously stored FeatureTrack
with the same name.trackName
- the track name.track
- the track.public boolean contains(java.lang.String trackName)
trackName
- name to check.public void addGlobal(java.lang.String s, java.lang.Object f)
s
- the name used to identify the feature set.f
- the features.public java.lang.Object getGlobal(java.lang.String s)
s
- the name.public boolean containsGlobal(java.lang.String s)
feature
- name to check.public void write()
write(File)
or FeatureSet(File)
.public void refresh()
public void write(java.io.File file)
File
and keeps the file ref for future use.file
- the file.public void write(java.lang.String fn)
fn
- the file name.public java.util.Map<java.lang.String,FeatureTrack> tracks()
public void printGlobalFeatures()