com.swath
Class Parameter

java.lang.Object
  extended bycom.swath.Parameter

public class Parameter
extends java.lang.Object

This class represents a parameter. Several value types are supported and range controls are performed.

Since:
SWATH 1.3
See Also:
UserDefinedScript, UserDefinedCommand

Field Summary
static int BOOLEAN
          The boolean value type.
static int CHOICE
          The choice value type.
static int DOUBLE
          The double value type.
static int INTEGER
          The integer value type.
static int NONE
          No value type.
static int STRING
          The string value type.
 
Constructor Summary
Parameter()
          Constructor.
Parameter(java.lang.String text)
          Constructor.
 
Method Summary
 boolean addChoice(int key, java.lang.String val)
          Adds a choice value.
 boolean getBoolean()
          Gets a boolean value.
 java.lang.String getChoice(int key)
          Gets a choice value for a specific key.
 int getCurrentChoice()
          Gets the current choice value.
 double getDouble()
          Gets a double value.
 double getDoubleMax()
          Gets the maximum double value limit.
 double getDoubleMin()
          Gets the minimum double value limit.
 java.lang.String getHelpText()
          Gets the help text for this parameter.
 int getInteger()
          Gets an integer value.
 int getIntegerMax()
          Gets the maximum integer value limit.
 int getIntegerMin()
          Gets the minimum integer value limit.
 java.util.Enumeration getKeys()
          Gets an enumeration of the choice value keys.
 int getMaxStringLength()
          Gets the maximum string length.
 java.lang.String getString()
          Gets a string value.
 java.lang.String getText()
          Gets the text for this parameter.
 int getType()
          Gets the type of this parameter.
 java.lang.Object getValue()
          Gets the value as an object.
 boolean isValid()
          Indicates if the parameter is valid or not.
 void removeChoice(int key)
          Removes a choice value.
 boolean setBoolean(boolean val)
          Sets a boolean value.
 boolean setCurrentChoice(int key)
          Sets the current choice value.
 boolean setDouble(double val)
          Sets a double value.
 boolean setDoubleRange(double min, double max)
          Sets the double value range.
 void setHelpText(java.lang.String helpText)
          Sets the help text for this parameter.
 boolean setInteger(int val)
          Sets an integer value.
 boolean setIntegerRange(int min, int max)
          Sets the integer value range.
 boolean setMaxStringLength(int maxLength)
          Sets the maximum string length.
 boolean setString(java.lang.String val)
          Sets a string value.
 void setText(java.lang.String text)
          Sets the text for this parameter.
 boolean setType(int type)
          Sets the type of this parameter.
 java.lang.String toString()
          Returns a string representation of the parameter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
No value type.

See Also:
Constant Field Values

STRING

public static final int STRING
The string value type.

See Also:
Constant Field Values

BOOLEAN

public static final int BOOLEAN
The boolean value type.

See Also:
Constant Field Values

INTEGER

public static final int INTEGER
The integer value type.

See Also:
Constant Field Values

DOUBLE

public static final int DOUBLE
The double value type.

See Also:
Constant Field Values

CHOICE

public static final int CHOICE
The choice value type.

See Also:
Constant Field Values
Constructor Detail

Parameter

public Parameter()
Constructor.

Since:
SWATH 1.3

Parameter

public Parameter(java.lang.String text)
Constructor.

Parameters:
text - The parameter text to display.
Since:
SWATH 1.3
Method Detail

toString

public java.lang.String toString()
Returns a string representation of the parameter.

Returns:
The string representation.
Since:
SWATH 1.3

isValid

public boolean isValid()
Indicates if the parameter is valid or not.

Returns:
true if valid, otherwise false.
Since:
SWATH 1.3

setText

public void setText(java.lang.String text)
Sets the text for this parameter.

Parameters:
text - The parameter text.
Since:
SWATH 1.3

getText

public java.lang.String getText()
Gets the text for this parameter.

Returns:
The parameter text.
Since:
SWATH 1.3

setHelpText

public void setHelpText(java.lang.String helpText)
Sets the help text for this parameter.

Parameters:
helpText - The parameter help text.
Since:
SWATH 1.3

getHelpText

public java.lang.String getHelpText()
Gets the help text for this parameter.

Returns:
The parameter help text.
Since:
SWATH 1.3

setType

public boolean setType(int type)
Sets the type of this parameter.

Parameters:
type - The parameter type.
Since:
SWATH 1.3
See Also:
STRING, BOOLEAN, INTEGER, DOUBLE, CHOICE

getType

public int getType()
Gets the type of this parameter.

Returns:
The parameter type.
Since:
SWATH 1.3
See Also:
STRING, BOOLEAN, INTEGER, DOUBLE, CHOICE

getValue

public java.lang.Object getValue()
Gets the value as an object.

Returns:
The value.
Since:
SWATH 1.3

setString

public boolean setString(java.lang.String val)
Sets a string value.

Parameters:
val - The string value.
Returns:
true if successful, otherwise false
Since:
SWATH 1.3

getString

public java.lang.String getString()
Gets a string value.

Returns:
The string value.
Since:
SWATH 1.3

setBoolean

public boolean setBoolean(boolean val)
Sets a boolean value.

Parameters:
val - The boolean value.
Returns:
true if successful, otherwise false
Since:
SWATH 1.3

getBoolean

public boolean getBoolean()
Gets a boolean value.

Returns:
The boolean value.
Since:
SWATH 1.3

setInteger

public boolean setInteger(int val)
Sets an integer value.

Parameters:
val - The integer value.
Returns:
true if successful, otherwise false
Since:
SWATH 1.3

getInteger

public int getInteger()
Gets an integer value.

Returns:
The integer value.
Since:
SWATH 1.3

setDouble

public boolean setDouble(double val)
Sets a double value.

Parameters:
val - The double value.
Returns:
true if successful, otherwise false
Since:
SWATH 1.3

getDouble

public double getDouble()
Gets a double value.

Returns:
The double value.
Since:
SWATH 1.3

addChoice

public boolean addChoice(int key,
                         java.lang.String val)
Adds a choice value.

Parameters:
key - The key.
val - The choice value to add.
Since:
SWATH 1.3

getChoice

public java.lang.String getChoice(int key)
Gets a choice value for a specific key.

Parameters:
key - The key of the choice value to get.
Returns:
The wanted choice value.
Since:
SWATH 1.3

getKeys

public java.util.Enumeration getKeys()
Gets an enumeration of the choice value keys.

Returns:
All key values.
Since:
SWATH 1.3

removeChoice

public void removeChoice(int key)
Removes a choice value.

Parameters:
key - The key of the choice value to remove.
Since:
SWATH 1.3

setCurrentChoice

public boolean setCurrentChoice(int key)
Sets the current choice value.

Parameters:
key - The key of the current choice value.
Returns:
true if successful, otherwise false
Since:
SWATH 1.3

getCurrentChoice

public int getCurrentChoice()
Gets the current choice value.

Returns:
The key of the current choice value or -1 if none.
Since:
SWATH 1.3

setMaxStringLength

public boolean setMaxStringLength(int maxLength)
Sets the maximum string length.

Parameters:
maxLength - The maximum string length.
Returns:
true if successful, otherwise false
Since:
SWATH 1.3

getMaxStringLength

public int getMaxStringLength()
Gets the maximum string length.

Returns:
The maximum string length.
Since:
SWATH 1.3

setIntegerRange

public boolean setIntegerRange(int min,
                               int max)
Sets the integer value range.

Parameters:
min - The minimum integer value.
max - The maximum integer value.
Returns:
true if successful, otherwise false
Since:
SWATH 1.3

getIntegerMin

public int getIntegerMin()
Gets the minimum integer value limit.

Returns:
The minimum integer value.
Since:
SWATH 1.3

getIntegerMax

public int getIntegerMax()
Gets the maximum integer value limit.

Returns:
The maximum integer value.
Since:
SWATH 1.3

setDoubleRange

public boolean setDoubleRange(double min,
                              double max)
Sets the double value range.

Parameters:
min - The minimum double value.
max - The maximum double value.
Returns:
true if successful, otherwise false
Since:
SWATH 1.3

getDoubleMin

public double getDoubleMin()
Gets the minimum double value limit.

Returns:
The minimum double value.
Since:
SWATH 1.3

getDoubleMax

public double getDoubleMax()
Gets the maximum double value limit.

Returns:
The maximum double value.
Since:
SWATH 1.3