[Zodb-checkins] CVS: Zope3/src/zodb/btrees - interfaces.py:1.11

Tim Peters tim.one at comcast.net
Mon Jun 23 18:01:53 EDT 2003


Update of /cvs-repository/Zope3/src/zodb/btrees
In directory cvs.zope.org:/tmp/cvs-serv14905/src/zodb/btrees

Modified Files:
	interfaces.py 
Log Message:
Document multiunion(), via a new interface.


=== Zope3/src/zodb/btrees/interfaces.py 1.10 => 1.11 ===
--- Zope3/src/zodb/btrees/interfaces.py:1.10	Fri Jun  6 11:24:19 2003
+++ Zope3/src/zodb/btrees/interfaces.py	Mon Jun 23 17:01:52 2003
@@ -375,6 +375,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