Class NodePair


  • public class NodePair
    extends java.lang.Object
    A directed pair of nodes (a,b != b,a).
    Since:
    12463 (extracted from CombineWayAction)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Node a  
      private Node b  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(Node n)
      Determines if this pair contains the given node.
      boolean equals​(java.lang.Object obj)  
      Node getA()
      Replies the first node.
      Node getB()
      Replies the second node
      int hashCode()  
      boolean isPredecessorOf​(NodePair other)
      Determines if this pair is predecessor of another one (this.b == other.a)
      boolean isSuccessorOf​(NodePair other)
      Determines if this pair is successor of another one (other.b == this.a)
      NodePair swap()
      Returns the inversed pair.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • NodePair

        public NodePair​(Node a,
                        Node b)
        Constructs a new NodePair.
        Parameters:
        a - The first node
        b - The second node
      • NodePair

        public NodePair​(Pair<Node,​Node> pair)
        Constructs a new NodePair.
        Parameters:
        pair - An existing Pair of nodes
    • Method Detail

      • getA

        public Node getA()
        Replies the first node.
        Returns:
        The first node
      • getB

        public Node getB()
        Replies the second node
        Returns:
        The second node
      • isSuccessorOf

        public boolean isSuccessorOf​(NodePair other)
        Determines if this pair is successor of another one (other.b == this.a)
        Parameters:
        other - other pair
        Returns:
        true if other.b == this.a
      • isPredecessorOf

        public boolean isPredecessorOf​(NodePair other)
        Determines if this pair is predecessor of another one (this.b == other.a)
        Parameters:
        other - other pair
        Returns:
        true if this.b == other.a
      • swap

        public NodePair swap()
        Returns the inversed pair.
        Returns:
        swapped copy
      • toString

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

        public boolean contains​(Node n)
        Determines if this pair contains the given node.
        Parameters:
        n - The node to look for
        Returns:
        true if n is in the pair, false otherwise
      • 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