private static final class DoubleOrderedMap.Node extends java.lang.Object implements java.util.Map.Entry, KeyValue
Modifier and Type | Field and Description |
---|---|
private boolean[] |
blackColor |
private boolean |
calculatedHashCode |
private java.lang.Comparable[] |
data |
private int |
hashcodeValue |
private DoubleOrderedMap.Node[] |
leftNode |
private DoubleOrderedMap.Node[] |
parentNode |
private DoubleOrderedMap.Node[] |
rightNode |
Constructor and Description |
---|
Node(java.lang.Comparable key,
java.lang.Comparable value)
Make a new cell with given key and value, and with null
links, and black (true) colors.
|
Modifier and Type | Method and Description |
---|---|
private void |
copyColor(DoubleOrderedMap.Node node,
int index)
make this node the same color as another
|
boolean |
equals(java.lang.Object o)
Compares the specified object with this entry for equality.
|
private java.lang.Comparable |
getData(int index)
get the specified data
|
java.lang.Object |
getKey()
Gets the key from the pair.
|
private DoubleOrderedMap.Node |
getLeft(int index)
get the left node
|
private DoubleOrderedMap.Node |
getParent(int index)
get the parent node
|
private DoubleOrderedMap.Node |
getRight(int index)
get the right node
|
java.lang.Object |
getValue()
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 black
|
private void |
setLeft(DoubleOrderedMap.Node node,
int index)
Set this node's left node
|
private void |
setParent(DoubleOrderedMap.Node node,
int index)
Set this node's parent node
|
private void |
setRed(int index)
make this node red
|
private void |
setRight(DoubleOrderedMap.Node node,
int index)
Set this node's right node
|
java.lang.Object |
setValue(java.lang.Object ignored)
Optional operation that is not permitted in this
implementation
|
private void |
swapColors(DoubleOrderedMap.Node node,
int index)
exchange colors with another node
|
private java.lang.Comparable[] data
private DoubleOrderedMap.Node[] leftNode
private DoubleOrderedMap.Node[] rightNode
private DoubleOrderedMap.Node[] parentNode
private boolean[] blackColor
private int hashcodeValue
private boolean calculatedHashCode
Node(java.lang.Comparable key, java.lang.Comparable value)
key
- value
- private java.lang.Comparable getData(int index)
index
- KEY or VALUEprivate void setLeft(DoubleOrderedMap.Node node, int index)
node
- the new left nodeindex
- KEY or VALUEprivate DoubleOrderedMap.Node getLeft(int index)
index
- KEY or VALUEprivate void setRight(DoubleOrderedMap.Node node, int index)
node
- the new right nodeindex
- KEY or VALUEprivate DoubleOrderedMap.Node getRight(int index)
index
- KEY or VALUEprivate void setParent(DoubleOrderedMap.Node node, int index)
node
- the new parent nodeindex
- KEY or VALUEprivate DoubleOrderedMap.Node getParent(int index)
index
- KEY or VALUEprivate void swapColors(DoubleOrderedMap.Node node, int index)
node
- the node to swap withindex
- KEY or VALUEprivate boolean isBlack(int index)
index
- KEY or VALUEprivate boolean isRed(int index)
index
- KEY or VALUEprivate void setBlack(int index)
index
- KEY or VALUEprivate void setRed(int index)
index
- KEY or VALUEprivate void copyColor(DoubleOrderedMap.Node node, int index)
node
- the node whose color we're adoptingindex
- KEY or VALUEpublic java.lang.Object getKey()
KeyValue
public java.lang.Object getValue()
KeyValue
public java.lang.Object setValue(java.lang.Object ignored) throws java.lang.UnsupportedOperationException
setValue
in interface java.util.Map.Entry
ignored
- java.lang.UnsupportedOperationException
public boolean equals(java.lang.Object o)
equals
in interface java.util.Map.Entry
equals
in class java.lang.Object
o
- object to be compared for equality with this map
entry.public int hashCode()
hashCode
in interface java.util.Map.Entry
hashCode
in class java.lang.Object