Require is_ok
.
redef fun next do
# If needed, fill the cache (an consume the current element)
current_item
# Empty the cache (so the next element will be read)
cache = null
end
lib/core/collection/abstract_collection.nit:341,2--346,4
redef fun next
do
assert is_ok
_node = _node._next_item
end
lib/core/collection/hash_collection.nit:495,2--499,4
redef fun next
do
var rank = iterators.length - 1
# Odometer-like increment starting from the last iterator
loop
var it = iterators[rank]
it.next
if it.is_ok then return
# The iterator if over
if rank == 0 then
# It it is the first, then the whole thing is over
is_ok = false
return
end
# If not, restart the iterator and increment the previous one
# (like a carry)
iterators[rank] = collection.collections[rank].iterator
rank -= 1
end
end
lib/combinations/combinations.nit:147,2--169,4
redef fun next
do
var rank = product.repeat - 1
loop
var it = iterators[rank]
if are_unique and not are_sorted then
var idx = indices[rank] + 1
it.next
var adv = next_free(rank, idx)
for i in [idx..adv[ do it.next
indices[rank] = adv
else
it.next
indices[rank] += 1
end
if it.is_ok then break
if rank == 0 then
is_ok = false
return
end
rank -= 1
end
for r in [rank+1..product.repeat[ do
reset_iterator(r)
end
end
lib/combinations/combinations.nit:346,2--375,4
redef fun next
do
# Process the last query
if item.res > 0 then
var tmp = array[i]
array[i] = array[j]
array[j] = tmp
end
# Get the next iteration
j += 1
if j >= array.length then
# End of small loop
i += 1
j = i + 1
end
if not is_ok then return
# Prepare the next query
item.a = array[i]
item.b = array[j]
item.res = 0
end
lib/for_abuse/for_abuse.nit:114,2--134,4
redef fun next do
inner.next
skip_nulls
end
lib/pipeline/pipeline.nit:282,2--285,4
redef fun next
do
targets_iterator.next
update_iterators
end
lib/graph/digraph.nit:694,2--698,4
# require: `self.statement.is_open`
redef fun next
do
assert statement_closed: statement.is_open
var err = statement.native_statement.step
if err.is_row then
is_ok = true
else if err.is_done then
# Clean complete
is_ok = false
else
# error
# FIXME do something with the error?
is_ok = false
end
end
lib/sqlite3/sqlite3.nit:293,2--309,4
redef fun next do
assert is_ok
if tree.sub.has_key(item) then
iterators.add tree.sub[item].iterator
else
iterators.last.next
while is_ok and not iterators.last.is_ok do
iterators.pop
if is_ok and iterators.last.is_ok then
iterators.last.next
end
end
end
end
lib/ordered_tree/ordered_tree.nit:313,2--326,4
redef fun next do
if pos < 0 then return
var curr = iter.prev
var currit = curr.as(not null).node
while curr != null do
currit = curr.node
if not currit isa Concat then
str = currit.as(FlatString)
pos -= str.length
iter = curr
return
end
if not curr.rdone then
curr.rdone = true
curr = new RopeCharIteratorPiece(currit._right, false, false, curr)
continue
end
if not curr.ldone then
curr.ldone = true
curr = new RopeCharIteratorPiece(currit._left, false, false, curr)
continue
end
curr = curr.prev
end
pos = -1
end
lib/core/text/ropes.nit:538,2--563,4
redef fun next do
pos += str.length
if pos > max then return
var it = iter.prev.as(not null)
var rnod = it.node
loop
if not rnod isa Concat then
it.ldone = true
it.rdone = true
str = rnod.as(FlatString)
iter = it
break
end
if not it.ldone then
rnod = rnod._left
it.ldone = true
it = new RopeCharIteratorPiece(rnod, false, false, it)
else if not it.rdone then
it.rdone = true
rnod = rnod._right
it = new RopeCharIteratorPiece(rnod, false, false, it)
else
it = it.prev.as(not null)
rnod = it.node
continue
end
end
end
lib/core/text/ropes.nit:612,2--639,4
redef fun next
do
sorted_iter.next
end
lib/functional/iter_extras.nit:367,9--370,11
redef fun next
do
index += 1
index_in_node += 1
if index_in_node >= node.tail_index then
node = node.next
if node != null then index_in_node = node.head_index
end
end
lib/more_collections/more_collections.nit:668,2--677,4