// Path: src/de/uni_koblenz/west/splendid/model/BindJoin.java
// public class BindJoin extends Join {
// 	
// 	public BindJoin(TupleExpr leftArg, TupleExpr rightArg) {
// 		super(leftArg, rightArg);
// 	}
// 	
// 	@Override
// 	public boolean equals(Object other) {
// 		return other instanceof BindJoin && super.equals(other);
// 	}
// 
// 	@Override
// 	public int hashCode() {
// 		return super.hashCode() ^ "BindJoin".hashCode();
// 	}
// 
// 	@Override
// 	public BindJoin clone() {
// 		return (BindJoin)super.clone();
// 	}
// 
// }
// 
// Path: src/de/uni_koblenz/west/splendid/model/HashJoin.java
// public class HashJoin extends Join {
// 	
// 	public HashJoin(TupleExpr leftArg, TupleExpr rightArg) {
// 		super(leftArg, rightArg);
// 	}
// 	
// 	@Override
// 	public boolean equals(Object other) {
// 		return other instanceof HashJoin && super.equals(other);
// 	}
// 
// 	@Override
// 	public int hashCode() {
// 		return super.hashCode() ^ "HashJoin".hashCode();
// 	}
// 
// 	@Override
// 	public HashJoin clone() {
// 		return (HashJoin)super.clone();
// 	}
// 
// }
// 
// Path: src/de/uni_koblenz/west/splendid/model/RemoteQuery.java
// public class RemoteQuery extends UnaryTupleOperator {
// 	
// 	public RemoteQuery(TupleExpr expr) {
// 		super(expr);
// 	}
// 
// 	@Override
// 	public <X extends Exception> void visit(QueryModelVisitor<X> visitor) throws X {
// 		visitor.meetOther(this);
// 	}
// 	
// 	public Set<Graph> getSources() {
// 		StatementPattern p = StatementPatternCollector.process(this).get(0);
// 		if (p instanceof MappedStatementPattern)
// 			return ((MappedStatementPattern) p).getSources();
// 		else
// 			return null;
// 	}
// 	
// }


import org.openrdf.query.algebra.Join;
import org.openrdf.query.algebra.UnaryTupleOperator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.uni_koblenz.west.splendid.model.BindJoin;
import de.uni_koblenz.west.splendid.model.HashJoin;
import de.uni_koblenz.west.splendid.model.RemoteQuery;
/*
 * This file is part of RDF Federator.
 * Copyright 2011 Olaf Goerlitz
 * 
 * RDF Federator is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * RDF Federator is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with RDF Federator.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * RDF Federator uses libraries from the OpenRDF Sesame Project licensed 
 * under the Aduna BSD-style license. 
 */
package de.uni_koblenz.west.splendid.estimation;



/**
 * Calculates the cost for executing the physical operators.
 * 
 * @author Olaf Goerlitz
 */
public class SPLENDIDCostEstimator extends AbstractCostEstimator {
	
	private static final Logger LOGGER = LoggerFactory.getLogger(SPLENDIDCostEstimator.class);
	
	private static final int C_TRANSFER_QUERY = 5;
	private static final int C_TRANSFER_TUPLE = 1;
	
	public String getName() {
		return "SPLDCost";
	}
	
	@Override
	public void meet(Join node) throws RuntimeException {
		
		// get cost of children first
		super.meet(node);
		
// Path: src/de/uni_koblenz/west/splendid/model/BindJoin.java
// public class BindJoin extends Join {
// 	
// 	public BindJoin(TupleExpr leftArg, TupleExpr rightArg) {
// 		super(leftArg, rightArg);
// 	}
// 	
// 	@Override
// 	public boolean equals(Object other) {
// 		return other instanceof BindJoin && super.equals(other);
// 	}
// 
// 	@Override
// 	public int hashCode() {
// 		return super.hashCode() ^ "BindJoin".hashCode();
// 	}
// 
// 	@Override
// 	public BindJoin clone() {
// 		return (BindJoin)super.clone();
// 	}
// 
// }
// 
// Path: src/de/uni_koblenz/west/splendid/model/HashJoin.java
// public class HashJoin extends Join {
// 	
// 	public HashJoin(TupleExpr leftArg, TupleExpr rightArg) {
// 		super(leftArg, rightArg);
// 	}
// 	
// 	@Override
// 	public boolean equals(Object other) {
// 		return other instanceof HashJoin && super.equals(other);
// 	}
// 
// 	@Override
// 	public int hashCode() {
// 		return super.hashCode() ^ "HashJoin".hashCode();
// 	}
// 
// 	@Override
// 	public HashJoin clone() {
// 		return (HashJoin)super.clone();
// 	}
// 
// }
// 
// Path: src/de/uni_koblenz/west/splendid/model/RemoteQuery.java
// public class RemoteQuery extends UnaryTupleOperator {
// 	
// 	public RemoteQuery(TupleExpr expr) {
// 		super(expr);
// 	}
// 
// 	@Override
// 	public <X extends Exception> void visit(QueryModelVisitor<X> visitor) throws X {
// 		visitor.meetOther(this);
// 	}
// 	
// 	public Set<Graph> getSources() {
// 		StatementPattern p = StatementPatternCollector.process(this).get(0);
// 		if (p instanceof MappedStatementPattern)
// 			return ((MappedStatementPattern) p).getSources();
// 		else
// 			return null;
// 	}
// 	
// }


// Path: src/de/uni_koblenz/west/splendid/estimation/SPLENDIDCostEstimator.java
import org.openrdf.query.algebra.Join;
import org.openrdf.query.algebra.UnaryTupleOperator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.uni_koblenz.west.splendid.model.BindJoin;
import de.uni_koblenz.west.splendid.model.HashJoin;
import de.uni_koblenz.west.splendid.model.RemoteQuery;

/*
 * This file is part of RDF Federator.
 * Copyright 2011 Olaf Goerlitz
 * 
 * RDF Federator is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * RDF Federator is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with RDF Federator.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * RDF Federator uses libraries from the OpenRDF Sesame Project licensed 
 * under the Aduna BSD-style license. 
 */
package de.uni_koblenz.west.splendid.estimation;



/**
 * Calculates the cost for executing the physical operators.
 * 
 * @author Olaf Goerlitz
 */
public class SPLENDIDCostEstimator extends AbstractCostEstimator {
	
	private static final Logger LOGGER = LoggerFactory.getLogger(SPLENDIDCostEstimator.class);
	
	private static final int C_TRANSFER_QUERY = 5;
	private static final int C_TRANSFER_TUPLE = 1;
	
	public String getName() {
		return "SPLDCost";
	}
	
	@Override
	public void meet(Join node) throws RuntimeException {
		
		// get cost of children first
		super.meet(node);
		
		if (node instanceof HashJoin) {