de.jstacs.sampling
Class AbstractBurnInTest

java.lang.Object
  extended by de.jstacs.sampling.AbstractBurnInTest
All Implemented Interfaces:
InstantiableFromParameterSet, BurnInTest, Storable, Cloneable
Direct Known Subclasses:
VarianceRatioBurnInTest

public abstract class AbstractBurnInTest
extends Object
implements BurnInTest, InstantiableFromParameterSet

This abstract class implements some of the methods of BurnInTest to alleviate the implementation of efficient and new burn-in tests.

Author:
Jens Keilwagen

Field Summary
protected  DoubleList[] values
          This array contains all values that will be set via BurnInTest.setValue(double).
 
Constructor Summary
protected AbstractBurnInTest(AbstractBurnInTestParameterSet parameters)
          This is the main constructor that creates a burn-in test given a specified set of parameters
protected AbstractBurnInTest(StringBuffer rep)
          This is the constructor for the Storable interface.
 
Method Summary
 AbstractBurnInTest clone()
          Return a deep copy of this object.
protected abstract  int computeLengthOfBurnIn()
          Computes and returns the length of the burn-in phase using the values from BurnInTest.setValue(double).
 AbstractBurnInTestParameterSet getCurrentParameterSet()
          Returns the InstanceParameterSet that has been used to instantiate the current instance of the implementing class.
protected abstract  StringBuffer getFurtherInformation()
          This method returns further information for the AbstractBurnInTest.
 int getLengthOfBurnIn()
          Computes and returns the length of the burn-in phase using the values from BurnInTest.setValue(double).
protected abstract  String getXMLTag()
          This method returns the XML tag that is used in toXML() and AbstractBurnInTest(StringBuffer).
 void resetAllValues()
          This method can be used to remove all values from the internal memory.
 void setCurrentSamplingIndex(int index)
          This method sets the value of the current sampling.
protected abstract  void setFurtherInformation(StringBuffer xml)
          This method sets further information for the AbstractBurnInTest.
 void setValue(double val)
          This method can be used to fill the internal memory with the values that will be used to determine the length of the burn-in phase.
 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.sampling.BurnInTest
getInstanceName
 

Field Detail

values

protected DoubleList[] values
This array contains all values that will be set via BurnInTest.setValue(double). The index of the array element denotes the sampling index.

Constructor Detail

AbstractBurnInTest

protected AbstractBurnInTest(AbstractBurnInTestParameterSet parameters)
                      throws CloneNotSupportedException
This is the main constructor that creates a burn-in test given a specified set of parameters

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

AbstractBurnInTest

protected AbstractBurnInTest(StringBuffer rep)
                      throws NonParsableException
This is the constructor for the Storable interface.

Parameters:
rep - the XML representation
Throws:
NonParsableException - if the StringBuffer could not be parsed
Method Detail

clone

public AbstractBurnInTest clone()
                         throws CloneNotSupportedException
Description copied from interface: BurnInTest
Return a deep copy of this object.

Specified by:
clone in interface BurnInTest
Overrides:
clone in class Object
Returns:
a deep copy of this object
Throws:
CloneNotSupportedException - if the object can not be cloned
See Also:
Object.clone()

getCurrentParameterSet

public AbstractBurnInTestParameterSet getCurrentParameterSet()
                                                      throws CloneNotSupportedException
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:
CloneNotSupportedException

resetAllValues

public final void resetAllValues()
Description copied from interface: BurnInTest
This method can be used to remove all values from the internal memory.

Specified by:
resetAllValues in interface BurnInTest

setCurrentSamplingIndex

public final void setCurrentSamplingIndex(int index)
Description copied from interface: BurnInTest
This method sets the value of the current sampling. This allows to assign the values from BurnInTest.setValue(double) to a sampling.

Specified by:
setCurrentSamplingIndex in interface BurnInTest
Parameters:
index - the index of the sampling

setValue

public final void setValue(double val)
Description copied from interface: BurnInTest
This method can be used to fill the internal memory with the values that will be used to determine the length of the burn-in phase.

Specified by:
setValue in interface BurnInTest
Parameters:
val - the value

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

getXMLTag

protected abstract String getXMLTag()
This method returns the XML tag that is used in toXML() and AbstractBurnInTest(StringBuffer).

Returns:
the XML tag that is used in toXML() and AbstractBurnInTest(StringBuffer)

getFurtherInformation

protected abstract StringBuffer getFurtherInformation()
This method returns further information for the AbstractBurnInTest. It enables to store test specific data via the method toXML().

This method should only be used in toXML().

Returns:
further information in XML format

setFurtherInformation

protected abstract void setFurtherInformation(StringBuffer xml)
                                       throws NonParsableException
This method sets further information for the AbstractBurnInTest. It enables to load test specific data in the constructor AbstractBurnInTest(StringBuffer).

This method should only be used in AbstractBurnInTest(StringBuffer).

Parameters:
xml - contains further information in XML format
Throws:
NonParsableException - if the StringBuffer could not be parsed

getLengthOfBurnIn

public final int getLengthOfBurnIn()
Description copied from interface: BurnInTest
Computes and returns the length of the burn-in phase using the values from BurnInTest.setValue(double).

Specified by:
getLengthOfBurnIn in interface BurnInTest
Returns:
the length of the burn-in phase

computeLengthOfBurnIn

protected abstract int computeLengthOfBurnIn()
Computes and returns the length of the burn-in phase using the values from BurnInTest.setValue(double). This method is used by getLengthOfBurnIn(). The result is stored in an internal variable to avoid multiple meaningless assessments.

Returns:
the length of the burn-in phase