up: I     index Zimbu documentation

INTERFACE I.MutateIterator<Titem> EXTENDS I.Iterator @public

summary

     

Interface for an iterator that can modify the container.

Sketch of how this is used:

  I.MutateIterator<ItemType> it = foo.Iterator()
  FOR item IN it
    IF item.bad()
      IF it.removeSupported()
        it.remove()
      ELSE
        IO.print("Bad item: " .. item.ToString())
      }
    }
  }

$setSupported() bool @public  Returns TRUE when $set() is supported.
$set(item) status @public  Replaces the item that was previously obtained with $next()
$removeSupported() bool @public  Returns TRUE when $remove() is supported.
$remove() status @public  Removes the item that was previously obtained with $next()
$addSupported() bool @public  Returns TRUE when $add() is supported.
$add(item) status @public  Adds item after the one that was previously obtained with $next() or $previous().
$insertSupported() bool @public  Returns TRUE when $insert() is supported.
$insert(item) status @public  Inserts item before the one that was previously obtained with $next() or $previous()
 
Inherited from I.Iterator:
$hasNext() bool @public  Returns TRUE when there is another item to fetch.
$next() Titem @public  Returns the next item and advances.
$peekSupported() bool @public  Returns TRUE when peek() is supported.
$peek() Titem @public  Returns the next item without advancing.
 
Known subclasses:
     
 

members (alphabetically)

     

FUNC $add(Titem item) status @abstract @public

     

Adds item after the one that was previously obtained with $next() or $previous().

This can be used after calling $remove, $set() and $insert() and can be called multiple times. However, it may fail in some cases.

When calling $add(one) and then $add(two) the two item will be placed after the one item.

This is an optional method, when adding is not possible it throws an E.Unsupported exception.

When adding is not possible FAIL is returned. Normally the implementation always works when it is implemented, but in rare cases it may fail to add only some items.

FUNC $addSupported() bool @abstract @public

     

Returns TRUE when $add() is supported.

FUNC $insert(Titem item) status @abstract @public

     

Inserts item before the one that was previously obtained with $next() or $previous()

This can be used after calling $remove or $set() and can be called multiple times. However, it may fail in some cases.

When calling $insert(one) and then $insert(two) the two item will be placed after the one item.

This can called before $next() and will insert item before the start of the box.

This is an optional method, when inserting is not possible it throws an E.Unsupported exception.

When inserting is not possible FAIL is returned. Normally the implementation always works when it is implemented, but in rare cases it may fail to insert only some items.

FUNC $insertSupported() bool @abstract @public

     

Returns TRUE when $insert() is supported.

FUNC $remove() status @abstract @public

     

Removes the item that was previously obtained with $next()

This can be used only once after calling $next(). This can not be used after $set().

This is an optional method, when removing is not possible it throws an E.Unsupported exception.

When removing is not possible FAIL is returned. Normally the implementation always works when it is implemented, but in rare cases it may fail to remove only some items.

FUNC $removeSupported() bool @abstract @public

     

Returns TRUE when $remove() is supported.

FUNC $set(Titem item) status @abstract @public

     

Replaces the item that was previously obtained with $next()

This can be used only once after calling $next(). This can not be called after $remove() or $add().

This is an optional method, when setting is not possible it throws an E.Unsupported exception.

When setting is not possible FAIL is returned. Normally the implementation always works when it is implemented, but in rare cases it may fail to set only some items.

FUNC $setSupported() bool @abstract @public

     

Returns TRUE when $set() is supported.

license

      Copyright 2013 Bram Moolenaar All Rights Reserved.

      Licensed under the Apache License, Version 2.0. See the LICENSE file or obtain a copy at: http://www.apache.org/licenses/LICENSE-2.0