Commit Graph

457 Commits

Author SHA1 Message Date
Pierre-Yves David
9d3c052ee3 generatorset: drop the leading underscore in the class name
This is a real smart set now.
2014-10-03 20:12:02 -07:00
Pierre-Yves David
dc2b8470bf generatorset: update the docstring now that it is a smartset
The documentation was still stating that this class was not a smartset. We drop
that part.
2014-10-03 20:14:43 -07:00
Pierre-Yves David
ccc0b916ad addset: drop the leading underscore from the class name
This class is now a real smartset.
2014-10-03 20:18:48 -07:00
Pierre-Yves David
e434af74be addset: this is a smartset, update the docstring
The documentation was still stating that this class is a not a smartset. We drop
that part.
2014-10-03 20:17:12 -07:00
Pierre-Yves David
d1e22facbe addset: use the ascending argument in _iterordered
Fix a bug where fastasc and fastdesc were iterator in the same order as
self._ascending.
2014-10-09 05:27:23 -07:00
Pierre-Yves David
cc531eaf7c revset: remove the now unused _descgeneratorset class 2014-10-03 12:54:56 -05:00
Pierre-Yves David
5660381e46 revset: use _generatorset in _revancestors
The _descgeneratorset class is going away.
2014-10-03 12:53:41 -05:00
Pierre-Yves David
0064df5af6 revset: remove now unused class _ascgeneratorset 2014-10-03 12:52:49 -05:00
Pierre-Yves David
2c0f15affd revset: use _generatorset directly in _revdescendant
_ascgeneratorset is going away.
2014-10-03 12:52:17 -05:00
Pierre-Yves David
d8ee591ede generatorset: move membership testing on ordered gen to the main class
We are phasing out the ordered version of the class to simplify the code.
2014-10-03 12:46:34 -05:00
Pierre-Yves David
f6fa8eb009 generatorset: make use of the new mechanism in the subclass
Until we remove them, we use the new parameter of _generatorset to make sure
the code is run.
2014-10-03 12:36:57 -05:00
Pierre-Yves David
8182bcd552 generatorset: make it possible to use gen as fastasc or fastdesc
We gain a parameter to inform that the generator is ascending or descending. If
the generator is ordered, it is also used for the `fastasc` or `fastdesc`
version.

