MCPcopy Create free account
hub / github.com/KentBeck/BPlusTree3 / Node

Class Node

python/bplustree/bplus_tree.py:640–666  ·  view source on GitHub ↗

Abstract base class for B+ tree nodes. This class defines the interface that both leaf and branch nodes must implement. All nodes in the B+ tree have a capacity limit and can check if they are full or underfull (for maintaining tree invariants during deletions).

Source from the content-addressed store, hash-verified

638
639
640class Node(ABC):
641 """Abstract base class for B+ tree nodes.
642
643 This class defines the interface that both leaf and branch nodes must implement.
644 All nodes in the B+ tree have a capacity limit and can check if they are full
645 or underfull (for maintaining tree invariants during deletions).
646 """
647
648 @abstractmethod
649 def is_leaf(self) -> bool:
650 """Returns True if this is a leaf node"""
651 pass
652
653 @abstractmethod
654 def is_full(self) -> bool:
655 """Returns True if the node is at capacity"""
656 pass
657
658 @abstractmethod
659 def __len__(self) -> int:
660 """Returns the number of items in the node"""
661 pass
662
663 @abstractmethod
664 def is_underfull(self) -> bool:
665 """Returns True if the node has fewer than minimum required keys"""
666 pass
667
668
669class LeafNode(Node):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected