Package microsim.statistics.functions
Class CountArrayFunction
java.lang.Object
microsim.statistics.functions.AbstractFunction
microsim.statistics.functions.AbstractArrayFunction
microsim.statistics.functions.CountArrayFunction
- All Implemented Interfaces:
EventListener,DoubleSource,IntSource,UpdatableSource
This class computes the number of values in an array taken from a data source. The mean function return always an int
value, so it implements the
IntSource interface and the standard DoubleSource one.-
Nested Class Summary
Nested classes/interfaces inherited from interface microsim.statistics.DoubleSource
DoubleSource.VariablesNested classes/interfaces inherited from interface microsim.statistics.IntSource
IntSource.Variables -
Field Summary
FieldsFields inherited from class microsim.statistics.functions.AbstractArrayFunction
dblSource, intSource, lngSource, type, TYPE_DBL, TYPE_INT, TYPE_LNGFields inherited from class microsim.statistics.functions.AbstractFunction
timeChecker -
Constructor Summary
ConstructorsConstructorDescriptionCountArrayFunction(@NonNull DoubleArraySource source) Creates a count function on a double array source.CountArrayFunction(@NonNull IntArraySource source) Creates a count function on an integer array source.CountArrayFunction(@NonNull LongArraySource source) Creates a count function on a long array source. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(double @NonNull [] data) Applies the function to the given array of double values.voidapply(int @NonNull [] data) Applies the function to the given array of integer values.voidapply(long @NonNull [] data) Applies the function to the given array of long values.doublegetDoubleValue(@NonNull Enum<?> variableID) Returns the double value corresponding to the given variableIDintgetIntValue(@NonNull Enum<?> id) Returns the integer value corresponding to the givenvariableIDMethods inherited from class microsim.statistics.functions.AbstractArrayFunction
applyFunctionMethods inherited from class microsim.statistics.functions.AbstractFunction
isCheckingTime, onEvent, setCheckingTime, updateSource
-
Field Details
-
count
protected int count
-
-
Constructor Details
-
CountArrayFunction
Creates a count function on an integer array source.- Parameters:
source- The data source.- Throws:
NullPointerException- whensourceisnull.
-
CountArrayFunction
Creates a count function on a long array source.- Parameters:
source- The data source.- Throws:
NullPointerException- whensourceisnull.
-
CountArrayFunction
Creates a count function on a double array source.- Parameters:
source- The data source.- Throws:
NullPointerException- whensourceisnull.
-
-
Method Details
-
apply
public void apply(double @NonNull [] data) Applies the function to the given array of double values.- Overrides:
applyin classAbstractArrayFunction- Parameters:
data- A source array of values.
-
apply
public void apply(int @NonNull [] data) Applies the function to the given array of integer values.- Overrides:
applyin classAbstractArrayFunction- Parameters:
data- A source array of values.
-
apply
public void apply(long @NonNull [] data) Applies the function to the given array of long values.- Overrides:
applyin classAbstractArrayFunction- Parameters:
data- A source array of values.
-
getDoubleValue
Returns the double value corresponding to the given variableID- Specified by:
getDoubleValuein interfaceDoubleSource- Parameters:
variableID- A unique identifier for a variable.- Returns:
- The current double value of the required variable.
-
getIntValue
Returns the integer value corresponding to the givenvariableID- Specified by:
getIntValuein interfaceIntSource- Parameters:
id- A unique identifier for a variable.- Returns:
- The current integer value of the required variable.
-