Beispiel #1
0
 def _iassoc(self, hsh, shift, node):
     if node.key == self.key:
         return node
     
     if hsh == self.hsh:
         return HashCollisionNode(
             [self, node]
         )
     return DispatchNode.make(shift, [self, node])        
Beispiel #2
0
 def assoc(self, hsh, shift, node):
     # If there is a hash-collision, return a HashCollisionNode,
     # otherwise return a DispatchNode dispatching depending on the
     # current level (if the two hashes only differ at a higher-level,
     # DispatchNode.make will return a DispatchNode that contains a
     # DispatchNode etc. up until the necessary depth.
     if node.key == self.key:
         return node
     
     if hsh == self.hsh:
         return HashCollisionNode(
             [self, node]
         )
     return DispatchNode.make(shift, [self, node])