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 alphabet container and if necessary the length, 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 a `InstanceParameterSet` having empty parameter values.
`SequenceScoringParameterSet(Class instanceClass, AlphabetContainer.AlphabetContainerType type, boolean simple, boolean variableLength)` Constructs a `InstanceParameterSet` having empty parameter values.
`SequenceScoringParameterSet(Class instanceClass, AlphabetContainer alphabet)` Constructs a `InstanceParameterSet` for an object that can handle sequences of variable length and with the alphabet.
`SequenceScoringParameterSet(Class instanceClass, AlphabetContainer alphabet, int length, boolean variableLength)` Constructs a `InstanceParameterSet` from the alphabet and the length.
`SequenceScoringParameterSet(StringBuffer representation)` Constructs a `InstanceParameterSet` from its XML-representation.

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 alphabet
`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 sequences the model can work on
`int` | `getNumberOfParameters()` Returns the number of parameters in set
`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 parameters in this `ParameterSet` to their default values or `null` if not default value was provided.
`StringBuffer` | `toXML()` This method returns an XML-representation 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 a `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` - whether the alphabet should be simple

### SequenceScoringParameterSet

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

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

  Parameters:
    `instanceClass` - the (sub-)class
    `type` - the type of the alphabet(s)
    `simple` - whether the alphabet should be simple
    `variableLength` - `true` if the object can handle sequences of arbitrary length

### SequenceScoringParameterSet

    public SequenceScoringParameterSet(StringBuffer representation)
                                throws NonParsableException

  Constructs a `InstanceParameterSet` from its XML-representation. Automatically calls the current implementation of `fromXML(StringBuffer)` of `Storable`.

  Parameters:
    `representation` - the XML-representation
  Throws:
    `NonParsableException` - a `NonParsableException` is thrown if `representation` could not be parsed

### SequenceScoringParameterSet

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

  Constructs a `InstanceParameterSet` from the alphabet and the length. This constructor can be used to implement a `InstanceParameterSet` that is already instantiated with known parameter values.

  Parameters:
    `instanceClass` - the class of the instance
    `alphabet` - the alphabet
    `length` - the length
    `variableLength` - whether the object can handle sequences of variable length
  Throws:
    `Exception` - an `Exception` is thrown if the alphabet or the length are not in the expected range of values

### SequenceScoringParameterSet

    public SequenceScoringParameterSet(Class instanceClass,
                                       AlphabetContainer alphabet)
                                throws Exception

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

  Parameters:
    `instanceClass` - the (sub-)class
    `alphabet` - the alphabet
  Throws:
    `Exception` - an `Exception` is thrown if the alphabet 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 CollectionParameterSets.

  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 String 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.hasDefaultOrIsSet() should be called prior to checking specific constraints.

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

### reset

    public void reset()

  Description copied from class: `ParameterSet`
  Resets all parameters 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 alphabet

  Returns:
    the alphabet

### getLength

    public int getLength()
                  throws IllegalArgumentException

  Returns the length of sequences the model can work on

  Returns:
    the length
  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
  Throws:
    `NonParsableException` - is thrown if the XML-code could not be parsed

### getNumberOfParameters

    public int getNumberOfParameters()

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

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

### 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` - is thrown if these instances could not be created

### 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
  Returns:
    the parameter

### toXML

    public StringBuffer toXML()

  Description copied from interface: `Storable`
  This method returns an XML-representation 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 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