Class IntegerArgs

java.lang.Object
  |
  +--support143.Args
        |
        +--IntegerArgs

public class IntegerArgs
extends Args

Advanced command line argument processor. Supports flags, flags with counts, and simple labels (strings).


Field Summary
protected  java.util.HashMap parameters
           
 
Fields inherited from class support143.Args
flags, unflaggedArgs
 
Constructor Summary
IntegerArgs(java.lang.String mainName, java.lang.String[] commandLine)
          Sole constructor.
 
Method Summary
 void addCommandWithIntegerParameter(java.lang.String f, java.lang.String helpMsg)
          Adds a parameterized argument to the legal set.
protected  boolean consumeArgument(java.lang.String f)
          Consumes (and processes) a single argument.
 java.lang.Integer getIntegerParameter(java.lang.String f)
          Gets the integer parameter associated with the given flag name.
 boolean isIntegerParameterPresent(java.lang.String f)
          Checks if a given parameterized argument is present on the command line.
 void showUsage()
          Displays invocation template.
 
Methods inherited from class support143.Args
addCommand, consumeFlaggedArgument, consumeUnflaggedArgument, expectUnflaggedArguments, getNonFlaggedArguments, getRemainingCommandLineArguments, help, help, isFlagPresent, parseCommandLine, setHelp, shiftCommandLine, showHelp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parameters

protected java.util.HashMap parameters
Constructor Detail

IntegerArgs

public IntegerArgs(java.lang.String mainName,
                   java.lang.String[] commandLine)
Sole constructor.

Method Detail

addCommandWithIntegerParameter

public void addCommandWithIntegerParameter(java.lang.String f,
                                           java.lang.String helpMsg)
Adds a parameterized argument to the legal set.

Parameters:
f - the argument
helpMsg - associated help string

isIntegerParameterPresent

public boolean isIntegerParameterPresent(java.lang.String f)
Checks if a given parameterized argument is present on the command line.

Parameters:
f - the argument in question
Returns:
true if found.

getIntegerParameter

public java.lang.Integer getIntegerParameter(java.lang.String f)
Gets the integer parameter associated with the given flag name.

Parameters:
f - the flag name (eg, "-repeat 10" would be "-repeat")
Returns:
the Integer, null if flag not found on command line

consumeArgument

protected boolean consumeArgument(java.lang.String f)
Description copied from class: Args
Consumes (and processes) a single argument.

Overrides:
consumeArgument in class Args
Parameters:
f - argument
Returns:
true if argument was valid, false otherwise.

showUsage

public void showUsage()
Description copied from class: Args
Displays invocation template.

Overrides:
showUsage in class Args