Package microsim.statistics.functions
Class AbstractArrayFunction
java.lang.Object
microsim.statistics.functions.AbstractFunction
microsim.statistics.functions.AbstractArrayFunction
- All Implemented Interfaces:
EventListener
,UpdatableSource
- Direct Known Subclasses:
CountArrayFunction
,MaxArrayFunction
,MeanArrayFunction
,MeanVarianceArrayFunction
,MinArrayFunction
,MovingAverageArrayFunction
,PercentileArrayFunction
,SumArrayFunction
This class represents the skeleton for all the function which operate on array of native data type values.
Each inheriting class automatically implements the
UpdatableSource
and the
EventListener
which are managed by the AbstractArrayFunction
.-
Field Summary
Modifier and TypeFieldDescriptionprotected DoubleArraySource
protected IntArraySource
protected LongArraySource
protected int
protected static final int
protected static final int
protected static final int
Fields inherited from class microsim.statistics.functions.AbstractFunction
timeChecker
-
Constructor Summary
ConstructorDescriptionAbstractArrayFunction
(@NonNull DoubleArraySource source) Creates a function on a double array source.AbstractArrayFunction
(@NonNull IntArraySource source) Creates a function on an integer array source.AbstractArrayFunction
(@NonNull LongArraySource source) Creates a function on a long array source. -
Method Summary
Modifier and TypeMethodDescriptionvoid
apply
(double[] data) Applies the function to the given array of double values.void
apply
(int[] data) Applies the function to the given array of integer values.void
apply
(long[] data) Applies the function to the given array of long values.void
Forces the function to update itself.Methods inherited from class microsim.statistics.functions.AbstractFunction
isCheckingTime, onEvent, setCheckingTime, updateSource
-
Field Details
-
TYPE_DBL
protected static final int TYPE_DBL- See Also:
-
TYPE_INT
protected static final int TYPE_INT- See Also:
-
TYPE_LNG
protected static final int TYPE_LNG- See Also:
-
dblSource
-
intSource
-
lngSource
-
type
protected int type
-
-
Constructor Details
-
AbstractArrayFunction
Creates a function on a double array source.- Parameters:
source
- The data source.- Throws:
NullPointerException
- whensource
isnull
.
-
AbstractArrayFunction
Creates a function on an integer array source.- Parameters:
source
- The data source.- Throws:
NullPointerException
- whensource
isnull
.
-
AbstractArrayFunction
Creates a function on a long array source.- Parameters:
source
- The data source.- Throws:
NullPointerException
- whensource
isnull
.
-
-
Method Details
-
applyFunction
public void applyFunction()Forces the function to update itself. If the data source implements theUpdatableSource
interface it is updated before reading data.- Specified by:
applyFunction
in classAbstractFunction
-
apply
public void apply(double[] data) Applies the function to the given array of double values.- Parameters:
data
- A source array of values.- Throws:
UnsupportedOperationException
- If the function is not able to work on double data type.
-
apply
public void apply(int[] data) Applies the function to the given array of integer values.- Parameters:
data
- A source array of values.- Throws:
UnsupportedOperationException
- If the function is not able to work on double data type.
-
apply
public void apply(long[] data) Applies the function to the given array of long values.- Parameters:
data
- A source array of values.- Throws:
UnsupportedOperationException
- If the function is not able to work on double data type.
-