Package com.graphbuilder.math
Class FuncNode
java.lang.Object
com.graphbuilder.math.Expression
com.graphbuilder.math.TermNode
com.graphbuilder.math.FuncNode
A node of an expression tree that represents a function. A FuncNode can have 0 or more children.
-
Field Summary
Fields inherited from class com.graphbuilder.math.Expression
parent -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(Expression x) Adds the expression as a child.child(int i) Returns the child expression at the specified index.doubleEvaluates each of the children, storing the result in an internal double array.voidinsert(Expression x, int i) Adds the expression as a child at the specified index.intReturns the number of child expressions.voidremove(Expression x) Removes the specified expression as a child.Methods inherited from class com.graphbuilder.math.Expression
checkBeforeAccept, getFunctionNames, getParent, getVariableNames, isDescendent, toString
-
Constructor Details
-
FuncNode
-
-
Method Details
-
add
Adds the expression as a child. -
insert
Adds the expression as a child at the specified index. -
remove
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
Returns the child expression at the specified index. -
eval
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:
evalin classExpression
-