// Path: src/main/java/com/declarativa/interprolog/util/IPException.java
// @SuppressWarnings("serial")
// public class IPException extends RuntimeException{
// 	private Throwable cause;
// 	
// 	public IPException(String s){
// 		super(s);
// 		//System.err.println("IPException about to be thrown:"+this);
// 		cause=null;
// 	}
//     
//     public IPException(String s, Throwable cause) {
//         super(s);
//         this.cause=cause;
//     }
//     
//     /** To allow compilation under JDK 1.3; this method is already defined in Throwable in later JDKs */
//     public Throwable getCause(){
//     	return cause;
//     }
// }
// 
// Path: src/main/java/com/declarativa/interprolog/util/IPPrologError.java
// @SuppressWarnings("serial")
// public class IPPrologError extends IPException{
// 	public final Object t;
// 	public IPPrologError(Object t){
// 		super(t.toString());
// 		this.t=t;
// 	}
// 	public String toString(){return "IPPrologError:"+t.toString();}
// 	
// 	public Object getError(){return t;}
// }


import java.util.Iterator;
import java.util.NoSuchElementException;
import com.declarativa.interprolog.util.IPException;
import com.declarativa.interprolog.util.IPPrologError;
/* 
Author: Miguel Calejo
Contact: info@interprolog.com, www.interprolog.com
Copyright InterProlog Consulting / Renting Point Lda, Portugal 2014
Use and distribution, without any warranties, under the terms of the
Apache License, as per http://www.apache.org/licenses/LICENSE-2.0.html
*/

package com.declarativa.interprolog;


/** An Iterator object that actually evaluates a goal and collects its solutions incrementally. Performance could probably be improved 
by using wait/notify rather than plain Thread.yield() */
public class SolutionIterator implements Iterator<Object[]>{
	AbstractPrologEngine engine;
	String G; String OVar; Object[] objectsP; String RVars;
	Thread prologExecution = null;
	boolean cancellationRequested = false;
	boolean cancelled = false;
	boolean foundAllSolutions = false;
// Path: src/main/java/com/declarativa/interprolog/util/IPException.java
// @SuppressWarnings("serial")
// public class IPException extends RuntimeException{
// 	private Throwable cause;
// 	
// 	public IPException(String s){
// 		super(s);
// 		//System.err.println("IPException about to be thrown:"+this);
// 		cause=null;
// 	}
//     
//     public IPException(String s, Throwable cause) {
//         super(s);
//         this.cause=cause;
//     }
//     
//     /** To allow compilation under JDK 1.3; this method is already defined in Throwable in later JDKs */
//     public Throwable getCause(){
//     	return cause;
//     }
// }
// 
// Path: src/main/java/com/declarativa/interprolog/util/IPPrologError.java
// @SuppressWarnings("serial")
// public class IPPrologError extends IPException{
// 	public final Object t;
// 	public IPPrologError(Object t){
// 		super(t.toString());
// 		this.t=t;
// 	}
// 	public String toString(){return "IPPrologError:"+t.toString();}
// 	
// 	public Object getError(){return t;}
// }


// Path: src/main/java/com/declarativa/interprolog/SolutionIterator.java
import java.util.Iterator;
import java.util.NoSuchElementException;
import com.declarativa.interprolog.util.IPException;
import com.declarativa.interprolog.util.IPPrologError;

/* 
Author: Miguel Calejo
Contact: info@interprolog.com, www.interprolog.com
Copyright InterProlog Consulting / Renting Point Lda, Portugal 2014
Use and distribution, without any warranties, under the terms of the
Apache License, as per http://www.apache.org/licenses/LICENSE-2.0.html
*/

package com.declarativa.interprolog;


/** An Iterator object that actually evaluates a goal and collects its solutions incrementally. Performance could probably be improved 
by using wait/notify rather than plain Thread.yield() */
public class SolutionIterator implements Iterator<Object[]>{
	AbstractPrologEngine engine;
	String G; String OVar; Object[] objectsP; String RVars;
	Thread prologExecution = null;
	boolean cancellationRequested = false;
	boolean cancelled = false;
	boolean foundAllSolutions = false;
	Object[] lastSolution = null;