|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.xj.anylogic.engine.TableFunction
public class TableFunction
Table function enables the user to define functions by giving a number of
(argument, value) pairs, i.e. a number of base points on a plot. Supports
various interpolation types. A call of get(x) will return a (possibly,
interpolated) value of the function. A number of behaviors are supported
for the case x is out of original argument range.
In case the function only supports discrete values (that were provided as
the argument set), and no interpolation is allowed, a call of get(x) with
x not matching any argument entry would result in exception thrown.
| Field Summary | |
|---|---|
static int |
INTERPOLATION_APPROXIMATION
|
static int |
INTERPOLATION_LINEAR
|
static int |
INTERPOLATION_NONE
|
static int |
INTERPOLATION_SPLINE
|
static int |
INTERPOLATION_STEP
|
static int |
OUTOFRANGE_CUSTOM
|
static int |
OUTOFRANGE_ERROR
|
static int |
OUTOFRANGE_EXTRAPOLATE
|
static int |
OUTOFRANGE_NEAREST
|
static int |
OUTOFRANGE_REPEAT
|
| Constructor Summary | |
|---|---|
TableFunction(double[] arguments,
double[] values,
int interpolationtype,
int outofrangeaction,
double outofrangevalue)
Deprecated. please use TableFunction(double[], double[], int, int, int, double) constructor instead |
|
TableFunction(double[] arguments,
double[] values,
int interpolationtype,
int approximationOrder,
int outofrangeaction,
double outofrangevalue)
Creates a new table function with the given arguments, values, interpolation type and out of range behavior type. |
|
| Method Summary | |
|---|---|
double |
get(double x)
Returns the table function value corresponding to the given argument, subject to the currently set interpolation type and out of range handling. |
int |
getApproximationOrder()
The method returns the currently set order of the approximation polynomial used in the approximation mode. |
double[] |
getArguments()
Returns the (sorted) array of arguments. |
int |
getInterpolationType()
Returns the current interpolation type of the table function. |
int |
getLength()
Returns the number of entries (rows) in the table function. |
double |
getNextArgument(double x)
Returns the value of the nearest argument that is strictly greater than x, respecting the possible table repeating. |
int |
getOutOfRangeAction()
Returns the current type of action performed for out of range arguments. |
double |
getOutOfRangeDefaultValue()
Returns the value that is returned by get(x) in case x is out of range when out of range action type is OUTOFRANGE_CUSTOM. |
double[] |
getValues()
Returns the array of values corresponding to the (sorted) array of arguments. |
void |
setApproximationOrder(int order)
This method sets order of the approximation polynomial for the INTERPOLATION_APPROXIMATION mode. |
void |
setArgumentsAndValues(double[] arguments,
double[] values)
Sets the new argument and value arrays for the table function. |
void |
setInterpolationType(int type)
Sets the new interpolation type for the table function. |
void |
setOutOfRangeAction(int action)
Sets the new action performed in case the argument provided in get() is out of range. |
void |
setOutOfRangeDefaultValue(double value)
Sets the value to be returned by get(x) in case x is out of range AND out of range action type is OUTOFRANGE_CUSTOM. |
java.lang.String |
toString()
Returns the textual representation of the table function. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int INTERPOLATION_NONE
public static final int INTERPOLATION_STEP
public static final int INTERPOLATION_LINEAR
public static final int INTERPOLATION_SPLINE
public static final int INTERPOLATION_APPROXIMATION
public static final int OUTOFRANGE_ERROR
public static final int OUTOFRANGE_NEAREST
public static final int OUTOFRANGE_CUSTOM
public static final int OUTOFRANGE_REPEAT
public static final int OUTOFRANGE_EXTRAPOLATE
| Constructor Detail |
|---|
@Deprecated
public TableFunction(double[] arguments,
double[] values,
int interpolationtype,
int outofrangeaction,
double outofrangevalue)
TableFunction(double[], double[], int, int, int, double) constructor instead
arguments - the array of arguments (2 or more - recommended, no duplicates, can be sorted or not)values - the array of values (same size as arguments)interpolationtype - the interpolation typeoutofrangeaction - the type of action performed for out of range arguments in get()outofrangevalue - the value returned if argument is out of range
public TableFunction(double[] arguments,
double[] values,
int interpolationtype,
int approximationOrder,
int outofrangeaction,
double outofrangevalue)
arguments - the array of arguments (2 or more - recommended, no duplicates, can be sorted or not)values - the array of values (same size as arguments)interpolationtype - the interpolation typeapproximationOrder - the order (1, 2, 3...) of the approximation
polynomial if the INTERPOLATION_APPROXIMATION mode is selectedoutofrangeaction - the type of action performed for out of range arguments in get()outofrangevalue - the value returned if argument is out of range| Method Detail |
|---|
public double get(double x)
x - the argument
public void setArgumentsAndValues(double[] arguments,
double[] values)
arguments - the array of argumentsvalues - the array of valuespublic double[] getArguments()
public double[] getValues()
public int getLength()
public double getNextArgument(double x)
public void setInterpolationType(int type)
setApproximationOrder(int) or in the
constructor) before calling this method
type - the new interpolation typepublic void setApproximationOrder(int order)
setInterpolationType(int))
order - order of the approximation (polynomial order)public int getApproximationOrder()
public int getInterpolationType()
public void setOutOfRangeAction(int action)
action - the type of action performed for out of range argumentspublic int getOutOfRangeAction()
public void setOutOfRangeDefaultValue(double value)
value - the value to be returned by get(x) in case x is out of rangepublic double getOutOfRangeDefaultValue()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||