|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.jstacs.AnnotatedEntity
de.jstacs.parameters.Parameter
de.jstacs.parameters.AbstractSelectionParameter
de.jstacs.parameters.MultiSelectionParameter
public class MultiSelectionParameter
Class for a Parameter that provides a collection of possible values.
The user can select one or more values out of the collection as values of
this Parameter.
AbstractSelectionParameter| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class de.jstacs.parameters.AbstractSelectionParameter |
|---|
AbstractSelectionParameter.InconsistentCollectionException |
| Field Summary |
|---|
| Fields inherited from class de.jstacs.parameters.AbstractSelectionParameter |
|---|
errorMessage, parameters, userSelected |
| Fields inherited from class de.jstacs.parameters.Parameter |
|---|
parent |
| Fields inherited from class de.jstacs.AnnotatedEntity |
|---|
comment, datatype, name |
| Constructor Summary | |
|---|---|
MultiSelectionParameter(DataType datatype,
String[] keys,
Object[] values,
String[] comments,
String name,
String comment,
boolean required)
Constructor for a MultiSelectionParameter. |
|
MultiSelectionParameter(DataType datatype,
String[] keys,
Object[] values,
String name,
String comment,
boolean required)
Constructor for a MultiSelectionParameter. |
|
MultiSelectionParameter(StringBuffer representation)
The standard constructor for the interface Storable. |
|
MultiSelectionParameter(String name,
String comment,
boolean required,
Class<? extends ParameterSet>... values)
Creates a new MultiSelectionParameter from an array of
Classes of ParameterSets. |
|
MultiSelectionParameter(String name,
String comment,
boolean required,
ParameterSet... values)
Creates a new MultiSelectionParameter from an array of
ParameterSets. |
|
| Method Summary | |
|---|---|
protected void |
appendFurtherInfos(StringBuffer sup)
This method can be used in the method Storable.toXML() to extract
further information (name, comment, datatype). |
boolean |
checkValue(Object value)
Returns true if the key specified by value is
in the set of keys of this AbstractSelectionParameter. |
MultiSelectionParameter |
clone()
|
protected void |
extractFurtherInfos(StringBuffer representation)
This method can be used in the constructor with parameter StringBuffer to
extract the further information. |
void |
fromGalaxy(String namePrefix,
StringBuffer command)
Parses the contents of command in the format defined by configBuffer of GalaxyConvertible.toGalaxy(String, String, int, StringBuffer, StringBuffer)
and sets the values of the Parameter or ParameterSet accordingly. |
int |
getNumberOfNexts(int afterIdx)
Returns the number of calls of next() that can be called
before false is returned. |
int |
getNumberOfValues()
Returns the number of values in the collection. |
int[] |
getSelected()
Returns the indexes of the selected options. |
Object |
getValue()
Returns the value of the AnnotatedEntity. |
Object |
getValueFor(int idx)
Returns the value of the option with no. |
Object |
getValueFor(String key)
Returns the value for the option with key key. |
Object[] |
getValues()
Returns the values of all selected options as an array. |
String |
getXMLTag()
This method returns a tag used as outer tag of the XML description. |
boolean |
hasDefault()
Returns true, if this AbstractSelectionParameter has a
default value. |
boolean |
hasDefaultOrIsSet()
Returns true if the parameter either has a default value or
the value was set by the user, false otherwise. |
boolean |
isRanged()
Returns true if this RangeIterator is ranging over a
set of values. |
boolean |
isSelected(int idx)
Returns true if the option at position idx is
selected. |
boolean |
isSelected(String key)
Returns the selection value of the option with key key. |
boolean |
next()
Switches to the next value in the collection of values in the specified range. |
void |
reset()
Resets the parameter and its contents to the default values or null if no defaults are given. |
void |
resetToFirst()
Resets the current value in the collection to the first value. |
void |
setDefault(Object defaultValue)
Sets the default value of this AbstractSelectionParameter to
defaultValue. |
void |
setDefaultSelected(int[] defaultSelection)
Sets the default selection of this MultiSelectionParameter to
defaultSelection. |
boolean |
setSelected(int idx,
boolean selected)
Sets the selection of option with no. |
boolean |
setSelected(String key,
boolean selected)
Sets the selection of the option with key key to the value
of selected. |
void |
setValue(Object value)
Sets the value of this Parameter to value. |
String |
valuesToString()
Returns a String representation of the set of values. |
| Methods inherited from class de.jstacs.parameters.AbstractSelectionParameter |
|---|
check, createParameterSet, equals, getErrorMessage, getParametersInCollection, getRangedInstance, isAtomic, isRangeable, isRequired, isSet, isUserSelected, setRangeable, toGalaxy |
| Methods inherited from class de.jstacs.parameters.Parameter |
|---|
getParent, isComparable, setParent |
| Methods inherited from class de.jstacs.AnnotatedEntity |
|---|
getComment, getDatatype, getName, toXML |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MultiSelectionParameter(DataType datatype,
String[] keys,
Object[] values,
String name,
String comment,
boolean required)
throws AbstractSelectionParameter.InconsistentCollectionException,
SimpleParameter.IllegalValueException,
SimpleParameter.DatatypeNotValidException
MultiSelectionParameter. The first
option in the selection is selected by default.
datatype - the data type of the parameters in the collectionkeys - the keys/names of the values in the collection, this is the
name the user will see in the user interfacevalues - the values the names stand for, this array must be of the same
length as keys, a key at a certain position
belongs to the value at the same position in the arrayname - the name of the parametercomment - a comment on the parameterrequired - true if the parameter is required,
false otherwise
InconsistentCollectionException - if the lengths of keys and values
are different or the collection is inconsistent for some
other reason
SimpleParameter.IllegalValueException - if one of the values in values is not of type
datatype
SimpleParameter.DatatypeNotValidException - if the datatype is not one of the allowed values
AbstractSelectionParameter.InconsistentCollectionExceptionpublic MultiSelectionParameter(DataType datatype,
String[] keys,
Object[] values,
String[] comments,
String name,
String comment,
boolean required)
throws AbstractSelectionParameter.InconsistentCollectionException,
SimpleParameter.IllegalValueException,
SimpleParameter.DatatypeNotValidException
MultiSelectionParameter. The first
option in the selection is selected by default.
datatype - the data type of the parameters in the collectionkeys - the keys/names of the values in the collection, this is the
name the user will see in the user interfacevalues - the values the names stand for, this array must be of the same
length as keys, a key at a certain position
belongs to the value at the same position in the arraycomments - the comments on the values in the collectionname - the name of the parametercomment - a comment on the parameterrequired - true if the parameter is required,
false otherwise
InconsistentCollectionException - if the lengths of keys and values
are different or the collection is inconsistent for some
other reason
SimpleParameter.IllegalValueException - if one of the values in values is not of type
datatype
SimpleParameter.DatatypeNotValidException - if the datatype is not one of the allowed values
AbstractSelectionParameter.InconsistentCollectionExceptionpublic MultiSelectionParameter(String name,
String comment,
boolean required,
ParameterSet... values)
MultiSelectionParameter from an array of
ParameterSets. The first option in the selection is selected by
default.
values - the options/values in the collectionname - the name of this MultiSelectionParametercomment - the comment on this MultiSelectionParameterrequired - true if this
MultiSelectionParameter is required,
false otherwisepublic MultiSelectionParameter(String name,
String comment,
boolean required,
Class<? extends ParameterSet>... values)
MultiSelectionParameter from an array of
Classes of ParameterSets. The first option in the selection is selected by
default. It is the lazy evaluation variant of MultiSelectionParameter(String, String, boolean, ParameterSet...),
i.e., the ParameterSets are only created if necessary.
values - the array of Classes of ParameterSetsname - the name of this MultiSelectionParametercomment - the comment on this MultiSelectionParameterrequired - true if this
MultiSelectionParameter is required,
false otherwisepublic MultiSelectionParameter(StringBuffer representation)
throws NonParsableException
Storable.
Creates a new MultiSelectionParameter from its XML
representation
representation - the XML representation as StringBuffer
NonParsableException - if the StringBuffer representation could
not be parsed| Method Detail |
|---|
public MultiSelectionParameter clone()
throws CloneNotSupportedException
clone in class AbstractSelectionParameterCloneNotSupportedExceptionpublic boolean setSelected(String key,
boolean selected)
key to the value
of selected.
key - the key of the optionselected - the selection value
true if the key could be found and set,
false otherwisepublic boolean isSelected(String key)
key.
key - the key of the option
false if no such option
existspublic Object getValueFor(String key)
key.
key - the key of the option
null if the corresponding option either
does not exist or is not selectedpublic boolean checkValue(Object value)
AbstractSelectionParametertrue if the key specified by value is
in the set of keys of this AbstractSelectionParameter.
checkValue in class AbstractSelectionParametervalue - the value to be checked
true if the key specified by value is
in the set of keys of this AbstractSelectionParameter,
false otherwisepublic void setValue(Object value)
throws SimpleParameter.IllegalValueException
ParameterParameter to value.
setValue in class Parametervalue - the new value of the Parameter
SimpleParameter.IllegalValueException - if the specified value is not valid for this
Parameterpublic int[] getSelected()
public boolean setSelected(int idx,
boolean selected)
idx to
selected.
idx - the index of the optionselected - the selection value
true if the option exists and could be set,
false otherwisepublic boolean isSelected(int idx)
AbstractSelectionParametertrue if the option at position idx is
selected.
isSelected in class AbstractSelectionParameteridx - the position
true if the option at position idx is
selected, false otherwisepublic Object getValueFor(int idx)
idx.
idx - the index of the option
null if the corresponding option either
does not exists or is not selectedpublic Object[] getValues()
public Object getValue()
AnnotatedEntityAnnotatedEntity.
getValue in class AnnotatedEntityAnnotatedEntitypublic boolean hasDefaultOrIsSet()
Parametertrue if the parameter either has a default value or
the value was set by the user, false otherwise.
hasDefaultOrIsSet in class Parametertrue if value has a default value or was set,
false otherwisepublic void reset()
Parameternull if no defaults are given.
reset in class Parameterpublic void setDefault(Object defaultValue)
throws SimpleParameter.IllegalValueException
AbstractSelectionParameterAbstractSelectionParameter to
defaultValue. This method also sets the current
value of this AbstractSelectionParameter to the default
and resets it such that AbstractSelectionParameter.isUserSelected()
returns false.
setDefault in class AbstractSelectionParameterdefaultValue - the default value
SimpleParameter.IllegalValueExceptionpublic void setDefaultSelected(int[] defaultSelection)
MultiSelectionParameter to
defaultSelection. This method also sets the current
selection of this MultiSelectionParameter to the default
and resets it such that AbstractSelectionParameter.isUserSelected()
returns false.
defaultSelection - the new default selectionpublic String getXMLTag()
AnnotatedEntity
getXMLTag in class AnnotatedEntityprotected void appendFurtherInfos(StringBuffer sup)
AnnotatedEntityStorable.toXML() to extract
further information (name, comment, datatype).
appendFurtherInfos in class AbstractSelectionParametersup - a XML representation of the main information as
StringBufferStorable.toXML()protected void extractFurtherInfos(StringBuffer representation)
throws NonParsableException
AnnotatedEntityStringBuffer to
extract the further information.
extractFurtherInfos in class AbstractSelectionParameterrepresentation - a XML represenation of the main information as
StringBuffer
NonParsableException - if the XML representation is not parsableAnnotatedEntity.AnnotatedEntity(StringBuffer)public boolean next()
throws ParameterException
RangeIterator
next in interface RangeIteratortrue if the next element exists, false
otherwise
ParameterException - if the next value could not be fetchedpublic void resetToFirst()
RangeIterator
resetToFirst in interface RangeIteratorpublic int getNumberOfValues()
RangeIterator
getNumberOfValues in interface RangeIteratorpublic int getNumberOfNexts(int afterIdx)
next() that can be called
before false is returned.
afterIdx - the index after which shall be counted
next()public String valuesToString()
RangeIteratorString representation of the set of values.
valuesToString in interface RangeIteratorString representationpublic boolean isRanged()
RangeIteratortrue if this RangeIterator is ranging over a
set of values.
isRanged in interface RangeIteratortrue if this RangeIterator is ranging over a
set of values, false otherwisepublic boolean hasDefault()
AbstractSelectionParametertrue, if this AbstractSelectionParameter has a
default value.
hasDefault in class AbstractSelectionParameterAbstractSelectionParameter has a default valueAbstractSelectionParameter.setDefault(Object)public void fromGalaxy(String namePrefix,
StringBuffer command)
throws Exception
GalaxyConvertiblecommand in the format defined by configBuffer of GalaxyConvertible.toGalaxy(String, String, int, StringBuffer, StringBuffer)
and sets the values of the Parameter or ParameterSet accordingly.
fromGalaxy in interface GalaxyConvertiblenamePrefix - the prefix of the variable namecommand - the command string
Exception - if the command string could not be parsed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||