Class EndpointPair<N>

  • All Implemented Interfaces:
    <N>

    @Beta
    (="N")
    public abstract class EndpointPair<N>
    extends 
    implements <N>
    An immutable pair representing the two endpoints of an edge in a graph. The EndpointPair of a directed edge is an ordered pair of nodes (source() and target()). The EndpointPair of an undirected edge is an unordered pair of nodes (nodeU() and nodeV()).

    The edge is a self-loop if, and only if, the two endpoints are equal.

    Since:
    20.0
    Author:
    James Sexton
    • Method Detail

      • adjacentNode

        public final  node)
        Returns the node that is adjacent to node along the origin edge.
        Throws:
        - if this EndpointPair does not contain node
      • isOrdered

        public abstract boolean isOrdered()
        Returns true if this EndpointPair is an ordered pair (i.e. represents the endpoints of a directed edge).
      • equals

        public abstract boolean   obj)
        Two ordered EndpointPairs are equal if their source() and target() are equal. Two unordered EndpointPairs are equal if they contain the same nodes. An ordered EndpointPair is never equal to an unordered EndpointPair.
        Overrides:
         in class 
        Parameters:
        obj - the reference object with which to compare.
        Returns:
        true if this object is the same as the obj argument; false otherwise.
        See Also:
        ,
      • hashCode

        public abstract int hashCode()
        The hashcode of an ordered EndpointPair is equal to Objects.hashCode(source(), target()). The hashcode of an unordered EndpointPair is equal to nodeU().hashCode() + nodeV().hashCode().
        Overrides:
         in class 
        Returns:
        a hash code value for this object.
        See Also:
        ,