@@ -82,16 +82,16 @@ cdef class IndexEngine:
82
82
83
83
cdef:
84
84
bint unique, monotonic_inc, monotonic_dec
85
- bint initialized, monotonic_check, unique_check
85
+ bint initialized, need_monotonic_check, need_unique_check
86
86
87
87
def __init__ (self , vgetter , n ):
88
88
self .vgetter = vgetter
89
89
90
90
self .over_size_threshold = n >= _SIZE_CUTOFF
91
91
92
92
self .initialized = 0
93
- self .monotonic_check = 0
94
- self .unique_check = 0
93
+ self .need_monotonic_check = 1
94
+ self .need_unique_check = 1
95
95
96
96
self .unique = 0
97
97
self .monotonic_inc = 0
@@ -216,21 +216,21 @@ cdef class IndexEngine:
216
216
if not self .initialized:
217
217
self .initialize()
218
218
219
- self .unique_check = 1
219
+ self .need_unique_check = 0
220
220
return self .unique == 1
221
221
222
222
property is_monotonic_increasing :
223
223
224
224
def __get__ (self ):
225
- if not self .monotonic_check :
225
+ if self .need_monotonic_check :
226
226
self ._do_monotonic_check()
227
227
228
228
return self .monotonic_inc == 1
229
229
230
230
property is_monotonic_decreasing :
231
231
232
232
def __get__ (self ):
233
- if not self .monotonic_check :
233
+ if self .need_monotonic_check :
234
234
self ._do_monotonic_check()
235
235
236
236
return self .monotonic_dec == 1
@@ -246,13 +246,13 @@ cdef class IndexEngine:
246
246
self .monotonic_dec = 0
247
247
is_unique = 0
248
248
249
- self .monotonic_check = 1
249
+ self .need_monotonic_check = 0
250
+ self .need_unique_check = 0
250
251
251
252
# we can only be sure of uniqueness if is_unique=1
252
253
if is_unique:
253
254
self .initialized = 1
254
255
self .unique = 1
255
- self .unique_check = 1
256
256
257
257
cdef _get_index_values(self ):
258
258
return self .vgetter()
@@ -269,7 +269,7 @@ cdef class IndexEngine:
269
269
cdef inline _ensure_mapping_populated(self ):
270
270
# need to reset if we have previously
271
271
# set the initialized from monotonic checks
272
- if self .unique_check :
272
+ if self .need_unique_check :
273
273
self .initialized = 0
274
274
if not self .initialized:
275
275
self .initialize()
@@ -282,14 +282,14 @@ cdef class IndexEngine:
282
282
283
283
if len (self .mapping) == len (values):
284
284
self .unique = 1
285
-
285
+ self .need_unique_check = 0
286
286
self .initialized = 1
287
287
288
288
def clear_mapping (self ):
289
289
self .mapping = None
290
290
self .initialized = 0
291
- self .monotonic_check = 0
292
- self .unique_check = 0
291
+ self .need_monotonic_check = 1
292
+ self .need_unique_check = 1
293
293
294
294
self .unique = 0
295
295
self .monotonic_inc = 0
0 commit comments