Package com.singularsys.jep.functions
Class MinMax
java.lang.Object
com.singularsys.jep.functions.PostfixMathCommand
com.singularsys.jep.functions.ArrayFunctionBase
com.singularsys.jep.functions.MinMax
- All Implemented Interfaces:
PostfixMathCommandI
,Serializable
Minimum and Maximum functions. Initialize with true for minimum and false
for maximum.
Since Jep 3.4 this function will flatten its arguments so
min([1,[2,3]])
will be 1.- Since:
- 3.1.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.singularsys.jep.functions.ArrayFunctionBase
ArrayFunctionBase.ZeroLengthErrorBehaviour
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Comparative
Used to compare greater than or less than between objects.Fields inherited from class com.singularsys.jep.functions.PostfixMathCommand
curNumberOfParameters, name, NaN, numberOfParameters
-
Constructor Summary
ConstructorDescriptionMinMax
(boolean isMin) Constructor.MinMax
(Comparative comp) Constructor allowing for a different Comparative object. -
Method Summary
Methods inherited from class com.singularsys.jep.functions.ArrayFunctionBase
addToArray, checkNumberOfParameters, getZeroLengthErrorBehaviour, run, setZeroLengthErrorBehaviour, throwAtLeastOneExcep
Methods inherited from class com.singularsys.jep.functions.PostfixMathCommand
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, getName, getNumberOfParameters, setCurNumberOfParameters, setName, toString, toString
-
Field Details
-
comp
Used to compare greater than or less than between objects.
-
-
Constructor Details
-
MinMax
public MinMax(boolean isMin) Constructor.- Parameters:
isMin
- set to true for Minimum, false for Maximum
-
MinMax
Constructor allowing for a different Comparative object. TheComparative.compare(Object, Object)
method will be used to compare elements.- Parameters:
comp
- a Comparative object or subclass implemented less than or greater than.- Since:
- 3.4.0
-
-
Method Details
-
calc
Description copied from class:ArrayFunctionBase
Abstract method for performing the array calculation.- Specified by:
calc
in classArrayFunctionBase
- Parameters:
v
- The list to operate on. Note this is in reverse order of the arguments of the function.- Returns:
- The result of the calculation.
- Throws:
EvaluationException
- if the calculation cannot be performed
-
minmax
- Throws:
EvaluationException
-
getComp
Return the Comparative objected used to order the objects.- Returns:
- the Comparative object
- Since:
- 3.4.0
-