public class SelectionParameter extends AbstractSelectionParameter implements Rangeable, GalaxyConvertible
ParameterSet.ParameterSetAbstractSelectionParameter.InconsistentCollectionExceptionerrorMessage, parameters, userSelectedcomment, datatype, name| Constructor and Description |
|---|
SelectionParameter(DataType datatype,
String[] keys,
Object[] values,
String[] comments,
String name,
String comment,
boolean required)
Constructor for a
SelectionParameter. |
SelectionParameter(DataType datatype,
String[] keys,
Object[] values,
String name,
String comment,
boolean required)
Constructor for a
SelectionParameter. |
SelectionParameter(StringBuffer representation)
The standard constructor for the interface
Storable. |
SelectionParameter(String name,
String comment,
boolean required,
Class<? extends ParameterSet>... values)
|
SelectionParameter(String name,
String comment,
boolean required,
ParameterSet... values)
Constructor for a
SelectionParameter from an array of
ParameterSets. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
appendFurtherInfos(StringBuffer buf)
This method can be used in the method
Storable.toXML() to extract
further information (name, comment, datatype). |
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, boolean)
and sets the values of the Parameter or ParameterSet accordingly. |
protected int |
getDefault()
Returns the index of the default selected value.
|
String |
getErrorMessage()
If a value could not be set successfully this method returns the
corresponding error message.
|
int |
getSelected()
Returns the index of the selected value.
|
Object |
getValue()
Returns the value of the
AnnotatedEntity. |
String |
getXMLTag()
This method returns a tag used as outer tag of the XML description.
|
boolean |
hasDefault()
Returns
true, if this SelectionParameter 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 |
isSelected(int idx)
Returns
true if the option at position idx is
selected. |
void |
reset()
Resets the parameter and its contents to the default values or
null if no defaults are given. |
void |
setDefault(Object defaultValue)
Sets the default value of this
AbstractSelectionParameter to
defaultValue. |
void |
setValue(Object value)
Sets the selected value to the one that is specified by the key
value. |
String |
toString() |
check, checkValue, clone, createParameterSet, equals, getParametersInCollection, getRangedInstance, isAtomic, isComparable, isRangeable, isRequired, isSet, isUserSelected, setRangeable, toGalaxygetComment, getDatatype, getName, toXMLfinalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetRangedInstance, isRangeabletoGalaxypublic SelectionParameter(DataType datatype, String[] keys, Object[] values, String name, String comment, boolean required) throws AbstractSelectionParameter.InconsistentCollectionException, SimpleParameter.IllegalValueException, SimpleParameter.DatatypeNotValidException
SelectionParameter.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 this SelectionParameter is
required, false otherwiseInconsistentCollectionException - if the length of keys and the
values is different or the collection is
inconsistent for some other reasonSimpleParameter.IllegalValueException - if one of the values in values is not of type
datatypeSimpleParameter.DatatypeNotValidException - if the datatype is not one of the allowed valuesAbstractSelectionParameter.InconsistentCollectionExceptionAbstractSelectionParameter.AbstractSelectionParameter(DataType, String[], Object[], String[], String, String, boolean)public SelectionParameter(DataType datatype, String[] keys, Object[] values, String[] comments, String name, String comment, boolean required) throws AbstractSelectionParameter.InconsistentCollectionException, SimpleParameter.IllegalValueException, SimpleParameter.DatatypeNotValidException
SelectionParameter.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 possible valuesname - the name of the parametercomment - a comment on the parameterrequired - true if the SelectionParameter is
required, false otherwiseInconsistentCollectionException - if the length of keys and values is
different or the collection is inconsistent for some other
reasonSimpleParameter.IllegalValueException - if one of the values in values is not of type
datatypeSimpleParameter.DatatypeNotValidException - if the datatype is not one of the allowed valuesAbstractSelectionParameter.InconsistentCollectionExceptionAbstractSelectionParameter.createParameterSet(Object[], String[], String[])public SelectionParameter(String name, String comment, boolean required, ParameterSet... values)
SelectionParameter from an array of
ParameterSets. This constructor can be used to easily construct a
SelectionParameter that lets the user select from a list of
possible options that all require an own set of Parameters to be
instantiated.values - the array of ParameterSetsname - the name of the parametercomment - a comment on the parameterrequired - true if the parameter is required,
false otherwiseAbstractSelectionParameter.createParameterSet(Object[], String[], String[])public SelectionParameter(String name, String comment, boolean required, Class<? extends ParameterSet>... values)
SelectionParameter from an array of
Classes of ParameterSets. This constructor can be used to easily construct a
SelectionParameter that lets the user select from a list of
possible options that all require an own set of Parameters to be
instantiated. It is the lazy evaluation variant of SelectionParameter(String, String, boolean, ParameterSet...),
i.e., the ParameterSets are only created if necessary.values - the array of Classes of ParameterSetsname - the name of the parametercomment - a comment on the parameterrequired - true if the parameter is required,
false otherwiseAbstractSelectionParameter.createParameterSet(Object[], String[], String[])public SelectionParameter(StringBuffer representation) throws NonParsableException
Storable.
Restores an instance of SelectionParameter from a XML
representation.representation - the XML representation as StringBufferNonParsableException - if the StringBuffer representation could
not be parsedpublic boolean hasDefault()
true, if this SelectionParameter has a
default value.hasDefault in class AbstractSelectionParameterSelectionParameter has a default valueAbstractSelectionParameter.setDefault(Object)public 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 String getErrorMessage()
ParametergetErrorMessage in class AbstractSelectionParameterpublic String getXMLTag()
AnnotatedEntitygetXMLTag in class AnnotatedEntityprotected void appendFurtherInfos(StringBuffer buf)
AnnotatedEntityStorable.toXML() to extract
further information (name, comment, datatype).appendFurtherInfos in class AbstractSelectionParameterbuf - 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
StringBufferNonParsableException - if the XML representation is not parsableAnnotatedEntity.AnnotatedEntity(StringBuffer)public boolean isSelected(int idx)
true if the option at position idx is
selected.isSelected in class AbstractSelectionParameteridx - the positiontrue if the option at position idx is
selected, false otherwisepublic int getSelected()
protected int getDefault()
public void setValue(Object value) throws SimpleParameter.IllegalValueException
value.setValue in class Parametervalue - the key of the desired valueSimpleParameter.IllegalValueException - if the specified value is not valid for this
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 valueSimpleParameter.IllegalValueExceptionpublic void reset()
Parameternull if no defaults are given.public Object getValue()
AnnotatedEntityAnnotatedEntity.getValue in class AnnotatedEntityAnnotatedEntitypublic void fromGalaxy(String namePrefix, StringBuffer command) throws Exception
GalaxyConvertiblecommand in the format defined by configBuffer of GalaxyConvertible.toGalaxy(String, String, int, StringBuffer, StringBuffer, boolean)
and sets the values of the Parameter or ParameterSet accordingly.fromGalaxy in interface GalaxyConvertiblenamePrefix - the prefix of the variable namecommand - the command stringException - if the command string could not be parsed