public class ArrayParameterSet extends ExpandableParameterSet
ParameterSet
that consists of a length-Parameter
that defines the length of the array and an array of
ParameterSetContainer
s of this length. Each
ParameterSetContainer
in the array holds a ParameterSet
as
defined by a template. The template is cloned in order to obtain the
specified number of elements in the array. The class takes care of the
consistency of the length-Parameter
and the length of the array.ParameterSet.ParameterList
commentTemplate, nameTemplate, template
errorMessage, parameters, parent
Constructor and Description |
---|
ArrayParameterSet(ParameterSet template,
String nameTemplate,
String commentTemplate)
Creates a new
ArrayParameterSet from a Class that can be
instantiated using this ArrayParameterSet and templates for the
ParameterSet in each element of the array, the name and the
comment that are displayed for the ParameterSetContainer s
enclosing the ParameterSet s. |
ArrayParameterSet(ParameterSet template,
String nameTemplate,
String commentTemplate,
String lengthName,
String lengthComment,
NumberValidator<Integer> allowedLengths)
Creates a new
ArrayParameterSet from a Class that can be
instantiated using this ArrayParameterSet and templates for the
ParameterSet in each element of the array, the name and the
comment that are displayed for the ParameterSetContainer s
enclosing the ParameterSet s. |
ArrayParameterSet(StringBuffer representation)
The standard constructor for the interface
Storable . |
Modifier and Type | Method and Description |
---|---|
protected void |
fromXML(StringBuffer representation)
Parses the instance fields of a
ParameterSet from the XML
representation as returned by ParameterSet.toXML() . |
int |
getNumberOfParameters()
Returns the number of parameters in the
ParameterSet . |
Parameter |
getParameterAt(int i)
Returns the
Parameter at position i . |
boolean |
hasDefaultOrIsSet()
Returns
true if all parameters in this ParameterSet
are either set by the user or have default values. |
void |
setLength(int length) |
StringBuffer |
toXML()
This method returns an XML representation as
StringBuffer of an
instance of the implementing class. |
addParameterToSet, clone, fromGalaxy, parameterRemovable, removeParameterFromSet, replaceContentWith, toGalaxy
getAllParameterNames, getComment, getComment, getErrorMessage, getIndex, getName, getName, getParameterForName, getParent, initParameterList, initParameterList, isAtomic, isComparable, parametersLoaded, reset, setParent
public ArrayParameterSet(ParameterSet template, String nameTemplate, String commentTemplate, String lengthName, String lengthComment, NumberValidator<Integer> allowedLengths) throws CloneNotSupportedException, SimpleParameter.IllegalValueException
ArrayParameterSet
from a Class
that can be
instantiated using this ArrayParameterSet
and templates for the
ParameterSet
in each element of the array, the name and the
comment that are displayed for the ParameterSetContainer
s
enclosing the ParameterSet
s.template
- the template of the ParameterSet
nameTemplate
- the name-templatecommentTemplate
- the comment-templatelengthName
- the name of the length-Parameter
lengthComment
- the comment of the length-Parameter
allowedLengths
- a NumberValidator
to set a lower and upper bound on
the number of elements in the arrayCloneNotSupportedException
- if the templace could not be clonedSimpleParameter.IllegalValueException
- if the values of allowedLengths
are not allowed values
of the length parameterpublic ArrayParameterSet(ParameterSet template, String nameTemplate, String commentTemplate) throws SimpleParameter.IllegalValueException, CloneNotSupportedException
ArrayParameterSet
from a Class
that can be
instantiated using this ArrayParameterSet
and templates for the
ParameterSet
in each element of the array, the name and the
comment that are displayed for the ParameterSetContainer
s
enclosing the ParameterSet
s.template
- the template of the ParameterSet
nameTemplate
- the name-templatecommentTemplate
- the comment-templateCloneNotSupportedException
- if the template could not be clonedSimpleParameter.IllegalValueException
- if the values of allowedLengths
are not allowed values
of the length parameterpublic ArrayParameterSet(StringBuffer representation) throws NonParsableException
Storable
.
Creates a new ArrayParameterSet
from its XML representation.representation
- the XML representation as StringBuffer
NonParsableException
- if the StringBuffer
representation
could
not be parsedpublic void setLength(int length) throws SimpleParameter.IllegalValueException, CloneNotSupportedException
public int getNumberOfParameters()
ParameterSet
ParameterSet
.getNumberOfParameters
in class ParameterSet
ParameterSet
public Parameter getParameterAt(int i)
ParameterSet
Parameter
at position i
.getParameterAt
in class ParameterSet
i
- the position in the ParameterSet
Parameter
at position i
public boolean hasDefaultOrIsSet()
ParameterSet
true
if all parameters in this ParameterSet
are either set by the user or have default values. If any additional
constraints are required on your parameters you should either specify
some ParameterValidator
on these parameters or implement these
constraints by overriding this method in your implementation of
ParameterSet
. It is recommended to specify a useful remark which
constraint failed in the member-variable errorMessage
, which
will be displayed to the user. In the overriding method
super.
ParameterSet.hasDefaultOrIsSet()
should be called prior to
checking specific constraints.hasDefaultOrIsSet
in class ParameterSet
true
if all parameters have some allowed value set,
false
otherwiseprotected void fromXML(StringBuffer representation) throws NonParsableException
ParameterSet
ParameterSet
from the XML
representation as returned by ParameterSet.toXML()
.fromXML
in class ExpandableParameterSet
representation
- the XML representation as StringBuffer
NonParsableException
- if the XML code could not be parsedParameterSet.toXML()
public StringBuffer toXML()
Storable
StringBuffer
of an
instance of the implementing class.toXML
in interface Storable
toXML
in class ExpandableParameterSet