public class RangeParameter extends Parameter implements RangeIterator, GalaxyConvertible
SimpleParameters to be set
to a set of values.RangeParameter
works just like a plain SimpleParameter. SimpleParameters
that are used to construct a RangeParameter must be rangeable, i.e.
their method SimpleParameter.isRangeable() must return
true, or they will be rejected.| Modifier and Type | Class and Description |
|---|---|
static class |
RangeParameter.RangeType
The possible types of defining ranges for a
RangeParameter. |
static class |
RangeParameter.Scale
|
comment, datatype, name| Constructor and Description |
|---|
RangeParameter(SimpleParameter par)
Constructs a
RangeParameter from a SimpleParameter that
is rangeable. |
RangeParameter(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.
|
RangeParameter |
clone() |
protected void |
extractFurtherInfos(StringBuffer buf)
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. |
static EnumParameter |
getCollectionOfScales()
Returns a
EnumParameter that allows the user to choose
between different scales. |
Object |
getEndValue()
Returns the last value of a range of parameter values or
null if no range was specified. |
String |
getErrorMessage()
If a value could not be set successfully this method returns the
corresponding error message.
|
String |
getList()
Returns a list of all parameter values as a
String or
null if no parameter values have been set. |
int |
getNumberOfNexts(int afterIndex)
Returns the number of calls of
next() that can be done before
obtaining false. |
int |
getNumberOfValues()
Returns the number of values in a list or range of parameter values.
|
String |
getScale()
Returns a description of the the scale of a range of parameter values.
|
Object |
getStartValue()
Returns the start value of a range of parameter values or
null if no range was specified. |
int |
getSteps()
Returns the number of steps of a range of parameter values or
0 if no range was specified. |
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 |
isRanged()
Returns
true if this RangeIterator is ranging over a
set of values. |
boolean |
isRequired()
|
boolean |
isSet()
Returns
true if the parameter was set by the user,
false otherwise. |
boolean |
next()
|
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 the
Parameter to
defaultValue. |
void |
setValue(Object value)
Sets the value of this
Parameter to value. |
void |
setValues(Object startValue,
int steps,
Object endValue,
RangeParameter.Scale scale)
Sets the values of this
RangeParameter as a range of values,
specified by a start value, a last value, a number of steps between these
values (without the last value) and a scale in that the values between
the first and the last value are chosen. |
void |
setValues(String values)
Sets a list of values from a
String containing a space separated
list of values. |
void |
setValuesInLogScale(boolean log,
double radix,
Object startValue,
int steps,
Object endValue)
This method enables you to set a list of values in an easy manner.
|
RangeParameter.RangeType |
shallBeRanged()
|
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 |
valuesToString()
Returns a
String representation of the set of values. |
getParent, isComparable, setParentgetComment, getDatatype, getName, toXMLpublic RangeParameter(SimpleParameter par) throws Exception
RangeParameter from a SimpleParameter that
is rangeable.par - the rangeable SimpleParameterException - if the SimpleParameter is not rangeable, i.e. its
method SimpleParameter.isRangeable() returns
falsepublic RangeParameter(StringBuffer representation) throws NonParsableException
Storable.
Restores a RangeParameter from its XML representation.representation - the XML representation as StringBufferNonParsableException - if the StringBuffer representation could
not be parsedpublic RangeParameter clone() throws CloneNotSupportedException
clone in class ParameterCloneNotSupportedExceptionpublic static EnumParameter getCollectionOfScales() throws ParameterException
EnumParameter that allows the user to choose
between different scales.EnumParameterParameterException - if the EnumParameter could, or if one of the
possible values of the SelectionParameter was not
legalpublic String getList()
String or
null if no parameter values have been set.nullpublic Object getStartValue()
null if no range was specified.nullpublic Object getEndValue()
null if no range was specified.nullpublic int getSteps()
0 if no range was specified.0public String getScale()
RangeParameter.Scalepublic 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 void setValue(Object value) throws SimpleParameter.IllegalValueException
ParameterParameter to value.setValue in class Parametervalue - the new value of the ParameterSimpleParameter.IllegalValueException - if the specified value is not valid for this
Parameterpublic void setValues(String values) throws SimpleParameter.IllegalValueException
String containing a space separated
list of values. After this method has been called,
shallBeRanged() returns RangeParameter.RangeType.LIST.values - the space separated list of valuesSimpleParameter.IllegalValueException - if at least one of the values in the list is not suitable for
this RangeParameterpublic void setValues(Object startValue, int steps, Object endValue, RangeParameter.Scale scale) throws SimpleParameter.IllegalValueException
RangeParameter as a range of values,
specified by a start value, a last value, a number of steps between these
values (without the last value) and a scale in that the values between
the first and the last value are chosen. This scale must be one of
those listed in RangeParameter.Scale.startValue - the first value of the rangesteps - the number of steps between startValue and
endValue (exclusive)endValue - the last value of the rangescale - the RangeParameter.ScaleSimpleParameter.IllegalValueException - if one of the values is not suitable for this
RangeParameter, e.g. is out of a specified range of
allowed valuesRangeParameter.Scalepublic void setValuesInLogScale(boolean log,
double radix,
Object startValue,
int steps,
Object endValue)
throws SimpleParameter.IllegalValueException
[startValue,endValue] in (inverse) logarithmic scale.log - if true a logarithmic scale is used, otherwise
the inverse logarithmic scaleradix - the radix for the scalestartValue - the first value of the rangesteps - the number of steps between startValue and
endValue (exclusive)endValue - the last value of the rangeSimpleParameter.IllegalValueException - if some constraints are not fulfilledpublic Object getValue()
AnnotatedEntityAnnotatedEntity.getValue in class AnnotatedEntityAnnotatedEntitypublic boolean next()
throws SimpleParameter.IllegalValueException
next in interface RangeIteratortrue if the next element exists and can be fetched,
false otherwiseSimpleParameter.IllegalValueException - if the next value to be fetched is not validsetValue(Object)public int getNumberOfValues()
getNumberOfValues in interface RangeIteratorpublic int getNumberOfNexts(int afterIndex)
next() that can be done before
obtaining false.public RangeParameter.RangeType shallBeRanged()
RangeParameter.RangeTypepublic 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 isAtomic()
Parametertrue if the parameter is of an atomic data type,
false otherwise.public String getErrorMessage()
ParametergetErrorMessage in class Parameterpublic 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 buf) throws NonParsableException
AnnotatedEntityStringBuffer to
extract the further information.extractFurtherInfos in class Parameterbuf - a XML represenation of the main information as
StringBufferNonParsableException - if the XML representation is not parsableAnnotatedEntity.AnnotatedEntity(StringBuffer)public void reset()
Parameternull if no defaults are given.public void resetToFirst()
RangeIteratorresetToFirst in interface RangeIteratorpublic void setDefault(Object defaultValue) throws Exception
ParameterParameter to
defaultValue. This method also sets the current
value of this Parameter to the default.setDefault in class ParameterdefaultValue - the default valueException - if the default value is not an appropriate value for this
Parameterpublic 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 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 failspublic 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