+
Point of view
All features
class ITERATOR_ON_C_ARRAY [ITEM_ -> C_STRUCT]
Summary
TODO: this class is conceptually obsolete as it actually duplicates ITERATOR_ON_COLLECTION, or more precisely ITERATOR_ON_TRAVERSABLE. It could and should be easily removed
copyright
Copyright (C) 2007-2022: Paolo Redaelli This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Direct parents
Inherit list: ITERATOR
Class invariant
Overview
Creation features
{ANY}
Features
Creation and implementation
{}
{ANY}
  • start
    Positions the iterator to the first object in the aggregate to be traversed.
  • is_off: BOOLEAN
    Returns True when there are no more objects in the sequence.
  • item: ITEM_
    Returns the object at the current position in the sequence.
  • next
    Positions the iterator to the next object in the sequence.
{ANY}
{ANY}
Agent-based features:
{ANY}
Invariant on generation` dynamics
{}
from_array (an_array: C_ARRAY[ITEM_])
effective procedure
{}
require
  • array_not_void: an_array /= Void
writable attribute
{}
Iterator index
array: C_ARRAY[ITEM_]
writable attribute
{}
start
effective procedure
{ANY}
Positions the iterator to the first object in the aggregate to be traversed.
ensure
  • is_valid
is_off: BOOLEAN
effective function
{ANY}
Returns True when there are no more objects in the sequence.
require
  • is_valid
ensure
  • generation = old generation
  • is_valid
item: ITEM_
effective function
{ANY}
Returns the object at the current position in the sequence.
require
  • is_valid
  • not is_off
ensure
  • generation = old generation
  • is_valid
next
effective procedure
{ANY}
Positions the iterator to the next object in the sequence.
require
  • is_valid
  • not is_off
ensure
  • generation = old generation
  • is_valid
iterable_generation: INTEGER_32
effective function
{ANY}
generation: INTEGER_32
writable attribute
{ANY}
is_valid: BOOLEAN
frozen
effective function
{ANY}
for_each (action: PROCEDURE[TUPLE[TUPLE 1[E_]]])
effective procedure
{ANY}
Apply action to every item of Current.
See also for_all, exists, aggregate.
for_all (test: FUNCTION[TUPLE[TUPLE 1[E_]]]): BOOLEAN
effective function
{ANY}
Do all items satisfy test?
See also for_each, exists, aggregate.
exists (test: FUNCTION[TUPLE[TUPLE 1[E_]]]): BOOLEAN
effective function
{ANY}
Does at least one item satisfy test?
See also for_each, for_all, aggregate.
aggregate (action: FUNCTION[TUPLE[TUPLE 2[E_, E_], E_]], initial: E_): E_
effective function
{ANY}
Aggregate all the elements starting from the initial value.
See also for_each, for_all, exists.
generation_for_invariant: INTEGER_32
writable attribute
{}
generation_only_grows: BOOLEAN
effective function
{}