Package org.apache.commons.collections
Class DoubleOrderedMap.Node
java.lang.Object
org.apache.commons.collections.DoubleOrderedMap.Node
- Enclosing class:
- DoubleOrderedMap
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean[]
private boolean
private Comparable[]
private int
private DoubleOrderedMap.Node[]
private DoubleOrderedMap.Node[]
private DoubleOrderedMap.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
(DoubleOrderedMap.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 datagetKey()
Gets the key from the pair.private DoubleOrderedMap.Node
getLeft
(int index) get the left nodeprivate DoubleOrderedMap.Node
getParent
(int index) get the parent nodeprivate DoubleOrderedMap.Node
getRight
(int index) get the right nodegetValue()
Gets the value from the pair.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 blackprivate void
setLeft
(DoubleOrderedMap.Node node, int index) Set this node's left nodeprivate void
setParent
(DoubleOrderedMap.Node node, int index) Set this node's parent nodeprivate void
setRed
(int index) make this node redprivate void
setRight
(DoubleOrderedMap.Node node, int index) Set this node's right nodeOptional operation that is not permitted in this implementationprivate void
swapColors
(DoubleOrderedMap.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
- KEY or VALUE- Returns:
- the key or value
-
setLeft
Set this node's left node- Parameters:
node
- the new left nodeindex
- KEY or VALUE
-
getLeft
get the left node- Parameters:
index
- KEY or VALUE- Returns:
- the left node -- may be null
-
setRight
Set this node's right node- Parameters:
node
- the new right nodeindex
- KEY or VALUE
-
getRight
get the right node- Parameters:
index
- KEY or VALUE- Returns:
- the right node -- may be null
-
setParent
Set this node's parent node- Parameters:
node
- the new parent nodeindex
- KEY or VALUE
-
getParent
get the parent node- Parameters:
index
- KEY or VALUE- Returns:
- the parent node -- may be null
-
swapColors
exchange colors with another node- Parameters:
node
- the node to swap withindex
- KEY or VALUE
-
isBlack
private boolean isBlack(int index) is this node black?- Parameters:
index
- KEY or VALUE- Returns:
- true if black (which is represented as a true boolean)
-
isRed
private boolean isRed(int index) is this node red?- Parameters:
index
- KEY or VALUE- Returns:
- true if non-black
-
setBlack
private void setBlack(int index) make this node black- Parameters:
index
- KEY or VALUE
-
setRed
private void setRed(int index) make this node red- Parameters:
index
- KEY or VALUE
-
copyColor
make this node the same color as another- Parameters:
node
- the node whose color we're adoptingindex
- KEY or VALUE
-
getKey
Description copied from interface:KeyValue
Gets the key from the pair. -
getValue
Description copied from interface:KeyValue
Gets the value from the pair. -
setValue
Optional operation that is not permitted in this implementation- Specified by:
setValue
in interfaceMap.Entry
- Parameters:
ignored
-- Returns:
- does not return
- Throws:
UnsupportedOperationException
-
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()
-