ds.ov2.util
Class Commandline

java.lang.Object
  extended by ds.ov2.util.Commandline

public class Commandline
extends Object

Command line instance that adds an index and the notion of the next unprocessed command line element to the string array received in the main method.

CPP Preprocessing
no cpp preprocessing needed
Execution Environment:
host, card
Author:
Hendrik Tews
Version:
$Revision: 1.2 $
Last Commit:
$Date: 2009-06-02 09:56:03 $ by $Author: tews $

Field Summary
private  String[] args
          The command line as received in the main method.
private  int next_option
          The index of the next element in the command line.
 
Constructor Summary
Commandline(String[] args)
          Constructor.
 
Method Summary
 boolean continue_parsing()
          Return true if not all command-line elements have been processed yet.
 boolean match(String option)
          Check if the next unprocessed command-line element is equal to option.
 String next_option()
          Return the next unprocessed command-line element without incrementing the option index next_option.
 String retrieve_option()
          Return the next command unprocessed line element and increment the option index next_option.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

args

private final String[] args
The command line as received in the main method.


next_option

private int next_option
The index of the next element in the command line. Automatically incremented in match and retrieve_option().

Constructor Detail

Commandline

public Commandline(String[] args)
Constructor. Initialize the fields of this instance.

Parameters:
args - the command line as received in the main method
Method Detail

continue_parsing

public boolean continue_parsing()
Return true if not all command-line elements have been processed yet.

Returns:
true if next_option still points to some unprocessed command-line element

next_option

public String next_option()
Return the next unprocessed command-line element without incrementing the option index next_option.

Returns:
next option to be parsed

retrieve_option

public String retrieve_option()
Return the next command unprocessed line element and increment the option index next_option.

Returns:
next command line element, or null if no further element is available

match

public boolean match(String option)
Check if the next unprocessed command-line element is equal to option. If it is, the method returns true and the command-line element is considered to be processed and the index of the next unprocessed command line element next_option is incremented. The actual state changes to record that the option option has been recognized is done in Option.matched.

Parameters:
option - option to check agains the next command line element
Returns:
true if option equals the next command line element