From 212d18be5b7c1162d51bc86251a5a713a94a0fd7 Mon Sep 17 00:00:00 2001 From: eiffel-org Date: Wed, 12 Sep 2018 17:24:40 +0000 Subject: [PATCH] Worked in the section "Linear chain iteration" Updated wikipage EiffelBase, Iteration. (Signed-off-by:WilliamsLima). git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@2077 abb3cda0-5349-4a8f-a601-0c33ac3a8c38 --- .../eiffelbase-iteration.wiki | 27 +++---------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/documentation/18.07/solutions/basic-computing/eiffelbase/eiffelbase-tutorial/eiffelbase-data-structures-overview/eiffelbase-iteration.wiki b/documentation/18.07/solutions/basic-computing/eiffelbase/eiffelbase-tutorial/eiffelbase-data-structures-overview/eiffelbase-iteration.wiki index baa45365..532e766e 100644 --- a/documentation/18.07/solutions/basic-computing/eiffelbase/eiffelbase-tutorial/eiffelbase-data-structures-overview/eiffelbase-iteration.wiki +++ b/documentation/18.07/solutions/basic-computing/eiffelbase/eiffelbase-tutorial/eiffelbase-data-structures-overview/eiffelbase-iteration.wiki @@ -1,4 +1,4 @@ -[[Property:modification_date|Wed, 12 Sep 2018 16:38:48 GMT]] +[[Property:modification_date|Wed, 12 Sep 2018 17:24:39 GMT]] [[Property:publication_date|Wed, 12 Sep 2018 13:40:39 GMT]] [[Property:title|EiffelBase, Iteration]] [[Property:weight|6]] @@ -235,26 +235,7 @@ Some of these features and most of the other iteration features introduced in pr ==Linear and chain iteration== [[ref:libraries/base/reference/linear_iterator_chart|LINEAR_ITERATOR]] , an effective class, refines the iteration mechanisms for cases in which the target is a linear structure, such as a list in any implementation or a circular chain.
-The class effects all the deferred features inherited from [[ref:libraries/base/reference/iterator_chart|ITERATOR]] , taking advantage of the linear traversal mechanisms present in the corresponding traversal class, [[ref:libraries/base/reference/linear_chart|LINEAR]] . Here for example is the effecting of do_if: - - do_if - -- Apply action to every item of target satisfying - -- test. - do - from - target.start - invariant - invariant_value - until - target.exhausted - loop - if test then - action - end - forth - end - end - +The class effects all the deferred features inherited from [[ref:libraries/base/reference/iterator_chart|ITERATOR]] , taking advantage of the linear traversal mechanisms present in the corresponding traversal class, [[ref:libraries/base/reference/linear_chart|LINEAR]] . [[#An example use of iteration|Here]] for example is the effecting of until_do.
This routine text relies on features start, forth and exhausted which, together with off, have for convenience been carried over to [[ref:libraries/base/reference/linear_iterator_chart|LINEAR_ITERATOR]] from their counterparts in [[ref:libraries/base/reference/linear_chart|LINEAR]] , with feature declarations such as off: BOOLEAN @@ -267,8 +248,8 @@ This routine text relies on features start, forth In addition to effecting the general iteration features from [[ref:libraries/base/reference/iterator_chart|ITERATOR]] , class [[ref:libraries/base/reference/linear_iterator_chart|LINEAR_ITERATOR]] introduces iteration features that apply to the specific case of linear structures: -* search (b :BOOLEAN) moves the iteration to the first position satisfying test if b is true, or not satisfying test if b is false. This use of a boolean argument to switch between two opposite semantics is not part of the recommended style, and you will find few if any other examples in the Base libraries. Here, however, it was deemed preferable to the alternative, which would have involved four separate procedures (if together with search we consider continue_search discussed next). -* With a linear structure we can implement an iteration corresponding to the 'for' loop of traditional programming languages, defined by three integers: the starting position, the number of items to be traversed, and the step between consecutive items. This is provided by procedure do_for ( starting , number , step :INTEGER). +* search (test: FUNCTION [G, BOOLEAN]; b: BOOLEAN) moves the iteration to the first position satisfying test if both test and b have the same value (both True or both False). +* With a linear structure we can implement an iteration corresponding to the 'for' loop of traditional programming languages, defined by three integers: the starting position, the number of items to be traversed, and the step between consecutive items. This is provided by procedure do_for (action: PROCEDURE [G]; starting , number , step: INTEGER). * Since with a linear target the iterator can advance the cursor step by step, the basic iteration operations are complemented by variants which pick up from the position reached by the last call: continue_until, until_continue, continue_while, while_continue, continue_search, continue_for. ==Two-way iteration==