@StoreNotUseStandardSerialization @StorableClass public class RBTSentinel<E> extends Object implements IRBTNode<E>, Serializable
Constructor and Description |
---|
RBTSentinel() |
Modifier and Type | Method and Description |
---|---|
void |
accept(IRBTVisitor<E> visitor)
accept red black tree visitor
|
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
|
static RBTSentinel |
newInstance(IInstanceFactory instanceFactory) |
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
|
String |
toString() |
public static RBTSentinel newInstance(IInstanceFactory instanceFactory)
public boolean isColorSetted()
isColorSetted
in interface IRBTNode<E>
public boolean isBlack() throws RBTException
IRBTNode
isBlack
in interface IRBTNode<E>
RBTException
- node access errorpublic void setBlack()
IRBTNode
public boolean isRed() throws RBTException
IRBTNode
isRed
in interface IRBTNode<E>
RBTException
- node access errorpublic void setRed()
IRBTNode
public IRBTNode<E> getParent() throws RBTException
IRBTNode
getParent
in interface IRBTNode<E>
RBTException
- node access errorpublic void setParent(IRBTNode<E> node)
IRBTNode
public IRBTNode<E> getLeft() throws RBTException
IRBTNode
getLeft
in interface IRBTNode<E>
RBTException
- node access errorpublic void setLeft(IRBTNode<E> node) throws RBTException
IRBTNode
setLeft
in interface IRBTNode<E>
node
- the left child of this nodeRBTException
- node access errorpublic IRBTNode<E> getRight() throws RBTException
IRBTNode
getRight
in interface IRBTNode<E>
RBTException
- node access errorpublic void setRight(IRBTNode<E> node) throws RBTException
IRBTNode
setRight
in interface IRBTNode<E>
node
- the right child of this nodeRBTException
- node access errorpublic int compareTo(IRBTComparableNode<E> node)
compareTo
in interface IRBTComparableNode<E>
public int compareTo(E element) throws RBTException
compareTo
in interface IRBTComparableNode<E>
RBTException
public boolean isSentinel() throws RBTException
IRBTNode
isSentinel
in interface IRBTNode<E>
RBTException
- node access errorpublic boolean getColor() throws RBTException
IRBTNode
RedBlackTree#BLACK
and RedBlackTree#RED
getColor
in interface IRBTNode<E>
RBTException
- node access errorpublic void setColor(boolean color)
IRBTNode
RedBlackTree#BLACK
and RedBlackTree#RED
public void accept(IRBTVisitor<E> visitor) throws RBTException
IRBTVisitable
accept
in interface IRBTVisitable<E>
visitor
- the red black tree visitorRBTException
- node access errorpublic int getNumberOfChild()
IRBTNode
getNumberOfChild
in interface IRBTNode<E>
public void setNumberOfChild(int numberOfChild)
IRBTNode
setNumberOfChild
in interface IRBTNode<E>
numberOfChild
- the number of childrenpublic void decrementNumberOfChild() throws RBTException
decrementNumberOfChild
in interface IRBTNode<E>
RBTException
public void incrementNumberOfChild() throws RBTException
incrementNumberOfChild
in interface IRBTNode<E>
RBTException
public E getElement()
IRBTNode
getElement
in interface IRBTNode<E>
public void setElement(E element)
IRBTNode
setElement
in interface IRBTNode<E>
element
- the element to set for this nodepublic void detach()
IRBTNode
public boolean isAttached()
isAttached
in interface IRBTNode<E>
Copyright © 2007-2012 Luc Peuvrier. All Rights Reserved.