1package aud.example.expr;
18 super(atom,left,right);
20 throw new RuntimeException(
"ExpressionTree: AtomicExpression "+
21 "is already bound to another node!");
45 throw new RuntimeException(
"ExpressionTree#setData: AtomicExpression "+
46 "is already bound to an ExpressionTree node!");
58 String term=(!
isRoot() ?
"(" :
"");
76 public static void main(String[] args) {
89 System.out.println(t);
95 System.out.println(t);
BinaryTree< T > getLeft()
get left child or null
BinaryTreeTraversal< T >.Postorder postorder()
Get postorder iterator over nodes in tree .
BinaryTree< T > getRight()
get right child or null)
boolean isLeaf()
Is this a leaf?
boolean isRoot()
Iscode this} root?
Superclass for data associated with a tree node.
ExpressionTree node_
uplink reference to node: node_.getData()==this @endiliteral
Tree representation of arithmetic expression.
GraphvizDecorator getDecorator()
get decoration or null
ExpressionTree(AtomicExpression atom)
create tree node
double getValue()
compute value of expression
void setData(AtomicExpression data)
Set AtomicExpression for this node.
String toString()
Get string presentation of node data.
static void main(String[] args)
test and example for usage
ExpressionTree(AtomicExpression atom, ExpressionTree left, ExpressionTree right)
creare and link tree node
Node representing constant number.
Node representing a symbolic parameter, e.g., a varibale.
Decorator for items of Graphvizable objects.
Example for a simple decorator.
utilities (not related to AuD lecture)
AuD lecture: Data structures, algorithms, examples.