public static class RangeList.AVLNode<E>
extends java.lang.Object
This node contains the real work.
TreeList is just there to implement List.
The nodes don't know the index of the object they are holding. They
do know however their position relative to their parent node.
This allows to calculate the index of a node while traversing the tree.
The Faedelung calculation stores a flag for both the left and right child to indicate if they are a child (false) or a link as in linked list (true).
| Modifier and Type | Field and Description |
|---|---|
int |
height
How many levels of left/right are below this one.
|
RangeList.AVLNode<E> |
left
The left child node or the predecessor if
leftIsPrevious. |
boolean |
leftIsPrevious
Flag indicating that left reference is not a subtree but the predecessor.
|
int |
relativePosition
The relative position, root holds absolute position.
|
RangeList.AVLNode<E> |
right
The right child node or the successor if
rightIsNext. |
boolean |
rightIsNext
Flag indicating that right reference is not a subtree but the successor.
|
| Modifier and Type | Method and Description |
|---|---|
RangeList.AVLNode<E> |
getLeftSubTree()
Gets the left node, returning null if its a faedelung.
|
RangeList.AVLNode<E> |
getRightSubTree()
Gets the right node, returning null if its a faedelung.
|
E |
getValue()
Gets the value.
|
RangeList.AVLNode<E> |
insertOnLeft(int indexRelativeToMe,
E obj) |
RangeList.AVLNode<E> |
insertOnLeft2(int indexRelativeToMe,
E obj) |
RangeList.AVLNode<E> |
max()
Gets the rightmost child of this node.
|
RangeList.AVLNode<E> |
min()
Gets the leftmost child of this node.
|
RangeList.AVLNode<E> |
next()
Gets the next node in the list after this one.
|
RangeList.AVLNode<E> |
nextTop() |
RangeList.AVLNode<E> |
prevDown() |
RangeList.AVLNode<E> |
previous()
Gets the node in the list before this one.
|
RangeList.AVLNode<E> |
prevTop() |
void |
setValue(E obj)
Sets the value.
|
java.lang.String |
toString()
Used for debugging.
|
public RangeList.AVLNode<E> left
leftIsPrevious.public boolean leftIsPrevious
public RangeList.AVLNode<E> right
rightIsNext.public boolean rightIsNext
public int height
public int relativePosition
public E getValue()
public void setValue(E obj)
obj - the value to storepublic RangeList.AVLNode<E> next()
public RangeList.AVLNode<E> nextTop()
public RangeList.AVLNode<E> prevTop()
public RangeList.AVLNode<E> prevDown()
public RangeList.AVLNode<E> previous()
public RangeList.AVLNode<E> insertOnLeft2(int indexRelativeToMe, E obj)
public RangeList.AVLNode<E> insertOnLeft(int indexRelativeToMe, E obj)
public RangeList.AVLNode<E> getLeftSubTree()
public RangeList.AVLNode<E> getRightSubTree()
public RangeList.AVLNode<E> max()
public RangeList.AVLNode<E> min()
public java.lang.String toString()
toString in class java.lang.Object