Class ExpressionSimplifier

java.lang.Object
math.differentialcalculus.ExpressionSimplifier

public class ExpressionSimplifier extends Object
Objects of this class seek to simplify a math expression, by taking it through a series of transformative processes.
  • Field Details

  • Constructor Details

    • ExpressionSimplifier

      public ExpressionSimplifier(ArrayList<String> scanned)
  • Method Details

    • getSimplifiedExpression

      public ArrayList<String> getSimplifiedExpression()
      Returns:
      an ArrayList containing the simplified expression.
    • translateToBaseTerms

      private ArrayList<String> translateToBaseTerms(Formula f)
      Returns:
      an ArrayList containing a Formula object's data in terms of the base variable.
    • simplifyCompoundBrackets

      public static void simplifyCompoundBrackets(List<String> list)
      Simplifies tokens in a List that have no + or - operator, but may have brackets. e.g. ((x^2)*(2/x)*...)
      Parameters:
      list - The List containing the tokens.
    • solve

      public static List<String> solve(List<String> list)
      Used by the main parser solve to figure out SBP portions of a multi-bracketed expression (MBP)
      Parameters:
      list - a list of scanner tokens of a maths expression
      Returns:
      the solution to a SBP maths expression
    • generateName

      private String generateName()
      Automatically generates a name for a given Formula object..especially since these are automatically created on the fly during expression simplification.
      Returns:
      a unique name for the object.