Class to represent a view of a plan. The view contains a subset of the plan. All the operators returned from the view are the same objects to the operators in its base plan. It is used to represent match results.
| 36 | * |
| 37 | */ |
| 38 | public class OperatorSubPlan implements OperatorPlan { |
| 39 | |
| 40 | private OperatorPlan basePlan; |
| 41 | private List<Operator> roots; |
| 42 | private List<Operator> leaves; |
| 43 | private Set<Operator> operators; |
| 44 | |
| 45 | public OperatorSubPlan(OperatorPlan base) { |
| 46 | basePlan = base; |
| 47 | roots = new ArrayList<Operator>(); |
| 48 | leaves = new ArrayList<Operator>(); |
| 49 | operators = new HashSet<Operator>(); |
| 50 | } |
| 51 | |
| 52 | public OperatorPlan getBasePlan() { |
| 53 | return basePlan; |
| 54 | } |
| 55 | |
| 56 | @Override |
| 57 | public void add(Operator op) { |
| 58 | operators.add(op); |
| 59 | leaves.clear(); |
| 60 | roots.clear(); |
| 61 | } |
| 62 | |
| 63 | @Override |
| 64 | public void connect(Operator from, int fromPos, Operator to, int toPos) { |
| 65 | throw new UnsupportedOperationException("connect() can not be called on OperatorSubPlan"); |
| 66 | } |
| 67 | |
| 68 | @Override |
| 69 | public void connect(Operator from, Operator to) { |
| 70 | throw new UnsupportedOperationException("connect() can not be called on OperatorSubPlan"); |
| 71 | } |
| 72 | |
| 73 | @Override |
| 74 | public Pair<Integer, Integer> disconnect(Operator from, Operator to) throws FrontendException { |
| 75 | throw new UnsupportedOperationException("disconnect() can not be called on OperatorSubPlan"); |
| 76 | } |
| 77 | |
| 78 | @Override |
| 79 | public List<Operator> getSinks() { |
| 80 | if (leaves.size() == 0 && operators.size() > 0) { |
| 81 | for (Operator op : operators) { |
| 82 | if (getSuccessors(op) == null) { |
| 83 | leaves.add(op); |
| 84 | } |
| 85 | } |
| 86 | } |
| 87 | return leaves; |
| 88 | } |
| 89 | |
| 90 | @Override |
| 91 | public Iterator<Operator> getOperators() { |
| 92 | return operators.iterator(); |
| 93 | } |
| 94 | |
| 95 | @Override |
nothing calls this directly
no outgoing calls
no test coverage detected