Class NumberReturningStatsOperator

java.lang.Object
parser.Operator
parser.NumberReturningStatsOperator
All Implemented Interfaces:
Validatable

public class NumberReturningStatsOperator extends Operator implements Validatable
Deals with number returning statistical operators e.g sum,avg,mode e.t.c and log and antilog to any base operators
  • Field Details

    • index

      private int index
      The index of this operator in the scanned Function that it belongs to.
  • Constructor Details

    • NumberReturningStatsOperator

      public NumberReturningStatsOperator(String name, int index, ArrayList<String> scan)
      Parameters:
      name - The name of this Operator with which it is represented in a math function.
      index - the location of this Operator object in its parent Function object's scanned ArrayList object.
      scan - The scanner output
  • Method Details

    • setIndex

      public void setIndex(int index, ArrayList<String> scan)
      Parameters:
      index - sets the index of this operator in the scanned Function that it belongs to.
      scan - The scanner output
    • getIndex

      public int getIndex()
      Returns:
      the index of this operator in the scanned Function that it belongs to.
    • validate

      public boolean validate(ArrayList<String> scan)
      Specified by:
      validate in interface Validatable
      Parameters:
      scan - the ArrayList object that this NumberReturningStatsOperator object exists in. validates the grammatical usage of this operator (by leaving the correctFunction attribute of the Function object un-modified) if the usage of this operator in its immediate environment i.e to its left and right is correct.
      Returns:
      true if valid