Class Graph.Edge

java.lang.Object
  extended by Graph.Edge
Enclosing class:
Graph<V,E>

public class Graph.Edge
extends java.lang.Object

Implements an edge in a graph.


Constructor Summary
Graph.Edge(E data, Graph.Node head, Graph.Node tail)
          Constructor creates a new edge
 
Method Summary
 boolean equals(java.lang.Object o)
          Two edges are equal if they connect the same endpoints regardless of the data they carry.
 E getData()
          Accessor for data
 Graph.Node getHead()
          Accessor for endpoint #1
 Graph.Node getTail()
          Accessor for endpoint #2
 int hashCode()
          Redefined hashcode to match redefined equals
 Graph.Node oppositeTo(Graph.Node node)
          Accessor for opposite node
 void setData(E data)
          Manipulator for data
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Graph.Edge

public Graph.Edge(E data,
                  Graph.Node head,
                  Graph.Node tail)
Constructor creates a new edge

Method Detail

getData

public E getData()
Accessor for data


getHead

public Graph.Node getHead()
Accessor for endpoint #1


getTail

public Graph.Node getTail()
Accessor for endpoint #2


oppositeTo

public Graph.Node oppositeTo(Graph.Node node)
Accessor for opposite node


setData

public void setData(E data)
Manipulator for data


equals

public boolean equals(java.lang.Object o)
Two edges are equal if they connect the same endpoints regardless of the data they carry. This definition is used by LinkedList.contains() and LinkedList.remove()

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Redefined hashcode to match redefined equals

Overrides:
hashCode in class java.lang.Object