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
FieldsModifier and TypeFieldDescriptionprotected WeightedDoubleArraySourceprotected WeightedIntArraySourceprotected WeightedLongArraySourceprotected intprotected static final intprotected static final intprotected static final intFields inherited from class microsim.statistics.functions.AbstractFunction
timeChecker -
Constructor Summary
ConstructorsConstructorDescriptionAbstractWeightedArrayFunction(@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 TypeMethodDescriptionvoidapply(double @NonNull [] data, double @NonNull [] weights) Apply the function to the given array of double values.voidapply(int @NonNull [] data, double @NonNull [] weights) Apply the function to the given array of integer values.voidapply(long @NonNull [] data, double @NonNull [] weights) Apply the function to the given array of long values.voidForce 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 theUpdatableSourceinterface it is updated before reading data.- Specified by:
applyFunctionin 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.
-