public class SimpleParameter extends Parameter implements Rangeable, GalaxyConvertible
Strings.| Modifier and Type | Class and Description |
|---|---|
static class |
SimpleParameter.DatatypeNotValidException
|
static class |
SimpleParameter.IllegalValueException
This exception is thrown if a parameter is not valid.
|
| Modifier and Type | Field and Description |
|---|---|
protected Object |
defaultValue
The default value of the parameter
|
protected boolean |
required
Determines if the parameter is required
|
protected ParameterValidator |
validator
The validator for the parameter values
|
protected Object |
value
The current value of the parameter
|
comment, datatype, name| Constructor and Description |
|---|
SimpleParameter(DataType datatype,
String name,
String comment,
boolean required)
Constructor for a
SimpleParameter without
ParameterValidator. |
SimpleParameter(DataType datatype,
String name,
String comment,
boolean required,
Object defaultVal)
Constructor for a
SimpleParameter without
ParameterValidator but with a default value. |
SimpleParameter(DataType datatype,
String name,
String comment,
boolean required,
ParameterValidator validator)
Constructor for a
SimpleParameter with a
ParameterValidator. |
SimpleParameter(DataType datatype,
String name,
String comment,
boolean required,
ParameterValidator validator,
Object defaultVal)
Constructor for a
SimpleParameter with validator and default
value. |
SimpleParameter(StringBuffer representation)
The standard constructor for the interface
Storable. |
| 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). |
boolean |
checkValue(Object value)
Checks the value for correctness, e.g.
|
SimpleParameter |
clone() |
protected String |
dataTypeToGalaxy()
Returns the Galaxy identifier for the
DataType of this parameter |
boolean |
equals(Object o2) |
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. |
String |
getErrorMessage()
If a value could not be set successfully this method returns the
corresponding error message.
|
Parameter |
getRangedInstance()
Returns an instance of
RangeIterator that has the same properties
as the current instance, but accepts a range or list of values. |
ParameterValidator |
getValidator()
Returns the
ParameterValidator used in this
SimpleParameter. |
Object |
getValue()
Returns the value of the
AnnotatedEntity. |
String |
getXMLTag()
This method returns a tag used as outer tag of the XML description.
|
boolean |
hasDefaultOrIsSet()
Returns
true if the parameter either has a default value or
the value was set by the user, false otherwise. |
boolean |
isAtomic()
Returns
true if the parameter is of an atomic data type,
false otherwise. |
boolean |
isRangeable()
Returns
true if the parameters can be varied over a range of
values. |
boolean |
isRequired()
|
boolean |
isSet()
Returns
true if the parameter was set by the user,
false otherwise. |
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 the
Parameter to
defaultValue. |
void |
setRangeable(boolean rangeable)
Sets the value returned by
isRangeable() to
rangeable. |
void |
setValidator(ParameterValidator validator)
Sets a new
ParameterValidator for this SimpleParameter. |
void |
setValue(Object value2)
Sets the value of this
Parameter to value. |
void |
toGalaxy(String namePrefix,
String configPrefix,
int depth,
StringBuffer descBuffer,
StringBuffer configBuffer,
boolean addLine)
Creates an Galaxy XML-representation of the parameters and appends it to
descBuffer
and variable configuration and appends it to configBuffer. |
String |
toString() |
getParent, isComparable, setParentgetComment, getDatatype, getName, toXMLprotected boolean required
protected Object value
protected Object defaultValue
protected ParameterValidator validator
public SimpleParameter(StringBuffer representation) throws NonParsableException
Storable.
Constructs a SimpleParameter out of an XML representation.representation - the XML representation as StringBufferNonParsableException - if the SimpleParameter could not be restored from the
StringBuffer representationpublic SimpleParameter(DataType datatype, String name, String comment, boolean required) throws SimpleParameter.DatatypeNotValidException
SimpleParameter without
ParameterValidator.datatype - the data type of the parameter valuename - the name of the parametercomment - a comment on the parameter that tells the user some details
about itrequired - determines if the parameter is requiredSimpleParameter.DatatypeNotValidException - if datatype is not one of the allowed
DataTypespublic SimpleParameter(DataType datatype, String name, String comment, boolean required, Object defaultVal) throws SimpleParameter.DatatypeNotValidException, SimpleParameter.IllegalValueException
SimpleParameter without
ParameterValidator but with a default value.datatype - the data type of the parameter valuename - the name of the parametercomment - a comment on the parameter that tells the user some details
about itrequired - determines if the parameter is requireddefaultVal - the default valueSimpleParameter.DatatypeNotValidException - if datatype is not in
the values allowed for a SimpleParameterSimpleParameter.IllegalValueException - if the default value is not a valid value with respect
to datatypepublic SimpleParameter(DataType datatype, String name, String comment, boolean required, ParameterValidator validator) throws SimpleParameter.DatatypeNotValidException
SimpleParameter with a
ParameterValidator.datatype - the data type of the parameter valuename - the name of the parametercomment - a comment on the parameter that tells the user some details
about itrequired - determines if the parameter is requiredvalidator - the validator for the parameter valuesSimpleParameter.DatatypeNotValidException - if datatype is not in the values allowed for a
SimpleParameterpublic SimpleParameter(DataType datatype, String name, String comment, boolean required, ParameterValidator validator, Object defaultVal) throws ParameterException
SimpleParameter with validator and default
value.datatype - the data type of the parameter valuename - the name of the parametercomment - a comment on the parameter that tells the user some details
about itrequired - determines if the parameter is requiredvalidator - the validator for the parameter valuesdefaultVal - the default valueParameterException - if either the default value is not a valid value with respect
to datatype or datatype is not in
the values allowed for a SimpleParameterpublic SimpleParameter clone() throws CloneNotSupportedException
clone in class ParameterCloneNotSupportedExceptionpublic 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 boolean isSet()
Parametertrue if the parameter was set by the user,
false otherwise.public boolean isRangeable()
Rangeabletrue if the parameters can be varied over a range of
values.isRangeable in interface Rangeabletrue if the parameter can be varied,
false otherwisepublic void setRangeable(boolean rangeable)
isRangeable() to
rangeable.rangeable - the new value that determines if this SimpleParameter
is rangeablepublic Parameter getRangedInstance() throws Exception
RangeableRangeIterator that has the same properties
as the current instance, but accepts a range or list of values. These
values can be obtained by the methods of RangeIterator.getRangedInstance in interface RangeableException - is thrown if Rangeable.isRangeable() returns
false or the ranged instance could not be
created for some other reasonpublic boolean isAtomic()
Parametertrue if the parameter is of an atomic data type,
false otherwise.public boolean isRequired()
ParameterisRequired in class Parametertrue if the Parameter is required,
false otherwisepublic boolean checkValue(Object value)
ParametercheckValue in class Parametervalue - the value to be checkedtrue if the value is valid, false
otherwisepublic String getErrorMessage()
ParametergetErrorMessage in class Parameterpublic void setDefault(Object defaultValue) throws SimpleParameter.IllegalValueException
ParameterParameter to
defaultValue. This method also sets the current
value of this Parameter to the default.setDefault in class ParameterdefaultValue - the default valueSimpleParameter.IllegalValueExceptionpublic void reset()
Parameternull if no defaults are given.public void setValue(Object value2) throws SimpleParameter.IllegalValueException
ParameterParameter to value.setValue in class Parametervalue2 - the new value of the ParameterSimpleParameter.IllegalValueException - if the specified value is not valid for this
Parameterpublic Object getValue()
AnnotatedEntityAnnotatedEntity.getValue in class AnnotatedEntityAnnotatedEntitypublic String getXMLTag()
AnnotatedEntitygetXMLTag in class AnnotatedEntityprotected void appendFurtherInfos(StringBuffer buf)
AnnotatedEntityStorable.toXML() to extract
further information (name, comment, datatype).appendFurtherInfos in class Parameterbuf - 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 Parameterrepresentation - a XML represenation of the main information as
StringBufferNonParsableException - if the XML representation is not parsableAnnotatedEntity.AnnotatedEntity(StringBuffer)public ParameterValidator getValidator()
SimpleParameterpublic void setValidator(ParameterValidator validator)
ParameterValidator for this SimpleParameter.validator - the new parameter validatorpublic void toGalaxy(String namePrefix, String configPrefix, int depth, StringBuffer descBuffer, StringBuffer configBuffer, boolean addLine) throws Exception
GalaxyConvertibledescBuffer
and variable configuration and appends it to configBuffer. The variable configuration
is also used to parse user-supplied values returned by Galaxy.toGalaxy in interface GalaxyConvertiblenamePrefix - the prefix of the variable name used in GalaxyconfigPrefix - the prefix for conditionalsdepth - the depth in the parameter hierarchy, used for graphical representation of nestingdescBuffer - the buffer for the parameter descriptionconfigBuffer - the buffer for the configuration lineaddLine - if true, a line is added before the title of a parameterException - if the conversion failsprotected String dataTypeToGalaxy()
DataType of this parameterpublic 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