public class ExpandableParameterSet extends ParameterSet
ParameterSet
that can be expanded by additional
Parameter
s at runtime. The Parameter
s are all of type
ParameterSetContainer
. The contents of these Parameter
s are
provided by a ParameterSet
-template, which is cloned each time
addParameterToSet()
is called and set as value of a
ParameterSetContainer
that is added to the Parameter
s of the
ExpandableParameterSet
. Already added Parameter
s can also be
removed from the set using removeParameterFromSet()
.ParameterSet.ParameterList
Modifier and Type | Field and Description |
---|---|
protected String |
commentTemplate
A template for the comment of the enclosing
ParameterSetContainer |
protected String |
nameTemplate
A template for the name of the enclosing
ParameterSetContainer |
protected ParameterSet |
template
The template for each
ParameterSet |
errorMessage, parameters, parent
Constructor and Description |
---|
ExpandableParameterSet(ParameterSet[] templateAndContent,
String nameTemplate,
String commentTemplate)
Creates a new
ExpandableParameterSet from a ParameterSet
-array. |
ExpandableParameterSet(ParameterSet template,
String nameTemplate,
String commentTemplate)
Creates a new
ExpandableParameterSet from a Class that
can be instantiated using this ExpandableParameterSet 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. |
ExpandableParameterSet(ParameterSet template,
String nameTemplate,
String commentTemplate,
int initCount)
Creates a new
ExpandableParameterSet from a Class that
can be instantiated using this ExpandableParameterSet 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. |
ExpandableParameterSet(StringBuffer representation)
The standard constructor for the interface
Storable . |
Modifier and Type | Method and Description |
---|---|
void |
addParameterToSet()
Adds a new
ParameterSetContainer containing a clone of the
ParameterSet -template to the set of Parameter s. |
ExpandableParameterSet |
clone()
Creates a full clone (deep copy) of this
ParameterSet . |
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 void |
fromXML(StringBuffer representation)
Parses the instance fields of a
ParameterSet from the XML
representation as returned by ParameterSet.toXML() . |
boolean |
parameterRemovable()
Returns
true if there is still a Parameter that can
be removed from the set. |
void |
removeParameterFromSet()
Removes the last
Parameter from set. |
boolean |
replaceContentWith(ParameterSet[] paramSetArray)
First removes all previous added
ParameterSetContainer s and
afterwards adds all given ParameterSet s (in the given order)
enclosed in new ParameterSetContainer s. |
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 . |
StringBuffer |
toXML()
This method returns an XML representation as
StringBuffer of an
instance of the implementing class. |
getAllParameterNames, getComment, getComment, getErrorMessage, getIndex, getName, getName, getNumberOfParameters, getParameterAt, getParameterForName, getParent, hasDefaultOrIsSet, initParameterList, initParameterList, isAtomic, isComparable, parametersLoaded, reset, setParent
protected ParameterSet template
ParameterSet
protected String nameTemplate
ParameterSetContainer
protected String commentTemplate
ParameterSetContainer
public ExpandableParameterSet(ParameterSet template, String nameTemplate, String commentTemplate) throws CloneNotSupportedException
ExpandableParameterSet
from a Class
that
can be instantiated using this ExpandableParameterSet
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 clonedpublic ExpandableParameterSet(ParameterSet template, String nameTemplate, String commentTemplate, int initCount) throws CloneNotSupportedException
ExpandableParameterSet
from a Class
that
can be instantiated using this ExpandableParameterSet
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-templateinitCount
- the number of initial copies of the templateCloneNotSupportedException
- if the template could not be clonedpublic ExpandableParameterSet(StringBuffer representation) throws NonParsableException
Storable
.
Creates a new ExpandableParameterSet
from its XML representation.representation
- the XML represenation as StringBuffer
NonParsableException
- if the StringBuffer
representation
could
not be parsedpublic ExpandableParameterSet(ParameterSet[] templateAndContent, String nameTemplate, String commentTemplate)
ExpandableParameterSet
from a ParameterSet
-array. The first element of this array is taken as a template for
further calls of addParameterToSet()
.templateAndContent
- the content (and template)nameTemplate
- the name-templatecommentTemplate
- the comment-templatepublic ExpandableParameterSet clone() throws CloneNotSupportedException
ParameterSet
ParameterSet
. As a
convenience-method the user can use
fillWithStandardFieldsForClone(ParameterSet)
on a newly
created instance of a subclass of ParameterSet
to obtain a
clone/copy of all standard member variables (those already defined in
ParameterSet
) in the passed ParameterSet
. Using this
method, the cloning process becomes merely three-step:ParameterSet
, most
likely with an empty constructor or the one taking just the instance
class.
this.fillWithStandardFieldsForClone
on this
instance.
Object
's method
Object.clone()
.clone
in class ParameterSet
ParameterSet
CloneNotSupportedException
public void addParameterToSet() throws CloneNotSupportedException
ParameterSetContainer
containing a clone of the
ParameterSet
-template to the set of Parameter
s.CloneNotSupportedException
- if the template could not be clonedpublic boolean replaceContentWith(ParameterSet[] paramSetArray)
ParameterSetContainer
s and
afterwards adds all given ParameterSet
s (in the given order)
enclosed in new ParameterSetContainer
s.paramSetArray
- the ParameterSet
s to be settrue
, if all given ParameterSet
s are of the
same class as the defined template-ParameterSet
of this
ExpandableParameterSet
, false
otherwise (In
this case, neither the previous added
ParameterSetContainer
s are removed nor is any given
ParameterSet
added. Hence the
ExpandableParameterSet
stays unchanged.)public boolean parameterRemovable()
true
if there is still a Parameter
that can
be removed from the set.true
if a Parameter
can be removed from the setpublic void removeParameterFromSet()
Parameter
from set.public StringBuffer toXML()
Storable
StringBuffer
of an
instance of the implementing class.toXML
in interface Storable
toXML
in class ParameterSet
protected void fromXML(StringBuffer representation) throws NonParsableException
ParameterSet
ParameterSet
from the XML
representation as returned by ParameterSet.toXML()
.fromXML
in class ParameterSet
representation
- the XML representation as StringBuffer
NonParsableException
- if the XML code could not be parsedParameterSet.toXML()
public void toGalaxy(String namePrefix, String configPrefix, int depth, StringBuffer descBuffer, StringBuffer configBuffer, boolean addLine) throws Exception
GalaxyConvertible
descBuffer
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 GalaxyConvertible
toGalaxy
in class ParameterSet
namePrefix
- 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
GalaxyConvertible
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.fromGalaxy
in interface GalaxyConvertible
fromGalaxy
in class ParameterSet
namePrefix
- the prefix of the variable namecommand
- the command stringException
- if the command string could not be parsed