Package parser

Class PolynomialExpression

    • Field Detail

      • DOUBLE_PRECISION

        public static final int DOUBLE_PRECISION
        Solves the Polynomial with normal double precision....about 16d.p.
        See Also:
        Constant Field Values
      • BIGDECIMAL_PRECISION

        public static final int BIGDECIMAL_PRECISION
        Solves the Polynomial with BigDecimal precision....about 16d.p.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PolynomialExpression

        public PolynomialExpression​(java.lang.String expression,
                                    int precision)
        Parameters:
        expression - A valid polynomial expression, having powers of the variable as only non-negative integers.
    • Method Detail

      • setPrecision

        public void setPrecision​(int precision)
        Parameters:
        precision - The precision to use. If set to any value other than 1 (DOUBLE_PRECISION) or 2 (BIGDECIMAL_PRECISION), it defaults to DOUBLE_PRECISION
      • getPrecision

        public int getPrecision()
      • solve

        public java.util.List<java.lang.String> solve​(java.util.List<java.lang.String> list)
        Description copied from class: MathExpression
        used by the main parser solve to figure out SBP portions of a multi-bracketed expression (MBP)
        Overrides:
        solve in class MathExpression
        Parameters:
        list - a list of scanner tokens of a maths expression
        Returns:
        the solution to a SBP maths expression
      • doublePrecisionSolve

        public java.util.List<java.lang.String> doublePrecisionSolve​(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. The precision returned here is that of double numbers, namely about 16d.p
      • bigDecimalPrecisionSolve

        public java.util.List<java.lang.String> bigDecimalPrecisionSolve​(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
      • main

        public static void main​(java.lang.String[] args)