Opus5
Class AbstractGraph.GraphEdge

java.lang.Object
  |
  +--Opus5.AbstractObject
        |
        +--Opus5.AbstractGraph.GraphEdge
All Implemented Interfaces:
Comparable, Edge
Enclosing class:
AbstractGraph

protected final class AbstractGraph.GraphEdge
extends AbstractObject
implements Edge

Represents an edge in this graph.

Version:
$Id: AbstractGraph.java,v 3.5 1998/07/28 12:58:55 brpreiss Exp $
Author:
Bruno R. Preiss, P.Eng.
See Also:
Edge

Field Summary
protected  int v0
          The number of the vertex in this graph from which this edge emanates.
protected  int v1
          The number of the vertex in this graph upon which this edge is incident.
protected  java.lang.Object weight
          The weight associated with this edge.
 
Fields inherited from interface Opus5.Edge
copyright
 
Constructor Summary
AbstractGraph.GraphEdge(int v0, int v1, java.lang.Object weight)
          Constructs a GraphEdge that connects the specified vertices and with the specified weight.
 
Method Summary
protected  int compareTo(Comparable object)
          Compares this edge with the specified comparable object.
 Vertex getMate(Vertex v)
          Returns the vertex at the end of this edge opposite to the specified vertex.
 Vertex getV0()
          Returns the vertex in this graph from which this edge emanates.
 Vertex getV1()
          Returns the vertex in this graph upon which this edge is incident.
 java.lang.Object getWeight()
          Returns the weight associated with this edge.
 int hashCode()
          Returns a hashcode for this edge.
 boolean isDirected()
          Tests whether this edge is directed.
 java.lang.String toString()
          Returns a string representation of this edge.
 
Methods inherited from class Opus5.AbstractObject
compare, equals, isEQ, isGE, isGT, isLE, isLT, isNE
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface Opus5.Comparable
compare, isEQ, isGE, isGT, isLE, isLT, isNE
 

Field Detail

v0

protected int v0
The number of the vertex in this graph from which this edge emanates.

v1

protected int v1
The number of the vertex in this graph upon which this edge is incident.

weight

protected java.lang.Object weight
The weight associated with this edge.
Constructor Detail

AbstractGraph.GraphEdge

public AbstractGraph.GraphEdge(int v0,
                               int v1,
                               java.lang.Object weight)
Constructs a GraphEdge that connects the specified vertices and with the specified weight.
Parameters:
v0 - The number of the vertex in this graph from which this edge emanates.
v1 - The number of the vertex in this upon which this edge is incident.
weight - The weight associated with this edge.
Method Detail

getV0

public Vertex getV0()
Returns the vertex in this graph from which this edge emanates.
Specified by:
getV0 in interface Edge
Returns:
The vertex in this graph from which this edge emenates.

getV1

public Vertex getV1()
Returns the vertex in this graph upon which this edge is incident.
Specified by:
getV1 in interface Edge
Returns:
The vertex in this graph upon which this edge is incident.

getWeight

public java.lang.Object getWeight()
Returns the weight associated with this edge.
Specified by:
getWeight in interface Edge
Returns:
The weight associated with this edge.

getMate

public Vertex getMate(Vertex v)
Returns the vertex at the end of this edge opposite to the specified vertex. It is always the case that getMate(getV0())==getV1() and getMate(getV1())==getV0().
Specified by:
getMate in interface Edge
Parameters:
v - The specified vertex.
Returns:
The vertex opposite to the specified vertex.

isDirected

public boolean isDirected()
Tests whether this edge is directed. An edge is directed if it is an edge in a directed graph.
Specified by:
isDirected in interface Edge
Returns:
True if this edge is directed.
See Also:
AbstractGraph.isDirected()

compareTo

protected int compareTo(Comparable object)
Compares this edge with the specified comparable object. This method is not implemented yet.
Overrides:
compareTo in class AbstractObject
Throws:
MethodNotImplemented - Always.

hashCode

public int hashCode()
Returns a hashcode for this edge.
Overrides:
hashCode in class java.lang.Object
Returns:
A hashcode for this edge.

toString

public java.lang.String toString()
Returns a string representation of this edge.
Overrides:
toString in class java.lang.Object
Returns:
A string representation of this vertex.