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 SequenceScoringParameterSet

    java.lang.Object
      de.jstacs.parameters.ParameterSet
          de.jstacs.parameters.InstanceParameterSet
              de.jstacs.parameters.SequenceScoringParameterSet

All Implemented Interfaces:
  RangeIterator, Storable, Cloneable

Direct Known Subclasses:
  BayesianNetworkScoringFunctionParameterSet, DGMParameterSet, ScoreClassifierParameterSet

    public abstract class SequenceScoringParameterSet

extends InstanceParameterSet

Abstract class for a `ParameterSet` containing all parameters necessary to construct an `Object` that implements `InstantiableFromParameterSet`. This parameter set handles the `AlphabetContainer` and if necessary the length of a sequence, so it is well suited as parameter set for `AbstractModel` and `AbstractClassifier`.

Author:
  Jan Grau, Jens Keilwagen
See Also:
  `InstantiableFromParameterSet`, `ParameterSet`, `AbstractModel`, `AbstractClassifier`

Nested Class Summary

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

Field Summary
`protected Parameter` | `alphabet` The alphabet the model works on
`protected Parameter` | `length` The length of sequences the model can work on or `0` for arbitrary length

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

Constructor Summary
`SequenceScoringParameterSet(Class instanceClass, AlphabetContainer.AlphabetContainerType type, boolean simple)` Constructs an `InstanceParameterSet` having empty parameter values.
`SequenceScoringParameterSet(Class instanceClass, AlphabetContainer.AlphabetContainerType type, boolean simple, boolean variableLength)` Constructs a `SequenceScoringParameterSet` having empty parameter values.
`SequenceScoringParameterSet(Class instanceClass, AlphabetContainer alphabet)` Constructs a `SequenceScoringParameterSet` for an object that can handle sequences of variable length and with the `AlphabetContainer` `alphabet`.
`SequenceScoringParameterSet(Class instanceClass, AlphabetContainer alphabet, int length, boolean variableLength)` Constructs a `SequenceScoringParameterSet` from an `AlphabetContainer` and the length of a sequence.
`SequenceScoringParameterSet(StringBuffer representation)` The standard constructor for the interface `Storable`.

Method Summary
`SequenceScoringParameterSet` | `clone()` Creates a full clone (deep copy) of this `ParameterSet`.
`boolean` | `equals(Object o)`
`protected void` | `fromXML(StringBuffer representation)` Parses the instance fields of a `ParameterSet` from the XML representation as returned by `ParameterSet.toXML()`.
`AlphabetContainer` | `getAlphabet()` Returns the `AlphabetContainer` of the current instance.
`static int` | `getIndex(String[] names, Object[] values, Comparable current, boolean hasAlternative)` This method tries to find the correct name (`String`) for your choice.
`int` | `getLength()` Returns the length of the sequences the model can work on.
`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` | `replaceParametersWithRangedInstance()` Replaces all `Parameter`s in this `ParameterSet` by their equivalents implementing the `Rangeable` interface.
`void` | `reset()` Resets all `Parameter`s in this `ParameterSet` to their default values or `null` if not default value was provided.
`StringBuffer` | `toXML()` This method returns an XML representation as `StringBuffer` of an instance of the implementing class.

Methods inherited from class de.jstacs.parameters.InstanceParameterSet
`getInstance, getInstanceClass, getInstanceComment, getInstanceName`

Methods inherited from class de.jstacs.parameters.ParameterSet
`getErrorMessage, getId, getNumberOfValues, getParent, initParameterList, initParameterList, isAtomic, isRanged, loadParameters, makeRanged, next, parametersLoaded, propagateId, recieveId, resetToFirst, setParent, simplify, valuesToString`

