AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
AbstractNode.java
Go to the documentation of this file.
1package aud.graph;
2
5
11public abstract class AbstractNode
12 implements Comparable<AbstractNode>, GraphvizDecorable {
13
15 int index_ = -1;
16
22 public abstract AbstractNode create();
23
26 return graph_;
27 }
29 public int index() { return index_; }
31 public String getLabel() { return ""+index_; }
32
34 public void setLabel(String label) {
35 throw new UnsupportedOperationException("'setLabel' undefined");
36 }
37
38
40 public void setPosition(double x,double y) {
41 throw new UnsupportedOperationException("'setPosition' undefined");
42 }
44 public double[] getPosition() { return null; }
45
46 @Override public GraphvizDecorator getDecorator() {
47 return graph_.getDecorator();
48 }
49
50 @Override public String toString() { return getLabel(); }
51
52 @Override public int compareTo(AbstractNode other) {
53 if (graph_!=other.graph_)
54 throw new UnsupportedOperationException();
55 return index_-other.index_;
56 }
57 @Override public boolean equals(Object other) {
58 return compareTo((AbstractNode) other)==0;
59 }
60}
Interface to a graph.
GraphvizDecorator getDecorator()
get decoration or null
Interface to nodes of a graph.
double[] getPosition()
helper for drawing the graph: return {x,y} as array or null
void setPosition(double x, double y)
helper for drawing the graph (if supported)
int compareTo(AbstractNode other)
AbstractGraph<? extends AbstractNode,? extends AbstractEdge > graph()
get graph
void setLabel(String label)
set label (if supported)
String getLabel()
get text description
abstract AbstractNode create()
Create new node instance.
int index()
get index, i.e., unique integer id within graph
GraphvizDecorator getDecorator()
get decoration or null
boolean equals(Object other)
Decorator for items of Graphvizable objects.
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