ds.ov2.util
Class String_option

java.lang.Object
  extended by ds.ov2.util.Option
      extended by ds.ov2.util.String_option

public class String_option
extends Option

Command line switch with a String argument. When the option is found the string 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 $

Field Summary
private  Reference<String> ref
          The reference where the option argument will be stored.
 
Fields inherited from class ds.ov2.util.Option
argument, explanation, option
 
Constructor Summary
String_option(String option, Reference<String> ref, String argument, String explanation)
          Construct a string option.
 
Method Summary
 String get_string_argument(Commandline cl)
          Retrieve a String argument from the command line.
 void matched(Commandline cl)
          Called when the option is recognized.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ref

private Reference<String> ref
The reference where the option argument will be stored.

Constructor Detail

String_option

public String_option(String option,
                     Reference<String> ref,
                     String argument,
                     String explanation)
Construct a string option. When found on the command line, the reference ref will be set to the next command line element.

Parameters:
option - the literal option string as it will appear on the command line
ref - the string reference
argument - name of the argument for the explanation
explanation - explanation for the usage information
Method Detail

get_string_argument

public String get_string_argument(Commandline cl)
Retrieve a String argument from the command line. Displays an error message and terminates the application if there is no next command line element.

Parameters:
cl - the command line instance
Returns:
next unprocessed command line element as String

matched

public void matched(Commandline cl)
Called when the option is recognized. Retrieves the next command line element and stores it in the String reference ref.

Specified by:
matched in class Option
Parameters:
cl - command line instance