Package microsim.statistics.functions
Class AbstractArrayFunction
java.lang.Object
microsim.statistics.functions.AbstractFunction
microsim.statistics.functions.AbstractArrayFunction
- All Implemented Interfaces:
EventListener,IUpdatableSource
- Direct Known Subclasses:
CountArrayFunction,MaxArrayFunction,MeanArrayFunction,MeanVarianceArrayFunction,MinArrayFunction,MovingAverageArrayFunction,PercentileArrayFunction,SumArrayFunction
This class represents the skeleton for all the function which opeate on array of native data type values.
Each inheriting class automatically implements the IUpdatableSource and the ISimEventListener,
which are managed by the AbstractArrayFunction.
Title: JAS
Description: Java Agent-based Simulation library
Copyright (C) 2002 Michele Sonnessa
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.- Author:
- Michele Sonnessa
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IDoubleArraySourceprotected IFloatArraySourceprotected IIntArraySourceprotected ILongArraySourceprotected intprotected static final intprotected static final intprotected static final intprotected static final intFields inherited from class microsim.statistics.functions.AbstractFunction
timeChecker -
Constructor Summary
ConstructorsConstructorDescriptionCreate a function on a double array source.Create a function on a float array source.AbstractArrayFunction(IIntArraySource source) Create a function on an integer array source.Create a function on a long array source. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(double[] data) Apply the function on a the given array of double values.voidapply(float[] data) Apply the function on a the given array of float values.voidapply(int[] data) Apply the function on a the given array of integer values.voidapply(long[] data) Apply the function on a 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_FLT
protected static final int TYPE_FLT- See Also:
-
TYPE_INT
protected static final int TYPE_INT- See Also:
-
TYPE_LNG
protected static final int TYPE_LNG- See Also:
-
dblSource
-
fltSource
-
intSource
-
lngSource
-
type
protected int type
-
-
Constructor Details
-
AbstractArrayFunction
Create a function on a double array source.- Parameters:
source- The data source.
-
AbstractArrayFunction
Create a function on a float array source.- Parameters:
source- The data source.
-
AbstractArrayFunction
Create a function on an integer array source.- Parameters:
source- The data source.
-
AbstractArrayFunction
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 the IUpdatableSource interface it is updated before reading data.- Specified by:
applyFunctionin classAbstractFunction
-
apply
public void apply(double[] data) Apply the function on a 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(float[] data) Apply the function on a the given array of float 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) Apply the function on a 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) Apply the function on a 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.
-