Class FuncNode


public class FuncNode extends TermNode
A node of an expression tree that represents a function. A FuncNode can have 0 or more children.
  • Constructor Details

    • FuncNode

      public FuncNode(String name, boolean negate)
  • Method Details

    • add

      public void add(Expression x)
      Adds the expression as a child.
    • insert

      public void insert(Expression x, int i)
      Adds the expression as a child at the specified index.
    • remove

      public void remove(Expression x)
      Removes the specified expression as a child. Does nothing if the expression was not a child.
    • numChildren

      public int numChildren()
      Returns the number of child expressions.
    • child

      public Expression child(int i)
      Returns the child expression at the specified index.
    • eval

      public double eval(VarMap v, FuncMap f)
      Evaluates each of the children, storing the result in an internal double array. The FuncMap is used to obtain a Function object based on the name of this FuncNode. The function is passed the double array and returns a result. If negate is true, the result is negated. The result is then returned. The numParam passed to the function is the number of children of this FuncNode.
      Specified by:
      eval in class Expression