org.sirix.index.art.Node Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sirix-core Show documentation
Show all versions of sirix-core Show documentation
SirixDB is a hybrid on-disk and in-memory document oriented, versioned database system. It has a lightweight buffer manager, stores everything in a huge persistent and durable tree and allows efficient reconstruction of every revision. Furthermore, SirixDB implements change tracking, diffing and supports time travel queries.
package org.sirix.index.art;
abstract class Node {
/**
* @return child pointer for the smallest partialKey stored in this Node.
* Returns null if this node has no children.
*/
abstract Node first();
abstract Node firstOrLeaf();
/**
* @return child pointer for the largest partialKey stored in this Node.
* Returns null if this node has no children.
*/
abstract Node last();
// for upwards traversal
// dev note: wherever you setup downlinks, you setup uplinks as well
private InnerNode parent;
private byte partialKey;
Node(){}
// copy ctor. called when growing/shrinking
Node(Node node) {
this.partialKey = node.partialKey;
this.parent = node.parent;
}
// do we need partial key for leaf nodes? we'll find out
static void createUplink(InnerNode parent, LeafNode, ?> child) {
Node c = child;
c.parent = parent;
}
static void createUplink(InnerNode parent, Node child, byte partialKey) {
child.parent = parent;
child.partialKey = partialKey;
}
// called when growing/shrinking and all children now have a new parent
static void replaceUplink(InnerNode parent, Node child) {
child.parent = parent;
}
static void removeUplink(Node child) {
child.parent = null;
}
/**
* @return the parent of this node. Returns null for root node.
*/
public InnerNode parent() {
return parent;
}
/**
* @return the uplinking partial key to parent
*/
public byte uplinkKey() {
return partialKey;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy