@NotStorableClass public abstract class AbstractHeapRBTNode<E extends Comparable<E>> extends Object implements IRBTNode<E>
IRBTNode where an association is made between
this node and its image in heap file| Modifier and Type | Field and Description |
|---|---|
boolean |
color
this node color:
RedBlackTree.BLACK or RedBlackTree.RED. |
boolean |
colorSetted
true if node color set. public is bad smell but this done for
optimization
|
protected IHeapElementManager |
heapElementManager
heap elements manager for access to
HeapRecord, null for sentinel
node |
int |
index |
long |
leftPositionInFile
position in heap file of the copy of this node left son. public is bad
smell but this done for optimization
|
int |
numberOfChild
number of child of this node. public is bad smell but this done for
optimization
|
long |
parentPositionInFile
position in heap file of the copy of this node parent. public is bad
smell but this done for optimization
|
long |
rightPositionInFile
position in heap file of the copy of this node right son. public is bad
smell but this done for optimization
|
boolean |
valueChanged
became true when value changed. public is bad smell but this done for
optimization
|
| Constructor and Description |
|---|
AbstractHeapRBTNode(IHeapElementManager heapElementManager,
long positionInFile,
long parentPositionInFile,
long leftPositionInFile,
long rightPositionInFile,
boolean colorSetted,
boolean color,
int numberOfChild) |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(IRBTVisitor<E> visitor)
accept red black tree visitor
|
void |
decrementNumberOfChild() |
void |
detach()
detach the node from the tree
|
boolean |
equals(Object obj) |
boolean |
getColor()
get node color
color definition: RedBlackTree#BLACK and RedBlackTree#RED |
HeapRecord |
getHeapRecord() |
int |
getIndex() |
IRBTNode<E> |
getLeft()
get left child of this node
|
long |
getLeftPositionInFile()
get this node left son node mirroring in heap file position
should be used only by HeapRecord to save it in heap file |
int |
getNumberOfChild()
get the number of node in right and left tree node, sentinel excluded
|
IRBTNode<E> |
getParent()
get parent node
|
long |
getParentPositionInFile()
get this node parent node mirroring in heap file position
should be used only by HeapRecord to save it in heap file |
long |
getPositionInFile()
get this node mirroring in heap file position
should be used only by heap red black tree node manager ( specialization of AbstractHeapNodeManager) and this |
IRBTNode<E> |
getRight()
get right child of this node
|
long |
getRightPositionInFile()
get this node right son node mirroring in heap file position
should be used only by HeapRecord to save it in heap file |
int |
hashCode() |
protected abstract AbstractHeapRBTNode<E> |
heapNode(HeapRecord heapRecord)
get the heap node from the heap record from heap file, depending of heap
tree it is not at same location on heap record.
|
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
|
boolean |
isValueChanged()
to know if state of this changed
|
void |
setBlack()
set node color to black
|
void |
setColor(boolean color)
set node color
color definition: RedBlackTree#BLACK and RedBlackTree#RED |
void |
setIndex(int index) |
void |
setLeft(IRBTNode<E> node)
set left child of this node
|
void |
setLeftPositionInFile(long leftPositionInFile)
set this node left son node mirroring in heap file position
should be used only by HeapRecord to load it from heap file |
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 |
setParentPositionInFile(long parentFilePosition)
set this node parent node mirroring in heap file position
should be used only by HeapRecord to load it from heap file |
void |
setRed()
set node color to red
|
void |
setRight(IRBTNode<E> node)
set right child of this node
|
void |
setRightPositionInFile(long rightPositionInFile)
set this node right son node mirroring in heap file position
should be used only by HeapRecord to load it from heap file |
String |
toString() |
void |
valueSetted() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetElement, setElementcompareTo, compareTopublic boolean valueChanged
public long parentPositionInFile
public long leftPositionInFile
public long rightPositionInFile
public boolean colorSetted
public boolean color
RedBlackTree.BLACK or RedBlackTree.RED.
public is bad smell but this done for optimizationpublic int numberOfChild
public int index
protected IHeapElementManager heapElementManager
HeapRecord, null for sentinel
nodepublic AbstractHeapRBTNode(IHeapElementManager heapElementManager, long positionInFile, long parentPositionInFile, long leftPositionInFile, long rightPositionInFile, boolean colorSetted, boolean color, int numberOfChild)
public HeapRecord getHeapRecord() throws HeapException
HeapExceptionpublic long getPositionInFile()
AbstractHeapNodeManager) and thispublic long getLeftPositionInFile()
throws RBTException
HeapRecord to save it in heap fileRBTExceptionpublic long getRightPositionInFile()
throws RBTException
HeapRecord to save it in heap fileRBTExceptionpublic long getParentPositionInFile()
HeapRecord to save it in heap filepublic void setLeftPositionInFile(long leftPositionInFile)
throws RBTException
HeapRecord to load it from heap fileleftPositionInFile - the position of this node left son node mirroring in heap fileRBTExceptionpublic void setRightPositionInFile(long rightPositionInFile)
throws RBTException
HeapRecord to load it from heap fileleftPositionInFile - the position of this node right son node mirroring in heap
fileRBTExceptionpublic void setParentPositionInFile(long parentFilePosition)
HeapRecord to load it from heap fileleftPositionInFile - the position of this node parent node mirroring in heap filepublic void setParent(IRBTNode<E> node) throws RBTException
IRBTNodesetParent in interface IRBTNode<E extends Comparable<E>>node - the parent nodeRBTException - node access errorpublic void setLeft(IRBTNode<E> node) throws RBTException
IRBTNodesetLeft in interface IRBTNode<E extends Comparable<E>>node - the left child of this nodeRBTException - node access errorpublic void setRight(IRBTNode<E> node) throws RBTException
IRBTNodesetRight in interface IRBTNode<E extends Comparable<E>>node - the right child of this nodeRBTException - node access errorpublic IRBTNode<E> getParent() throws RBTException
IRBTNodegetParent in interface IRBTNode<E extends Comparable<E>>RBTException - node access errorpublic IRBTNode<E> getLeft() throws RBTException
IRBTNodegetLeft in interface IRBTNode<E extends Comparable<E>>RBTException - node access errorpublic IRBTNode<E> getRight() throws RBTException
IRBTNodegetRight in interface IRBTNode<E extends Comparable<E>>RBTException - node access errorprotected abstract AbstractHeapRBTNode<E> heapNode(HeapRecord heapRecord) throws RBTException
heapRecord - the heap recordRBTExceptionpublic boolean isSentinel()
IRBTNodeisSentinel in interface IRBTNode<E extends Comparable<E>>public boolean isColorSetted()
isColorSetted in interface IRBTNode<E extends Comparable<E>>public boolean isBlack()
throws RBTException
IRBTNodeisBlack in interface IRBTNode<E extends Comparable<E>>RBTException - node access errorpublic boolean isRed()
throws RBTException
IRBTNodeisRed in interface IRBTNode<E extends Comparable<E>>RBTException - node access errorpublic void setBlack()
throws RBTException
IRBTNodesetBlack in interface IRBTNode<E extends Comparable<E>>RBTExceptionpublic void setRed()
throws RBTException
IRBTNodesetRed in interface IRBTNode<E extends Comparable<E>>RBTException - node access errorpublic void setColor(boolean color)
throws RBTException
IRBTNodeRedBlackTree#BLACK and RedBlackTree#REDsetColor in interface IRBTNode<E extends Comparable<E>>color - the node colorRBTException - node access errorpublic boolean getColor()
throws RBTException
IRBTNodeRedBlackTree#BLACK and RedBlackTree#REDgetColor in interface IRBTNode<E extends Comparable<E>>RBTException - node access errorpublic int getNumberOfChild()
throws RBTException
IRBTNodegetNumberOfChild in interface IRBTNode<E extends Comparable<E>>RBTException - node access errorpublic void setNumberOfChild(int numberOfChild)
throws RBTException
IRBTNodesetNumberOfChild in interface IRBTNode<E extends Comparable<E>>numberOfChild - the number of childrenRBTExceptionpublic void setIndex(int index)
setIndex in interface IRBTNode<E extends Comparable<E>>public int getIndex()
getIndex in interface IRBTNode<E extends Comparable<E>>public void decrementNumberOfChild()
throws RBTException
decrementNumberOfChild in interface IRBTNode<E extends Comparable<E>>RBTExceptionpublic void incrementNumberOfChild()
throws RBTException
incrementNumberOfChild in interface IRBTNode<E extends Comparable<E>>RBTExceptionpublic void accept(IRBTVisitor<E> visitor) throws RBTException
IRBTVisitableaccept in interface IRBTVisitable<E extends Comparable<E>>visitor - the red black tree visitorRBTException - node access errorpublic boolean isValueChanged()
throws RBTException
RBTExceptionpublic void valueSetted()
throws RBTException
RBTExceptionpublic void detach()
IRBTNodedetach in interface IRBTNode<E extends Comparable<E>>public boolean isAttached()
isAttached in interface IRBTNode<E extends Comparable<E>>Copyright © 2007-2012 Luc Peuvrier. All Rights Reserved.