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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • operators

      private static final 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.
    • functions

      private static final java.util.HashMap<Function,​java.util.function.Function<java.lang.Float,​java.lang.Float>> functions
      Association between functions and their associated functions.
  • Constructor Details

  • Method Details

    • evaluate

      public static float evaluate​(java.util.Stack<EquationObjectData> data, float xValue)
      Evaluate the function with the RPN Algorithm
      Parameters:
      data - stack of equations in reverse mode
      xValue - value of x
      Returns:
      The value of f(x) (float)