Class TreeBidiMap.Node

java.lang.Object
org.apache.commons.collections.bidimap.TreeBidiMap.Node
All Implemented Interfaces:
Map.Entry, KeyValue
Enclosing class:
TreeBidiMap

static class TreeBidiMap.Node extends Object implements Map.Entry, KeyValue
A node used to store the data.
  • Field Details

    • data

      private Comparable[] data
    • leftNode

      private TreeBidiMap.Node[] leftNode
    • rightNode

      private TreeBidiMap.Node[] rightNode
    • parentNode

      private TreeBidiMap.Node[] parentNode
    • blackColor

      private boolean[] blackColor
    • hashcodeValue

      private int hashcodeValue
    • calculatedHashCode

      private boolean calculatedHashCode
  • Constructor Details

    • Node

      Node(Comparable key, Comparable value)
      Make a new cell with given key and value, and with null links, and black (true) colors.
      Parameters:
      key -
      value -
  • Method Details

    • getData

      private Comparable getData(int index)
      Get the specified data.
      Parameters:
      index - the KEY or VALUE int
      Returns:
      the key or value
    • setLeft

      private void setLeft(TreeBidiMap.Node node, int index)
      Set this node's left node.
      Parameters:
      node - the new left node
      index - the KEY or VALUE int
    • getLeft

      private TreeBidiMap.Node getLeft(int index)
      Get the left node.
      Parameters:
      index - the KEY or VALUE int
      Returns:
      the left node, may be null
    • setRight

      private void setRight(TreeBidiMap.Node node, int index)
      Set this node's right node.
      Parameters:
      node - the new right node
      index - the KEY or VALUE int
    • getRight

      private TreeBidiMap.Node getRight(int index)
      Get the right node.
      Parameters:
      index - the KEY or VALUE int
      Returns:
      the right node, may be null
    • setParent

      private void setParent(TreeBidiMap.Node node, int index)
      Set this node's parent node.
      Parameters:
      node - the new parent node
      index - the KEY or VALUE int
    • getParent

      private TreeBidiMap.Node getParent(int index)
      Get the parent node.
      Parameters:
      index - the KEY or VALUE int
      Returns:
      the parent node, may be null
    • swapColors

      private void swapColors(TreeBidiMap.Node node, int index)
      Exchange colors with another node.
      Parameters:
      node - the node to swap with
      index - the KEY or VALUE int
    • isBlack

      private boolean isBlack(int index)
      Is this node black?
      Parameters:
      index - the KEY or VALUE int
      Returns:
      true if black (which is represented as a true boolean)
    • isRed

      private boolean isRed(int index)
      Is this node red?
      Parameters:
      index - the KEY or VALUE int
      Returns:
      true if non-black
    • setBlack

      private void setBlack(int index)
      Make this node black.
      Parameters:
      index - the KEY or VALUE int
    • setRed

      private void setRed(int index)
      Make this node red.
      Parameters:
      index - the KEY or VALUE int
    • copyColor

      private void copyColor(TreeBidiMap.Node node, int index)
      Make this node the same color as another
      Parameters:
      node - the node whose color we're adopting
      index - the KEY or VALUE int
    • getKey

      public Object getKey()
      Gets the key.
      Specified by:
      getKey in interface KeyValue
      Specified by:
      getKey in interface Map.Entry
      Returns:
      the key corresponding to this entry.
    • getValue

      public Object getValue()
      Gets the value.
      Specified by:
      getValue in interface KeyValue
      Specified by:
      getValue in interface Map.Entry
      Returns:
      the value corresponding to this entry.
    • setValue

      public Object setValue(Object ignored) throws UnsupportedOperationException
      Optional operation that is not permitted in this implementation
      Specified by:
      setValue in interface Map.Entry
      Parameters:
      ignored -
      Returns:
      does not return
      Throws:
      UnsupportedOperationException - always
    • equals

      public boolean equals(Object obj)
      Compares the specified object with this entry for equality. Returns true if the given object is also a map entry and the two entries represent the same mapping.
      Specified by:
      equals in interface Map.Entry
      Overrides:
      equals in class Object
      Parameters:
      obj - the object to be compared for equality with this entry.
      Returns:
      true if the specified object is equal to this entry.
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Map.Entry
      Overrides:
      hashCode in class Object
      Returns:
      the hash code value for this map entry.