AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
aud.util.GraphDemo Class Reference

Demonstrate visualization of graph algorithms. More...

+ Inheritance diagram for aud.util.GraphDemo:
+ Collaboration diagram for aud.util.GraphDemo:

Classes

class  MyGraph
 

Static Public Member Functions

static void main (String args[])
 
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

AbstractGraph<?,?> g = null
 
DotViewer v
 
- Protected Attributes inherited from aud.util.SingleStepper
JFrame frame
 
JTextArea history
 
JButton next
 
Object monitor = new Object()
 
int timeout = 0
 

Additional Inherited Members

- 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...
 

Detailed Description

Demonstrate visualization of graph algorithms.

Definition at line 7 of file GraphDemo.java.

Member Function Documentation

◆ main()

static void aud.util.GraphDemo.main ( String  args[])
static

Reimplemented from aud.util.SingleStepper.

Definition at line 34 of file GraphDemo.java.

34 {
35
36 MyGraph g=new MyGraph();
37 GraphDemo app=new GraphDemo(g);
38
39 SimpleNode n0=g.addNode(); app.halt();
40 SimpleNode n1=g.addNode(); app.halt();
41 SimpleNode n2=g.addNode(); app.halt();
42
43 SimpleEdge e0=g.addEdge(n0,n1); app.whereAmI().showSource().halt("add e0");
44 SimpleEdge e1=g.addEdge(n1,n0); app.halt("add e1");
45
46 SimpleEdge e2=g.addEdge(n0,n2); app.halt("add e2");
47 SimpleEdge e3=g.addEdge(n2,n1); app.halt("add e3");
48
49 System.out.println("n0="+n0);
50 System.out.println("n1="+n1);
51 System.out.println("n2="+n2);
52 System.out.println("e0="+e0);
53 System.out.println("e1="+e1);
54 System.out.println("e2="+e2);
55 System.out.println("e3="+e3);
56
57 SimpleDecorator decorator=(SimpleDecorator) g.getDecorator();
58 decorator.markNode(n0); app.halt();
59 n0.setLabel("A");
60 e0.setLabel("a b c");
61 decorator.markEdge(e0); app.halt();
62 decorator.unmarkNode(n0);
63 decorator.markNode(n1); app.halt();
64 decorator.highlightNode(n2);
65 decorator.highlightEdge(e2); app.halt();
66
67 app.halt("QUIT");
68 System.exit(0);
69 }
GraphvizDecorator getDecorator()
get decoration or null
abstract Edge addEdge(Node source, Node destination)
Create and add new edge from source to destination.
abstract Node addNode()
create and add new node
plain simple edge
Definition: SimpleEdge.java:4
void setLabel(String label)
set label (default label if label==null)
Definition: SimpleEdge.java:17
plain simple node
Definition: SimpleNode.java:4
void setLabel(String label)
set label (default label if label==null)
Definition: SimpleNode.java:16
AbstractGraph<?,?> g
Definition: GraphDemo.java:9

References aud.graph.AbstractGraph< Node extends AbstractNode, Edge extends AbstractEdge >.addEdge(), aud.graph.AbstractGraph< Node extends AbstractNode, Edge extends AbstractEdge >.addNode(), aud.util.GraphDemo.g, aud.graph.AbstractGraph< Node extends AbstractNode, Edge extends AbstractEdge >.getDecorator(), aud.util.SingleStepper.halt(), aud.util.SimpleDecorator.highlightEdge(), aud.util.SimpleDecorator.highlightNode(), aud.util.SimpleDecorator.markEdge(), aud.util.SimpleDecorator.markNode(), aud.graph.SimpleEdge.setLabel(), aud.graph.SimpleNode.setLabel(), aud.util.SingleStepper.showSource(), aud.util.SimpleDecorator.unmarkNode(), and aud.util.SingleStepper.whereAmI().

+ Here is the call graph for this function:

◆ onHalt()

void aud.util.GraphDemo.onHalt ( )
protected

Reimplemented from aud.util.SingleStepper.

Definition at line 29 of file GraphDemo.java.

29 {
30 if (g!=null)
31 v.display(g);
32 }
void display(String code)
display dot code
Definition: DotViewer.java:107

References aud.util.DotViewer.display(), aud.util.GraphDemo.g, and aud.util.GraphDemo.v.

+ Here is the call graph for this function:

Member Data Documentation

◆ g

AbstractGraph<?,?> aud.util.GraphDemo.g = null
protected

Definition at line 9 of file GraphDemo.java.

Referenced by aud.util.GraphDemo.main(), and aud.util.GraphDemo.onHalt().

◆ v

DotViewer aud.util.GraphDemo.v
protected
Initial value:
= DotViewer.displayWindow((String) null,
"aud.util.GraphDemo")

Definition at line 10 of file GraphDemo.java.

Referenced by aud.util.GraphDemo.onHalt().


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