|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.app.util.ScalableList.TreeNode<E>
E - the type of element stored in the ScalableListstatic class ScalableList.TreeNode<E>
An object which forms a tree above the ListNode<E> linked list.
Each TreeNode<E> has a child reference to either one
TreeNode<E> or a ListNode<E>. The TreeNode<E>
also has a reference to its next and previous sibling and its parent.
The TreeNode<E> is intended to only track the size of its
descendant children and the number of children that it owns.
| Field Summary | |
|---|---|
static byte |
DECREMENT_CHILDREN_AND_SIZE
|
static byte |
DECREMENT_SIZE
|
static byte |
INCREMENT_CHILDREN_AND_SIZE
|
static byte |
INCREMENT_SIZE
|
| Constructor Summary | |
|---|---|
ScalableList.TreeNode(ScalableList<E> list,
ScalableList.TreeNode<E> parent,
boolean isSplit)
Constructor which creates a TreeNode while specifying
parameters for the node characteristics |
|
ScalableList.TreeNode(ScalableList<E> list,
ScalableList.TreeNode<E> parent,
E e)
Create a new TreeNode on account of a new leaf ( ListNode)
being created. |
|
| Method Summary | |
|---|---|
void |
clear()
Walks up the tree and removes the object and any of its parents. |
(package private) void |
decrement()
Recursively decrements the node's size until reaching the root. |
(package private) void |
decrementChildrenAndSize()
Decrements the number of children and size, and determines whether the parent should do both again, or just decrement the size. |
(package private) ScalableList.Node<E> |
getChild()
Obtains the child of the current node. |
(package private) int |
getChildCount()
Retrieves the number of immediate children beneath this node. |
ScalableList.TreeNode<E> |
getParent()
Retrieves the node's parent. |
(package private) void |
increment()
Recursively increments the node's size until reaching the root. |
(package private) void |
incrementChildrenAndSize()
Increments the number of children and size, and determines whether the parent should do both, or just perform an increment of the size. |
ScalableList.TreeNode<E> |
next()
Returns the next Node in sequence, or null if none exists. |
ScalableList.TreeNode<E> |
prev()
Returns the previous Node in sequence, or null if none
exists. |
(package private) void |
prune()
Unlinks itself from the tree without performing a recursive deletion. |
com.sun.sgs.app.util.ScalableList.SearchResult<E> |
search(int currentValue,
int destIndex)
Traverses the tree (recursively) in search of the ListNode |
(package private) void |
setChild(ScalableList.Node<E> child,
int size,
int numberOfChildren)
Sets the child to be the supplied parameter as long as it is not null. |
(package private) void |
setChildToNull()
Sets the child to null for the relinking process. |
void |
setNext(ScalableList.Node<E> ref)
Sets the next element to be the supplied argument. |
void |
setParent(ScalableList.TreeNode<E> parent)
Sets the parent for the node. |
void |
setPrev(ScalableList.Node<E> ref)
Sets the previous element to be the supplied argument. |
int |
size()
The size of the node; that is, the sum of the sizes of its immediate children. |
String |
toString()
Returns a String representation of this object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final byte DECREMENT_SIZE
public static final byte INCREMENT_SIZE
public static final byte INCREMENT_CHILDREN_AND_SIZE
public static final byte DECREMENT_CHILDREN_AND_SIZE
| Constructor Detail |
|---|
ScalableList.TreeNode(ScalableList<E> list,
ScalableList.TreeNode<E> parent,
E e)
ListNode)
being created.
list - the ScalableList which is the owner of this
structureparent - the intended parente - an element to add into the empty ListNode
ScalableList.TreeNode(ScalableList<E> list,
ScalableList.TreeNode<E> parent,
boolean isSplit)
TreeNode while specifying
parameters for the node characteristics
list - the ScalableList owner of this structureparent - the intended parent ListNodeisSplit - true if the TreeNode is to be
created due to a split operation, and false
otherwise.| Method Detail |
|---|
public String toString()
String representation of this object.
toString in class ObjectString representation of this object.public ScalableList.TreeNode<E> prev()
Node in sequence, or null if none
exists.
prev in interface ScalableList.Node<E>public void setPrev(ScalableList.Node<E> ref)
setPrev in interface ScalableList.Node<E>ref - the previous Nodepublic ScalableList.TreeNode<E> next()
Node in sequence, or null if none exists.
next in interface ScalableList.Node<E>ScalableList.Node<E> getChild()
TreeNode does not have
references to all the children, so it uses knowledge of the head to
iterate through them.
TreeNode or
ListNode, depending on the position of the current node in
the tree.
void setChild(ScalableList.Node<E> child,
int size,
int numberOfChildren)
child - the new childvoid setChildToNull()
public int size()
size in interface ScalableList.Node<E>void increment()
void decrement()
public void clear()
AsynchronousClearTask operation.
clear in interface ScalableList.Node<E>int getChildCount()
public ScalableList.TreeNode<E> getParent()
getParent in interface ScalableList.Node<E>public void setNext(ScalableList.Node<E> ref)
setNext in interface ScalableList.Node<E>ref - the next Nodevoid prune()
The first condition is if the TreeNode is an intermediate
node. If so, it is necessary to link the left and right siblings
together before the node is pruned.
The second condition is if the TreeNode is the tail node.
If so, then the previous element's next reference is set to null
before the node is pruned.
The third condition is if the TreeNode is the head node. If
so, then the next element's previous reference is set to null
before the node is pruned.
The last condition is if the TreeNode is an only- child. If
so, then the parent's child reference is set to null before the
node is pruned.
public void setParent(ScalableList.TreeNode<E> parent)
setParent in interface ScalableList.Node<E>parent - the intended parentvoid incrementChildrenAndSize()
void decrementChildrenAndSize()
public com.sun.sgs.app.util.ScalableList.SearchResult<E> search(int currentValue,
int destIndex)
search in interface ScalableList.Node<E>currentValue - the current index value at the beginning of
this current searchdestIndex - the absolute index of the desired element
ListNode containing the absolute
destIndex
|
RedDwarf, Version 0.10.1 2010-03-14 10:56:12 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||