provided.util
Class ABCUtil

java.lang.Object
  extended by provided.util.ABCUtil

public class ABCUtil
extends java.lang.Object


Field Summary
static ABCUtil Singleton
          Singleton instance of the class
 
Constructor Summary
private ABCUtil()
          private constructor
 
Method Summary
 java.lang.String getFileContents(java.lang.String filename)
          Returns the contents of a text file, e.g.
 ABCInstrument[] getInstruments()
          Get an array of all the available instruments as ABCInstruments where the instrument's value is the MIDI instrument number
 double parseFraction(java.lang.String frac)
          Return the evaluation of a string "a/b".
 double parseTempo(java.lang.String tempo, double defaultNotesPerQuarterNote)
          Return the tempo given by the input string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Singleton

public static final ABCUtil Singleton
Singleton instance of the class

Constructor Detail

ABCUtil

private ABCUtil()
private constructor

Method Detail

parseFraction

public double parseFraction(java.lang.String frac)
Return the evaluation of a string "a/b".

Parameters:
frac - - a string containing a fraction
Returns:
- the result of evaluating the fraction

parseTempo

public double parseTempo(java.lang.String tempo,
                         double defaultNotesPerQuarterNote)
Return the tempo given by the input string. The returned value is in the units of quarter notes per minute. Accepts "bpm" (beats per default note) or "a/b=bpm" (beats per a/b note).

Parameters:
tempo - - tempo represented as a string
defaultNotesPerQuarterNote - - default notes per quarter note
Returns:
- the tempo indicated by the string

getFileContents

public java.lang.String getFileContents(java.lang.String filename)
Returns the contents of a text file, e.g. an abc file, as a single string.

Parameters:
filename - the name of the file with respect to the default package, where "/" refers to the default package, e.g. a file in the "data" package would "/data/myfile.abc"
Returns:
the contents of the file

getInstruments

public ABCInstrument[] getInstruments()
Get an array of all the available instruments as ABCInstruments where the instrument's value is the MIDI instrument number

Returns:
an array of ABCInstruments