de.jstacs.models.discrete
Class DGMParameterSet

java.lang.Object
  extended by de.jstacs.parameters.ParameterSet
      extended by de.jstacs.parameters.InstanceParameterSet
          extended by de.jstacs.models.discrete.DGMParameterSet
All Implemented Interfaces:
RangeIterator, Storable, Cloneable
Direct Known Subclasses:
IDGMParameterSet

public abstract class DGMParameterSet
extends InstanceParameterSet

The super ParameterSet for any ParameterSet of a DiscreteGraphicalModel.

Author:
Jens Keilwagen

Nested Class Summary
 
Nested classes/interfaces inherited from class de.jstacs.parameters.ParameterSet
ParameterSet.ParameterList
 
Field Summary
 
Fields inherited from class de.jstacs.parameters.InstanceParameterSet
alphabet, length
 
Fields inherited from class de.jstacs.parameters.ParameterSet
alternativeInstanceClass, errorMessage, parameters, parent, ranged
 
Constructor Summary
protected DGMParameterSet(Class<? extends DiscreteGraphicalModel> instanceClass, AlphabetContainer alphabet, double ess, String description)
          The constructor for models, that can handle variable lengths.
protected DGMParameterSet(Class<? extends DiscreteGraphicalModel> instanceClass, AlphabetContainer alphabet, int length, double ess, String description)
          The constructor for models that can handle only sequences of fixed length.
protected DGMParameterSet(Class<? extends DiscreteGraphicalModel> instanceClass, boolean simple, boolean variableLength)
          An empty constructor of extended classes.
protected DGMParameterSet(StringBuffer s)
          The constructor for the Storable interface.
 
Method Summary
 DGMParameterSet clone()
          Creates a full clone (deep copy) of this ParameterSet.
 String getInstanceName()
          Returns the name of an instance of the class that can be constructed using this ParameterSet.
 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.
 void setEss(double ess)
          This method can be used to set the ess of this parameter set.
 
Methods inherited from class de.jstacs.parameters.InstanceParameterSet
equals, fromXML, getAlphabet, getIndex, getLength, getNumberOfParameters, getParameterAt, replaceParametersWithRangedInstance, reset, toXML
 
Methods inherited from class de.jstacs.parameters.ParameterSet
getErrorMessage, getId, getInstance, getInstanceClass, getInstanceComment, getNumberOfValues, getParent, initParameterList, initParameterList, isAtomic, isRanged, makeRanged, next, parametersLoaded, propagateId, recieveId, resetToFirst, setAlternativeInstanceClass, setParent, simplify, valuesToString
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DGMParameterSet

protected DGMParameterSet(StringBuffer s)
                   throws NonParsableException
The constructor for the Storable interface.

Parameters:
s - the StringBuffer
Throws:
NonParsableException - if the StringBuffer is not parsable

DGMParameterSet

protected DGMParameterSet(Class<? extends DiscreteGraphicalModel> instanceClass,
                          boolean simple,
                          boolean variableLength)
An empty constructor of extended classes.

Parameters:
instanceClass - the (sub-)class
simple - whether the alphabet should be simple or not
variableLength - whether the model can handle sequences of variable length

DGMParameterSet

protected DGMParameterSet(Class<? extends DiscreteGraphicalModel> instanceClass,
                          AlphabetContainer alphabet,
                          double ess,
                          String description)
                   throws Exception
The constructor for models, that can handle variable lengths.

Parameters:
instanceClass - the (sub-)class
alphabet - the alphabet
ess - the ESS
description - the description
Throws:
Exception - if something went wrong

DGMParameterSet

protected DGMParameterSet(Class<? extends DiscreteGraphicalModel> instanceClass,
                          AlphabetContainer alphabet,
                          int length,
                          double ess,
                          String description)
                   throws Exception
The constructor for models that can handle only sequences of fixed length.

Parameters:
instanceClass - the (sub-)class
alphabet - the alphabet
length - the length of the modeled sequences
ess - the ESS
description - the description
Throws:
Exception - if something went wrong
Method Detail

loadParameters

protected void loadParameters()
                       throws Exception
Description copied from class: ParameterSet
Loads the parameters for this ParameterSet. This is in most cases done by simply creating a new ArrayList<Parameter> for the field parameters/code> and filling it with instances of subclasses of Parameter

Specified by:
loadParameters in class ParameterSet
Throws:
Exception - an Exception is thrown if the parameters could not be loaded
See Also:
ParameterSet.parameters, Parameter

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 specifiy some ParameterValidator on these parameters or implement these contraints 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 InstanceParameterSet
Returns:
true if all parameters have some allowed value set

getInstanceName

public String getInstanceName()
Description copied from class: ParameterSet
Returns the name of an instance of the class that can be constructed using this ParameterSet.

Specified by:
getInstanceName in class ParameterSet
Returns:
the name

clone

public DGMParameterSet 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 fulfils the conventions of Object's method clone()

Overrides:
clone in class InstanceParameterSet
Returns:
a deep clone of this ParameterSet
Throws:
CloneNotSupportedException

setEss

public void setEss(double ess)
            throws SimpleParameter.IllegalValueException
This method can be used to set the ess of this parameter set.

Parameters:
ess - the ESS
Throws:
SimpleParameter.IllegalValueException - if ess is negative