Class PFunction

  • All Implemented Interfaces:
    PNodeI, java.io.Serializable, java.lang.Comparable<PNodeI>

    public class PFunction
    extends AbstractPNode
    Represents a function.
    Author:
    Rich Morris Created on 15-Dec-2004
    See Also:
    Serialized Form
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • compareTo

        public int compareTo​(PFunction fun)
      • toString

        public java.lang.String toString()
        Description copied from interface: PNodeI
        Produces a string representation of the argument.
        Specified by:
        toString in interface PNodeI
        Overrides:
        toString in class java.lang.Object
      • toCompactNode

        public Node toCompactNode()
                           throws ParseException
        Description copied from interface: PNodeI
        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
      • getName

        public java.lang.String getName()
        Returns:
        Returns the name of the function.
      • getPfmc

        public PostfixMathCommandI getPfmc()
        Returns:
        Returns the PostfixMathCommandI for the function.
      • getNArgs

        public int getNArgs()
        Returns:
        the number of arguments
      • getArg

        public PNodeI getArg​(int i)
        Parameters:
        i -
        Returns:
        returns the i-th argument
      • convertToPolyArray

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