gov.llnl.babel
Class SwitchDictionary

java.lang.Object
  extended by gov.llnl.babel.SwitchDictionary
All Implemented Interfaces:
CommandLineDictionary

public class SwitchDictionary
extends java.lang.Object
implements CommandLineDictionary


Constructor Summary
SwitchDictionary(boolean multiMode)
           
 
Method Summary
 void addCommandLineSwitch(CommandLineSwitch cls)
          Add a command line switch to the dictionary of available command line switches.
 java.lang.String[] executeCommandLineSwitches(java.lang.String[] arguments)
          Execute the command line switches from arguments and return the unprocessed command line arguments.
 int executeMultiple(java.lang.String[] arguments)
           
 boolean getHelpPrinted()
          Return true iff the help text was printed.
 void printHelpText()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwitchDictionary

public SwitchDictionary(boolean multiMode)
Method Detail

getHelpPrinted

public boolean getHelpPrinted()
Return true iff the help text was printed.


addCommandLineSwitch

public void addCommandLineSwitch(CommandLineSwitch cls)
                          throws NameCollisionException
Add a command line switch to the dictionary of available command line switches. Babel requires that each command line switch have a unique long name. Given that short names are limited, it allocates abbreviated forms on a first come first served basis.

Specified by:
addCommandLineSwitch in interface CommandLineDictionary
Parameters:
cls - a non-null command line switch to add to the dictionary.
Throws:
NameCollisionException - this indicates that cls has the same long name as a CommandLineSwitch already in the dictionary. This exception is never generated due to collisions in the short form.

printHelpText

public void printHelpText()

executeCommandLineSwitches

public java.lang.String[] executeCommandLineSwitches(java.lang.String[] arguments)
                                              throws InvalidOptionException
Execute the command line switches from arguments and return the unprocessed command line arguments.

Parameters:
arguments - the command line arguments to execute.
Returns:
a non-NULL array containing the remaining unprocessed arguments (i.e., those arguments that aren't part of a command line switch).
Throws:
InvalidOptionException - when this exception is thrown, it indicates that the Babel run should be ended. Assume the error has already been reported to System.err.

executeMultiple

public int executeMultiple(java.lang.String[] arguments)