public class Arrangement extends Object implements Iterable<Arrangement.ArrangementEntry>
Track
Modifier and Type | Class and Description |
---|---|
static class |
Arrangement.ArrangementEntry
Immutable container for an arrangement entry.
|
Constructor and Description |
---|
Arrangement()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Track track,
String instrument)
Adds the given track and assigns the given instrument to the track.
|
Arrangement.ArrangementEntry |
get(int index)
Returns the arrangement entry with the given index.
|
Arrangement.ArrangementEntry |
get(String instrument)
Returns the arrangement entry whose instrument has the given name.
|
Iterator<Arrangement.ArrangementEntry> |
iterator()
Provides an iterator that iterates over all ArrangementEntries of this Arrangement in the order the corresponding (Track, Instrument) pairs
have been added.
|
static Arrangement |
loadArrangement(String filename)
Loads a gzip-serialized arrangement from the given file and returns it.
|
static void |
saveArrangement(Arrangement arrangement,
String filename)
Serializes this arrangement and writes it in gziped format to the given file.
|
int |
size()
Returns the number of arrangement entries.
|
public void add(Track track, String instrument)
track
- the trackinstrument
- the instrumentpublic Iterator<Arrangement.ArrangementEntry> iterator()
iterator
in interface Iterable<Arrangement.ArrangementEntry>
public int size()
public Arrangement.ArrangementEntry get(int index)
index
- the index (starting with 0)public Arrangement.ArrangementEntry get(String instrument)
instrument
- the name of the instrumentpublic static Arrangement loadArrangement(String filename) throws IOException, ClassNotFoundException
filename
- the filename of the arrangement to loadIOException
- in case of an I/O problemClassNotFoundException
- in case of a deserialization problempublic static void saveArrangement(Arrangement arrangement, String filename) throws IOException
arrangement
- the arrangement to savefilename
- the filename to save the arrangement toIOException
- in case of an I/O problem