All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class structure.ComparableEdge

java.lang.Object
    |
    +----structure.Edge
            |
            +----structure.ComparableEdge

public class ComparableEdge
extends Edge
implements 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 Index

 o ComparableEdge(Edge)
Construct a (possibly directed) edge between two labeled vertices.
 o ComparableEdge(Object, Object, Object, boolean)
Construct a (possibly directed) edge between two labeled vertices.

Method Index

 o compareTo(Object)
Compare edge, based on labels.
 o toString()
Construct a string representation of edge.

Constructors

 o ComparableEdge
public ComparableEdge(Object vtx1,
                      Object vtx2,
                      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.

Postcondition:
edge associates vtx1 and vtx2. labeled with label. directed if "directed" set true

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.
 o 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.

Postcondition:
edge associates vtx1 and vtx2. labeled with label. directed if "directed" set true

Parameters:
e - The edge to be used as the basis for a comparable edge

Methods

 o compareTo
public int compareTo(Object other)
Compare edge, based on labels.

Precondition:
labels are Comparable
Postcondition:
returns integer representing relation between labels.

 o toString
public String toString()
Construct a string representation of edge.

Postcondition:
returns string representation of edge

Returns:
String representing edge.
Overrides:
toString in class Edge

All Packages  Class Hierarchy  This Package  Previous  Next  Index