Package fr.iMath.algorithms
Class RPNAlgorithm
java.lang.Object
fr.iMath.algorithms.RPNAlgorithm
public class RPNAlgorithm
extends java.lang.Object
Application of the Reverse Polish Algorithm
- Author:
- HESEQUE Antoine
-
Field Summary
Fields Modifier and Type Field Description private static java.util.HashMap<Function,java.util.function.Function<java.lang.Float,java.lang.Float>>
functions
Association between functions and their associated functions.private static java.util.HashMap<Operator,java.util.function.BiFunction<java.lang.Float,java.lang.Float,java.lang.Float>>
operators
Association between operators and their associated functions. -
Constructor Summary
Constructors Constructor Description RPNAlgorithm()
-
Method Summary
Modifier and Type Method Description static float
evaluate(java.util.Stack<EquationObjectData> data, float xValue)
Evaluate the function with the RPN Algorithm
-
Field Details
-
operators
private static final java.util.HashMap<Operator,java.util.function.BiFunction<java.lang.Float,java.lang.Float,java.lang.Float>> operatorsAssociation between operators and their associated functions. -
functions
private static final java.util.HashMap<Function,java.util.function.Function<java.lang.Float,java.lang.Float>> functionsAssociation between functions and their associated functions.
-
-
Constructor Details
-
RPNAlgorithm
public RPNAlgorithm()
-
-
Method Details
-
evaluate
Evaluate the function with the RPN Algorithm- Parameters:
data
- stack of equations in reverse modexValue
- value of x- Returns:
- The value of f(x) (float)
-