uk.ed.inf.graph.impl
Class NodePair

java.lang.Object
  extended by uk.ed.inf.graph.impl.NodePair
All Implemented Interfaces:
IBasicPair<Node,Edge>, IUndirectedPair<Node,Edge>

public final class NodePair
extends java.lang.Object
implements IUndirectedPair<Node,Edge>


Constructor Summary
NodePair(Node oneNode, Node twoNode)
           
 
Method Summary
 boolean containsNode(Node node)
          Is this node contained in this end pair.
 boolean equals(java.lang.Object obj)
          Test whether a pair is equal, that is do they include the same pair of nodes.
 Node getOneNode()
           
 Node getOtherNode(Node node)
          Get the other node of the pair to this one.
 Node getTwoNode()
           
 boolean hasEnds(Node endOne, Node endTwo)
          Tests if this end pair is made up of these two nodes.
 int hashCode()
          The hashCode that should given identical behaviour to equals.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodePair

NodePair(Node oneNode,
         Node twoNode)
Method Detail

getOneNode

public Node getOneNode()
Specified by:
getOneNode in interface IUndirectedPair<Node,Edge>

getTwoNode

public Node getTwoNode()
Specified by:
getTwoNode in interface IUndirectedPair<Node,Edge>

containsNode

public boolean containsNode(Node node)
Description copied from interface: IBasicPair
Is this node contained in this end pair.

Specified by:
containsNode in interface IBasicPair<Node,Edge>
Parameters:
node - The node to test, can be null.
Returns:
true is node is contained, else false.

getOtherNode

public Node getOtherNode(Node node)
Get the other node of the pair to this one.

Specified by:
getOtherNode in interface IBasicPair<Node,Edge>
Parameters:
node -
Returns:

hashCode

public int hashCode()
Description copied from interface: IBasicPair
The hashCode that should given identical behaviour to equals. That is is equals returns true both object should have the same hash code value.

Specified by:
hashCode in interface IBasicPair<Node,Edge>
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Description copied from interface: IBasicPair
Test whether a pair is equal, that is do they include the same pair of nodes. The ordering is important and reciprocal pairs are not regarded as equivalent. This is in addition to the standard contact for equals.

Specified by:
equals in interface IBasicPair<Node,Edge>
Overrides:
equals in class java.lang.Object
Parameters:
obj - the other object to compare for equality.
Returns:
true if they are equals by the equals contract, false otherwise.

hasEnds

public boolean hasEnds(Node endOne,
                       Node endTwo)
Description copied from interface: IBasicPair
Tests if this end pair is made up of these two nodes. This is ignores the direction of the edge these edges make up. In all cases, even for directed edges the following holds:

hasEnds(endOne, endTwo) == hasEnds(endTwo, endOne)

Specified by:
hasEnds in interface IBasicPair<Node,Edge>
Parameters:
endOne - The first node end.
endTwo - The second node end.
Returns:
true if both nodes make up the end pair, false otherwise.