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).
| 638 | |
| 639 | |
| 640 | class 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 | |
| 669 | class LeafNode(Node): |
nothing calls this directly
no outgoing calls
no test coverage detected