org.obe.spi.model
Interface PersistentIterator

All Superinterfaces:
java.util.Iterator, java.io.Serializable

public interface PersistentIterator
extends java.io.Serializable, java.util.Iterator

Supports persistent iteration over arbitrary content. This iterator can be serialized, deserialized, and used to continue iteration. The target content is not persisted, and the caller must check whether it is still available by calling hasContent(), and restore the original content if necessary by calling setContent(java.lang.Object).

Author:
Adrian Price

Method Summary
 boolean hasContent()
          Checks whether the target content is available.
 boolean isModified()
          Returns whether the iterator has changed since it was created or last deserialized.
 void reset()
          Resets the iterator, clearing the content, index and internal fields.
 void setContent(java.lang.Object content)
          Sets the content over which to iterate (or continue iteration).
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 

Method Detail

hasContent

public boolean hasContent()
Checks whether the target content is available. The target content is cleared during object serialization, and must be restored externally by calling setContent(java.lang.Object) before continuing iteration over a deserialized instance of this class.

Returns:
true if the content is available.

isModified

public boolean isModified()
Returns whether the iterator has changed since it was created or last deserialized. The modified flag is set by Iterator.next(), reset(), and setContent(java.lang.Object), and cleared only be serialization. The flag indicates that the iterator's persistent state needs to be updated.

Returns:
true if the iterator has changed.

reset

public void reset()
Resets the iterator, clearing the content, index and internal fields. The iterator must be re-initialied by calling setContent(java.lang.Object) before it can be used to perform further iterations. This method sets the modified flag.


setContent

public void setContent(java.lang.Object content)
Sets the content over which to iterate (or continue iteration). This method sets the modified flag.

Parameters:
content - The target array.
Throws:
java.lang.IllegalArgumentException - if the object is not of the expected class.
java.util.ConcurrentModificationException - if the content has changed since it was first set.


SourceForge.net Logo OBE-1.0 Copyright (C) 2002-2006 Adrian Price. All Rights Reserved.