ds.ov2.util
Class Int_option
java.lang.Object
ds.ov2.util.Option
ds.ov2.util.Int_option
- Direct Known Subclasses:
- Bool_int_option
public class Int_option
- extends Option
Command line switch with an integer argument. When the option is
found the integer value is recorded in a reference.
- CPP Preprocessing
- no cpp preprocessing needed
- Execution Environment:
- host
- Author:
- Hendrik Tews
- Version:
- $Revision: 1.1 $
- Last Commit:
- $Date: 2009-06-02 09:56:03 $ by $Author: tews $
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ref
private Reference<Integer> ref
- The int reference to set.
Int_option
public Int_option(String option,
Reference<Integer> ref,
String argument,
String explanation)
- Construct an integer option. When found on the
command line, the reference
ref
will be set to the
value of the int argument.
- Parameters:
option
- the literal option string as it will appear on
the command lineref
- the int referenceargument
- name of the argument for the explanationexplanation
- explanation for the usage information
get_int_argument
public int get_int_argument(Commandline cl)
- Parse an int argument from the command line. Tries to convert
the next unprocessed command line element to an integer.
Displays an error message and terminates the application if
there is no next command line element or if it cannot be
converted to an integer. If successful the index
Commandline.next_option
in cl
of the next unprocessed
command line element is incremented.
- Parameters:
cl
- command line instance
- Returns:
- next unprocessed option converted to int if possible
matched
public void matched(Commandline cl)
- Called when the option is recognized. Converts the next command
line element to an integer and puts it into
ref
.
Prints an error and exits the program on any problem.
- Specified by:
matched
in class Option
- Parameters:
cl
- command line instance