Class Operator

java.lang.Object
ch.andre601.expressionparser.operator.Operator
Direct Known Subclasses:
ListOperator

public abstract class Operator extends Object
Class used to do operations on ExpressionTemplates.
  • Constructor Details

    • Operator

      public Operator(int priority)
      Constructor for creating a new Operator.
      Parameters:
      priority - Priority this Operator should have.
  • Method Details

    • of

      public static Operator of(int priority, BiFunction<ExpressionTemplate,ExpressionTemplate,ExpressionTemplate> function)
      Static method to create a new Operator with its createTemplate method utilizing the provided BiFunction.
      Parameters:
      priority - The priority this Operator should have.
      function - The BiFunction that should be used when createTemplate is called for the Operator.
      Returns:
      A new Operator.
    • getPriority

      public int getPriority()
      Returns the priority set for this Operator.
      Returns:
      Priority of this Operator.
    • createTemplate

      public abstract ExpressionTemplate createTemplate(ExpressionTemplate a, ExpressionTemplate b)
      Method to create an ExpressionTemplate from two ExpressionTemplates.
      Parameters:
      a - First ExpressionTemplate to use.
      b - Second ExpressionTemplate to use.
      Returns:
      ExpressionTemplate instance made from the provided ExpressionTemplates.