INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

description: "Objects that are able to iterate over linear structures"
title: "EiffelBase: library of reusable components for Eiffel. ", "Based on EiffelBase library for ISE Eiffel, ", "used with permission. "
project: "EiffelBase Library"
copyright: "(c) 1986-1997 Interactive Software Engineering Inc. ", "Modifications and extensions: ", "(c) 1997 Object Tools ", "All rights reserved. Duplication and distribution prohibited", "May be used only with Visual Eiffel under terms of user ", "license "
key: iterators, iteration, linear_iterators, linear_iteration
cluster: eiffelbase
class LINEAR_ITERATOR [G]
inherit

ITERATOR [G]
redefine
target
end
feature -- Cursor movement

target: LINEAR [G]

do_all
-- Apply `action' to every item of `target'.
-- (from the `start' of `target')
ensure
exhausted

do_while
-- Apply `action' to every item of `target' up to
-- and including first one not satisfying `test'.
-- (from the `start' of `target')
ensure
finished: not exhausted implies not test

continue_while
-- Apply `action' to every item of `target' up to
-- and including first one not satisfying `test'
-- (from the current position of `target').
require
traversable_exists: target /= void
invariant_satisfied: invariant_value
ensure
finished: not exhausted implies not test

while_do
-- Apply `action' to every item of `target' up to
-- but excluding first one not satisfying `test'.
-- (Apply to full list if all items satisfy `test'.)
ensure
finished: not exhausted implies not test

while_continue
-- Apply `action' to every item of `target' up to
-- but excluding first one not satisfying `test'.
ensure
finished: not exhausted implies not test

until_do
-- Apply `action' to every item of `target' up to
-- but excluding first one satisfying `test'.
-- (Apply to full list if no item satisfies `test'.)
ensure
achieved: not exhausted implies test

until_continue
-- Apply `action' to every item of `target' from current
-- position, up to but excluding first one satisfying `test'.
require
traversable_exists: target /= void
invariant_satisfied: invariant_value
ensure
achieved: exhausted or else test
invariant_satisfied: invariant_value

do_until
-- Apply `action' to every item of `target' up to
-- and including first one satisfying `test'.
ensure
achieved: not exhausted implies test

continue_until
-- Apply `action' to every item of `target' up to
-- and including first one satisfying `test'.
-- (from the current position of `target').
require
traversable_exists: target /= void
invariant_satisfied: invariant_value
ensure
achieved: not exhausted implies test

search (b: BOOLEAN)
-- Search the first item of `target' for which `test'
-- has the same value as `b' (both true or both false).
require
traversable_exists: target /= void

continue_search (b: BOOLEAN)
-- Search the first item of `target'
-- satisfying: `test' equals to `b'
-- (from the current position of `target').
require
traversable_exists: target /= void
ensure
found: not exhausted = (b = test)

do_if
-- Apply `action' to every item of `target'
-- satisfying `test'.

do_for (i, n, k: INTEGER)
-- Apply `action' to every `k'-th item,
-- `n' times if possible, starting from `i'-th.
require
traversable_exists: target /= void
valid_start: i >= 1
valid_repetition: n >= 0
valid_skip: k >= 1

continue_for (n, k: INTEGER)
-- Apply `action' to every `k'-th item,
-- `n' times if possible.
require
traversable_exists: target /= void
valid_repetition: n >= 0
valid_skip: k >= 1

forall: BOOLEAN
-- Does `test' return true for
-- all items of `target'?

exists: BOOLEAN
-- Does `test' return true for
-- at least one item of `target'?

start
-- Move to first position of `target'.
require
traversable_exists: target /= void

forth
-- Move to next position of `target'.
require
traversable_exists: target /= void

off: BOOLEAN
-- Is position of `target' off?
require
traversable_exists: target /= void

exhausted: BOOLEAN
-- Is `target' exhausted?
require
traversable_exists: target /= void
end -- class LINEAR_ITERATOR

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES