de.jstacs.algorithms.optimization.termination
Class AbstractTerminationCondition

java.lang.Object
  extended by de.jstacs.algorithms.optimization.termination.AbstractTerminationCondition
All Implemented Interfaces:
TerminationCondition, InstantiableFromParameterSet, Storable, Cloneable
Direct Known Subclasses:
AbsoluteValueCondition, CombinedCondition, IterationCondition, SmallDifferenceOfFunctionEvaluationsCondition, SmallGradientConditon, SmallStepCondition, TimeCondition

public abstract class AbstractTerminationCondition
extends Object
implements TerminationCondition

This class is the abstract super class of many TerminationConditions. It implements several methods for loading, saving, cloning, ... allowing for a fast implementation of a new TerminationCondition.

Author:
Jens Keilwagen

Nested Class Summary
static class AbstractTerminationCondition.AbstractTerminationConditionParameterSet
          This class implements the super class of all parameter sets of instances from AbstractTerminationCondition.
 
Field Summary
protected  AbstractTerminationCondition.AbstractTerminationConditionParameterSet parameter
          The internally used parameters.
 
Constructor Summary
protected AbstractTerminationCondition(AbstractTerminationCondition.AbstractTerminationConditionParameterSet parameter)
          This is the main constructor creating an instance from a given parameter set.
protected AbstractTerminationCondition(StringBuffer xml)
          The standard constructor for the interface Storable.
 
Method Summary
 AbstractTerminationCondition clone()
           
 AbstractTerminationCondition.AbstractTerminationConditionParameterSet getCurrentParameterSet()
          Returns the InstanceParameterSet that has been used to instantiate the current instance of the implementing class.
protected abstract  String getXmlTag()
          This method returns the xml tag that is used in the method toXML() and in the constructor AbstractTerminationCondition(StringBuffer).
protected abstract  void set()
          This method sets internal member variables from parameter.
 StringBuffer toXML()
          This method returns an XML representation as StringBuffer of an instance of the implementing class.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.jstacs.algorithms.optimization.termination.TerminationCondition
doNextIteration, isSimple
 

Field Detail

parameter

protected AbstractTerminationCondition.AbstractTerminationConditionParameterSet parameter
The internally used parameters.

Constructor Detail

AbstractTerminationCondition

protected AbstractTerminationCondition(AbstractTerminationCondition.AbstractTerminationConditionParameterSet parameter)
                                throws CloneNotSupportedException
This is the main constructor creating an instance from a given parameter set.

Parameters:
parameter - the set of parameters
Throws:
CloneNotSupportedException - if parameter can not be cloned properly.

AbstractTerminationCondition

protected AbstractTerminationCondition(StringBuffer xml)
                                throws NonParsableException
The standard constructor for the interface Storable. Constructs a AbstractTerminationCondition out of an XML representation.

Parameters:
xml - the XML representation as StringBuffer
Throws:
NonParsableException - if the AbstractTerminationCondition could not be reconstructed out of the StringBuffer xml
Method Detail

clone

public AbstractTerminationCondition clone()
                                   throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException

getXmlTag

protected abstract String getXmlTag()
This method returns the xml tag that is used in the method toXML() and in the constructor AbstractTerminationCondition(StringBuffer).

Returns:
the xml tag of the instance

set

protected abstract void set()
This method sets internal member variables from parameter. It is used in the constructors.


toXML

public final 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
Returns:
the XML representation

getCurrentParameterSet

public AbstractTerminationCondition.AbstractTerminationConditionParameterSet getCurrentParameterSet()
                                                                                             throws Exception
Description copied from interface: InstantiableFromParameterSet
Returns the InstanceParameterSet that has been used to instantiate the current instance of the implementing class. If the current instance was not created using an InstanceParameterSet, an equivalent InstanceParameterSet should be returned, so that an instance created using this InstanceParameterSet would be in principle equal to the current instance.

Specified by:
getCurrentParameterSet in interface InstantiableFromParameterSet
Returns:
the current InstanceParameterSet
Throws:
Exception - if the InstanceParameterSet could not be returned