private static final class BinaryTree.Node extends Object implements Map.Entry
Modifier and Type | Field and Description |
---|---|
private boolean[] |
_black |
private boolean |
_calculated_hashcode |
private Comparable[] |
_data |
private int |
_hashcode |
private BinaryTree.Node[] |
_left |
private BinaryTree.Node[] |
_parent |
private BinaryTree.Node[] |
_right |
Constructor and Description |
---|
BinaryTree.Node(Comparable key,
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(BinaryTree.Node node,
int index)
make this node the same color as another
|
boolean |
equals(Object o)
Compares the specified object with this entry for equality.
|
private Comparable |
getData(int index)
get the specified data
|
Object |
getKey() |
private BinaryTree.Node |
getLeft(int index)
get the left node
|
private BinaryTree.Node |
getParent(int index)
get the parent node
|
private BinaryTree.Node |
getRight(int index)
get the right node
|
Object |
getValue() |
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(BinaryTree.Node node,
int index)
Set this node's left node
|
private void |
setParent(BinaryTree.Node node,
int index)
Set this node's parent node
|
private void |
setRed(int index)
make this node red
|
private void |
setRight(BinaryTree.Node node,
int index)
Set this node's right node
|
Object |
setValue(Object ignored)
Optional operation that is not permitted in this
implementation
|
private void |
swapColors(BinaryTree.Node node,
int index)
exchange colors with another node
|
private Comparable[] _data
private BinaryTree.Node[] _left
private BinaryTree.Node[] _right
private BinaryTree.Node[] _parent
private boolean[] _black
private int _hashcode
private boolean _calculated_hashcode
BinaryTree.Node(Comparable key, Comparable value)
key
- value
- private Comparable getData(int index)
index
- _KEY or _VALUEprivate void setLeft(BinaryTree.Node node, int index)
node
- the new left nodeindex
- _KEY or _VALUEprivate BinaryTree.Node getLeft(int index)
index
- _KEY or _VALUEprivate void setRight(BinaryTree.Node node, int index)
node
- the new right nodeindex
- _KEY or _VALUEprivate BinaryTree.Node getRight(int index)
index
- _KEY or _VALUEprivate void setParent(BinaryTree.Node node, int index)
node
- the new parent nodeindex
- _KEY or _VALUEprivate BinaryTree.Node getParent(int index)
index
- _KEY or _VALUEprivate void swapColors(BinaryTree.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(BinaryTree.Node node, int index)
node
- the node whose color we're adoptingindex
- _KEY or _VALUEpublic Object getKey()
public Object getValue()
public Object setValue(Object ignored) throws UnsupportedOperationException
setValue
in interface Map.Entry
ignored
- UnsupportedOperationException
public boolean equals(Object o)
Copyright © 2016 Open Microscopy Environment