final Map<BasicOperator, BasicOperator> operators = new HashMap<BasicOperator, BasicOperator>();
// myRule.transformBasicOperatorGraph(mso,rootOperator);
for (final String label : this.transformation.keySet()) {
if (mso.containsKey(label)) {
final BasicOperator op1 = this.transformation.get(label);
final BasicOperator op2 = mso.get(label);
final List<OperatorIDTuple> succs = op2
.getSucceedingOperators();
for (int i = succs.size() - 1; i >= 0; i--) {
final OperatorIDTuple opID = succs.get(i);
if (this.inSubgraph(mso, opID)) {
succs.remove(i);
opID.getOperator().removePrecedingOperator(op2);
if (opID.getOperator().getPrecedingOperators().size() == 0) {
deleted.add(opID.getOperator());
}
}
}
op2.addSucceedingOperators(op1.getSucceedingOperators());
operators.put(op1, op2);
} else {
final BasicOperator toAdd = this.transformation.get(label).clone();
added.add(toAdd);
operators.put(this.transformation.get(label), toAdd);
}
}
for (final BasicOperator op : operators.keySet()) {
final BasicOperator realOp = operators.get(op);
for (int i = 0; i < realOp.getSucceedingOperators().size(); i++) {
final OperatorIDTuple succ = realOp.getSucceedingOperators()
.get(i);
if (operators.containsKey(succ.getOperator())) {
realOp.getSucceedingOperators().set(
i,
new OperatorIDTuple(operators.get(succ
.getOperator()), succ.getId()));
operators.get(succ.getOperator()).addPrecedingOperator(
realOp);