![]() |
AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
|
example: visualize binary tree traversal More...
Classes | |
class | MyTree |
simple tree with decorator for visualization | |
Public Member Functions | |
BinaryTreeTraversal (MyTree tree) | |
create traversal application for tree More... | |
void | traverse (String type) |
start traversal More... | |
![]() | |
SingleStepper (JFrame parent) | |
create new instance More... | |
SingleStepper (String caption) | |
create new instance More... | |
JFrame | parent () |
get parent widget More... | |
void | halt (String text, int timeout) |
display text and wait for user or timeout More... | |
void | setTimeout (int timeout) |
Set global timeout. More... | |
SingleStepper | whereAmI () |
print location of calling code More... | |
SingleStepper | showSource () |
jmp to caller's location in editor (emacs only) More... | |
void | halt (String text) |
display text and wait for user (or global timeout) More... | |
void | halt () |
wait for user More... | |
Static Public Member Functions | |
static MyTree | exampleTree () |
generate some tree More... | |
static void | main (String[] args) |
static void | main (String[] args) |
Protected Member Functions | |
void | onHalt () |
void | output (MyTree node) |
output node during traversal More... | |
void | see (MyTree node) |
arrived node for first time (for visualization) More... | |
void | preorder (MyTree node) |
recursive preorder traversal More... | |
void | inorder (MyTree node) |
recursive inorder traversal More... | |
void | postorder (MyTree node) |
recursive postorder traversal More... | |
void | levelorder (MyTree root) |
level order traversdal More... | |
![]() | |
JComponent | createComponents () |
void | onNext () |
call on button pressed More... | |
void | println (String text) |
print to both, text area and stdout More... | |
void | onHalt () |
Protected Attributes | |
MyTree | tree_ = null |
DotViewer | viewer_ |
SimpleDecorator | decorator |
![]() | |
JFrame | frame |
JTextArea | history |
JButton | next |
Object | monitor = new Object() |
int | timeout = 0 |
example: visualize binary tree traversal
Definition at line 12 of file example/BinaryTreeTraversal.java.
aud.example.BinaryTreeTraversal.BinaryTreeTraversal | ( | MyTree | tree | ) |
create traversal application for tree
Definition at line 20 of file example/BinaryTreeTraversal.java.
References aud.example.BinaryTreeTraversal.decorator, and aud.example.BinaryTreeTraversal.tree_.
|
static |
generate some tree
Definition at line 45 of file example/BinaryTreeTraversal.java.
Referenced by aud.example.BinaryTreeTraversal.main().
|
protected |
recursive inorder traversal
Definition at line 123 of file example/BinaryTreeTraversal.java.
References aud.example.BinaryTreeTraversal.inorder(), aud.example.BinaryTreeTraversal.output(), and aud.example.BinaryTreeTraversal.see().
Referenced by aud.example.BinaryTreeTraversal.inorder(), and aud.example.BinaryTreeTraversal.traverse().
|
protected |
level order traversdal
Definition at line 143 of file example/BinaryTreeTraversal.java.
References aud.Queue< T >.dequeue(), aud.Queue< T >.enqueue(), aud.util.SingleStepper.halt(), aud.Queue< T >.is_empty(), aud.example.BinaryTreeTraversal.output(), and aud.example.BinaryTreeTraversal.see().
Referenced by aud.example.BinaryTreeTraversal.traverse().
|
static |
Reimplemented from aud.util.SingleStepper.
Definition at line 168 of file example/BinaryTreeTraversal.java.
References aud.example.BinaryTreeTraversal.exampleTree(), aud.util.SingleStepper.halt(), and aud.example.BinaryTreeTraversal.traverse().
|
protected |
Reimplemented from aud.util.SingleStepper.
Definition at line 26 of file example/BinaryTreeTraversal.java.
References aud.util.DotViewer.display(), aud.example.BinaryTreeTraversal.tree_, and aud.example.BinaryTreeTraversal.viewer_.
|
protected |
output node during traversal
Definition at line 69 of file example/BinaryTreeTraversal.java.
References aud.example.BinaryTreeTraversal.decorator, aud.util.CommonGraphvizDecorator.getGraphLabel(), aud.util.SingleStepper.halt(), aud.util.SimpleDecorator.highlightNode(), aud.util.SimpleDecorator.markNode(), and aud.util.CommonGraphvizDecorator.setGraphLabel().
Referenced by aud.example.BinaryTreeTraversal.inorder(), aud.example.BinaryTreeTraversal.levelorder(), aud.example.BinaryTreeTraversal.postorder(), and aud.example.BinaryTreeTraversal.preorder().
|
protected |
recursive postorder traversal
Definition at line 133 of file example/BinaryTreeTraversal.java.
References aud.example.BinaryTreeTraversal.output(), aud.example.BinaryTreeTraversal.postorder(), and aud.example.BinaryTreeTraversal.see().
Referenced by aud.example.BinaryTreeTraversal.postorder(), and aud.example.BinaryTreeTraversal.traverse().
|
protected |
recursive preorder traversal
Definition at line 113 of file example/BinaryTreeTraversal.java.
References aud.example.BinaryTreeTraversal.output(), aud.example.BinaryTreeTraversal.preorder(), and aud.example.BinaryTreeTraversal.see().
Referenced by aud.example.BinaryTreeTraversal.preorder(), and aud.example.BinaryTreeTraversal.traverse().
|
protected |
arrived node
for first time (for visualization)
Definition at line 76 of file example/BinaryTreeTraversal.java.
References aud.example.BinaryTreeTraversal.decorator, and aud.util.SimpleDecorator.markEdge().
Referenced by aud.example.BinaryTreeTraversal.inorder(), aud.example.BinaryTreeTraversal.levelorder(), aud.example.BinaryTreeTraversal.postorder(), and aud.example.BinaryTreeTraversal.preorder().
void aud.example.BinaryTreeTraversal.traverse | ( | String | type | ) |
start traversal
type | denotes the type of traversal "preorder", "inorder","postorder" |
RuntimeException | for unknown type |
Definition at line 85 of file example/BinaryTreeTraversal.java.
References aud.util.CommonGraphvizDecorator.clear(), aud.example.BinaryTreeTraversal.decorator, aud.util.SingleStepper.halt(), aud.util.SimpleDecorator.highlightNode(), aud.example.BinaryTreeTraversal.inorder(), aud.example.BinaryTreeTraversal.levelorder(), aud.example.BinaryTreeTraversal.postorder(), aud.example.BinaryTreeTraversal.preorder(), aud.util.CommonGraphvizDecorator.setGraphLabel(), and aud.example.BinaryTreeTraversal.tree_.
Referenced by aud.example.BinaryTreeTraversal.main().
|
protected |
Definition at line 17 of file example/BinaryTreeTraversal.java.
Referenced by aud.example.BinaryTreeTraversal.BinaryTreeTraversal(), aud.example.BinaryTreeTraversal.output(), aud.example.BinaryTreeTraversal.see(), and aud.example.BinaryTreeTraversal.traverse().
|
protected |
Definition at line 14 of file example/BinaryTreeTraversal.java.
Referenced by aud.example.BinaryTreeTraversal.BinaryTreeTraversal(), aud.example.BinaryTreeTraversal.onHalt(), and aud.example.BinaryTreeTraversal.traverse().
|
protected |
Definition at line 15 of file example/BinaryTreeTraversal.java.
Referenced by aud.example.BinaryTreeTraversal.onHalt().