Methods inherited from class java.lang.Object
`finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### alphabet

    protected Parameter alphabet

  The alphabet the model works on

### length

    protected Parameter length

  The length of sequences the model can work on or `0` for arbitrary length

Constructor Detail

### SequenceScoringParameterSet

    public SequenceScoringParameterSet(Class instanceClass,
                                       AlphabetContainer.AlphabetContainerType type,
                                       boolean simple)

  Constructs an `InstanceParameterSet` having empty parameter values. This constructor should only be used if the object can handle sequences of fixed length.

  Parameters:
    `instanceClass` - the class of the instance
    `type` - the type of the alphabet(s)
    `simple` - determines whether the alphabet should be simple
  See Also:
    `AlphabetContainer.AlphabetContainerType`

### SequenceScoringParameterSet

    public SequenceScoringParameterSet(Class instanceClass,
                                       AlphabetContainer.AlphabetContainerType type,
                                       boolean simple,
                                       boolean variableLength)

  Constructs a `SequenceScoringParameterSet` having empty parameter values. The user can specify a-priori if the object can handle sequences of variable lengths. If that is the case the object is not queried from the user as it is `0` anyway.

  Parameters:
    `instanceClass` - the (sub-)class of the instance
    `type` - the type of the alphabet(s)
    `simple` - determines whether the alphabet should be simple
    `variableLength` - `true` if the object can handle sequences of arbitrary length, `false` otherwise
  See Also:
    `AlphabetContainer.AlphabetContainerType`

### SequenceScoringParameterSet

    public SequenceScoringParameterSet(StringBuffer representation)
                                throws NonParsableException

  The standard constructor for the interface `Storable`. Constructs a `SequenceScoringParameterSet` from its XML representation. Automatically calls the current implementation of `fromXML(StringBuffer)`.

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

### SequenceScoringParameterSet

    public SequenceScoringParameterSet(Class instanceClass,
                                       AlphabetContainer alphabet,
                                       int length,
                                       boolean variableLength)
                                throws Exception

  Constructs a `SequenceScoringParameterSet` from an `AlphabetContainer` and the length of a sequence. This constructor can be used to implement a `SequenceScoringParameterSet` that is already instantiated with known parameter values.

  Parameters:
    `instanceClass` - the class of the instance
    `alphabet` - the `AlphabetContainer` for a sequence
    `length` - the length of sequence
    `variableLength` - `true` if the object can handle sequences of arbitrary length, `false` otherwise
  Throws:
    `Exception` - if the alphabets or the length are not in the expected range of values

### SequenceScoringParameterSet

    public SequenceScoringParameterSet(Class instanceClass,
                                       AlphabetContainer alphabet)
                                throws Exception

  Constructs a `SequenceScoringParameterSet` for an object that can handle sequences of variable length and with the `AlphabetContainer` `alphabet`. This constructor can be used to implement a `SequenceScoringParameterSet` that is already instantiated with known parameter values.
  The length parameter is set to `0`.

  Parameters:
    `instanceClass` - the (sub-)class of the instance
    `alphabet` - the `AlphabetContainer` for a sequence
  Throws:
    `Exception` - if the alphabets or the length are not in the expected range of values

Method Detail

### getIndex

    public static int getIndex(String[] names,
                               Object[] values,
                               Comparable current,
                               boolean hasAlternative)
                        throws IllegalArgumentException

  This method tries to find the correct name (`String`) for your choice. This method is useful if you handle `CollectionParameter`s.

  Parameters:
    `names` - the names
    `values` - the values that can be set
    `current` - the value to be set
    `hasAlternative` - indicates whether the last entry of names is an alternative parameter
  Returns:
    the `StringIndexOutOfBoundsException` that has to be used
  Throws:
    `IllegalArgumentException` - if no match could be found
  See Also:
    `CollectionParameter`

### 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

### reset

    public void reset()

  Description copied from class: `ParameterSet`
  Resets all `Parameter`s in this `ParameterSet` to their default values or `null` if not default value was provided.

  Overrides:
    `reset` in class `ParameterSet`
  See Also:
    `Parameter.reset()`

### getAlphabet

    public AlphabetContainer getAlphabet()

  Returns the `AlphabetContainer` of the current instance.

  Returns:
    the `AlphabetContainer`

### getLength

    public int getLength()
                  throws IllegalArgumentException

  Returns the length of the sequences the model can work on.

  Returns:
    the length of the sequences the model can work on
  Throws:
    `IllegalArgumentException` - if the length is not correct, i.e. the length is not suitable for the chosen requirements

### 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 `InstanceParameterSet`
  Parameters:
    `representation` - the XML representation as `StringBuffer`
  Throws:
    `NonParsableException` - if the XML code could not be parsed
  See Also:
    `ParameterSet.toXML()`

### 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`

### replaceParametersWithRangedInstance

    protected void replaceParametersWithRangedInstance()
                                                throws Exception

  Description copied from class: `ParameterSet`
  Replaces all `Parameter`s in this `ParameterSet` by their equivalents implementing the `Rangeable` interface.

  Overrides:
    `replaceParametersWithRangedInstance` in class `ParameterSet`
  Throws:
    `Exception` - if these instances could not be created
  See Also:
    `ParameterSet.makeRanged()`

### 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`

### 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 `InstanceParameterSet`
  Returns:
    the XML representation

### equals

    public boolean equals(Object o)

  Overrides:
    `equals` in class `Object`

### clone

    public SequenceScoringParameterSet clone()
                                      throws CloneNotSupportedException

  Description copied from class: `ParameterSet`
  Creates a full clone (deep copy) of this `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:
  - Create a new instance of your subclass of `ParameterSet`, most likely with an empty constructor or the one taking just the instance class.
  - Call `this.fillWithStandardFieldsForClone` on this instance.
  - Return the instance.
  This method fulfills the conventions of `Object`'s method `Object.clone()`.

  Overrides:
    `clone` in class `ParameterSet`
  Returns:
    a deep clone/copy of this `ParameterSet`
  Throws:
    `CloneNotSupportedException`

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