The _ascgeneratorset and _descgeneratorset class will be removed soon.
2014-10-03 12:36:08 -05:00
Pierre-Yves David
360df469a0 baseset: rely on the abstractsmartset implementation for filter 2014-10-03 03:19:00 -05:00
Pierre-Yves David
1173000a7c _orderedsetmixin: drop this now unused class
All my friends are dead.
2014-10-02 19:48:14 -05:00
Pierre-Yves David
214e70e3ed spanset: drop _orderedsetmixin inheritance
The min/max method are as well provided by abstractsmartset.
2014-10-02 19:47:33 -05:00
Pierre-Yves David
5c0b91dc51 orderedlazyset: drop this now unused class
All my friends are dead.
2014-10-03 01:44:52 -05:00
Pierre-Yves David
2d5a7f7706 _descendant: use filteredset instead of orderedlazyset
The orderedlazyset class is going away. Filteredset gives the same service.
2014-10-02 19:43:42 -05:00
Pierre-Yves David
5081443516 addset: use the base implementation for ascending and descending 2014-10-03 01:37:13 -05:00
Pierre-Yves David
c77388089d addset: use base implementation for __filter__ 2014-10-03 01:34:25 -05:00
Pierre-Yves David
02ce29364d addset: use base implementation for __add__ 2014-10-03 01:33:32 -05:00
Pierre-Yves David
355c9d986e addset: use base implementation for __sub__ 2014-10-03 01:32:50 -05:00
Pierre-Yves David
a24bd6fb5b addset: use base implementation for __and__ 2014-10-03 01:31:46 -05:00
Pierre-Yves David
c65b8b42bd addset: promote to real smartset
Better revset performance are also achieved with less overlay. There is no good
reason for addset to not be a smartset. We can replace the `_orderedsetmixin`
inheritance since `abstractsmartset` has efficient min and max too.
2014-10-02 19:42:06 -05:00
Pierre-Yves David
7a25a7121b addset: add a __nonzero__ method
This is required to be a full smartset (not sure what was happening before
that...)
2014-10-03 00:12:22 -05:00
Pierre-Yves David
6a1c6ffa59 addset: offer a fastasc and fastdesc methods
If the underlying object offers fast iterators, we use them to provide fast
iterators too.
2014-10-02 23:38:30 -05:00
Pierre-Yves David
89b6f70699 addset: split simple and ordered iteration
We have two goals here. First, we would like to restore the former iteration
order we had in 2.9. Second, we want this logic to be reusable for `fastasc`
and `fastdesc` methods.
2014-10-02 23:28:18 -05:00
Pierre-Yves David
5559000069 generatorset: promote to smartset
This is not going to be efficient but we need all basic set classes to be smartsets
for the other classes to work.
2014-10-03 01:55:09 -05:00
Pierre-Yves David
58b382b0f7 generatorset: implement __nonzero__
This is necessary to become a real smartset.
2014-10-03 01:56:57 -05:00
Pierre-Yves David
a14781af28 spanset: use base implementation for __add__ 2014-10-03 00:31:33 -05:00
Pierre-Yves David
215016c505 spanset: use base implementation for __sub__ 2014-10-03 00:31:18 -05:00
Pierre-Yves David
8f595a844a spanset: use base implementation for __and__ 2014-10-03 00:30:58 -05:00
Pierre-Yves David
12baf0e606 spanset: use base implementation for filter 2014-10-03 00:39:57 -05:00
Pierre-Yves David
5d23f77ec3 filteredset: use base implementation for filter 2014-10-03 01:27:00 -05:00
Pierre-Yves David
1be20553d2 filteredset: use base implementation for __add__ 2014-10-03 01:25:35 -05:00
Pierre-Yves David
23bcf240b5 filteredset: use base implementation for __sub__ 2014-10-03 01:24:30 -05:00
Pierre-Yves David
24ee9a4abf filteredset: use base implementation for __and__ 2014-10-03 01:23:12 -05:00
Pierre-Yves David
13924bc45b abstractsmartset: add default implementation for __sub__ 2014-10-02 19:22:17 -05:00
Pierre-Yves David
67a9c485c6 abstractsmartset: add default implementation for __add__ 2014-10-02 19:22:03 -05:00
Pierre-Yves David
47e527a95f abstractsmartset: add default implementation for __and__ 2014-10-02 19:21:40 -05:00
Pierre-Yves David
8a3b420ade abstractsmartset: add default implementation for filter 2014-10-01 00:26:50 -05:00
Pierre-Yves David
133cc5824b lazyset: rename the class to filteredset
All smartsets try to be lazy. The purpose of this class is to apply a
filter on another set. So we rename the class (and all its occurences) to
`filteredset`.
2014-10-03 01:16:23 -05:00
Pierre-Yves David
c7274e7678 lazyset: add order awareness to the class
Just a bit of extra code makes the lazyset aware of order. This renders
orderedlazyset useless.

At some point, the `subset` will become responsible for this ordering logic. But
we are not there yet because the various objects used as subsets are not good enough.
2014-10-02 19:14:03 -05:00
Pierre-Yves David
0b05dee60c lazyset: remove min/max
This is now handled by abstractsmartset.
2014-10-02 19:03:14 -05:00
Pierre-Yves David
76604324cd baseset: remove min/max methods
This is now handled by the base class.
2014-10-02 19:02:50 -05:00
Pierre-Yves David
fb4c81e11e abstractsmartset: add a default implementation for min and max
This default implementation takes advantage of the fast iterator if available.
2014-10-02 18:59:41 -05:00
Pierre-Yves David
d810f109b3 lazyset: drop now useless ascending/descending definition 2014-10-02 18:52:09 -05:00
Pierre-Yves David
4be4f3fe52 lazyset: inherit the fastasc and fastdesc method from subset
When the filtered subset has such methods, we can use them. It is implemented
as properties to be able to quickly return None if no corresponding fastasc exists
on the subset.
2014-09-30 23:36:57 -05:00
Pierre-Yves David
b0f4537a2a lazyset: split the iteration logic from the condition filtering logic
So that the filter can be reused by `fastasc` or `fastdesc`.
2014-10-02 18:25:37 -05:00
Pierre-Yves David
5310fa5e65 spanset: do a single range check in __contains__
Now that `start <= end` is always true, we can simplify this function.
2014-10-02 17:53:55 -05:00
Pierre-Yves David
9d76d87327 spanset: enforce the order lazily to gain fastasc and fastdesc methods
Instead of having the direction of iteration enforced through the ordering of
`start` and `end` attributes of spanset, we encode the iteration direction in
an explicit attribute and always store start < end.  The logic for sort and
reverse has to be updated. The __iter__ is now based on the newly introduced
`fastasc` and `fastdesc` methods.

This will allow other code simplifications in the future.
2014-10-02 18:02:17 -05:00