AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
SimpleNode.java
Go to the documentation of this file.
1package aud.graph;
2
4public class SimpleNode extends AbstractNode {
5
6 String label_ = null;
7 double[] position_ = null;
8
9 @Override public SimpleNode create() {
10 return new SimpleNode();
11 }
12 @Override public String getLabel() {
13 return label_==null ? super.getLabel() : label_;
14 }
16 public void setLabel(String label) { label_=label; }
17
18 @Override public void setPosition(double x,double y) {
19 position_=new double[] {x,y};
20 }
22 public double[] getPosition() { return position_; }
23}
Interface to nodes of a graph.
plain simple node
Definition: SimpleNode.java:4
String getLabel()
get text description
Definition: SimpleNode.java:12
SimpleNode create()
Create new node instance.
Definition: SimpleNode.java:9
void setLabel(String label)
set label (default label if label==null)
Definition: SimpleNode.java:16
double[] getPosition()
helper for drawing the graph: return {x,y} as array or null
Definition: SimpleNode.java:22
void setPosition(double x, double y)
helper for drawing the graph (if supported)
Definition: SimpleNode.java:18