Class ExpressionSimplifier


  • public class ExpressionSimplifier
    extends java.lang.Object
    Objects of this class seek to simplify a math expression, by taking it through a series of transformative processes.
    Author:
    GBEMIRO
    • Constructor Summary

      Constructors 
      Constructor Description
      ExpressionSimplifier​(java.util.ArrayList<java.lang.String> scanned)  
    • Method Summary

      Modifier and Type Method Description
      java.util.ArrayList<java.lang.String> getSimplifiedExpression()  
      static void simplifyCompoundBrackets​(java.util.List<java.lang.String> list)
      Simplifies tokens in a List that have no + or - operator, but may have brackets.
      static java.util.List<java.lang.String> solve​(java.util.List<java.lang.String> list)
      Used by the main parser solve to figure out SBP portions of a multi-bracketed expression (MBP)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ExpressionSimplifier

        public ExpressionSimplifier​(java.util.ArrayList<java.lang.String> scanned)
    • Method Detail

      • getSimplifiedExpression

        public java.util.ArrayList<java.lang.String> getSimplifiedExpression()
        Returns:
        an ArrayList containing the simplified expression.
      • simplifyCompoundBrackets

        public static void simplifyCompoundBrackets​(java.util.List<java.lang.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 java.util.List<java.lang.String> solve​(java.util.List<java.lang.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