Package com.singularsys.jep.walkers
These classes implement various methods of traversing trees representing equations.
For very large equations with 10,000+ nodes the standard ParserVisitor
class
can encounter problems with stack overflows due to recursions. The PostfixTreeWalker
offers a base class for
a traversal strategy which minimises the number of stack frames
used and the PostfixEvaluator
is an evaluator which uses this strategy. These methods visit each node in postfix fashion
hence for 1+cos(x)
the nodes are visited in the order
1, x, cos, +
.
PrefixTreeWalker
is similar but visits nodes in a prefix fashion
for 1+cos(x)
the nodes are visited in the order
+, 1, cos, x
.
DoNothingVisitor
and DeepCopyVisitor
are two base classes for classes which manipulate
expressions using a standard recursive traversal. DoNothingVisitor
visits each node
in turn performing no action and returning the node.
DeepCopyVisitor
visits each node returning a copy of that node.
-
ClassDescriptionA Visitor which returns an exact copy of the tree.A Visitor which visits each node of an expression tree and does nothing.Consolidates nested addition and multiplication to produce nary operators.Remove a specific hook from any node which has it on a treeImports an expression from one Jep instance into another.Evaluation component that avoids excessive use of the stack for large expressions.Base class for routines which use a non-recursive tree walker strategy.Dumps the contents of a tree to a specified stream, or to standard output.Base class for routines which use a non-recursive tree walker strategy.Allows substitution of variable with values or expressions.Analyze an expression, counting the number of nodes of each type, and recording which variables, functions and operators occurred in the expression.