Class TreeBidiMap.Node
java.lang.Object
org.apache.commons.collections.bidimap.TreeBidiMap.Node
- Enclosing class:
TreeBidiMap
A node used to store the data.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean[]
private boolean
private Comparable[]
private int
private TreeBidiMap.Node[]
private TreeBidiMap.Node[]
private TreeBidiMap.Node[]
-
Constructor Summary
ConstructorsConstructorDescriptionNode
(Comparable key, Comparable value) Make a new cell with given key and value, and with null links, and black (true) colors. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
copyColor
(TreeBidiMap.Node node, int index) Make this node the same color as anotherboolean
Compares the specified object with this entry for equality.private Comparable
getData
(int index) Get the specified data.getKey()
Gets the key.private TreeBidiMap.Node
getLeft
(int index) Get the left node.private TreeBidiMap.Node
getParent
(int index) Get the parent node.private TreeBidiMap.Node
getRight
(int index) Get the right node.getValue()
Gets the value.int
hashCode()
private boolean
isBlack
(int index) Is this node black?private boolean
isRed
(int index) Is this node red?private void
setBlack
(int index) Make this node black.private void
setLeft
(TreeBidiMap.Node node, int index) Set this node's left node.private void
setParent
(TreeBidiMap.Node node, int index) Set this node's parent node.private void
setRed
(int index) Make this node red.private void
setRight
(TreeBidiMap.Node node, int index) Set this node's right node.Optional operation that is not permitted in this implementationprivate void
swapColors
(TreeBidiMap.Node node, int index) Exchange colors with another node.
-
Field Details
-
data
-
leftNode
-
rightNode
-
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
Get the specified data.- Parameters:
index
- the KEY or VALUE int- Returns:
- the key or value
-
setLeft
Set this node's left node.- Parameters:
node
- the new left nodeindex
- the KEY or VALUE int
-
getLeft
Get the left node.- Parameters:
index
- the KEY or VALUE int- Returns:
- the left node, may be null
-
setRight
Set this node's right node.- Parameters:
node
- the new right nodeindex
- the KEY or VALUE int
-
getRight
Get the right node.- Parameters:
index
- the KEY or VALUE int- Returns:
- the right node, may be null
-
setParent
Set this node's parent node.- Parameters:
node
- the new parent nodeindex
- the KEY or VALUE int
-
getParent
Get the parent node.- Parameters:
index
- the KEY or VALUE int- Returns:
- the parent node, may be null
-
swapColors
Exchange colors with another node.- Parameters:
node
- the node to swap withindex
- 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
Make this node the same color as another- Parameters:
node
- the node whose color we're adoptingindex
- the KEY or VALUE int
-
getKey
Gets the key. -
getValue
Gets the value. -
setValue
Optional operation that is not permitted in this implementation- Specified by:
setValue
in interfaceMap.Entry
- Parameters:
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. -
hashCode
public int hashCode()
-