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

Example for a simple decorator. More...

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

Public Member Functions

void highlightNode (GraphvizDecorable object)
 Set highlighted node. More...
 
void highlightEdge (GraphvizDecorable object)
 Set highlighted edge. More...
 
void markNode (GraphvizDecorable object)
 
void unmarkNode (GraphvizDecorable object)
 unmark node object
More...
 
void unmarkAllNodes ()
 unmark all nodes More...
 
void markEdge (GraphvizDecorable object)
 
void unmarkEdge (GraphvizDecorable object)
 unmark edge object
More...
 
void unmarkAllEdges ()
 unmark all edges More...
 
String getNodeDecoration (GraphvizDecorable object)
 get node decoration More...
 
String getEdgeDecoration (GraphvizDecorable object)
 get node decoration More...
 
- Public Member Functions inherited from aud.util.CommonGraphvizDecorator
abstract void highlightNode (GraphvizDecorable object)
 Set highlighted node. More...
 
abstract void highlightEdge (GraphvizDecorable object)
 Set highlighted edge. More...
 
abstract void markNode (GraphvizDecorable object)
 
abstract void unmarkNode (GraphvizDecorable object)
 unmark node object
More...
 
abstract void unmarkAllNodes ()
 unmark all nodes More...
 
abstract void markEdge (GraphvizDecorable object)
 
abstract void unmarkEdge (GraphvizDecorable object)
 unmark edge object
More...
 
abstract void unmarkAllEdges ()
 unmark all edges More...
 
String getGraphLabel ()
 get label More...
 
void setGraphLabel (String text)
 set label More...
 
void clear ()
 Clear all decorations. More...
 
String getGraphDecoration (GraphvizDecorable object)
 get graph decoration (returns same for all nodes/edges) More...
 
String getAllNodesDecoration ()
 get standard decoration for all nodes (list head) More...
 
String getAllEdgesDecoration ()
 get standard decoration for all edges (list head) More...
 
String getGlobalStyle ()
 get global style (returns same for all nodes/edges) More...
 
- Public Member Functions inherited from aud.util.GraphvizDecorator
String getNodeDecoration (GraphvizDecorable object)
 get node decoration More...
 
String getEdgeDecoration (GraphvizDecorable object)
 get node decoration More...
 
String getGraphDecoration (GraphvizDecorable object)
 get graph decoration (returns same for all nodes/edges) More...
 
String getAllNodesDecoration ()
 get standard decoration for all nodes (list head) More...
 
String getAllEdgesDecoration ()
 get standard decoration for all edges (list head) More...
 
String getGlobalStyle ()
 get global style (returns same for all nodes/edges) More...
 
String getFullNodeDecoration (GraphvizDecorable object)
 concatenates getAllNodesDecoration and getNodeDecoration More...
 
String getFullEdgeDecoration (GraphvizDecorable object)
 concatenates getAllEdgesDecoration and getEdgeDecoration More...
 

Protected Attributes

GraphvizDecorable hilit_node = null
 
GraphvizDecorable hilit_edge = null
 
HashSet< GraphvizDecorablemarked_nodes = new HashSet<GraphvizDecorable>()
 
HashSet< GraphvizDecorablemarked_edges = new HashSet<GraphvizDecorable>()
 
- Protected Attributes inherited from aud.util.CommonGraphvizDecorator
String all_nodes_style = "shape=circle"
 
String all_edges_style = null
 
String global_style = null
 
String graph_style = "fontsize=24"
 
String graph_label = null
 
String hilit_node_style = "style=filled,fillcolor=yellow,penwidth=2"
 
String hilit_edge_style = "color=red,penwidth=2"
 
String marked_node_style = "style=filled,fillcolor=lightgray,penwidth=1.5"
 
String marked_edge_style = "color=blue,penwidth=1.5"
 

Detailed Description

Example for a simple decorator.

The entire state is held in the decorator instance. There is no access of/no need for node and edge attributes.

Definition at line 10 of file SimpleDecorator.java.

Member Function Documentation

◆ getEdgeDecoration()

String aud.util.SimpleDecorator.getEdgeDecoration ( GraphvizDecorable  object)

get node decoration

Reimplemented from aud.util.GraphvizDecorator.

Definition at line 54 of file SimpleDecorator.java.

54 {
55 if (object==hilit_edge)
56 return hilit_edge_style;
57 else if (marked_edges.contains(object))
58 return marked_edge_style;
59 else
60 return null;
61 }
GraphvizDecorable hilit_edge
HashSet< GraphvizDecorable > marked_edges

References aud.util.SimpleDecorator.hilit_edge, aud.util.CommonGraphvizDecorator.hilit_edge_style, aud.util.CommonGraphvizDecorator.marked_edge_style, and aud.util.SimpleDecorator.marked_edges.

