Package pulse.tasks.processing
Class Buffer
- java.lang.Object
-
- pulse.util.UpwardsNavigable
-
- pulse.util.Group
-
- pulse.util.Accessible
-
- pulse.util.PropertyHolder
-
- pulse.tasks.processing.Buffer
-
- All Implemented Interfaces:
Serializable,Descriptive
public class Buffer extends PropertyHolder
ABufferis used to estimate the convergence of the reverse problem solution, by comparing the variance of the properties to a pre-specified error tolerance.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Buffer()Creates aBufferwith a default size.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doubleaverage(NumericPropertyKeyword index)Calculates the average for theindex-- if the respectiveNumericPropertyis contained in theIndexedVectordata of thisBuffer.doubleaverageStatistic()Calculates the average statistic valuevoidfill(GeneralTask t, int bufferElement)(Over)writes a buffer cell corresponding to thebufferElementwith the current set of parameters ofSearchTaskand the search statistic.ParameterVector[]getData()Retrieves the contents of thisBuffer.static NumericPropertygetSize()Gets the buffer size (a NumericProperty derived fromBUFFER_SIZE.voidinit()booleanisErrorTooHigh(double errorTolerance)Determines whether the relative error (variance divided by mean) for any of the properties in this buffer is higher than the expecterrorTolerance.List<Property>listedTypes()TheBUFFER_SIZEis the single listed parameter for this class.voidset(NumericPropertyKeyword type, NumericProperty property)An abstract method, which must be overriden to gain access over setting the values of all relevant (selected by the programmer)NumericProperties in subclasses ofAccessible.static voidsetSize(NumericProperty newSize)Sets a new size for thisBuffer.doublevariance(NumericPropertyKeyword index)Calculates the variance for theindex-- if the respectiveNumericPropertyis contained in theIndexedVectordata of thisBuffer.-
Methods inherited from class pulse.util.PropertyHolder
addListener, areDetailsHidden, data, describe, firePropertyChanged, getDescriptor, getListeners, getPrefix, ignoreSiblings, initListeners, isListedNumericType, isListedParameter, listedKeywords, numericData, parameterListChanged, removeListeners, setPrefix, updateProperties, updateProperty
-
Methods inherited from class pulse.util.Accessible
accessibleChildren, genericProperties, genericProperty, numericProperties, numericProperty, property, update, update
-
Methods inherited from class pulse.util.UpwardsNavigable
addHierarchyListener, getHierarchyListeners, getParent, identify, removeHierarchyListener, removeHierarchyListeners, setParent, specificAncestor, tellParent
-
-
-
-
Method Detail
-
getData
public ParameterVector[] getData()
Retrieves the contents of thisBuffer.- Returns:
- the data
-
init
public final void init()
-
fill
public final void fill(GeneralTask t, int bufferElement)
(Over)writes a buffer cell corresponding to thebufferElementwith the current set of parameters ofSearchTaskand the search statistic.- Parameters:
t- theSearchTaskbufferElement- thebufferElementwhich will be written over
-
isErrorTooHigh
public boolean isErrorTooHigh(double errorTolerance)
Determines whether the relative error (variance divided by mean) for any of the properties in this buffer is higher than the expecterrorTolerance.- Parameters:
errorTolerance- the maximum tolerated relative error.- Returns:
trueif convergence has not been reached.
-
average
public double average(NumericPropertyKeyword index)
Calculates the average for theindex-- if the respectiveNumericPropertyis contained in theIndexedVectordata of thisBuffer.- Parameters:
index- a symbolic index (keyword)- Returns:
- the mean of the data sample for the specific type of
NumericProperties
-
averageStatistic
public double averageStatistic()
Calculates the average statistic value- Returns:
- the mean statistic value.
-
variance
public double variance(NumericPropertyKeyword index)
Calculates the variance for theindex-- if the respectiveNumericPropertyis contained in theIndexedVectordata of thisBuffer.- Parameters:
index- a symbolic index (keyword).- Returns:
- the variance of the data sample for the specific type of
NumericProperties.
-
getSize
public static NumericProperty getSize()
Gets the buffer size (a NumericProperty derived fromBUFFER_SIZE.- Returns:
- the buffer size property
- See Also:
NumericPropertyKeyword
-
setSize
public static void setSize(NumericProperty newSize)
Sets a new size for thisBuffer.- Parameters:
newSize- aNumericPropertyof the typeBUFFER_SIZE.
-
set
public void set(NumericPropertyKeyword type, NumericProperty property)
Description copied from class:AccessibleAn abstract method, which must be overriden to gain access over setting the values of all relevant (selected by the programmer)
NumericProperties in subclasses ofAccessible. Typically this involves aswitchstatement that goes through the different options for thetypeand invokes differentset(...)methods to update the matchingNumericPropertywithproperty.- Specified by:
setin classAccessible- Parameters:
type- the type, which must be equal by definition toproperty.getType().property- the property, which contains new information.
-
listedTypes
public List<Property> listedTypes()
TheBUFFER_SIZEis the single listed parameter for this class.- Overrides:
listedTypesin classPropertyHolder- Returns:
- a list of
Propertyinstances, which have been explicitly marked as a listed parameter for thisPropertyHolder. - See Also:
NumericPropertyKeyword
-
-