Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.jstacs.parameters
Class ArrayParameterSet

    java.lang.Object
      de.jstacs.parameters.ParameterSet
          de.jstacs.parameters.ExpandableParameterSet
              de.jstacs.parameters.ArrayParameterSet

All Implemented Interfaces:
  GalaxyConvertible, RangeIterator, Storable, Cloneable

Direct Known Subclasses:
  AlphabetContainerParameterSet.AlphabetArrayParameterSet

    public class ArrayParameterSet

extends ExpandableParameterSet

Class for a `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.

Author:
  Jan Grau

Nested Class Summary

Nested classes/interfaces inherited from class de.jstacs.parameters.ParameterSet
`ParameterSet.ParameterList`

Field Summary

Fields inherited from class de.jstacs.parameters.ExpandableParameterSet
`commentTemplate, nameTemplate, template`

Fields inherited from class de.jstacs.parameters.ParameterSet
`errorMessage, parameters, parent, ranged`

Constructor Summary
`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`.

Method Summary
`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.
`protected void` | `loadParameters()` Loads the parameters for this `ParameterSet`.
`StringBuffer` | `toXML()` This method returns an XML representation as `StringBuffer` of an instance of the implementing class.

Methods inherited from class de.jstacs.parameters.ExpandableParameterSet
`addParameterToSet, clone, fromGalaxy, parameterRemovable, removeParameterFromSet, replaceContentWith, replaceParametersWithRangedInstance, toGalaxy`

Methods inherited from class de.jstacs.parameters.ParameterSet
`getErrorMessage, getId, getIndex, getNumberOfValues, getParent, 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`

Constructor Detail

### ArrayParameterSet

    public 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.

  Parameters:
    `template` - the template of the `ParameterSet`
    `nameTemplate` - the name-template
    `commentTemplate` - the comment-template
    `lengthName` - 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 array

### ArrayParameterSet

    public 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.

  Parameters:
    `template` - the template of the `ParameterSet`
    `nameTemplate` - the name-template
    `commentTemplate` - the comment-template

### ArrayParameterSet

    public ArrayParameterSet(StringBuffer representation)
                      throws NonParsableException

  The standard constructor for the interface `Storable`. Creates a new `ArrayParameterSet` from its XML representation.

  Parameters:
    `representation` - the XML representation as `StringBuffer`
  Throws:
    `NonParsableException` - if the `StringBuffer` `representation` could not be parsed

Method Detail

### loadParameters

    protected final void loadParameters()
                                 throws Exception

  Description copied from class: `ParameterSet`
  Loads the parameters for this `ParameterSet`. 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`.

  Overrides:
    `loadParameters` in class `ExpandableParameterSet`
  Throws:
    `Exception` - if the parameters could not be loaded
  See Also:
    `Parameter`, `ParameterSet.parameters`, `ParameterSet.initParameterList()`, `ParameterSet.initParameterList(int)`

### getNumberOfParameters

    public int getNumberOfParameters()

  Description copied from class: `ParameterSet`
  Returns the number of parameters in the `ParameterSet`.

  Overrides:
    `getNumberOfParameters` in class `ParameterSet`
  Returns:
    the number of parameters in the `ParameterSet`

### getParameterAt

    public Parameter getParameterAt(int i)

  Description copied from class: `ParameterSet`
  Returns the `Parameter` at position `i`.

  Overrides:
    `getParameterAt` in class `ParameterSet`
  Parameters:
    `i` - the position in the `ParameterSet.ParameterList`
  Returns:
    the `Parameter` at position `i`

### hasDefaultOrIsSet

    public boolean hasDefaultOrIsSet()

  Description copied from class: `ParameterSet`
  Returns `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.

  Overrides:
    `hasDefaultOrIsSet` in class `ParameterSet`
  Returns:
    `true` if all parameters have some allowed value set, `false` otherwise

### fromXML

    protected void fromXML(StringBuffer representation)
                    throws NonParsableException

  Description copied from class: `ParameterSet`
  Parses the instance fields of a `ParameterSet` from the XML representation as returned by `ParameterSet.toXML()`.

  Overrides:
    `fromXML` in class `ExpandableParameterSet`
  Parameters:
    `representation` - the XML representation as `StringBuffer`
  Throws:
    `NonParsableException` - if the XML code could not be parsed
  See Also:
    `ParameterSet.toXML()`

### toXML

    public StringBuffer toXML()

  Description copied from interface: `Storable`
  This method returns an XML representation as `StringBuffer` of an instance of the implementing class.

  Specified by:
    `toXML` in interface `Storable`
  Overrides:
    `toXML` in class `ExpandableParameterSet`
  Returns:
    the XML representation

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD