GNU Prolog for Java

gnu.prolog.vm
Class PrologCollectionIterator

java.lang.Object
  extended by gnu.prolog.vm.BacktrackInfo
      extended by gnu.prolog.vm.PrologCollectionIterator

public class PrologCollectionIterator
extends BacktrackInfo

Generic collection iterator which can be used by PrologCode implementations.

Author:
Michiel Hendriks

Field Summary
protected  Term destTerm
          The term to unify the value with
protected  Iterator<?> iterator
          The iterator it will go through
protected  int startUndoPosition
          The start undo position
 
Fields inherited from class gnu.prolog.vm.BacktrackInfo
codePosition, undoPosition
 
Constructor Summary
PrologCollectionIterator(Iterable<?> iterable, Term destination, int undoPosition)
           
PrologCollectionIterator(Iterator<?> iterable, Term destination, int undoPosition)
           
 
Method Summary
 int getUndoPosition()
           
 int nextSolution(Interpreter interpreter)
          Get the next value
 
Methods inherited from class gnu.prolog.vm.BacktrackInfo
undo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iterator

protected Iterator<?> iterator
The iterator it will go through


destTerm

protected Term destTerm
The term to unify the value with


startUndoPosition

protected int startUndoPosition
The start undo position

Constructor Detail

PrologCollectionIterator

public PrologCollectionIterator(Iterable<?> iterable,
                                Term destination,
                                int undoPosition)
Parameters:
iterable - The collection to iterate over
destination - The destination term
undoPosition - the value of interpreter.getUndoPosition();

PrologCollectionIterator

public PrologCollectionIterator(Iterator<?> iterable,
                                Term destination,
                                int undoPosition)
Parameters:
iterable - The collection to iterate over
destination - The destination term
undoPosition - the value of interpreter.getUndoPosition();
Method Detail

getUndoPosition

public int getUndoPosition()
Returns:
the startUndoPosition

nextSolution

public int nextSolution(Interpreter interpreter)
                 throws PrologException
Get the next value

Parameters:
interpreter -
Returns:
Throws:
PrologException

GNU Prolog for Java