Interface PNodeI

  • All Superinterfaces:
    java.lang.Comparable<PNodeI>, java.io.Serializable
    All Known Implementing Classes:
    AbstractPNode, Monomial, PConstant, PFunction, Polynomial, POperator, PVariable

    public interface PNodeI
    extends java.lang.Comparable<PNodeI>, java.io.Serializable
    An element in a polynomial representation of an expression. Provides the main routines for creating, comparing and manipulating polynomials.
    Author:
    Rich Morris Created on 17-Dec-2004
    • Method Detail

      • equalsPNode

        boolean equalsPNode​(PNodeI node)
        True is nodes represent the same parse trees
      • equals

        boolean equals​(java.lang.Object o)
        True is nodes represent the same parse trees
        Overrides:
        equals in class java.lang.Object
      • compareTo

        int compareTo​(PNodeI fun)
        Compares this expression to argument. Uses a total ordering of expressions. Returns positive if this node comes after the argument.
        Specified by:
        compareTo in interface java.lang.Comparable<PNodeI>
      • toCompactNode

        Node toCompactNode()
                    throws ParseException
        Converts to a more efficient Jep representation. Exploits the feature of the Add and Multiply operators which allow the operators to work as n-ary operators. Order of elements is altered to make for more efficient operation.
        Returns:
        Throws:
        ParseException
      • toString

        java.lang.String toString()
        Produces a string representation of the argument.
        Overrides:
        toString in class java.lang.Object
      • isZero

        boolean isZero()
        True if node represents zero
      • isOne

        boolean isOne()
        True if node represents one
      • convertToPolyArray

        void convertToPolyArray​(java.lang.String var,
                                java.util.Map<java.lang.Integer,​PNodeI> polyArray)
                         throws ParseException
        Internal method for extracting coefficients
        Parameters:
        var - variable name
        polyArray - results added to this map
        Throws:
        ParseException