abc4j API Specification

abc.parser
Class TuneParser

java.lang.Object
  extended by abc.parser.AbcParserAbstract
      extended by abc.parser.TuneParser
Direct Known Subclasses:
AsynchronousTuneParser

public class TuneParser
extends AbcParserAbstract

A convenient class to ease the parsing of ONE tune. The result of the parsing is directly returned as a Tune object synchronously. You don't have to attach yourself as a listener or whatever to get the parsing result.


Constructor Summary
TuneParser()
          Constructs a new tune parser.
 
Method Summary
 void addListener(TuneParserListenerInterface listener)
          Adds a listener to catch events thrwon by the parser durin tune parsing.
 Tune parse(java.io.Reader charStream)
          Parses the specified stream in ABC notation.
 Tune parse(java.lang.String tune)
          Parse the given string and creates a Tune object as parsing result.
 Tune parseHeader(java.io.Reader charStream)
          Parse the given string and creates a Tune object with no music as parsing result.
 Tune parseHeader(java.lang.String tune)
          Parses the header of the specified tune notation.
 void removeListener(TuneParserListenerInterface listener)
          Removes a listener from this parser.
 
Methods inherited from class abc.parser.AbcParserAbstract
getScanner
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TuneParser

public TuneParser()
Constructs a new tune parser.

Method Detail

parse

public Tune parse(java.lang.String tune)
Parse the given string and creates a Tune object as parsing result.

Parameters:
tune - The abc tune, as a String, to be parsed.
Returns:
An object representation of the abc notation string.

parse

public Tune parse(java.io.Reader charStream)
Parses the specified stream in ABC notation.

Parameters:
charStream - Tune stream in ABC notation.
Returns:
A tune representing the ABC notation stream.

parseHeader

public Tune parseHeader(java.lang.String tune)
Parses the header of the specified tune notation.

Parameters:
tune - A tune notation in ABC.
Returns:
A tune representing the ABC notation with header values only.

parseHeader

public Tune parseHeader(java.io.Reader charStream)
Parse the given string and creates a Tune object with no music as parsing result. This purpose of this method method is to provide a faster parsing when just abc header fields are needed.

Parameters:
charStream - The stream to be parsed.
Returns:
An object representation with no score of the abc notation string.

addListener

public void addListener(TuneParserListenerInterface listener)
Adds a listener to catch events thrwon by the parser durin tune parsing.

Overrides:
addListener in class AbcParserAbstract
Parameters:
listener - Object that implements the TuneParserListenerInterface.
See Also:
removeListener(abc.parser.TuneParserListenerInterface)

removeListener

public void removeListener(TuneParserListenerInterface listener)
Removes a listener from this parser.

Overrides:
removeListener in class AbcParserAbstract
Parameters:
listener - The listener to be removed.
See Also:
addListener(abc.parser.TuneParserListenerInterface)

abc4j API Specification

Submit a bug or feature