AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
aud.graph.AbstractNode Class Referenceabstract

Interface to nodes of a graph. More...

+ Inheritance diagram for aud.graph.AbstractNode:
+ Collaboration diagram for aud.graph.AbstractNode:

Public Member Functions

abstract AbstractNode create ()
 Create new node instance. More...
 
AbstractGraph<? extends AbstractNode,? extends AbstractEdgegraph ()
 get graph More...
 
int index ()
 get index, i.e., unique integer id within graph More...
 
String getLabel ()
 get text description More...
 
void setLabel (String label)
 set label (if supported) More...
 
void setPosition (double x, double y)
 helper for drawing the graph (if supported) More...
 
double[] getPosition ()
 helper for drawing the graph: return {x,y} as array or null
More...
 
GraphvizDecorator getDecorator ()
 get decoration or null
More...
 
String toString ()
 
int compareTo (AbstractNode other)
 
boolean equals (Object other)
 
GraphvizDecorator getDecorator ()
 get decoration or null
More...
 

Detailed Description

Interface to nodes of a graph.

Note that some operations require reimplementation (or throw UnsupportedOperationException.

See also
AbstractGraph

Definition at line 11 of file AbstractNode.java.

Member Function Documentation

◆ compareTo()

int aud.graph.AbstractNode.compareTo ( AbstractNode  other)

Definition at line 52 of file AbstractNode.java.

52 {
53 if (graph_!=other.graph_)
54 throw new UnsupportedOperationException();
55 return index_-other.index_;
56 }

Referenced by aud.graph.AbstractNode.equals().

+ Here is the caller graph for this function:

◆ create()

abstract AbstractNode aud.graph.AbstractNode.create ( )
abstract

Create new node instance.

Must initialize any attributes introduced in subclasses of AbstractNode.

Returns
node instance

Reimplemented in aud.example.graph.MyNode, and aud.graph.SimpleNode.

◆ equals()

boolean aud.graph.AbstractNode.equals ( Object  other)

Definition at line 57 of file AbstractNode.java.

57 {
58 return compareTo((AbstractNode) other)==0;
59 }
int compareTo(AbstractNode other)

References aud.graph.AbstractNode.compareTo().

+ Here is the call graph for this function:

◆ getDecorator()

GraphvizDecorator aud.graph.AbstractNode.getDecorator ( )

get decoration or null

Implements aud.util.GraphvizDecorable.

Definition at line 46 of file AbstractNode.java.

46 {
47 return graph_.getDecorator();
48 }

◆ getLabel()

String aud.graph.AbstractNode.getLabel ( )

get text description

Reimplemented in aud.graph.SimpleNode.

Definition at line 31 of file AbstractNode.java.

31{ return ""+index_; }

Referenced by aud.graph.AbstractNode.toString().

+ Here is the caller graph for this function:

◆ getPosition()

double[] aud.graph.AbstractNode.getPosition ( )

helper for drawing the graph: return {x,y} as array or null

Reimplemented in aud.graph.SimpleNode.

Definition at line 44 of file AbstractNode.java.

44{ return null; }

◆ graph()

AbstractGraph<? extends AbstractNode,? extends AbstractEdge > aud.graph.AbstractNode.graph ( )

get graph

Definition at line 25 of file AbstractNode.java.

25 {
26 return graph_;
27 }

Referenced by aud.test.GraphTest.testDirectedGraph(), and aud.test.GraphTest.testUndirectedGraph().

+ Here is the caller graph for this function:

◆ index()

int aud.graph.AbstractNode.index ( )

get index, i.e., unique integer id within graph

Definition at line 29 of file AbstractNode.java.

29{ return index_; }

◆ setLabel()

void aud.graph.AbstractNode.setLabel ( String  label)

set label (if supported)

Reimplemented in aud.graph.SimpleNode.

Definition at line 34 of file AbstractNode.java.

34 {
35 throw new UnsupportedOperationException("'setLabel' undefined");
36 }

◆ setPosition()

void aud.graph.AbstractNode.setPosition ( double  x,
double  y 
)

helper for drawing the graph (if supported)

Reimplemented in aud.graph.SimpleNode.

Definition at line 40 of file AbstractNode.java.

40 {
41 throw new UnsupportedOperationException("'setPosition' undefined");
42 }

◆ toString()

String aud.graph.AbstractNode.toString ( )

Reimplemented in aud.example.graph.MyNode.

Definition at line 50 of file AbstractNode.java.

50{ return getLabel(); }
String getLabel()
get text description

References aud.graph.AbstractNode.getLabel().

+ Here is the call graph for this function:

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