AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
aud.example.A234TreeExample Class Reference

example: insert entries More...

+ Inheritance diagram for aud.example.A234TreeExample:
+ Collaboration diagram for aud.example.A234TreeExample:

Classes

class  MyA234Tree
 

Public Member Functions

 A234TreeExample (boolean bottom_up)
 create application instance More...
 
MyA234Tree getTree ()
 
- Public Member Functions inherited from aud.util.SingleStepper
 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 void main (String[] args)
 start interactive example More...
 
static void main (String[] args)
 

Protected Member Functions

void onHalt ()
 
- Protected Member Functions inherited from aud.util.SingleStepper
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

MyA234Tree tree_ = null
 
DotViewer viewer_
 
- Protected Attributes inherited from aud.util.SingleStepper
JFrame frame
 
JTextArea history
 
JButton next
 
Object monitor = new Object()
 
int timeout = 0
 

Detailed Description

example: insert entries

See also
aud.A234Tree

Definition at line 12 of file A234TreeExample.java.

Constructor & Destructor Documentation

◆ A234TreeExample()

create application instance

Definition at line 33 of file A234TreeExample.java.

33 {
34 super("aud.example.A234TreeExample");
35 tree_=new MyA234Tree(this,bottom_up);
36 }

References aud.example.A234TreeExample.tree_.

Member Function Documentation

◆ getTree()

MyA234Tree aud.example.A234TreeExample.getTree ( )

Definition at line 38 of file A234TreeExample.java.

38{ return tree_; }

References aud.example.A234TreeExample.tree_.

Referenced by aud.example.A234TreeExample.main().

+ Here is the caller graph for this function:

◆ main()

static void aud.example.A234TreeExample.main ( String[]  args)
static

start interactive example

Reimplemented from aud.util.SingleStepper.

Definition at line 46 of file A234TreeExample.java.

46 {
47
48 final String HELP=
49 "usage: java aud.example.A234TreeExample [pause] [bottom-up]\n"+
50 " Reads and insert words from standard input.\n"+
51 " 'quit' quits.\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"
57 ;
58
59 A234TreeExample app=new A234TreeExample(args.length>1);
60
61 if (args.length>0) {
62 try {
63 app.setTimeout(Integer.parseInt(args[0]));
64 } catch (NumberFormatException e) {
65 System.err.println(HELP);
66 System.exit(-1);
67 }
68 }
69
70 app.halt("EMPTY TREE");
71
72 Scanner s=new Scanner(System.in);
73 s.useDelimiter("\\s+");
74
75 while (s.hasNext()) {
76 String key=s.next();
77 if (key.compareTo("quit")==0)
78 break;
79 else {
80 app.getTree().insert(key);
81 app.halt("inserted '"+key);
82 }
83 }
84 app.halt("QUIT");
85 System.exit(0);
86 }
A234TreeExample(boolean bottom_up)
create application instance

References aud.example.A234TreeExample.getTree(), aud.util.SingleStepper.halt(), and aud.util.SingleStepper.setTimeout().

+ Here is the call graph for this function:

◆ onHalt()

void aud.example.A234TreeExample.onHalt ( )
protected

Reimplemented from aud.util.SingleStepper.

Definition at line 40 of file A234TreeExample.java.

40 {
41 if (tree_!=null)
43 }
void display(String code)
display dot code
Definition: DotViewer.java:108

References aud.util.DotViewer.display(), aud.example.A234TreeExample.tree_, and aud.example.A234TreeExample.viewer_.

+ Here is the call graph for this function:

Member Data Documentation

◆ tree_

MyA234Tree aud.example.A234TreeExample.tree_ = null
protected

◆ viewer_

DotViewer aud.example.A234TreeExample.viewer_
protected
Initial value:
= DotViewer.displayWindow
((String) null,"aud.example.A234TreeExample")

Definition at line 29 of file A234TreeExample.java.

Referenced by aud.example.A234TreeExample.onHalt().


The documentation for this class was generated from the following file: