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.
- Since:
- 3.0 (previously DoubleOrderedMap v2.0)
-
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) Make this node the same color as anotherbooleanCompares 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) Get 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) Make this node black.private voidsetLeft(TreeBidiMap.Node<K, V> node, TreeBidiMap.DataElement dataElement) private voidsetParent(TreeBidiMap.Node<K, V> node, TreeBidiMap.DataElement dataElement) Set this node's parent node.private voidsetRed(TreeBidiMap.DataElement dataElement) Make this node red.private voidsetRight(TreeBidiMap.Node<K, V> node, TreeBidiMap.DataElement dataElement) Optional operation that is not permitted in this implementationprivate voidswapColors(TreeBidiMap.Node<K, V> node, TreeBidiMap.DataElement dataElement) Exchange 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
-
-
Method Details
-
getData
-
setLeft
-
getLeft
-
setRight
-
getRight
-
setParent
Set this node's parent node.- Parameters:
node- the new parent nodedataElement- eitherTreeBidiMap.DataElement.KEYkey} or thevalue.
-
getParent
Get the parent node.- Parameters:
dataElement- eitherTreeBidiMap.DataElement.KEYkey} or thevalue.- Returns:
- the parent node, may be null
-
swapColors
Exchange colors with another node.- Parameters:
node- the node to swap withdataElement- eitherTreeBidiMap.DataElement.KEYkey} or thevalue.
-
isBlack
Is this node black?- Parameters:
dataElement- eitherTreeBidiMap.DataElement.KEYkey} or thevalue.- Returns:
- true if black (which is represented as a true boolean)
-
isRed
Is this node red?- Parameters:
dataElement- eitherTreeBidiMap.DataElement.KEYkey} or thevalue.- Returns:
- true if non-black
-
setBlack
Make this node black.- Parameters:
dataElement- eitherTreeBidiMap.DataElement.KEYkey} or thevalue.
-
setRed
Make this node red.- Parameters:
dataElement- eitherTreeBidiMap.DataElement.KEYkey} or thevalue.
-
copyColor
Make this node the same color as another- Parameters:
node- the node whose color we're adoptingdataElement- eitherTreeBidiMap.DataElement.KEYkey} or thevalue.
-
isLeftChild
-
isRightChild
-
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.
-
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.
-
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
-
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.
-
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.
-