7import java.util.Scanner;
14 class MyA234Tree
extends A234Tree<String> {
18 System.err.println(bottom_up ?
"bottom-up mode\n" :
"top-down mode\n");
21 @Override
protected void onSplit(KTreeNode<String> node) {
23 halt(
"insert requires split...");
28 protected MyA234Tree
tree_ =
null;
30 ((String)
null,
"aud.example.A234TreeExample");
34 super(
"aud.example.A234TreeExample");
35 tree_=
new MyA234Tree(
this,bottom_up);
46 public static void main(String[] args) {
49 "usage: java aud.example.A234TreeExample [pause] [bottom-up]\n"+
50 " Reads and insert words from standard input.\n"+
52 "\tpause [milliseconds] set pause between animation steps\n"+
53 "\t A value of 0 requires to explicitly push the 'continue'\n"+
54 "\t button. The default value is 0 (or the value of then\n"+
55 "\t environment variable 'AUD_TIMEOUT')!\n"+
56 "\tbottom-up select bottom-up splitting on insertion\n"
64 }
catch (NumberFormatException e) {
65 System.err.println(HELP);
70 app.
halt(
"EMPTY TREE");
72 Scanner s=
new Scanner(System.in);
73 s.useDelimiter(
"\\s+");
77 if (key.compareTo(
"quit")==0)
81 app.
halt(
"inserted '"+key);
static void main(String[] args)
start interactive example
A234TreeExample(boolean bottom_up)
create application instance
Simple viewer for Graphvizable.
void display(String code)
display dot code
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.