AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
MyDecorator.java
Go to the documentation of this file.
1package aud.example.graph;
2
5
6public class MyDecorator extends SimpleDecorator {
7
8 MyGraph g_;
9
10 public MyDecorator(MyGraph g) {
11 g_=g;
12 }
13
14 @Override public String getNodeDecoration(GraphvizDecorable object) {
15 String decoration=super.getNodeDecoration(object);
16 if ((decoration==null || !decoration.contains("fillcolor=")) &&
17 ((MyNode) object).color!=null){
18 decoration=(decoration==null ? "" : decoration+",")+
19 "style=filled,fillcolor="+((MyNode) object).color;
20 }
21 return decoration;
22 }
23
24 @Override public String getEdgeDecoration(GraphvizDecorable object) {
25 String decoration=super.getEdgeDecoration(object);
26 if ((decoration==null || !decoration.contains("color=")) &&
27 ((MyEdge) object).color!=null) {
28 decoration=(decoration==null ? "" : decoration+",")+
29 "color="+((MyEdge) object).color;
30 }
31 if (((MyEdge) object).penwidth>=0.0) {
32 decoration=(decoration==null ? "" : decoration+",")+
33 "penwidth="+((MyEdge) object).penwidth;
34 }
35 return decoration;
36 }
37}
String getNodeDecoration(GraphvizDecorable object)
get node decoration
String getEdgeDecoration(GraphvizDecorable object)
get node decoration
edge with all possible attributes that we require ;-)
Definition: MyEdge.java:6
graph based on aud.graph.GraphAM
Definition: MyGraph.java:11
node with all possible attributes that we require ;-)
Definition: MyNode.java:6
Example for a simple decorator.
Interface for decorating items of Graphvizable objects.
utilities (not related to AuD lecture)
Definition: Colormap.java:1
AuD lecture: Data structures, algorithms, examples.
Definition: A234Tree.java:1