7import java.util.Scanner;
14 class MyTree
extends BTree<String> {
18 @Override
protected void onSplit(KTreeNode<String> node) {
20 halt(
"insert requires split...");
27 ((String)
null,
"aud.example.BTreeExample");
31 super(
"aud.example.BTreeExample");
32 tree_=
new MyTree(m,
this);
43 public static void main(String[] args) {
46 "usage: java aud.example.BTreeExample [M] [pause]\n"+
47 " Reads and insert words from standard input.\n"+
49 "\tpause [milliseconds] set pause between animation steps\n"+
50 "\t A value of 0 requires to explicitly push the 'continue'\n"+
51 "\t button. The default value is 0 (or the value of then\n"+
52 "\t environment variable 'AUD_TIMEOUT')!\n";
54 int m=args.length>0 ? Integer.parseInt(args[0]) : 1;
61 }
catch (NumberFormatException e) {
62 System.err.println(HELP);
67 app.
halt(
"EMPTY TREE");
69 Scanner s=
new Scanner(System.in);
70 s.useDelimiter(
"\\s+");
74 if (key.compareTo(
"quit")==0)
78 app.
halt(
"inserted '"+key);
static void main(String[] args)
start interactive example
BTreeExample(int m)
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.