Create an edge between two nodes. The direction of the edge implies data flow. @param from Operator data will flow from. @param to Operator data will flow to. @throws PlanException if this edge will create multiple inputs for an operator that does not support multiple inputs or create multiple outp
(E from, E to)
| 172 | * for an operator that does not support multiple outputs. |
| 173 | */ |
| 174 | public void connect(E from, E to) throws PlanException { |
| 175 | markDirty(); |
| 176 | |
| 177 | // Check that both nodes are in the plan. |
| 178 | checkInPlan(from); |
| 179 | checkInPlan(to); |
| 180 | |
| 181 | // Check to see if the from operator already has outputs, and if so |
| 182 | // whether it supports multiple outputs. |
| 183 | if (mFromEdges.get(from) != null && |
| 184 | !from.supportsMultipleOutputs()) { |
| 185 | PlanException pe = new PlanException("Attempt to give operator of type " + |
| 186 | from.getClass().getName() + " multiple outputs. This operator does " |
| 187 | + "not support multiple outputs."); |
| 188 | log.error(pe.getMessage()); |
| 189 | throw pe; |
| 190 | } |
| 191 | |
| 192 | // Check to see if the to operator already has inputs, and if so |
| 193 | // whether it supports multiple inputs. |
| 194 | if (mToEdges.get(to) != null && |
| 195 | !to.supportsMultipleInputs()) { |
| 196 | PlanException pe = new PlanException("Attempt to give operator of type " + |
| 197 | to.getClass().getName() + " multiple inputs. This operator does " |
| 198 | + "not support multiple inputs."); |
| 199 | log.error(pe.getMessage()); |
| 200 | throw pe; |
| 201 | } |
| 202 | mFromEdges.put(from, to); |
| 203 | mToEdges.put(to, from); |
| 204 | } |
| 205 | |
| 206 | /** |
| 207 | * Create an soft edge between two nodes. |
no test coverage detected