Class AbstractWeightedArrayFunction
java.lang.Object
microsim.statistics.functions.AbstractFunction
microsim.statistics.weighted.functions.AbstractWeightedArrayFunction
- All Implemented Interfaces:
EventListener
,UpdatableSource
- Direct Known Subclasses:
Weighted_MeanArrayFunction
,Weighted_SumArrayFunction
This class represents the skeleton for all the function which operate on array of native data type values,
appropriately weighted by weights specified in a corresponding array of doubles. Each inheriting class automatically
implements the
UpdatableSource
and the EventListener
, which are managed by the
AbstractWeightedArrayFunction.-
Field Summary
Modifier and TypeFieldDescriptionprotected WeightedDoubleArraySource
protected WeightedIntArraySource
protected WeightedLongArraySource
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
ConstructorDescriptionAbstractWeightedArrayFunction
(@NonNull WeightedDoubleArraySource source) Create a function on a double array source.AbstractWeightedArrayFunction
(@NonNull WeightedIntArraySource source) Create a function on an integer array source.AbstractWeightedArrayFunction
(@NonNull WeightedLongArraySource source) Create a function on a long array source. -
Method Summary
Modifier and TypeMethodDescriptionvoid
apply
(double @NonNull [] data, double @NonNull [] weights) Apply the function to the given array of double values.void
apply
(int @NonNull [] data, double @NonNull [] weights) Apply the function to the given array of integer values.void
apply
(long @NonNull [] data, double @NonNull [] weights) Apply the function to the given array of long values.void
Force 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
-
AbstractWeightedArrayFunction
Create a function on a double array source.- Parameters:
source
- The data source.
-
AbstractWeightedArrayFunction
Create a function on an integer array source.- Parameters:
source
- The data source.
-
AbstractWeightedArrayFunction
Create a function on a long array source.- Parameters:
source
- The data source.
-
-
Method Details
-
applyFunction
public void applyFunction()Force 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 @NonNull [] data, double @NonNull [] weights) Apply the function to the given array of double values.- Parameters:
data
- A source array of values.weights
- An array of weights.- Throws:
UnsupportedOperationException
- If the function is not able to work on double data type.
-
apply
public void apply(int @NonNull [] data, double @NonNull [] weights) Apply the function to the given array of integer values.- Parameters:
data
- A source array of values.weights
- An array of weights.- Throws:
UnsupportedOperationException
- If the function is not able to work on double data type.
-
apply
public void apply(long @NonNull [] data, double @NonNull [] weights) Apply the function to the given array of long values.- Parameters:
data
- A source array of values.weights
- An array of weights.- Throws:
UnsupportedOperationException
- If the function is not able to work on double data type.
-