Package com.singularsys.jep.walkers

Expression tree traversal classes.

See:
          Description

Interface Summary
SerializableExpression.Element interface used in internal representation of expression
 

Class Summary
DeepCopyVisitor A Visitor which returns an exact copy of the tree.
DoNothingVisitor A Visitor which visits each node of a expression tree and does nothing.
ExpressionConsolidator Consolidates nested addition and multiplication to produce nary operators.
PostfixEvaluator Evaluation component that avoids excessive use of the stack for large expressions.
PostfixTreeWalker Base class for routines which use a non recursive tree walker strategy.
PrefixTreeDumper Dumps the contents of a tree to a specified stream, or to standard output.
PrefixTreeWalker Base class for routines which use a non recursive tree walker strategy.
SerializableExpression A serializable representation of an expression.
SerializableExpression.Constant  
SerializableExpression.Function  
SerializableExpression.Operator  
SerializableExpression.Variable  
SubstitutionVisitor Allows substitution of a given variable with an expression tree.
TreeAnalyzer Analyze an expression, counting the number of nodes of each type, and recording which variables, functions and operators occurred in the expression.
 

Package com.singularsys.jep.walkers Description

Expression tree traversal classes.

These classes implement various methods of transversing 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 transversal 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 transversal. DoNothingVisitor visits each node in turn performing no action and returning the node. DeepCopyVisitor visits each node returning a copy of that node.



Copyright © 2010 Singular Systems http://www.singularsys.com/jep