Move everything below a given operator to the new operator plan. The specified operator will be moved and will be the root of the new operator plan @param root Operator to move everything after @param newPlan new operator plan to move things into @throws PlanException
(Operator root, BaseOperatorPlan newPlan)
| 489 | * @throws PlanException |
| 490 | */ |
| 491 | public void moveTree(Operator root, BaseOperatorPlan newPlan) throws FrontendException { |
| 492 | Deque<Operator> queue = new ArrayDeque<Operator>(); |
| 493 | newPlan.add(root); |
| 494 | root.setPlan(newPlan); |
| 495 | queue.addLast(root); |
| 496 | while (!queue.isEmpty()) { |
| 497 | Operator node = queue.poll(); |
| 498 | if (getSuccessors(node)!=null) { |
| 499 | for (Operator succ : getSuccessors(node)) { |
| 500 | if (!queue.contains(succ)) { |
| 501 | queue.addLast(succ); |
| 502 | newPlan.add(succ); |
| 503 | succ.setPlan(newPlan); |
| 504 | newPlan.connect(node, succ); |
| 505 | } |
| 506 | } |
| 507 | } |
| 508 | } |
| 509 | |
| 510 | trimBelow(root); |
| 511 | } |
| 512 | |
| 513 | /** |
| 514 | * Trim everything below a given operator. The specified operator will |