Class OptionHandler

java.lang.Object
  |
  +--OptionHandler

public class OptionHandler
extends java.lang.Object

OptionHandler Handles runstring options and compulsory parameters
+opt parameter: an option with leading '+' requires an addition parameter;
-opt: a leading '-' is a boolean option

Author:
M. Baer 9.12.1998 baer@seismo.ifg.ethz.ch

Constructor Summary
OptionHandler()
          initialize the vectors for runstring options
 
Method Summary
 boolean checkOption(java.lang.String opt)
          returns true or false if the specified opt was set
 java.util.Vector compulsoryOption()
          returns the compulsory Vector of the runstring part
 void defineOption(java.lang.String opt)
          defines a new option name (e.g.
 void defineOption(java.lang.String opt, java.lang.String help)
          defines a new option name (e.g.
 java.lang.String getOption(java.lang.String opt)
          returns the value of a specified opt , (for '-opt', the return value is null)
 void listOptions()
          list all options defined for this program
 int numberOption()
          returns the number of options defined
 void rcFile(java.lang.String fname)
          read options from a file
one option per line
 void RunstringOptions(java.lang.String[] arg, int narg)
          process the runstring of the program
 void setOption(java.lang.String opt, java.lang.String value)
          set the Option opt to a specific value, (for '-opt', value is ignored)
 void unsetOption(java.lang.String opt)
          clear the Option opt
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptionHandler

public OptionHandler()
initialize the vectors for runstring options
Method Detail

defineOption

public void defineOption(java.lang.String opt)
defines a new option name (e.g. "+s" , "-?" or "?" )

defineOption

public void defineOption(java.lang.String opt,
                         java.lang.String help)
defines a new option name (e.g. "+s" , "-?" or "?" )

numberOption

public int numberOption()
returns the number of options defined

setOption

public void setOption(java.lang.String opt,
                      java.lang.String value)
set the Option opt to a specific value, (for '-opt', value is ignored)

unsetOption

public void unsetOption(java.lang.String opt)
clear the Option opt

getOption

public java.lang.String getOption(java.lang.String opt)
returns the value of a specified opt , (for '-opt', the return value is null)

checkOption

public boolean checkOption(java.lang.String opt)
returns true or false if the specified opt was set

compulsoryOption

public java.util.Vector compulsoryOption()
returns the compulsory Vector of the runstring part

RunstringOptions

public void RunstringOptions(java.lang.String[] arg,
                             int narg)
process the runstring of the program

rcFile

public void rcFile(java.lang.String fname)
read options from a file
one option per line

listOptions

public void listOptions()
list all options defined for this program