rainbowadn/rainbowadn/data/collection/trees/binary/binarytreecreationprotocol.py

26 lines
1000 B
Python

from typing import Generic, Optional, TypeVar
from rainbowadn.data.collection.trees.binary.binarytreesplit import BinaryTreeSplit
from rainbowadn.data.collection.trees.comparison.comparator import Comparator
from rainbowadn.hashing.hashpoint import HashPoint
__all__ = ('BinaryTreeCreationProtocol',)
TreeType = TypeVar('TreeType')
ActiveKeyType = TypeVar('ActiveKeyType')
MetaDataType = TypeVar('MetaDataType')
class BinaryTreeCreationProtocol(Generic[ActiveKeyType, MetaDataType, TreeType]):
def __init__(self, comparator: Comparator[ActiveKeyType]):
self.comparator = comparator
def split(self, tree: TreeType) -> Optional[
BinaryTreeSplit[ActiveKeyType, MetaDataType, TreeType]
]:
"""result of this method is supposed to be used right after the call, therefore all values are resolved"""
raise NotImplementedError
def tree(self, treel: TreeType, treer: TreeType, key: HashPoint[ActiveKeyType]) -> TreeType:
raise NotImplementedError