structure
Class ComparableEdge
java.lang.Object
structure.Edge
structure.ComparableEdge
- All Implemented Interfaces:
- java.lang.Comparable
public class ComparableEdge
- extends Edge
- implements java.lang.Comparable
A class implementing common edge type among graphs. This class
supports both directed and undirected edges. Edge may also have
visited flags set and cleared.
- See Also:
Graph
Constructor Summary |
ComparableEdge(Edge e)
Construct a (possibly directed) edge between two labeled
vertices. |
ComparableEdge(java.lang.Object vtx1,
java.lang.Object vtx2,
java.lang.Object label,
boolean directed)
Construct a (possibly directed) edge between two labeled
vertices. |
Method Summary |
int |
compareTo(java.lang.Object other)
Compare edge, based on labels. |
java.lang.String |
toString()
Construct a string representation of edge. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
ComparableEdge
public ComparableEdge(java.lang.Object vtx1,
java.lang.Object vtx2,
java.lang.Object label,
boolean directed)
- Construct a (possibly directed) edge between two labeled
vertices. When edge is directed, vtx1 specifies source.
When undirected, order of vertices is unimportant. Label
on edge is any type, and may be null.
Edge is initially unvisited.
- Parameters:
vtx1
- The label of a vertex (source if directed).vtx2
- The label of another vertex (destination if directed).label
- The label associated with the edge.directed
- True iff this edge is directed.- Postcondition:
- edge associates vtx1 and vtx2. labeled with label
directed if "directed" set true
ComparableEdge
public ComparableEdge(Edge e)
- Construct a (possibly directed) edge between two labeled
vertices. When edge is directed, vtx1 specifies source.
When undirected, order of vertices is unimportant. Label
on edge is any type, and may be null.
Edge is initially unvisited.
- Parameters:
e
- The edge to be used as the basis for a comparable edge- Postcondition:
- edge associates vtx1 and vtx2. labeled with label.
directed if "directed" set true
compareTo
public int compareTo(java.lang.Object other)
- Compare edge, based on labels.
- Specified by:
compareTo
in interface java.lang.Comparable
- Precondition:
- labels are Comparable
- Postcondition:
- returns integer representing relation between labels
toString
public java.lang.String toString()
- Construct a string representation of edge.
- Overrides:
toString
in class Edge
- Returns:
- String representing edge.
- Postcondition:
- returns string representation of edge