laser.util.argument
Class BooleanParameter

java.lang.Object
  extended by laser.util.argument.Argument
      extended by laser.util.argument.Parameter
          extended by laser.util.argument.BooleanParameter
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class BooleanParameter
extends Parameter

The BooleanParameter class defines a user-defined parameter of type Boolean.

Author:
Heather M. Conboy (laser-software@cs.umass.edu)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class laser.util.argument.Parameter
NOT_REPEATABLE_CHAR, REPEATABLE_CHAR
 
Fields inherited from class laser.util.argument.Argument
FIRST, HELP_DEFAULT, HELP_PREFIX, REPEATABLE_DEFAULT, TYPE_PREFIX, TYPE_SUFFIX
 
Constructor Summary
BooleanParameter(java.lang.String name)
          Creates a new BooleanParameter with the given name.
BooleanParameter(java.lang.String name, java.lang.String helpMessage)
          Creates a new BooleanParameter with the given name.
 
Method Summary
 java.lang.Object clone()
          Clones this Object.
protected  java.lang.Object fromStringValue(java.lang.String value)
          Parses a String value into an Object appropriate for the type NOTE: In Java when parsing a string to a boolean value, true ( case insensitive ) is true and ANYTHING else is false.
 java.lang.Boolean getBooleanValue()
          Gets the first value of this BooleanParameter.
 java.lang.Boolean getBooleanValue(int index)
          Gets the value of this BooleanParameter at the specified index.
 java.lang.Class getType()
          Gets the type of this Parameter.
 void setValue(java.lang.Boolean value)
          Sets the value of this BooleanParameter to the specified value.
 
Methods inherited from class laser.util.argument.Parameter
check, getHelp, getRepeatableChar
 
Methods inherited from class laser.util.argument.Argument
checkValue, clear, equals, getHelpMessage, getName, getValue, getValue, getValues, initialize, isRepeatable, numberOfActualValues, numberOfValues, parseValue, save, setValue, toString, toStringValue, toStringValue
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BooleanParameter

public BooleanParameter(java.lang.String name,
                        java.lang.String helpMessage)
Creates a new BooleanParameter with the given name. It will be multi-valued if isRepeatable is true and single-valued otherwise. The help message will be made available to the user upon request.

Parameters:
name - The name for the option
helpMessage - The help message to report to the user upon request
See Also:
Argument.REPEATABLE_DEFAULT

BooleanParameter

public BooleanParameter(java.lang.String name)
Creates a new BooleanParameter with the given name. It will have the default setting for isRepeatable and helpMessage.

Parameters:
name - The name for the option
See Also:
Argument.REPEATABLE_DEFAULT, Argument.HELP_DEFAULT
Method Detail

setValue

public void setValue(java.lang.Boolean value)
              throws ArgumentFormatException,
                     ArgumentNotRepeatableException
Sets the value of this BooleanParameter to the specified value.

Parameters:
value - The value for this BooleanParameter
Throws:
ArgumentFormatException - if the value is incorrectly formatted
ArgumentNotRepeatableException - if the user attempted to set the value of a single-valued argument multiple times

getBooleanValue

public java.lang.Boolean getBooleanValue()
Gets the first value of this BooleanParameter.

Returns:
The first value

getBooleanValue

public java.lang.Boolean getBooleanValue(int index)
Gets the value of this BooleanParameter at the specified index.

Parameters:
index - The index of the value
Returns:
The string value

fromStringValue

protected java.lang.Object fromStringValue(java.lang.String value)
                                    throws ArgumentFormatException
Parses a String value into an Object appropriate for the type NOTE: In Java when parsing a string to a boolean value, true ( case insensitive ) is true and ANYTHING else is false.

Specified by:
fromStringValue in class Argument
Parameters:
value - the value
Returns:
the parsed Object
Throws:
ArgumentFormatException - if the value is malformed
See Also:
laser.util.argument.Argument.toStringValue(Object)

getType

public java.lang.Class getType()
Gets the type of this Parameter.

Specified by:
getType in class Argument
Returns:
The type description

clone

public java.lang.Object clone()
Clones this Object.

Specified by:
clone in class Argument
Returns:
The clone