org.exist.storage.btree
Class BTree.BTreeNode

java.lang.Object
  extended byorg.exist.storage.btree.BTree.BTreeNode
All Implemented Interfaces:
Cacheable
Enclosing class:
BTree

protected final class BTree.BTreeNode
extends java.lang.Object
implements Cacheable

A node in the B+-tree. Every node is backed by a Page for storing the node's data. Both, branch and leaf nodes are represented by this class. Each node stores its keys as instances of Value and its values as pointers of type long. If the node is a branch, the long pointers point to the child nodes of the branch. If it is a leaf, the pointers contain the virtual storage of the data section associated to the key.

Author:
wolf

Field Summary
 
Fields inherited from interface org.exist.storage.cache.Cacheable
MAX_REF
 
Constructor Summary
BTree.BTreeNode(Paged.Page page, boolean newPage)
           
 
Method Summary
 boolean allowUnload()
          Is it safe to unload the Cacheable from the cache? Called before an object is actually removed.
 int decReferenceCount()
          Decrease the reference count of this object by one and return it.
 long getKey()
          Get a unique key for the object.
 BTree.BTreeNode getParent()
           
 int getReferenceCount()
          Get the current reference count.
 int getTimestamp()
          Get the current timestamp marker.
 int incReferenceCount()
          Increase the reference count of this object by one and return it.
 boolean isDirty()
           
 void setParent(BTree.BTreeNode parent)
          Set the link to the parent of this node.
 void setReferenceCount(int count)
          Set the reference count of this object.
 void setTimestamp(int timestamp)
          Set the timestamp marker.
 boolean sync(boolean syncJournal)
          Called before the object is released by the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BTree.BTreeNode

public BTree.BTreeNode(Paged.Page page,
                       boolean newPage)
Method Detail

setParent

public void setParent(BTree.BTreeNode parent)
Set the link to the parent of this node.

Parameters:
parent -

getParent

public BTree.BTreeNode getParent()
Returns:
the parent of this node.

getReferenceCount

public int getReferenceCount()
Description copied from interface: Cacheable
Get the current reference count.

Specified by:
getReferenceCount in interface Cacheable
Returns:
See Also:
Cacheable.getReferenceCount()

incReferenceCount

public int incReferenceCount()
Description copied from interface: Cacheable
Increase the reference count of this object by one and return it.

Specified by:
incReferenceCount in interface Cacheable
Returns:
the reference count
See Also:
Cacheable.incReferenceCount()

setReferenceCount

public void setReferenceCount(int count)
Description copied from interface: Cacheable
Set the reference count of this object.

Specified by:
setReferenceCount in interface Cacheable
Parameters:
count -
See Also:
Cacheable.setReferenceCount(int)

setTimestamp

public void setTimestamp(int timestamp)
Description copied from interface: Cacheable
Set the timestamp marker.

Specified by:
setTimestamp in interface Cacheable
Parameters:
timestamp -
See Also:
Cacheable.setTimestamp(int)

allowUnload

public boolean allowUnload()
Description copied from interface: Cacheable
Is it safe to unload the Cacheable from the cache? Called before an object is actually removed. Return false to avoid being removed.

Specified by:
allowUnload in interface Cacheable
Returns:
See Also:
Cacheable.allowUnload()

getTimestamp

public int getTimestamp()
Description copied from interface: Cacheable
Get the current timestamp marker.

Specified by:
getTimestamp in interface Cacheable
Returns:
timestamp marker
See Also:
Cacheable.getTimestamp()

sync

public boolean sync(boolean syncJournal)
Description copied from interface: Cacheable
Called before the object is released by the cache. The object should prepare to be garbage collected. All unwritten data should be flushed to disk.

Specified by:
sync in interface Cacheable
See Also:
org.exist.storage.cache.Cacheable#sync()

getKey

public long getKey()
Description copied from interface: Cacheable
Get a unique key for the object. Usually this is the page number.

Specified by:
getKey in interface Cacheable
Returns:
unique key
See Also:
Cacheable.getKey()

decReferenceCount

public int decReferenceCount()
Description copied from interface: Cacheable
Decrease the reference count of this object by one and return it.

Specified by:
decReferenceCount in interface Cacheable
Returns:
the reference count
See Also:
Cacheable.decReferenceCount()

isDirty

public boolean isDirty()
Specified by:
isDirty in interface Cacheable
See Also:
Cacheable.isDirty()


<oXygen/> XML Editor provides support for editing and debugging XQuery expressions against the eXist XML Database.