6import java.util.Scanner;
13 class MyAVLTree
extends AVLTree<String,String> {
17 @Override
protected void onInsert(Node node) {
19 halt(
"insert '"+node.getKey()+
"' before rebalancing");
24 protected MyAVLTree
tree_ =
null;
26 ((String)
null,
"aud.example.AVLTreeExample");
30 super(
"aud.example.AVLTreeExample");
31 tree_=
new MyAVLTree(
this);
42 public static void main(String[] args) {
45 "usage: java aud.example.AVLTreeExample [pause]\n"+
46 " Reads and insert words from standard input.\n"+
48 "\tpause [milliseconds] set pause between animation steps\n"+
49 "\t A value of 0 requires to explicitly push the 'continue'\n"+
50 "\t button. The default value is 0 (or the value of then\n"+
51 "\t environment variable 'AUD_TIMEOUT')!\n";
58 }
catch (NumberFormatException e) {
59 System.err.println(HELP);
64 app.
halt(
"EMPTY TREE");
66 Scanner s=
new Scanner(System.in);
67 s.useDelimiter(
"\\s+");
71 if (key.compareTo(
"quit")==0)
75 app.
halt(
"inserted '"+key+
"' and rebalanced");
example: insert entries and maintain balance
static void main(String[] args)
start interactive example
AVLTreeExample()
create application instance
Simple viewer for Graphvizable.
void display(String code)
display dot code
Example for a simple decorator.
Simple framework for single stepping code.
void setTimeout(int timeout)
Set global timeout.
void halt(String text, int timeout)
display text and wait for user or timeout
utilities (not related to AuD lecture)
AuD lecture: Data structures, algorithms, examples.