avrora.util
Class Option.Str

java.lang.Object
  extended byavrora.util.Option
      extended byavrora.util.Option.Str
Enclosing class:
Option

public static class Option.Str
extends Option

The Option.Str class is an implementation of the Option class that encapsulates a string.


Nested Class Summary
 
Nested classes inherited from class avrora.util.Option
Option.Bool, Option.Double, Option.Interval, Option.List, Option.Long, Option.Str
 
Field Summary
protected  java.lang.String defvalue
          The defvalue field stores the default (initial) value for this option.
protected  java.lang.String value
           
 
Fields inherited from class avrora.util.Option
COMPARATOR, description, name
 
Constructor Summary
Option.Str(java.lang.String nm, java.lang.String val, java.lang.String desc)
          The constructor for the Option.Str class creates a new option that can store a string.
 
Method Summary
 java.lang.String get()
          The get() method returns the current value of the option.
 void printHelp()
          The printHelp() method prints out a textual paragraph of the help item for this option to the terminal.
 void set(java.lang.String val)
          The set() method updates the value of the option.
 void setNewDefault(java.lang.String val)
          The setNewDefault() method sets a new default value for this option.
 java.lang.String stringValue()
          The stringValue() method returns a string representation of the value of the option.
 
Methods inherited from class avrora.util.Option
getName, parseError, printDescription, printHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defvalue

protected java.lang.String defvalue
The defvalue field stores the default (initial) value for this option. It is used in reporting the help item.


value

protected java.lang.String value
Constructor Detail

Option.Str

public Option.Str(java.lang.String nm,
                  java.lang.String val,
                  java.lang.String desc)
The constructor for the Option.Str class creates a new option that can store a string. It is given an option name, a help description, and a default value.

Parameters:
nm - the string name of the option
val - the default value of the option
desc - the description of the option
Method Detail

set

public void set(java.lang.String val)
The set() method updates the value of the option.

Specified by:
set in class Option
Parameters:
val - a string representation of the new value of the option.

setNewDefault

public void setNewDefault(java.lang.String val)
The setNewDefault() method sets a new default value for this option. This is useful for inherited options that might have a different default value for different actions or different simulations.

Parameters:
val - the new default value for this option

get

public java.lang.String get()
The get() method returns the current value of the option.

Returns:
the value of the option as a string.

stringValue

public java.lang.String stringValue()
The stringValue() method returns a string representation of the value of the option. This is used in debugging and reporting purposes.

Specified by:
stringValue in class Option
Returns:
a string representation of the value of the option.

printHelp

public void printHelp()
The printHelp() method prints out a textual paragraph of the help item for this option to the terminal.

Specified by:
printHelp in class Option