◆ getNodeDecoration()

String aud.util.SimpleDecorator.getNodeDecoration ( GraphvizDecorable  object)

get node decoration

Reimplemented from aud.util.GraphvizDecorator.

Definition at line 45 of file SimpleDecorator.java.

45 {
46 if (object==hilit_node)
47 return hilit_node_style;
48 else if (marked_nodes.contains(object))
49 return marked_node_style;
50 else
51 return null;
52 }
HashSet< GraphvizDecorable > marked_nodes
GraphvizDecorable hilit_node

References aud.util.SimpleDecorator.hilit_node, aud.util.CommonGraphvizDecorator.hilit_node_style, aud.util.CommonGraphvizDecorator.marked_node_style, and aud.util.SimpleDecorator.marked_nodes.

◆ highlightEdge()

void aud.util.SimpleDecorator.highlightEdge ( GraphvizDecorable  object)

Set highlighted edge.

See also
highlightNode

Reimplemented from aud.util.CommonGraphvizDecorator.

Definition at line 21 of file SimpleDecorator.java.

21 {
22 hilit_edge=object;
23 }

References aud.util.SimpleDecorator.hilit_edge.

◆ highlightNode()

void aud.util.SimpleDecorator.highlightNode ( GraphvizDecorable  object)

Set highlighted node.

There is exactly one or no such node.

Parameters
objectnode or null (no highlight)

Reimplemented from aud.util.CommonGraphvizDecorator.

Definition at line 18 of file SimpleDecorator.java.

18 {
19 hilit_node=object;
20 }

References aud.util.SimpleDecorator.hilit_node.

Referenced by aud.example.expr.ExpressionTreeTraversal.levelorder(), aud.example.expr.ExpressionTreeTraversal.output(), aud.example.BinaryTreeTraversal.output(), aud.example.BinaryTreeTraversal.traverse(), and aud.example.expr.ExpressionTreeTraversal.traverse().

+ Here is the caller graph for this function:

◆ markEdge()

void aud.util.SimpleDecorator.markEdge ( GraphvizDecorable  object)

Reimplemented from aud.util.CommonGraphvizDecorator.

Definition at line 35 of file SimpleDecorator.java.

35 {
36 marked_edges.add(object);
37 }

References aud.util.SimpleDecorator.marked_edges.

Referenced by aud.example.expr.ExpressionTreeTraversal.see(), and aud.example.BinaryTreeTraversal.see().

+ Here is the caller graph for this function:

◆ markNode()

void aud.util.SimpleDecorator.markNode ( GraphvizDecorable  object)

Reimplemented from aud.util.CommonGraphvizDecorator.

Definition at line 25 of file SimpleDecorator.java.

25 {
26 marked_nodes.add(object);
27 }

References aud.util.SimpleDecorator.marked_nodes.

Referenced by aud.example.expr.ExpressionTreeTraversal.output(), and aud.example.BinaryTreeTraversal.output().

+ Here is the caller graph for this function:

◆ unmarkAllEdges()

void aud.util.SimpleDecorator.unmarkAllEdges ( )

unmark all edges

Reimplemented from aud.util.CommonGraphvizDecorator.

Definition at line 41 of file SimpleDecorator.java.

41 {
42 marked_edges.clear();
43 }

References aud.util.SimpleDecorator.marked_edges.

◆ unmarkAllNodes()

void aud.util.SimpleDecorator.unmarkAllNodes ( )

unmark all nodes

Reimplemented from aud.util.CommonGraphvizDecorator.

Definition at line 31 of file SimpleDecorator.java.

31 {
32 marked_nodes.clear();
33 }

References aud.util.SimpleDecorator.marked_nodes.

◆ unmarkEdge()

void aud.util.SimpleDecorator.unmarkEdge ( GraphvizDecorable  object)

unmark edge object

Reimplemented from aud.util.CommonGraphvizDecorator.

Definition at line 38 of file SimpleDecorator.java.

38 {
39 marked_edges.remove(object);
40 }

References aud.util.SimpleDecorator.marked_edges.

◆ unmarkNode()

void aud.util.SimpleDecorator.unmarkNode ( GraphvizDecorable  object)

unmark node object

Reimplemented from aud.util.CommonGraphvizDecorator.

Definition at line 28 of file SimpleDecorator.java.

28 {
29 marked_nodes.remove(object);
30 }

References aud.util.SimpleDecorator.marked_nodes.

Member Data Documentation

◆ hilit_edge

GraphvizDecorable aud.util.SimpleDecorator.hilit_edge = null
protected

◆ hilit_node

GraphvizDecorable aud.util.SimpleDecorator.hilit_node = null
protected

◆ marked_edges

◆ marked_nodes


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