Package jsl.utilities.statistic
Class AbstractCollector
- java.lang.Object
-
- jsl.utilities.statistic.AbstractCollector
-
- All Implemented Interfaces:
GetNameIfc,IdentityIfc,ArraySaverIfc,CollectorIfc
- Direct Known Subclasses:
AbstractStatistic,ExceedanceEstimator
public abstract class AbstractCollector extends java.lang.Object implements CollectorIfc, IdentityIfc, ArraySaverIfc
An abstract base class for building sub-classes that implement the CollectorIfc. Permits saving of collected data to an array via the ArraySaverIfc Implementations must implement saving during collection process. The default is to not save data automatically.
-
-
Field Summary
-
Fields inherited from interface jsl.utilities.statistic.ArraySaverIfc
DEFAULT_DATA_ARRAY_SIZE
-
-
Constructor Summary
Constructors Constructor Description AbstractCollector()AbstractCollector(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearSavedData()Should clear the saved data from the arrayintgetId()java.lang.StringgetName()double[]getSavedData()Returns a copy of the data saved while the saved data option was turned on, will return null if no data were collectedbooleangetSaveOption()Indicates whether or not the save data option is on true = on, false = offvoidsave(double x)Used to save data to an array.voidsave(double[] values)Saves all values in the arrayvoidsetArraySizeIncrement(int n)Controls the amount that the saved data array will grow by after it has been filled up.voidsetName(java.lang.String str)Sets the namevoidsetSaveOption(boolean flag)Sets the save data option true = on, false = off If true, the data will be saved to an array If this option is toggled, then only the data when the option is true will be saved.
-
-
-
Method Detail
-
getName
public final java.lang.String getName()
- Specified by:
getNamein interfaceGetNameIfc- Returns:
- a string representing the name of the object
-
setName
public final void setName(java.lang.String str)
Sets the name- Parameters:
str- The name as a string.
-
getId
public final int getId()
- Specified by:
getIdin interfaceIdentityIfc- Returns:
- an int representing the id of the object
-
getSaveOption
public final boolean getSaveOption()
Description copied from interface:ArraySaverIfcIndicates whether or not the save data option is on true = on, false = off- Specified by:
getSaveOptionin interfaceArraySaverIfc- Returns:
- true if save option is on
-
save
public final void save(double x)
Description copied from interface:ArraySaverIfcUsed to save data to an array. This method should not save anything unless the save option is on.- Specified by:
savein interfaceArraySaverIfc- Parameters:
x- the data to save to the array
-
save
public final void save(double[] values)
Description copied from interface:ArraySaverIfcSaves all values in the array- Specified by:
savein interfaceArraySaverIfc- Parameters:
values- the values to save
-
getSavedData
public final double[] getSavedData()
Description copied from interface:ArraySaverIfcReturns a copy of the data saved while the saved data option was turned on, will return null if no data were collected- Specified by:
getSavedDatain interfaceArraySaverIfc- Returns:
- the array of data
-
setArraySizeIncrement
public final void setArraySizeIncrement(int n)
Description copied from interface:ArraySaverIfcControls the amount that the saved data array will grow by after it has been filled up. If the potential number of data points is known, then this method can be used so that arrays do not have to be copied during collection The array size will start at this value and then increment by this value whenever full- Specified by:
setArraySizeIncrementin interfaceArraySaverIfc- Parameters:
n- the growth increment
-
setSaveOption
public final void setSaveOption(boolean flag)
Description copied from interface:ArraySaverIfcSets the save data option true = on, false = off If true, the data will be saved to an array If this option is toggled, then only the data when the option is true will be saved.- Specified by:
setSaveOptionin interfaceArraySaverIfc- Parameters:
flag- true means save the data
-
clearSavedData
public final void clearSavedData()
Description copied from interface:ArraySaverIfcShould clear the saved data from the array- Specified by:
clearSavedDatain interfaceArraySaverIfc
-
-