net.beadsproject.beads.data
Class SampleManager

java.lang.Object
  extended by net.beadsproject.beads.data.SampleManager

public class SampleManager
extends java.lang.Object

SampleManager provides a static repository for Sample data and provides methods to organise samples into groups.


Constructor Summary
SampleManager()
           
 
Method Summary
static void destroyGroup(java.lang.String groupName)
          Removes the specified group, and removes all of the samples found in the group from the sample repository.
static Sample fromGroup(java.lang.String groupName, int index)
          Gets the Sample at the specified index from the specified group.
static java.util.ArrayList<Sample> getGroup(java.lang.String groupName)
          Gets the specified group in the form ArrayList<Sample>.
static java.util.List<java.lang.String> getSampleNameList()
          Returns an ArrayList containing all of the Sample names.
static void group(java.lang.String groupName, Sample[] sampleList)
          Generates a new group with the given group name and list of Samples to be added to the group.
static void group(java.lang.String groupName, java.lang.String folderName)
          Generates a new group with the given group name and a string that specifies where to load samples to be added to the group.
static void group(java.lang.String groupName, java.lang.String[] fileNameList)
          Generates a new group with the given group name and a list of file names to be added to the group.
static void printSampleList()
          Prints a list of all Samples to System.out.
static Sample randomFromGroup(java.lang.String groupName)
          Gets a random sample from the specified group.
static void removeGroup(java.lang.String groupName)
          Removes the specified group, without removing the samples.
static void removeSample(Sample sample)
          Removes the Sample.
static void removeSample(java.lang.String sampleName)
          Removes the named Sample.
static Sample sample(java.lang.String fn)
          Returns a new Sample from the given filename.
static Sample sample(java.lang.String ref, java.lang.String fn)
          Like sample(String) but with the option to specify the name with which this Sample is indexed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SampleManager

public SampleManager()
Method Detail

sample

public static Sample sample(java.lang.String fn)
Returns a new Sample from the given filename. If the Sample has already been loaded, it will not be loaded again, but will simply be retrieved from the static repository.

Parameters:
fn - the file path.
Returns:
the sample.

sample

public static Sample sample(java.lang.String ref,
                            java.lang.String fn)
Like sample(String) but with the option to specify the name with which this Sample is indexed.

Parameters:
ref - the name with which to index this Sample.
fn - the file path.
Returns:
the sample.

group

public static void group(java.lang.String groupName,
                         Sample[] sampleList)
Generates a new group with the given group name and list of Samples to be added to the group.

Parameters:
groupName - the group name.
sampleList - the sample list.

group

public static void group(java.lang.String groupName,
                         java.lang.String folderName)
Generates a new group with the given group name and a string that specifies where to load samples to be added to the group. The string is interpreted firstly as a URL, and if that fails, as a folder path.

Parameters:
groupName - the group name.
folderName - the folder address (URL or file path).

group

public static void group(java.lang.String groupName,
                         java.lang.String[] fileNameList)
Generates a new group with the given group name and a list of file names to be added to the group.

Parameters:
groupName - the group name.
fileNameList - the file name list.

getGroup

public static java.util.ArrayList<Sample> getGroup(java.lang.String groupName)
Gets the specified group in the form ArrayList<Sample>.

Parameters:
groupName - the group name.
Returns:
the group.

randomFromGroup

public static Sample randomFromGroup(java.lang.String groupName)
Gets a random sample from the specified group.

Parameters:
groupName - the group.
Returns:
a random Sample.

fromGroup

public static Sample fromGroup(java.lang.String groupName,
                               int index)
Gets the Sample at the specified index from the specified group.

Parameters:
groupName - the group name.
index - the index.
Returns:
the Sample.

removeSample

public static void removeSample(java.lang.String sampleName)
Removes the named Sample.

Parameters:
sampleName - the sample name.

removeSample

public static void removeSample(Sample sample)
Removes the Sample.

Parameters:
sample - the Sample.

removeGroup

public static void removeGroup(java.lang.String groupName)
Removes the specified group, without removing the samples.

Parameters:
groupName - the group name.

destroyGroup

public static void destroyGroup(java.lang.String groupName)
Removes the specified group, and removes all of the samples found in the group from the sample repository.

Parameters:
groupName - the group name.

printSampleList

public static void printSampleList()
Prints a list of all Samples to System.out.


getSampleNameList

public static java.util.List<java.lang.String> getSampleNameList()
Returns an ArrayList containing all of the Sample names.

Returns:
ArrayList of Sample names.