uk.ed.inf.graph.impl
Class Edge

java.lang.Object
  extended by uk.ed.inf.graph.impl.Edge
All Implemented Interfaces:
java.lang.Comparable<Edge>, IBasicEdge<Node,Edge>, IRestorableGraphElement, IUndirectedEdge<Node,Edge>

public final class Edge
extends java.lang.Object
implements IUndirectedEdge<Node,Edge>, IRestorableGraphElement


Constructor Summary
Edge(Graph graph, int index, Node oneNode, Node twoNode)
           
 
Method Summary
 int compareTo(Edge o)
           
 boolean equals(java.lang.Object obj)
           
 NodePair getConnectedNodes()
          Get the ends of
 Graph getGraph()
          Get the owning graph of this edge.
 int getIndex()
          Get the index that uniquely identifies the edge within its owning graph.
 boolean hasEnds(IBasicPair<? super Node,? super Edge> ends)
          Tests if this edge has these ends.
 int hashCode()
           
 boolean isRemoved()
          Test if the edge has been removed from the graph.
 boolean isSelfEdge()
          Is this a self edge, i.e.
 void markRemoved(boolean markRemoved)
          Used to reset the removal status of a graph edge or node.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Edge

Edge(Graph graph,
     int index,
     Node oneNode,
     Node twoNode)
Method Detail

getConnectedNodes

public NodePair getConnectedNodes()
Description copied from interface: IBasicEdge
Get the ends of

Specified by:
getConnectedNodes in interface IBasicEdge<Node,Edge>
Specified by:
getConnectedNodes in interface IUndirectedEdge<Node,Edge>
Returns:

getGraph

public Graph getGraph()
Description copied from interface: IBasicEdge
Get the owning graph of this edge.

Specified by:
getGraph in interface IBasicEdge<Node,Edge>
Specified by:
getGraph in interface IUndirectedEdge<Node,Edge>
Returns:
the owning graph.

getIndex

public int getIndex()
Description copied from interface: IBasicEdge
Get the index that uniquely identifies the edge within its owning graph.

Specified by:
getIndex in interface IBasicEdge<Node,Edge>
Returns:
The index, which is a While number (>-0).

isSelfEdge

public boolean isSelfEdge()
Description copied from interface: IBasicEdge
Is this a self edge, i.e. both ends are the same node.

Specified by:
isSelfEdge in interface IBasicEdge<Node,Edge>
Returns:
true if removed.

compareTo

public int compareTo(Edge o)
Specified by:
compareTo in interface java.lang.Comparable<Edge>

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

isRemoved

public boolean isRemoved()
Description copied from interface: IBasicEdge
Test if the edge has been removed from the graph.

Specified by:
isRemoved in interface IBasicEdge<Node,Edge>
Returns:
true if removed, false otherwise.

markRemoved

public void markRemoved(boolean markRemoved)
Description copied from interface: IRestorableGraphElement
Used to reset the removal status of a graph edge or node.

Specified by:
markRemoved in interface IRestorableGraphElement

hasEnds

public boolean hasEnds(IBasicPair<? super Node,? super Edge> ends)
Description copied from interface: IBasicEdge
Tests if this edge has these ends. Ignores the directions of the ends.

Specified by:
hasEnds in interface IBasicEdge<Node,Edge>
Parameters:
ends - The ends to be tested.
Returns:
true if the edge contains the ends, false otherwise.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object