Class Range
java.lang.Object
com.singularsys.jep.functions.PostfixMathCommand
com.singularsys.jep.functions.BinaryFunction
com.singularsys.jep.misc.functions.Range
- All Implemented Interfaces:
PostfixMathCommandI,Serializable
A function which returns an increasing sequence of all the items between the end points inclusive.
[1..10]This is typically used with the
RangeOperator
and a modified parser such as ConfigurableParserWithRange.
OperatorTable2 optab = new StandardOperatorTable2();
Operator rangeOp = new RangeOperator("..", "[", "]", new Range(), Operator.BINARY+Operator.NOT_IN_PARSER);
optab.insertOperator(OperatorTable2.SpecialOperators.RANGE , rangeOp, optab.getAssign());
ConfigurableParser cp = new ConfigurableParserWithRange("..");
Jep jep = new Jep(cp,optab);
- Since:
- Jep 4.1
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.singularsys.jep.functions.BinaryFunction
BinaryFunction.BiFunctionWithException<T> -
Field Summary
Fields inherited from class com.singularsys.jep.functions.PostfixMathCommand
curNumberOfParameters, description, name, NaN, numberOfParameters -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.singularsys.jep.functions.BinaryFunction
instanceOf, instanceOf, instanceOf, instanceOf, runMethods inherited from class com.singularsys.jep.functions.PostfixMathCommand
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, asType, checkNumberOfParameters, getDescription, getDescription, getDescriptionWithType, getName, getNumberOfParameters, setCurNumberOfParameters, setDescription, setName, toString, toString
-
Constructor Details
-
Range
public Range()
-
-
Method Details
-
eval
Evaluate the function. The arguments should be numbers, and the result is a vector of all the numbers between the end points inclusive. Both end points are cast to ints, and rounded if necessary- Specified by:
evalin classBinaryFunction- Parameters:
l- the lower boundr- the upper bound- Returns:
- a vector of Double values, or an empty vector if
r < l. - Throws:
EvaluationException- if the function cannot be evaluated.
-