|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object blog.AbstractObjectIterator
public abstract class AbstractObjectIterator
Abstract implementation of the ObjectIterator interface. Subclasses must implement the findNext method, and may also implement skipAfterNext.
Field Summary | |
---|---|
protected boolean |
canDetermineNext
Should be set to false by findNext when the next object cannot be determined. |
Constructor Summary | |
---|---|
AbstractObjectIterator()
|
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. |
protected abstract java.lang.Object |
findNext()
Returns the next object to be returned by this iterator, or null if there are no more objects. |
boolean |
hasNext()
|
java.lang.Object |
next()
|
void |
remove()
|
protected int |
skipAfterNext()
Behaves like skipIndistinguishable, except it can assume that this call to skipIndistinguishable comes immediately after a successful call to next , with no intervening calls to
findNext or any other methods. |
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 |
Field Detail |
---|
protected boolean canDetermineNext
Constructor Detail |
---|
public AbstractObjectIterator()
Method Detail |
---|
public boolean hasNext()
hasNext
in interface java.util.Iterator
public java.lang.Object next()
next
in interface java.util.Iterator
public void remove()
remove
in interface java.util.Iterator
public int skipIndistinguishable()
ObjectIterator
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.
skipIndistinguishable
in interface ObjectIterator
public boolean canDetermineNext()
ObjectIterator
hasNext
is called when canDetermineNext
would return false,
then hasNext
returns false.
canDetermineNext
in interface ObjectIterator
protected int skipAfterNext()
next
, with no intervening calls to
findNext
or any other methods.
This default implementation just returns zero.
protected abstract java.lang.Object findNext()
canDetermineNext
to false
and returns null.
This method will not be called when canDetermineNext
is false. However, it may be called again after it has returned null,
in which case it should just return null again.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |