Filter newFilter;
try {
newFilter = new Filter(filter.toString().substring(
0, filter.toString().length() - 2));
indexScan
.setSucceedingOperator(new OperatorIDTuple(
newFilter, 0));
newFilter
.setSucceedingOperator(new OperatorIDTuple(
new Result(), 0));
} catch (final ParseException e) {
e.printStackTrace();
}
} else {
indexScan.setSucceedingOperator(new OperatorIDTuple(
new Result(), 0));
}
} else {
indexScan.setSucceedingOperator(new OperatorIDTuple(
new Result(), 0));
}
// indexScan.setSucceedingOperator(new OperatorIDTuple(new
// Result(),
// 0));
//connect indexScan in subgraph container
rootNodeOfSubGraph.setSucceedingOperator(new OperatorIDTuple(
indexScan, countingSubgraphs));
rootNodeOfSubGraph.deleteParents();
rootNodeOfSubGraph.setParents();
// original connections set at new graph
/*
* create Operator for union of all subgraphs
*/
OperatorIDTuple unionIDOperator = new OperatorIDTuple(union, countingSubgraphs++);
container.setSucceedingOperator(unionIDOperator);
/*
* store this subgraph
*/
subgraphs.add(container);
}
//connect all subgraphs as predecessor of the new union
union.addPrecedingOperators(subgraphs);
/*
* create list of OperatorIDTuples connected to the subgraphs
*/
List<OperatorIDTuple> list = new ArrayList<OperatorIDTuple>();
for (BasicOperator g : subgraphs) {
list.add(new OperatorIDTuple(g, 0));
}
/*
* now connect the root with all new subgraphs
*/
for (final BasicOperator pred : preds) {
/*
* and remove indexScan (because, this is moved to subgraph container)
*/
OperatorIDTuple a = pred.getOperatorIDTuple(_indexScan);
if (a != null) {
pred.removeSucceedingOperator(a);
}
//but add all subgraphs
pred.addSucceedingOperators(list);