Class BaseNFunction

java.lang.Object
parser.MathExpression
math.otherBaseParser.BaseNFunction
All Implemented Interfaces:
Savable, Solvable, Serializable

public class BaseNFunction extends MathExpression
See Also:
  • Field Details

    • baseOfOperation

      private int baseOfOperation
      The number base that objects of this class will use in computations.
  • Constructor Details

    • BaseNFunction

      public BaseNFunction(String input, int baseOfOperation)
      Parameters:
      input - The function to be evaluated. The general format contains variable and constant declarations for variables and constants that are not yet initialized,assignment expressions for those that have been initialized and then an expression to evaluate. e.g. var x =-12; var y =x+1/12; const x1,x2,x3=10; var z =sin(3x-1)+2.98cos(4x);cos(3x+12); The last expression is function to be evaluated and it is always without any equals sign and may or may not end with a semicolon.
      baseOfOperation - The number base that objects of this class will use in computations.
  • Method Details

    • setBaseOfOperation

      public void setBaseOfOperation(int baseOfOperation)
    • getBaseOfOperation

      public int getBaseOfOperation()
    • isBaseCompatible

      private ArrayList<Integer> isBaseCompatible()
      Checks if the numbers in the input are only of the specified base.
      Returns:
      An ArrayList containing the indices of all numbers in the scanner.
    • convertNumbersToDecimal

      private void convertNumbersToDecimal()
      Converts all numbers to base 10 system.
    • solve

      public String solve()
      Description copied from class: MathExpression
      Method solve is the main parser used to evaluate the input multi-bracket pair (MBP) expressions used to initialize the constructor of class MathExpression
      Specified by:
      solve in interface Solvable
      Overrides:
      solve in class MathExpression
      Returns:
      the result of the evaluation
    • main

      public static void main(String[] args)