blog
Class DefaultObjectIterator

java.lang.Object
  extended by blog.DefaultObjectIterator
All Implemented Interfaces:
ObjectIterator, java.util.Iterator

public class DefaultObjectIterator
extends java.lang.Object
implements ObjectIterator

ObjectIterator implementation that wraps around an ordinary Iterator.


Constructor Summary
DefaultObjectIterator(java.util.Iterator iter)
          Creates an ObjectIterator that behaves just like the given iterator.
 
Method Summary
 boolean canDetermineNext()
          Returns true if this ObjectIterator is running on a partial world that is complete enough to determine whether there is a next object, and if so, what that object is.
 boolean hasNext()
           
 java.lang.Object next()
           
 void remove()
           
 int skipIndistinguishable()
          Skips remaining objects that are indistinguishable from the object returned by the last call to next.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultObjectIterator

public DefaultObjectIterator(java.util.Iterator iter)
Creates an ObjectIterator that behaves just like the given iterator. Its canDetermineNext method always returns true, and its skipIndistinguishable method always returns zero.

Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Specified by:
next in interface java.util.Iterator

remove

public void remove()
Specified by:
remove in interface java.util.Iterator

skipIndistinguishable

public int skipIndistinguishable()
Description copied from interface: ObjectIterator
Skips remaining objects that are indistinguishable from the object returned by the last call to next. Two objects are indistinguishable if the underlying partial world implies that they both satisfy the same POP application, neither one serves as a value or argument for any instantiated basic random variable, and neither one occurs in the set of "externally distinguished" objects passed to the iterator call that produced this iterator. Typically, the externally distinguished objects are the values of logical variables in the current scope.

This method can only be called immediately after a call to next: that is, there can be no intervening calls to any methods on this iterator. Even calling hasNext may cause some implementations to lose internal state that is necessary for skipping indistinguishable objects.

Specified by:
skipIndistinguishable in interface ObjectIterator
Returns:
the number of objects skipped (may be zero). The return value is always zero if canDetermineNext would return false.

canDetermineNext

public boolean canDetermineNext()
Description copied from interface: ObjectIterator
Returns true if this ObjectIterator is running on a partial world that is complete enough to determine whether there is a next object, and if so, what that object is. If hasNext is called when canDetermineNext would return false, then hasNext returns false.

Specified by:
canDetermineNext in interface ObjectIterator