public class SampleManager
extends java.lang.Object
Sample data and provides methods to organise samples into groups.| Modifier and Type | Class and Description |
|---|---|
static interface |
SampleManager.SampleGroupListener
Interface for notificaiton of changes to a group.
|
| Constructor and Description |
|---|
SampleManager() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addGroupListener(SampleManager.SampleGroupListener l) |
static void |
addToGroup(java.lang.String group,
java.util.List<Sample> newSamples)
Add a new list of Samples to the specified group.
|
static void |
addToGroup(java.lang.String group,
Sample sample)
Add a new Sample to a group.
|
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.lang.String |
getGroupDir(java.lang.String groupName)
Gets the directory path of the group.
|
static java.util.List<java.lang.String> |
getSampleNameList()
Returns an ArrayList containing all of the Sample names.
|
static java.util.List<Sample> |
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 java.util.List<Sample> |
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 java.util.List<Sample> |
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 java.util.List<Sample> |
group(java.lang.String groupName,
java.lang.String[] fileNameList,
int maxItems)
Generates a new group with the given group name and a list of file names
to be added to the group, with number of elements loaded limited to maxItems.
|
static java.util.List<Sample> |
group(java.lang.String groupName,
java.lang.String folderName,
int maxItems)
Generates a new group with the given group name and a string that
specifies where to load samples to be added to the group, and also limits the number of items loaded from the folder to maxItems.
|
static java.util.Set<java.lang.String> |
groups()
Gets the set of group names.
|
static java.util.List<java.lang.String> |
groupsAsList()
List the groups by name as a list of Strings.
|
static boolean |
isVerbose()
Determines if SampleManager is being verbose.
|
static void |
logSamplePaths(java.lang.String toFile)
Creates a text file at the specified path containing a list of all of the
file names of
Samples loaded so far. |
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 |
removeGroupListener(SampleManager.SampleGroupListener l) |
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 void |
sample(java.lang.String name,
Sample sample)
Adds a sample by name to the sample list.
|
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. |
static void |
setVerbose(boolean verbose)
Tells SampleManager to produce verbose output.
|
static void |
transferSamples(java.lang.String sourceRootDir,
java.lang.String destRootDir,
boolean force)
Takes all of the
Samples currently stored and attempts to relocate
them so that their position relative to destRootDir duplicates their position
relative to sourceRootDir. |
public static Sample sample(java.lang.String fn)
fn - the file path.public static void sample(java.lang.String name,
Sample sample)
name - sample - public static Sample sample(java.lang.String ref, java.lang.String fn)
sample(String) but with the option to specify the name with which this Sample is indexed.ref - the name with which to index this Sample.fn - the file path.public static java.util.List<Sample> group(java.lang.String groupName, Sample[] sampleList)
groupName - the group name.sampleList - the sample list.public static java.util.List<Sample> group(java.lang.String groupName, java.lang.String folderName)
groupName - the group name.folderName - the folder address (URL or file path).public static java.util.List<Sample> group(java.lang.String groupName, java.lang.String folderName, int maxItems)
groupName - the group name.folderName - the folder address (URL or file path).maxItems - number of items to limit to.public static java.util.List<Sample> group(java.lang.String groupName, java.lang.String[] fileNameList)
groupName - the group name.fileNameList - the file name list.public static java.util.List<Sample> group(java.lang.String groupName, java.lang.String[] fileNameList, int maxItems)
groupName - the group name.fileNameList - the file name list.maxItems - number of items to limit to.public static void addToGroup(java.lang.String group,
Sample sample)
group - the group to add to.sample - the Sample to add.public static void addToGroup(java.lang.String group,
java.util.List<Sample> newSamples)
group - the group to add to.newSamples - the list of Samples to add.public static java.util.Set<java.lang.String> groups()
public static java.util.List<java.lang.String> groupsAsList()
public static java.util.ArrayList<Sample> getGroup(java.lang.String groupName)
groupName - the group name.public static java.lang.String getGroupDir(java.lang.String groupName)
groupName - public static Sample randomFromGroup(java.lang.String groupName)
groupName - the group.public static Sample fromGroup(java.lang.String groupName, int index)
groupName - the group name.index - the index.public static void removeSample(java.lang.String sampleName)
Sample.sampleName - the sample name.public static void removeSample(Sample sample)
Sample.sample - the Sample.public static void removeGroup(java.lang.String groupName)
groupName - the group name.public static void destroyGroup(java.lang.String groupName)
groupName - the group name.public static void addGroupListener(SampleManager.SampleGroupListener l)
public static void removeGroupListener(SampleManager.SampleGroupListener l)
public static void printSampleList()
Samples to System.out.public static java.util.List<java.lang.String> getSampleNameList()
public static boolean isVerbose()
public static void setVerbose(boolean verbose)
verbose - true for verbose output.public static void logSamplePaths(java.lang.String toFile)
Samples loaded so far. Useful if you need to gather
all of your sample data into one place using a script. Puts all file names in
double quotes.toFile - destination of the file.public static void transferSamples(java.lang.String sourceRootDir,
java.lang.String destRootDir,
boolean force)
Samples currently stored and attempts to relocate
them so that their position relative to destRootDir duplicates their position
relative to sourceRootDir. This only applies to Samples that were loaded
from a position below sourceRootDir.sourceRootDir - root that you want to transfer fromdestRootDir - place you want to transfer toforce - set to true to force overwrite existing files - take care!