graph
Class StoredDirectedEdge

java.lang.Object
  |
  +--container.HashDecorable
        |
        +--graph.StoredDirectedEdge
All Implemented Interfaces:
Decorable, DirectedEdge, Position

public class StoredDirectedEdge
extends HashDecorable
implements DirectedEdge

A straightforward implementation of the DirectedEdge interface. Other implementations are possible.


Field Summary
protected  graph.Vertex dest
           
protected  java.lang.Object element
           
protected  graph.Vertex orig
           
 
Fields inherited from class container.HashDecorable
m
 
Constructor Summary
StoredDirectedEdge(graph.Vertex orig, graph.Vertex dest, java.lang.Object element)
          Creates a new edge from orig to dest, labeled with element.
 
Method Summary
 graph.Vertex destination()
          Vertex where this directed edge ends.
 java.lang.Object element()
          Element stored on this edge.
 graph.Vertex origin()
          Vertex where this directed edge starts.
 java.lang.String toString()
          A printable representation of this edge, such as [directed edge 999 from [vertex @12345 - xyz] to [vertex @54321 - abc]]; here 999 is the element stored on the edge.
 
Methods inherited from class container.HashDecorable
get, has, put, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface container.Decorable
get, has, put, remove
 

Field Detail

orig

protected graph.Vertex orig

dest

protected graph.Vertex dest

element

protected java.lang.Object element
Constructor Detail

StoredDirectedEdge

public StoredDirectedEdge(graph.Vertex orig,
                          graph.Vertex dest,
                          java.lang.Object element)
Creates a new edge from orig to dest, labeled with element.

Method Detail

element

public java.lang.Object element()
Element stored on this edge.

Specified by:
element in interface Position

origin

public graph.Vertex origin()
Description copied from interface: DirectedEdge
Vertex where this directed edge starts.

Specified by:
origin in interface DirectedEdge

destination

public graph.Vertex destination()
Description copied from interface: DirectedEdge
Vertex where this directed edge ends.

Specified by:
destination in interface DirectedEdge

toString

public java.lang.String toString()
A printable representation of this edge, such as [directed edge 999 from [vertex @12345 - xyz] to [vertex @54321 - abc]]; here 999 is the element stored on the edge.

The @12345 part is computed from the edge's hash code, just as in Object.toString(). It serves to distinguish multiple distinct edges that might happen to store the same element (e.g., "xyz"). Also, it won't change if we call replaceElement().

Overrides:
toString in class java.lang.Object