|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.jstacs.parameters.ParameterSet
de.jstacs.parameters.ExpandableParameterSet
public class ExpandableParameterSet
A class for a ParameterSet that can be expanded by additional
Parameters at runtime. The Parameters are all of type
ParameterSetContainer. The contents of these Parameters 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 Parameters of the
ExpandableParameterSet. Already added Parameters can also be
removed from the set using removeParameterFromSet().
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class de.jstacs.parameters.ParameterSet |
|---|
ParameterSet.ParameterList |
| Field Summary | |
|---|---|
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 |
| Fields inherited from class de.jstacs.parameters.ParameterSet |
|---|
errorMessage, parameters, parent, ranged |
| Constructor Summary | |
|---|---|
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
ParameterSetContainers enclosing the ParameterSets. |
|
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
ParameterSetContainers enclosing the ParameterSets. |
|
ExpandableParameterSet(StringBuffer representation)
The standard constructor for the interface Storable. |
|
| Method Summary | |
|---|---|
void |
addParameterToSet()
Adds a new ParameterSetContainer containing a clone of the
ParameterSet-template to the set of Parameters. |
ExpandableParameterSet |
clone()
Creates a full clone (deep copy) of this ParameterSet. |
protected void |
fromXML(StringBuffer representation)
Parses the instance fields of a ParameterSet from the XML
representation as returned by ParameterSet.toXML(). |
protected void |
loadParameters()
Loads the parameters for this ParameterSet. |
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 ParameterSetContainers and
afterwards adds all given ParameterSets (in the given order)
enclosed in new ParameterSetContainers. |
protected void |
replaceParametersWithRangedInstance()
Replaces all Parameters in this ParameterSet by their
equivalents implementing the Rangeable interface. |
StringBuffer |
toXML()
This method returns an XML representation as StringBuffer of an
instance of the implementing class. |
| Methods inherited from class de.jstacs.parameters.ParameterSet |
|---|
getErrorMessage, getId, getIndex, getNumberOfParameters, getNumberOfValues, getParameterAt, getParent, hasDefaultOrIsSet, initParameterList, initParameterList, isAtomic, isRanged, makeRanged, next, parametersLoaded, propagateId, recieveId, reset, resetToFirst, setParent, simplify, valuesToString |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ParameterSet template
ParameterSet
protected String nameTemplate
ParameterSetContainer
protected String commentTemplate
ParameterSetContainer
| Constructor Detail |
|---|
public ExpandableParameterSet(ParameterSet template,
String nameTemplate,
String commentTemplate)
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
ParameterSetContainers enclosing the ParameterSets.
Initially, the method loadParameters() creates one copy of the
template.
template - the template of the ParameterSetnameTemplate - the name-templatecommentTemplate - the comment-template
public ExpandableParameterSet(ParameterSet template,
String nameTemplate,
String commentTemplate,
int initCount)
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
ParameterSetContainers enclosing the ParameterSets. Using
this constructor, the method loadParameters() initially creates
initCount copies of the template.
template - the template of the ParameterSetnameTemplate - the name-templatecommentTemplate - the comment-templateinitCount - the number of initial copies of the template
public 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 parsed
public 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-template| Method Detail |
|---|
public ExpandableParameterSet clone()
throws CloneNotSupportedException
ParameterSetParameterSet. 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 ParameterSetParameterSet
CloneNotSupportedException
protected void loadParameters()
throws Exception
ParameterSetParameterSet. This is in most cases
done by calling ParameterSet.initParameterList() or
ParameterSet.initParameterList(int) to initialize
ParameterSet.parameters and afterwards filling
ParameterSet.parameters with instances of subclasses of
Parameter.
loadParameters in class ParameterSetException - if the parameters could not be loadedParameter,
ParameterSet.parameters,
ParameterSet.initParameterList(),
ParameterSet.initParameterList(int)
protected void replaceParametersWithRangedInstance()
throws Exception
ParameterSetParameters in this ParameterSet by their
equivalents implementing the Rangeable interface.
replaceParametersWithRangedInstance in class ParameterSetException - if these instances could not be createdParameterSet.makeRanged()
public void addParameterToSet()
throws CloneNotSupportedException
ParameterSetContainer containing a clone of the
ParameterSet-template to the set of Parameters.
CloneNotSupportedException - if the template could not be clonedpublic boolean replaceContentWith(ParameterSet[] paramSetArray)
ParameterSetContainers and
afterwards adds all given ParameterSets (in the given order)
enclosed in new ParameterSetContainers.
paramSetArray - the ParameterSets to be set
true, if all given ParameterSets are of the
same class as the defined template-ParameterSet of this
ExpandableParameterSet, false otherwise (In
this case, neither the previous added
ParameterSetContainers 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()
StorableStringBuffer of an
instance of the implementing class.
toXML in interface StorabletoXML in class ParameterSet
protected void fromXML(StringBuffer representation)
throws NonParsableException
ParameterSetParameterSet from the XML
representation as returned by ParameterSet.toXML().
fromXML in class ParameterSetrepresentation - the XML representation as StringBuffer
NonParsableException - if the XML code could not be parsedParameterSet.toXML()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||