// Path: src/main/java/org/deri/cqels/data/Mapping.java
// public interface Mapping extends Map<Var, Long>{
// 	
// 
// 	public long get(Var var); 
// 	
// 	public void from(OpRouter router);
// 	
// 	public OpRouter from();
// 	
// 	public ExecContext getCtx();
// 	
// 	public Iterator<Var> vars();
// 	
// 	public void addParent(Mapping parent);
// 	
// 	public boolean hasParent();
// 	
// 	public boolean isCompatible(Mapping mapping);
// }
// 
// Path: src/main/java/org/deri/cqels/engine/iterator/MappingIterator.java
// public interface MappingIterator extends Closeable, Iterator<Mapping> {
// 
//     /**
//      * Get next binding
//      */
//     public Mapping nextMapping();
// 
//     /**
//      * Cancels the query as soon as is possible for the given iterator
//      */
//     public void cancel();
// }


import org.deri.cqels.data.Mapping;
import org.deri.cqels.engine.iterator.MappingIterator;
import com.hp.hpl.jena.sparql.algebra.Op;
package org.deri.cqels.engine;



public class RoutingRunner extends Thread {
	
	ExecContext context;
	MappingIterator itr;
	OpRouterBase router;
	public RoutingRunner (ExecContext context,MappingIterator itr,OpRouterBase router){
		this.context=context;
		this.itr=itr;
		this.router=router;
	}

	public void run() {	
		//System.out.println("start send thread "+this.toString());
		//System.out.println(mapping.getCtx().plan());
		//TODO: get plan via planner
		
		while (itr.hasNext()) {
			
			Mapping _mapping=itr.next();
			router._route( _mapping);
		}
		//System.out.println("end of thread "+this.toString());
		itr.close();
		try {
			this.finalize();
// Path: src/main/java/org/deri/cqels/data/Mapping.java
// public interface Mapping extends Map<Var, Long>{
// 	
// 
// 	public long get(Var var); 
// 	
// 	public void from(OpRouter router);
// 	
// 	public OpRouter from();
// 	
// 	public ExecContext getCtx();
// 	
// 	public Iterator<Var> vars();
// 	
// 	public void addParent(Mapping parent);
// 	
// 	public boolean hasParent();
// 	
// 	public boolean isCompatible(Mapping mapping);
// }
// 
// Path: src/main/java/org/deri/cqels/engine/iterator/MappingIterator.java
// public interface MappingIterator extends Closeable, Iterator<Mapping> {
// 
//     /**
//      * Get next binding
//      */
//     public Mapping nextMapping();
// 
//     /**
//      * Cancels the query as soon as is possible for the given iterator
//      */
//     public void cancel();
// }


// Path: src/main/java/org/deri/cqels/engine/RoutingRunner.java
import org.deri.cqels.data.Mapping;
import org.deri.cqels.engine.iterator.MappingIterator;
import com.hp.hpl.jena.sparql.algebra.Op;

package org.deri.cqels.engine;



public class RoutingRunner extends Thread {
	
	ExecContext context;
	MappingIterator itr;
	OpRouterBase router;
	public RoutingRunner (ExecContext context,MappingIterator itr,OpRouterBase router){
		this.context=context;
		this.itr=itr;
		this.router=router;
	}

	public void run() {	
		//System.out.println("start send thread "+this.toString());
		//System.out.println(mapping.getCtx().plan());
		//TODO: get plan via planner
		
		while (itr.hasNext()) {
			
			Mapping _mapping=itr.next();
			router._route( _mapping);
		}
		//System.out.println("end of thread "+this.toString());
		itr.close();
		try {
			this.finalize();
		} catch (Throwable e) {