de.jstacs.models.mixture.gibbssampling
Class AbstractBurnInTest

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

public abstract class AbstractBurnInTest
extends BurnInTest

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(int starts)
          This is the main constructor that creates a burn-in test for a specified number of Gibbs sampling starts.
protected AbstractBurnInTest(StringBuffer rep)
          This is the constructor for the Storable interface.
 
Method Summary
protected abstract  int computeLengthOfBurnIn()
          Computes and returns the length of the burn-in phase using the values from BurnInTest.setValue(double).
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 de.jstacs.models.mixture.gibbssampling.BurnInTest
clone, getInstanceName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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(int starts)
This is the main constructor that creates a burn-in test for a specified number of Gibbs sampling starts.

Parameters:
starts - the number of Gibbs sampling starts

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

resetAllValues

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

Specified by:
resetAllValues in class BurnInTest

setCurrentSamplingIndex

public final void setCurrentSamplingIndex(int index)
Description copied from class: 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 class BurnInTest
Parameters:
index - the index of the sampling

setValue

public final void setValue(double val)
Description copied from class: 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 class 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.

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 class: BurnInTest
Computes and returns the length of the burn-in phase using the values from BurnInTest.setValue(double).

Specified by:
getLengthOfBurnIn in class 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