[Zodb-checkins] CVS: ZODB3/BTrees - Interfaces.py:1.18.92.1

Tim Peters tim.one at comcast.net
Tue Jul 1 19:04:15 EDT 2003


Update of /cvs-repository/ZODB3/BTrees
In directory cvs.zope.org:/tmp/cvs-serv26554/BTrees

Modified Files:
      Tag: zodb33-devel-branch
	Interfaces.py 
Log Message:
Add IMergeIntegerKey (multiunion) BTrees interface from ZODB4.


=== ZODB3/BTrees/Interfaces.py 1.18 => 1.18.92.1 ===
--- ZODB3/BTrees/Interfaces.py:1.18	Tue Jun 25 18:46:42 2002
+++ ZODB3/BTrees/Interfaces.py	Tue Jul  1 18:04:14 2003
@@ -348,6 +348,38 @@
         Note that c1 and c2 must be collections.
         """
 
+class IMergeIntegerKey(IMerge):
+    """IMerge-able objects with integer keys.
+
+    Concretely, this means the types in IOBTree and IIBTree.
+    """
+
+    def multiunion(seq):
+        """Return union of (zero or more) integer sets, as an integer set.
+
+        seq is a sequence of objects each convertible to an integer set.
+        These objects are convertible to an integer set:
+
+        + An integer, which is added to the union.
+
+        + A Set or TreeSet from the same module (for example, an
+          IIBTree.TreeSet for IIBTree.multiunion()).  The elements of the
+          set are added to the union.
+
+        + A Bucket or BTree from the same module (for example, an
+          IOBTree.IOBTree for IOBTree.multiunion()).  The keys of the
+          mapping are added to the union.
+
+        The union is returned as a Set from the same module (for example,
+        IIBTree.multiunion() returns an IIBTree.IISet).
+
+        The point to this method is that it can run much faster than
+        doing a sequence of two-input union() calls.  Under the covers,
+        all the integers in all the inputs are sorted via a single
+        linear-time radix sort, then duplicates are removed in a second
+        linear-time pass.
+        """
+
 ###############################################################
 # IMPORTANT NOTE
 #




More information about the Zodb-checkins mailing list