Source:
<code>public PhysicalPlan<PartitionedQuery, MistEvent.Direction> chainOperators( final PhysicalPlan<Operator, MistEvent.Direction> plan) { final Map<Source, Map<PartitionedQuery, MistEvent.Direction>> sourceMap = new HashMap<>(); final Map<PartitionedQuery, Set<Sink>> sinkMap = new HashMap<>(); final DAG<PartitionedQuery, MistEvent.Direction> partitionedQueryDAG = new AdjacentListDAG<>(); final Map<Operator, PartitionedQuery> partitionedQueryMap = new HashMap<>(); for (final Map.Entry<Source, Map<Operator, MistEvent.Direction>> entry : plan.getSourceMap().entrySet()) { final Map<Operator, MistEvent.Direction> rootOperatorEdges = entry.getValue(); final Map<PartitionedQuery, MistEvent.Direction> partitionedQueries = new HashMap<>(); final Iterator<Operator> rootOperators = rootOperatorEdges.keySet().iterator(); <START> while (rootOperators.hasNext()) { <END> final Operator rootOperator = rootOperators.next(); final MistEvent.Direction edgeDirection = rootOperatorEdges.get(rootOperator); PartitionedQuery currOpChain = partitionedQueryMap.get(rootOperator); if (currOpChain == null) { currOpChain = new DefaultPartitionedQuery(); partitionedQueryMap.put(rootOperator, currOpChain); currOpChain.insertToTail(rootOperator); chainOperatorHelper(plan, partitionedQueryMap, partitionedQueryDAG, sinkMap, rootOperator, null, currOpChain, edgeDirection); } partitionedQueries.put(currOpChain, edgeDirection); } sourceMap.put(entry.getKey(), partitionedQueries); } return new DefaultPhysicalPlanImpl<>(sourceMap, partitionedQueryDAG, sinkMap); }</code><technical_language>java for (final Map.Entry<Operator, MistEvent.Direction> opAndEdge : rootOperatorEdges) { ... }</technical_language>

Target:
public PhysicalPlan<PartitionedQuery, MistEvent.Direction> chainOperators( final PhysicalPlan<Operator, MistEvent.Direction> plan) { final Map<Source, Map<PartitionedQuery, MistEvent.Direction>> sourceMap = new HashMap<>(); final Map<PartitionedQuery, Set<Sink>> sinkMap = new HashMap<>(); final DAG<PartitionedQuery, MistEvent.Direction> partitionedQueryDAG = new AdjacentListDAG<>(); final Map<Operator, PartitionedQuery> partitionedQueryMap = new HashMap<>(); for (final Map.Entry<Source, Map<Operator, MistEvent.Direction>> entry : plan.getSourceMap().entrySet()) { final Map<Operator, MistEvent.Direction> rootOperatorEdges = entry.getValue(); final Map<PartitionedQuery, MistEvent.Direction> partitionedQueries = new HashMap<>(); for (final Map.Entry<Operator, MistEvent.Direction> opAndEdge : rootOperatorEdges.entrySet()) { final Operator rootOperator = opAndEdge.getKey(); final MistEvent.Direction edgeDirection = opAndEdge.getValue(); PartitionedQuery currOpChain = partitionedQueryMap.get(rootOperator); if (currOpChain == null) { currOpChain = new DefaultPartitionedQuery(); partitionedQueryMap.put(rootOperator, currOpChain); currOpChain.insertToTail(rootOperator); chainOperatorHelper(plan, partitionedQueryMap, partitionedQueryDAG, sinkMap, rootOperator, null, currOpChain, edgeDirection); } partitionedQueries.put(currOpChain, edgeDirection); } sourceMap.put(entry.getKey(), partitionedQueries); } return new DefaultPhysicalPlanImpl<>(sourceMap, partitionedQueryDAG, sinkMap); }