BpNode

scalation.database.BpNode
See theBpNode companion object
class BpNode(var keys: Int, val isLeaf: Boolean, DLINK: Boolean) extends Serializable

The BpNode class defines nodes of size order that that may be stored in a B+tree. Keys have type ValueType and may reference values of Any type.

Value parameters

DLINK

whether the leaf nodes support linkage in both directions (ref(0) & pre)

isLeaf

whether this node is a leaf

keys

number of active keys

Attributes

Companion
object
Graph
Supertypes
trait Serializable
class Object
trait Matchable
class Any

Members list

Value members

Constructors

def this(left: BpNode, dkey: ValueType, right: BpNode)

Construct a new root node with one key (and two references) in it.

Construct a new root node with one key (and two references) in it.

Value parameters

dkey

the divider key

left

the left node (< dkey)

right

the right node (>= dkey)

Attributes

Concrete methods

def add(k: ValueType, v: Any): Option[Any]

Add the new key k and value v into this node at the to be found insertion position (ip). If a duplicate key is entered, return the OLD VALUE stored with the key, otherwise return None (meaning no duplicate was found)..

Add the new key k and value v into this node at the to be found insertion position (ip). If a duplicate key is entered, return the OLD VALUE stored with the key, otherwise return None (meaning no duplicate was found)..

Value parameters

k

the new key

v

the new value (or node for internal nodes)

Attributes

inline def apply(i: Int): ValueType

Return the key at index position i.

Return the key at index position i.

Value parameters

i

the index position in this node

Attributes

def find(k: ValueType): Int

Find and return the first position where 'k < key_i' in this node. If none, return keys (corresponds to last ref).

Find and return the first position where 'k < key_i' in this node. If none, return keys (corresponds to last ref).

Value parameters

k

the key whose index position is sought

Attributes

def findEq(k: ValueType): Int

Find and return the first position where 'k == key_i' in this node. If none, return -1 meaning not found.

Find and return the first position where 'k == key_i' in this node. If none, return -1 meaning not found.

Value parameters

k

the key whose index position is sought

Attributes

def merge(rt: BpNode): Unit

Merge this LEAF node with its right sibling node (rt).

Merge this LEAF node with its right sibling node (rt).

Value parameters

rt

the right sibling node

Attributes

def mergeI(dk: ValueType, rt: BpNode): Unit

Merge this INTERNAL node with its right sibling node (rt).

Merge this INTERNAL node with its right sibling node (rt).

Value parameters

dk

the divider key from parent

rt

the right sibling node

Attributes

inline def overflow: Boolean

Return whether this node has overflowed (too many keys).

Return whether this node has overflowed (too many keys).

Attributes

def remove(dp: Int): Boolean

Remove key at dp and its reference from this node and check for underflow.

Remove key at dp and its reference from this node and check for underflow.

Value parameters

dp

the deletion index position (may use findEq to find it)

Attributes

def removeI(dp: Int): Boolean

Remove key at dp and its reference from this INTERNAL node and check for underflow.

Remove key at dp and its reference from this INTERNAL node and check for underflow.

Value parameters

dp

the deletion index position (may use findEq to find it)

Attributes

inline def rich: Boolean

Return whether this node is rich (i.e., has surplus keys).

Return whether this node is rich (i.e., has surplus keys).

Attributes

def shiftR(ip: Int): Unit

Shift keys from ip to keys one position to the RIGHT (make room for insertion). Also shift all references to the right of key ip.

Shift keys from ip to keys one position to the RIGHT (make room for insertion). Also shift all references to the right of key ip.

Value parameters

ip

the future insertion position

Attributes

def show(): Unit

Show the node's data structure.

Show the node's data structure.

Attributes

def showRef(): Unit

Show the node's references.

Show the node's references.

Attributes

def split(): (ValueType, BpNode)

Split this LEAF node by creating a right sibling node (rt) and moving half the keys and references to that new node, leaving halfp. Return the divider key and the right sibling node.

Split this LEAF node by creating a right sibling node (rt) and moving half the keys and references to that new node, leaving halfp. Return the divider key and the right sibling node.

Attributes

def splitI(): (ValueType, BpNode)

Split this INTERNAL node by creating a right sibling rt and moving half the keys and references to that new node, leaving halfp - 1. Return the divider key and the right sibling node.

Split this INTERNAL node by creating a right sibling rt and moving half the keys and references to that new node, leaving halfp - 1. Return the divider key and the right sibling node.

Attributes

override def toString: String

Convert this node to a string.

Convert this node to a string.

Attributes

Definition Classes
Any
inline def underflow: Boolean

Return whether this node has underflowed (too few keys).

Return whether this node has underflowed (too few keys).

Attributes

inline def update(i: Int, k: ValueType): Unit

Update the key at index position i.

Update the key at index position i.

Value parameters

i

the index position in this node

k

the new value for key(i)

Attributes

Concrete fields

val isLeaf: Boolean