be.hogent.tarsos.cli
Class AbstractTarsosApp

java.lang.Object
  extended by be.hogent.tarsos.cli.AbstractTarsosApp
Direct Known Subclasses:
Annotate, AnnotationSynth, AudioToScala, DetectPitch, MidiToWav, PitchTable, 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.
abstract  java.lang.String 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 printHelp(joptsimple.OptionParser parser)
          Prints command line help for an application.
abstract  void run(java.lang.String... args)
           
 
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 abstract java.lang.String name()
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.

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.

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.