Oracle Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.1.2)

E26041-01

AbstractStableIterator Class Reference

#include <coherence/util/AbstractStableIterator.hpp>

Inherits Object, and Muterator.

Inherited by SafeHashMap::EntrySetIterator.

List of all members.


Detailed Description

An abstract Iterator implementation that is stable between the hasNext() and next() methods.

Author:
mf 2008.02.28

Public Types

typedef spec::Handle Handle
 AbstractStableIterator Handle definition.
typedef spec::View View
 AbstractStableIterator View definition.
typedef spec::Holder Holder
 AbstractStableIterator Holder definition.

Public Member Functions

virtual void remove ()
 Remove from the collection associated with this iterator, the last element returned from the iterator.

Exceptions:
UnsupportedOperationException if removal is not supported

virtual bool hasNext () const
 Determine if the iteration has another element.

Returns:
true if the iterator has another element

virtual Object::Holder next ()
 Return the next element in the iterated series.

Returns:
the next element in the iterated series
Exceptions:
coherence::lang::NoSuchElementException if iteration has no more elements


Protected Member Functions

virtual Object::Holder getPrevious () const
 Obtain the previous object provided by the Iterator.
virtual void setNext (Object::Holder ohNext)
 Specify the next object to provide from the Iterator.
virtual void advance ()=0
 Advance to the next object.
virtual void remove (Object::Holder ohPrev)
 Remove the specified item.
virtual void onInit ()
 Event called once the Object has finished being constructed.

Specifically when the first attachment is made. This provides a safe point at which Handles/Views to "this" can be created. It is not safe to create Handles/Views to an Object from within its constructor, thus any operations which rely upon this should be deferred until the onInit event is triggered.

As with all event methods any derived implementation should include a call to the super class's implementation. Specifically delegation to Object::onInit() must eventually occur or an IllegalStateException will result.

The default implementation calls the onInit() method of each of the Object's SmartMembers.


Member Function Documentation

virtual Object::Holder getPrevious (  )  const [protected, virtual]

Obtain the previous object provided by the Iterator.

Returns:
the object previously returned from a call to next()

virtual void setNext ( Object::Holder  ohNext  )  [protected, virtual]

Specify the next object to provide from the Iterator.

Parameters:
ohNext the next object to provide from the Iterator

virtual void advance (  )  [protected, pure virtual]

Advance to the next object.

This method must be implemented by the concrete sub-class by calling setNext() if there is a next object.

Implemented in SafeHashMap::EntrySetIterator.

virtual void remove ( Object::Holder  ohPrev  )  [protected, virtual]

Remove the specified item.

This is an optional operation. If the Iterator supports element removal, then it should implement this method, which is delegated to by the remove() method.

Parameters:
ohPrev the previously iterated object that should be removed
Exceptions:
coherence::lang::UnsupportedOperationException if removal is not supported

Reimplemented in SafeHashMap::EntrySetIterator.


The documentation for this class was generated from the following file:
Copyright © 2000, 2013, Oracle and/or its affiliates. All rights reserved.