note description: "External iteration cursor for {READABLE_INDEXABLE}." library: "EiffelBase: Library of reusable components for Eiffel." status: "See notice at end of class." legal: "See notice at end of class." date: "$Date: 2016-04-13 13:29:38 +0000 (Wed, 13 Apr 2016) $" revision: "$Revision: 98619 $" deferred class interface INDEXABLE_ITERATION_CURSOR [G] feature -- Access cursor_index: INTEGER_32 -- Index position of cursor in the iteration. require is_valid: is_valid ensure positive_index: Result >= 0 target_index: INTEGER_32 -- Index position of target structure for current iteration. first_index: INTEGER_32 -- First valid index of target structure for current iteration. -- Note that if is_reversed, first_index might be greater than last_index. last_index: INTEGER_32 -- Last valid index of target structure for current iteration. -- Note that if is_reversed, first_index might be greater than last_index. step: INTEGER_32 -- Distance between successive iteration elements. new_cursor: INDEXABLE_ITERATION_CURSOR [G] -- Restarted cursor of the iteration. reversed alias "-": INDEXABLE_ITERATION_CURSOR [G] -- Reversed cursor of the iteration. ensure is_reversed: Result.is_reversed = not is_reversed same_step: Result.step = step incremented alias "+" (n: like step): INDEXABLE_ITERATION_CURSOR [G] -- Cursor for the iteration with step increased by n. require n_valid: step + n > 0 ensure is_incremented: Result.step = step + n same_direction: Result.is_reversed = is_reversed decremented alias "-" (n: like step): INDEXABLE_ITERATION_CURSOR [G] -- Cursor for the iteration with step decreased by n. require n_valid: step > n ensure is_incremented: Result.step = step - n same_direction: Result.is_reversed = is_reversed with_step (n: like step): INDEXABLE_ITERATION_CURSOR [G] -- Cursor for the iteration with step set to n. require n_positive: n > 0 ensure step_set: Result.step = n same_direction: Result.is_reversed = is_reversed feature -- Status report is_reversed: BOOLEAN -- Are we traversing target structure backwards? is_valid: BOOLEAN -- Is the cursor still compatible with the associated underlying object? is_first: BOOLEAN -- Is cursor at first position? is_last: BOOLEAN -- Is cursor at last position? feature -- Cursor movement start -- Move to first position. ensure cursor_index_set_to_one: cursor_index = 1 target_index_set_to_first: target_index = first_index is_first: is_first forth -- Move to next position. ensure then cursor_index_advanced: cursor_index = old cursor_index + 1 invariant step_positive: step > 0 note copyright: "Copyright (c) 1984-2016, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software 5949 Hollister Ave., Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Website http://www.eiffel.com Customer support http://support.eiffel.com ]" end -- class INDEXABLE_ITERATION_CURSOR
Generated by ISE EiffelStudio