|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--AFLPcore.Option
This class provides a way for other class to specify options and
parameters. There are three types of options supported by this class.
The first is a simply a string indicating that some sort of string
should be given as an option. The class that created this option should
check to see if the string matches whatever it needs. The second type is
a number. The third type is a choice, which consists of a list of
possible selections. Some other part of a program may wish to implement
a user interface for these different types of options. This way, a
program can query a class, get it's options, present the options to the
user, and return the users choices to the program. Parameters that the
class needs to operate should be marked as required
in the
constructor.
Operation
,
AFLPgui.OptionsDialog
Field Summary | |
static int |
CHOICE
|
static int |
LABEL
|
static int |
NUMBER
|
static int |
STRING
Constant for denoting option type |
Constructor Summary | |
Option(java.lang.String label,
int type,
boolean required)
|
|
Option(java.lang.String label,
int type,
boolean required,
int defaultValue)
Create a new option of the specified type with the specified label. |
|
Option(java.lang.String label,
int type,
boolean required,
java.lang.String defaultString)
Create a new option of the specified type with the specified label. |
|
Option(java.lang.String label,
int type,
boolean required,
java.lang.String[] values)
Create a new option of the specified type with the specified label. |
|
Option(java.lang.String label,
int type,
boolean required,
java.lang.String[] values,
java.lang.String defaultChoice)
Create a new option of the specified type with the specified label. |
Method Summary | |
java.lang.String[] |
getChoices()
Gives the list of possiblities for a choice option. |
java.lang.String |
getDefaultChoice()
Gives the default choice for this option. |
java.lang.String |
getLabel()
Gives a label for this option that serves as an identifier for the option. |
double |
getNumValue()
Gives the numerical value associated with this option. |
java.lang.String |
getStringValue()
Gives the string that represents the value of this option. |
int |
getType()
Gives the type of option for this class. |
boolean |
isRequired()
Tells whether or not this option is required by an Operation |
boolean |
isSet()
Tells whether or not this option has been set to a value. |
void |
setValue(double setValue)
Sets the numerical value of this option to the specified value. |
void |
setValue(java.lang.String setValue)
Sets the string value of this option to the specified value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int STRING
public static final int NUMBER
public static final int CHOICE
public static final int LABEL
Constructor Detail |
public Option(java.lang.String label, int type, boolean required)
public Option(java.lang.String label, int type, boolean required, int defaultValue)
STRING
or NUMBER
type. The other constructor
should be used to create an option of type CHOICE
, since
it also takes a list of values to choose from.label
- the name of this optiontype
- one of the type in the class descriptionrequired
- determines if this "option" is required for the
operation or if it is truly optional.java.lang.IllegalArgumentException
- occurs when the type is not
one known to this class, or if it can only be created with the
other constructor because some options require more details than
others.public Option(java.lang.String label, int type, boolean required, java.lang.String defaultString)
STRING
or NUMBER
type. The other constructor
should be used to create an option of type CHOICE
, since
it also takes a list of values to choose from.label
- the name of this optiontype
- one of the type in the class descriptionrequired
- determines if this "option" is required for the
operation or if it is truly optional.java.lang.IllegalArgumentException
- occurs when the type is not
one known to this class, or if it can only be created with the
other constructor because some options require more details than
others.public Option(java.lang.String label, int type, boolean required, java.lang.String[] values)
CHOICE
. The other constructor should be used to create
options of other types. This is done because the choice requires
an extra bit of information: the possible choices.label
- the name of this optiontype
- one of the type in the class descriptionrequired
- determines if this "option" is required for the
operation or if it is truly optional.values
- a list of strings representing the possible choices
for this option.java.lang.IllegalArgumentException
- occurs when the type is not
one known to this class that requires the extra String[]
parameter. If the type is not one of these, the other constructor
should be used and this one will create the error.public Option(java.lang.String label, int type, boolean required, java.lang.String[] values, java.lang.String defaultChoice)
CHOICE
. The other constructor should be used to create
options of other types. This is done because the choice requires
an extra bit of information: the possible choices.label
- the name of this optiontype
- one of the type in the class descriptionrequired
- determines if this "option" is required for the
operation or if it is truly optional.values
- a list of strings representing the possible choices
for this option.default
- the default choice to be taken for the possilbe
list of values. If it is null, no default will be set.java.lang.IllegalArgumentException
- occurs when the type is not
one known to this class that requires the extra String[]
parameter. If the type is not one of these, the other constructor
should be used and this one will create the error.Method Detail |
public java.lang.String getStringValue()
null
if one of the error conditions
above occurs.public double getNumValue()
public void setValue(java.lang.String setValue)
setValue
- the new value for this option.public void setValue(double setValue)
setValue
- the new value for this option.public java.lang.String getLabel()
public int getType()
public boolean isRequired()
Operation
true
if it is required.public boolean isSet()
true
when it has been set.public java.lang.String[] getChoices()
null
if this option is not
of type choice.public java.lang.String getDefaultChoice()
null
if not set or not
applicable.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |