Class TreeBidiMap.Node<K extends Comparable<K>,V extends Comparable<V>>
java.lang.Object
org.apache.commons.collections4.bidimap.TreeBidiMap.Node<K,V>
- Enclosing class:
TreeBidiMap<K extends Comparable<K>,V extends Comparable<V>>
static class TreeBidiMap.Node<K extends Comparable<K>,V extends Comparable<V>>
extends Object
implements Map.Entry<K,V>, KeyValue<K,V>
A node used to store the data.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final boolean[]private booleanprivate intprivate final Kprivate final TreeBidiMap.Node<K,V>[] private final TreeBidiMap.Node<K,V>[] private final TreeBidiMap.Node<K,V>[] private final V -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcopyColor(TreeBidiMap.Node<K, V> node, TreeBidiMap.DataElement dataElement) Makes this node the same color as another.booleanCompares the specified object with this entry for equality.private ObjectgetData(TreeBidiMap.DataElement dataElement) getKey()Gets the key.private TreeBidiMap.Node<K, V> getLeft(TreeBidiMap.DataElement dataElement) private TreeBidiMap.Node<K, V> getParent(TreeBidiMap.DataElement dataElement) Gets the parent node.private TreeBidiMap.Node<K, V> getRight(TreeBidiMap.DataElement dataElement) getValue()Gets the value.inthashCode()private booleanisBlack(TreeBidiMap.DataElement dataElement) Is this node black?private booleanisLeftChild(TreeBidiMap.DataElement dataElement) private booleanisRed(TreeBidiMap.DataElement dataElement) Is this node red?private booleanisRightChild(TreeBidiMap.DataElement dataElement) private voidsetBlack(TreeBidiMap.DataElement dataElement) Makes this node black.private voidsetLeft(TreeBidiMap.Node<K, V> node, TreeBidiMap.DataElement dataElement) private voidsetParent(TreeBidiMap.Node<K, V> node, TreeBidiMap.DataElement dataElement) Sets this node's parent node.private voidsetRed(TreeBidiMap.DataElement dataElement) Makes this node red.private voidsetRight(TreeBidiMap.Node<K, V> node, TreeBidiMap.DataElement dataElement) Optional operation that is not permitted in this implementation.private voidswapColors(TreeBidiMap.Node<K, V> node, TreeBidiMap.DataElement dataElement) Exchanges colors with another node.
-
Field Details
-
key
-
value
-
leftNode
-
rightNode
-
parentNode
-
blackColor
private final boolean[] blackColor -
hashCodeValue
private int hashCodeValue -
calculatedHashCode
private boolean calculatedHashCode
-
-
Constructor Details
-
Node
Makes a new cell with given key and value, and with null links, and black (true) colors.- Parameters:
key- the key of this nodevalue- the value of this node
-
-
Method Details
-
copyColor
Makes this node the same color as another. -
equals
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:
equalsin interfaceMap.Entry<K extends Comparable<K>,V extends Comparable<V>> - Overrides:
equalsin classObject- Parameters:
obj- the object to be compared for equality with this entry.- Returns:
- true if the specified object is equal to this entry.
-
getData
-
getKey
Gets the key.- Specified by:
getKeyin interfaceKeyValue<K extends Comparable<K>,V extends Comparable<V>> - Specified by:
getKeyin interfaceMap.Entry<K extends Comparable<K>,V extends Comparable<V>> - Returns:
- the key corresponding to this entry.
-
getLeft
-
getParent
Gets the parent node. -
getRight
-
getValue
Gets the value.- Specified by:
getValuein interfaceKeyValue<K extends Comparable<K>,V extends Comparable<V>> - Specified by:
getValuein interfaceMap.Entry<K extends Comparable<K>,V extends Comparable<V>> - Returns:
- the value corresponding to this entry.
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceMap.Entry<K extends Comparable<K>,V extends Comparable<V>> - Overrides:
hashCodein classObject- Returns:
- the hash code value for this map entry.
-
isBlack
Is this node black? -
isLeftChild
-
isRed
Is this node red? -
isRightChild
-
setBlack
Makes this node black. -
setLeft
-
setParent
Sets this node's parent node. -
setRed
Makes this node red. -
setRight
-
setValue
Optional operation that is not permitted in this implementation.- Specified by:
setValuein interfaceMap.Entry<K extends Comparable<K>,V extends Comparable<V>> - Parameters:
ignored- this parameter is ignored.- Returns:
- does not return
- Throws:
UnsupportedOperationException- always
-
swapColors
Exchanges colors with another node.
-