}
// 2. Joins erstellen
BasicOperator headOperator = null;
final Iterator<BasicOperator> opIt = operands.iterator();
if (operands.size() > 1) {
Join bottomJoin = new IndexJoinWithDuplicateElimination();
final BasicOperator op1 = opIt.next();
for(final OperatorIDTuple opID: op1.getSucceedingOperators()){
opID.getOperator().removePrecedingOperator(op1);
}
op1.getSucceedingOperators().clear();
op1.addSucceedingOperator(new OperatorIDTuple(bottomJoin, 0));
bottomJoin.addPrecedingOperator(op1);
final BasicOperator op2 = opIt.next();
for(final OperatorIDTuple opID: op2.getSucceedingOperators()){
opID.getOperator().removePrecedingOperator(op2);
}
op2.getSucceedingOperators().clear();
op2.addSucceedingOperator(new OperatorIDTuple(bottomJoin, 1));
bottomJoin.addPrecedingOperator(op2);
if(arg!=null){
bottomJoin.setSucceedingOperator((OperatorIDTuple) arg);
((OperatorIDTuple) arg).getOperator().addPrecedingOperator(bottomJoin);
}
while (opIt.hasNext()) {
final Join tempJoin = new IndexJoinWithDuplicateElimination();
final BasicOperator operand = opIt.next();
for(final OperatorIDTuple opID: operand.getSucceedingOperators()){
opID.getOperator().removePrecedingOperator(operand);
}
operand.getSucceedingOperators().clear();
operand.setSucceedingOperator(new OperatorIDTuple(tempJoin, 0));
tempJoin.addPrecedingOperator(operand);
for(final OperatorIDTuple opID: bottomJoin.getSucceedingOperators()){
opID.getOperator().removePrecedingOperator(bottomJoin);
}
bottomJoin.getSucceedingOperators().clear();
bottomJoin.setSucceedingOperator(new OperatorIDTuple(tempJoin, 1));
tempJoin.addPrecedingOperator(bottomJoin);
if(arg!=null){
tempJoin.setSucceedingOperator((OperatorIDTuple) arg);
((OperatorIDTuple) arg).getOperator().addPrecedingOperator(tempJoin);
}
bottomJoin = tempJoin;
}
headOperator = bottomJoin;