equal
deleted
inserted
replaced
2310 """Represent the addition of two sets |
2310 """Represent the addition of two sets |
2311 |
2311 |
2312 Wrapper structure for lazily adding two structures without losing much |
2312 Wrapper structure for lazily adding two structures without losing much |
2313 performance on the __contains__ method |
2313 performance on the __contains__ method |
2314 |
2314 |
|
2315 If the ascending attribute is set, that means the two structures are |
|
2316 ordered in either an ascending or descending way. Therefore, we can add |
|
2317 them mantaining the order by iterating over both at the same time |
|
2318 |
2315 This class does not duck-type baseset and it's only supposed to be used |
2319 This class does not duck-type baseset and it's only supposed to be used |
2316 internally |
2320 internally |
2317 """ |
2321 """ |
2318 def __init__(self, revs1, revs2): |
2322 def __init__(self, revs1, revs2, ascending=None): |
2319 self._r1 = revs1 |
2323 self._r1 = revs1 |
2320 self._r2 = revs2 |
2324 self._r2 = revs2 |
2321 self._iter = None |
2325 self._iter = None |
|
2326 self._ascending = ascending |
2322 |
2327 |
2323 def _iterator(self): |
2328 def _iterator(self): |
2324 if not self._iter: |
2329 if not self._iter: |
2325 def gen(): |
2330 def gen(): |
2326 for r in self._r1: |
2331 for r in self._r1: |