sbrt.kernel.math.graph_theory
Class DirectedGraph.Edge<N>

java.lang.Object
  extended by sbrt.kernel.math.graph_theory.DirectedGraph.Edge<N>
Type Parameters:
N - the type of node.
Enclosing class:
DirectedGraph<N>

public static final class DirectedGraph.Edge<N>
extends java.lang.Object

This class is used to represent the unidirectional edges of a directed graph. An edge is directed from a source node to a sink node.

Author:
This class was written and documented by Jeremiah Wright while in the Wagner lab.

Constructor Summary
DirectedGraph.Edge(T source, S sink)
          Constructs a new directed edge from the provided source and sink nodes.
 
Method Summary
 boolean equals(java.lang.Object o)
          Indicates if the provided object is equal to this directed edge.
 N getSink()
          Returns the sink node of this directed edge.
 N getSource()
          Returns the source node of this directed edge.
 int hashCode()
          Returns a content-based hash code for this directed edge.
 boolean hasNode(java.lang.Object node)
          Indicates if the provided object is a node of this directed edge.
 java.lang.String toString()
          Returns an appropriate string representation of this edge.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DirectedGraph.Edge

public DirectedGraph.Edge(T source,
                          S sink)
Constructs a new directed edge from the provided source and sink nodes.

Type Parameters:
T - a type that extends N.
S - a type that extends N.
Parameters:
source - the source node.
sink - the sink node.
Method Detail

getSource

public N getSource()
Returns the source node of this directed edge.

Returns:
the source node of this directed edge.

getSink

public N getSink()
Returns the sink node of this directed edge.

Returns:
the sink node of this directed edge.

hasNode

public boolean hasNode(java.lang.Object node)
Indicates if the provided object is a node of this directed edge.

Parameters:
node - the potential node.
Returns:
true if the provided object equals the source or sink node; false otherwise.

equals

public boolean equals(java.lang.Object o)
Indicates if the provided object is equal to this directed edge. An object is equal to this edge if 1) it is an instance of Edge, 2) its source node is the same as this edge's, and 3) its sink node is the same as this edge's.

Overrides:
equals in class java.lang.Object
Parameters:
o - the reference object with which to compare.
Returns:
true if this object is equal to the provided object; false otherwise.

hashCode

public int hashCode()
Returns a content-based hash code for this directed edge.

Overrides:
hashCode in class java.lang.Object
Returns:
a content-based hash code for this directed edge.

toString

public java.lang.String toString()
Returns an appropriate string representation of this edge.

Overrides:
toString in class java.lang.Object
Returns:
an appropriate string representation of this edge.