@NotStorableClass public abstract class AbstractHeapRecordableRBTNode<E> extends AbstractHeapRecordable implements IRBTNode<E>
| Modifier and Type | Field and Description |
|---|---|
protected static int |
headerByteSize |
heapRecordableManager, helperBinaryConversion, logger| Constructor and Description |
|---|
AbstractHeapRecordableRBTNode(HeapRecordableManager heapRecordableManager,
HelperBinaryConversion helperBinaryConversion) |
AbstractHeapRecordableRBTNode(HelperBinaryConversion helperBinaryConversion)
construct a sentinel
|
| Modifier and Type | Method and Description |
|---|---|
void |
accept(IRBTVisitor<E> visitor)
accept red black tree visitor
|
int |
byteSize() |
protected abstract int |
byteSize(E element) |
protected void |
checkNotSentinel() |
int |
compareTo(E element) |
int |
compareTo(IRBTComparableNode<E> node) |
void |
decrementNumberOfChild() |
void |
detach()
detach the node from the tree
|
boolean |
getColor()
get node color
color definition: RedBlackTree#BLACK and RedBlackTree#RED |
E |
getElement()
get the element of this node
|
int |
getIndex() |
IRBTNode<E> |
getLeft()
get left child of this node
|
int |
getNumberOfChild()
get the number of node in right and left tree node, sentinel excluded
|
IRBTNode<E> |
getParent()
get parent node
|
IRBTNode<E> |
getRight()
get right child of this node
|
void |
incrementNumberOfChild() |
boolean |
isAttached() |
boolean |
isBlack()
to know if node is black
|
boolean |
isColorSetted() |
boolean |
isRed()
to know if node is red
|
boolean |
isSentinel()
to know if this node is a sentinel ( a black leaf marker ), if not a
sentinel it is a valued node with right and left child
|
void |
marshall(byte[] binary)
from object state to binary form
|
protected abstract void |
marshallElement(byte[] binary,
int offset,
E element) |
protected abstract AbstractHeapRecordableRBTNode<E> |
newNode(HeapRecordableManager heapRecordableManager) |
protected abstract AbstractHeapRecordableRBTNode<E> |
newSentinel() |
void |
setBlack()
set node color to black
|
void |
setColor(boolean color)
set node color
color definition: RedBlackTree#BLACK and RedBlackTree#RED |
void |
setElement(E element)
set this node element
|
void |
setIndex(int index) |
void |
setLeft(IRBTNode<E> node)
set left child of this node
|
void |
setNumberOfChild(int numberOfChild)
set the number of node in right and left tree node, sentinel excluded
|
void |
setParent(IRBTNode<E> node)
set parent node
|
void |
setRed()
set node color to red
|
void |
setRight(IRBTNode<E> node)
set right child of this node
|
void |
setStateHaveChanged()
set state changed,
HeapRecordableManager will save change |
String |
toString() |
void |
unmarshall(byte[] binary)
from binary form to object state
|
protected abstract E |
unmarshallElement(byte[] binary,
int offset) |
checkLoaded, clear, compareTo, equals, getDataRecordIdentifier, hashCode, isStateChanged, setDataRecordIdentifier, setSynchronizedWithFileprotected static final int headerByteSize
public AbstractHeapRecordableRBTNode(HeapRecordableManager heapRecordableManager, HelperBinaryConversion helperBinaryConversion)
public AbstractHeapRecordableRBTNode(HelperBinaryConversion helperBinaryConversion)
public int byteSize()
throws HeapRecordableException
byteSize in interface IHeapRecordableHeapRecordableExceptionprotected abstract int byteSize(E element) throws HeapRecordableException
HeapRecordableExceptionpublic void marshall(byte[] binary)
throws HeapRecordableException
IHeapRecordablemarshall in interface IHeapRecordablebinary - where write the object stateHeapRecordableExceptionprotected abstract void marshallElement(byte[] binary,
int offset,
E element)
throws BinaryConverterException
BinaryConverterExceptionpublic void unmarshall(byte[] binary)
throws HeapRecordableException
IHeapRecordableunmarshall in interface IHeapRecordablebinary - where read the object stateHeapRecordableExceptionprotected abstract AbstractHeapRecordableRBTNode<E> newNode(HeapRecordableManager heapRecordableManager)
protected abstract AbstractHeapRecordableRBTNode<E> newSentinel()
protected abstract E unmarshallElement(byte[] binary, int offset) throws HeapRecordableException
HeapRecordableExceptionprotected void checkNotSentinel()
throws RBTException
RBTExceptionpublic void setStateHaveChanged()
throws HeapRecordableException
AbstractHeapRecordableHeapRecordableManager will save changesetStateHaveChanged in class AbstractHeapRecordableHeapRecordableExceptionpublic boolean isColorSetted()
throws RBTException
isColorSetted in interface IRBTNode<E>RBTExceptionpublic boolean getColor()
throws RBTException
IRBTNodeRedBlackTree#BLACK and RedBlackTree#REDgetColor in interface IRBTNode<E>RBTException - node access errorpublic IRBTNode<E> getLeft() throws RBTException
IRBTNodegetLeft in interface IRBTNode<E>RBTException - node access errorpublic IRBTNode<E> getParent() throws RBTException
IRBTNodegetParent in interface IRBTNode<E>RBTException - node access errorpublic IRBTNode<E> getRight() throws RBTException
IRBTNodegetRight in interface IRBTNode<E>RBTException - node access errorpublic boolean isBlack()
throws RBTException
IRBTNodeisBlack in interface IRBTNode<E>RBTException - node access errorpublic boolean isRed()
throws RBTException
IRBTNodeisRed in interface IRBTNode<E>RBTException - node access errorpublic boolean isSentinel()
throws RBTException
IRBTNodeisSentinel in interface IRBTNode<E>RBTException - node access errorpublic void setBlack()
throws RBTException
IRBTNodesetBlack in interface IRBTNode<E>RBTExceptionpublic void setColor(boolean color)
throws RBTException
IRBTNodeRedBlackTree#BLACK and RedBlackTree#REDsetColor in interface IRBTNode<E>color - the node colorRBTException - node access errorpublic void setLeft(IRBTNode<E> node) throws RBTException
IRBTNodesetLeft in interface IRBTNode<E>node - the left child of this nodeRBTException - node access errorpublic void setNumberOfChild(int numberOfChild)
throws RBTException
IRBTNodesetNumberOfChild in interface IRBTNode<E>numberOfChild - the number of childrenRBTExceptionpublic int getNumberOfChild()
throws RBTException
IRBTNodegetNumberOfChild in interface IRBTNode<E>RBTException - node access errorpublic void decrementNumberOfChild()
throws RBTException
decrementNumberOfChild in interface IRBTNode<E>RBTExceptionpublic void incrementNumberOfChild()
throws RBTException
incrementNumberOfChild in interface IRBTNode<E>RBTExceptionpublic void setParent(IRBTNode<E> node) throws RBTException
IRBTNodesetParent in interface IRBTNode<E>node - the parent nodeRBTException - node access errorpublic void setRed()
throws RBTException
IRBTNodesetRed in interface IRBTNode<E>RBTException - node access errorpublic void setRight(IRBTNode<E> node) throws RBTException
IRBTNodesetRight in interface IRBTNode<E>node - the right child of this nodeRBTException - node access errorpublic int compareTo(IRBTComparableNode<E> node) throws RBTException
compareTo in interface IRBTComparableNode<E>RBTExceptionpublic int compareTo(E element) throws RBTException
compareTo in interface IRBTComparableNode<E>RBTExceptionpublic void accept(IRBTVisitor<E> visitor) throws RBTException
IRBTVisitableaccept in interface IRBTVisitable<E>visitor - the red black tree visitorRBTException - node access errorpublic E getElement() throws RBTException
IRBTNodegetElement in interface IRBTNode<E>RBTExceptionpublic void setElement(E element) throws RBTException
IRBTNodesetElement in interface IRBTNode<E>element - the element to set for this nodeRBTExceptionpublic void detach()
IRBTNodepublic boolean isAttached()
isAttached in interface IRBTNode<E>public String toString()
toString in class AbstractHeapRecordableCopyright © 2007-2012 Luc Peuvrier. All Rights Reserved.