be.hogent.tarsos.cli
Class AbstractTarsosApp

java.lang.Object
  extended by be.hogent.tarsos.cli.AbstractTarsosApp
Direct Known Subclasses:
Annotate, AnnotationSynth, AudioToScala, DetectPitch, HistogramToScala, MidiToWav, PitchTable, PitchToHistogram, PitchToMidi, PowerExtractor, Rank, TuneMidiSynth

public abstract class AbstractTarsosApp
extends java.lang.Object

Author:
Joren Six

Constructor Summary
AbstractTarsosApp()
           
 
Method Summary
protected  joptsimple.OptionSpec<PitchDetectionMode> createDetectionModeSpec(joptsimple.OptionParser parser)
          Creates an optionspec for a pitch detector.
abstract  java.lang.String description()
           
protected  boolean isHelpOptionSet(joptsimple.OptionSet options)
          Checks if the OptionSet contains the help argument.
protected  boolean isValidAudioFileOrDirectory(java.lang.String argument)
          An argument is a
 java.lang.String name()
          The name of the application is based on the class name.
protected  joptsimple.OptionSet parse(java.lang.String[] args, joptsimple.OptionParser parser, AbstractTarsosApp application)
          Parses arguments, adds and checks for help option an prints command line help for an application.
protected  void printError(joptsimple.OptionParser parser, java.lang.String message)
           
protected  void printHelp(joptsimple.OptionParser parser)
          Prints command line help for an application.
abstract  void run(java.lang.String... args)
           
 java.lang.String synopsis()
          The synopsis is a short description of the required or optional arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTarsosApp

public AbstractTarsosApp()
Method Detail

run

public abstract void run(java.lang.String... args)
Parameters:
args - The arguments to start the program.

name

public final java.lang.String name()
The name of the application is based on the class name. If the class is called PitchToMidi the name is pitch_to_midi.

Returns:
The name of the parameter used to start the application.

description

public abstract java.lang.String description()
Returns:
The short description of the application. What purpose it serves.

synopsis

public java.lang.String synopsis()
The synopsis is a short description of the required or optional arguments.

Returns:
The command line synopsis. E.g. [options] input_file output_file. Is printed as 'java -jar tarsos.jar name [options] input_file output_file'."

parse

protected final joptsimple.OptionSet parse(java.lang.String[] args,
                                           joptsimple.OptionParser parser,
                                           AbstractTarsosApp application)
Parses arguments, adds and checks for help option an prints command line help for an application.

Parameters:
args - The command line arguments (options).
parser - The argument parser.
application - The application that needs the parameters.
Returns:
null if the arguments could not be parsed by parser. An OptionSet otherwise.

isHelpOptionSet

protected final boolean isHelpOptionSet(joptsimple.OptionSet options)
Checks if the OptionSet contains the help argument.

Parameters:
options - The options to check.
Returns:
True if options is null or options contain help.

isValidAudioFileOrDirectory

protected final boolean isValidAudioFileOrDirectory(java.lang.String argument)
An argument is a

Parameters:
argument -

createDetectionModeSpec

protected final joptsimple.OptionSpec<PitchDetectionMode> createDetectionModeSpec(joptsimple.OptionParser parser)
Creates an optionspec for a pitch detector.

Parameters:
parser - The parser to add an option to.
Returns:
An OptionSpec with a correct name and a clear description.

printHelp

protected final void printHelp(joptsimple.OptionParser parser)
Prints command line help for an application.

Parameters:
parser - The command line argument parser.

printError

protected final void printError(joptsimple.OptionParser parser,
                                java.lang.String message)