37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
from typing import Generic, TypeVar
|
|
|
|
from rainbowadn.collection.comparison import *
|
|
from rainbowadn.core import *
|
|
from .binarycreation import *
|
|
from .binaryprotocolized import *
|
|
|
|
__all__ = ('BinaryBalancing',)
|
|
|
|
TreeType = TypeVar('TreeType')
|
|
ActiveKeyType = TypeVar('ActiveKeyType')
|
|
MetaDataType = TypeVar('MetaDataType')
|
|
|
|
|
|
class BinaryBalancing(Generic[ActiveKeyType, MetaDataType, TreeType]):
|
|
def __init__(self, comparator_: Comparator[ActiveKeyType]):
|
|
assert isinstance(comparator_, Comparator)
|
|
self.comparator = comparator_
|
|
|
|
def empty_metadata(self) -> HashPoint[MetaDataType]:
|
|
raise NotImplementedError
|
|
|
|
async def metadata(
|
|
self,
|
|
treel: TreeType,
|
|
treer: TreeType,
|
|
key: HashPoint[ActiveKeyType],
|
|
creation: BinaryCreation[ActiveKeyType, MetaDataType, TreeType]
|
|
) -> HashPoint[MetaDataType]:
|
|
raise NotImplementedError
|
|
|
|
async def balance(
|
|
self,
|
|
protocolized: BinaryProtocolized[ActiveKeyType, MetaDataType, TreeType],
|
|
) -> TreeType:
|
|
raise NotImplementedError
|