org.finetracker.simple_lm
Class ConfigurationFromCmd

java.lang.Object
  extended by org.finetracker.simple_lm.ConfigurationFromCmd

public class ConfigurationFromCmd
extends java.lang.Object

This class parses the command line arguments, and stores them in two data structures. The first data structure is a Map which stores parameters with their values. The second datas structure is a List which stores the remaining arguments. The parameters can be retrieved using getOption(String parameter), and the arguments using getArguments().

Author:
Frank Kusters, Albert Gerritsen

Constructor Summary
ConfigurationFromCmd(java.lang.String[] args)
          Constructs a ConfigurationFromCmd object containing settings read from the command line, retrieved from args.
 
Method Summary
 java.util.List<java.lang.String> getArguments()
          Gets the list of arguments (any options that do not start with a dash ('-')).
 java.lang.Double getOption(java.lang.String parameter)
          Get the value belonging to the option specified on the command line.
 java.lang.String getUsageString()
          Returns the usage (command line options) of the application.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurationFromCmd

public ConfigurationFromCmd(java.lang.String[] args)
                     throws java.io.IOException
Constructs a ConfigurationFromCmd object containing settings read from the command line, retrieved from args.

Parameters:
args - an array of Strings containing the arguments as normally used in a main() method.
Throws:
java.io.IOException - when the commandline could not be parsed correctly
Method Detail

getUsageString

public java.lang.String getUsageString()
Returns the usage (command line options) of the application. The returned string is meant for display to the user.

Returns:
the command line options of the applications combined with explaining text

getOption

public java.lang.Double getOption(java.lang.String parameter)
Get the value belonging to the option specified on the command line.

Parameters:
parameter - the parameter
Returns:
the value belonging to the parameter, or null if the parameter was not specified.

getArguments

public java.util.List<java.lang.String> getArguments()
Gets the list of arguments (any options that do not start with a dash ('-')).

Returns:
the list of arguments. If no arguments where specified, the list is of zero-length.