class interface P_TREE_PRE_ITERATOR[G] feature(s) from P_ONEWAY_ITERATOR -- Copy copy (other: like Current) -- Cannot copy iterator. require other_not_void: other /= Void ensure is_equal: is_equal(other) feature(s) from P_ONEWAY_ITERATOR -- Access outside: BOOLEAN -- Is the iterator outside the container? iterable: BOOLEAN -- Is the associated structure iterable (not empty)? item: G -- Return the item at the current position. require inside: not outside feature(s) from P_ONEWAY_ITERATOR -- Synchronization synchronize_container -- Set the current item of the target container to be -- the one currently pointed at by the iterator. -- THIS METHOD DOES CHANGE THE CONTAINER STATE. require inside: not outside ensure done: -- container current position changed feature(s) from P_ONEWAY_ITERATOR -- Iteration first -- Go to first item of the container. require outside: outside ensure done: iterable implies not outside synchronize -- Iterate sub tree starting at current node. require outside: outside; iterable: iterable ensure done: not outside forth -- Next item. require inside: not outside stop -- Finish. require inside: not outside ensure done: outside feature(s) from P_ONEWAY_ITERATOR -- Iterator locking is_locked: BOOLEAN -- Is the current iterator locked? lock -- Lock iterator: lock the current item into the container -- and leave the iterator. require inside: not outside; unlocked: not is_locked ensure locked: is_locked; outside: outside unlock -- Unlock iterator require locked: is_locked; outside: outside ensure inside: not outside; not_locked: not is_locked feature(s) from P_ONEWAY_ITERATOR -- Variant support forward_variant: INTEGER -- Forward variant for forth-only loops. invariant outside_locked: not outside implies not is_locked; end of P_TREE_PRE_ITERATOR[G]