/** * この要素への入力ポートに対する、フロー部品内部の入力ポートを返す。 * * @param externalInput この要素への入力ポート * @return 対応するフロー部品内部の入力ポート * @throws IllegalArgumentException 引数に{@code null}が指定された場合 */ public FlowIn<?> getInternalInputPort(FlowElementPortDescription externalInput) { if (externalInput == null) { throw new IllegalArgumentException("externalInput must not be null"); // $NON-NLS-1$ } assert inputPorts.size() == flowGraph.getFlowInputs().size(); int index = inputPorts.indexOf(externalInput); if (index < 0) { throw new IllegalArgumentException(); } return flowGraph.getFlowInputs().get(index); }
/** * Creates a new instance. * * @param flowGraph the flow-graph which represents this flow-part structure * @param parameters the parameters for this flow-part * @throws IllegalArgumentException if some parameters were {@code null} * @since 0.5.0 */ public FlowPartDescription(FlowGraph flowGraph, List<? extends Parameter> parameters) { if (flowGraph == null) { throw new IllegalArgumentException("flowGraph must not be null"); // $NON-NLS-1$ } if (parameters == null) { throw new IllegalArgumentException("parameters must not be null"); // $NON-NLS-1$ } this.flowGraph = flowGraph; List<FlowElementPortDescription> inputs = new ArrayList<FlowElementPortDescription>(); List<FlowElementPortDescription> outputs = new ArrayList<FlowElementPortDescription>(); this.inputPorts = Collections.unmodifiableList(inputs); this.outputPorts = Collections.unmodifiableList(outputs); this.parameters = Collections.unmodifiableList(new ArrayList<Parameter>(parameters)); for (FlowIn<?> in : flowGraph.getFlowInputs()) { inputs.add( new FlowElementPortDescription( in.getDescription().getName(), in.getDescription().getDataType(), PortDirection.INPUT)); } for (FlowOut<?> out : flowGraph.getFlowOutputs()) { outputs.add( new FlowElementPortDescription( out.getDescription().getName(), out.getDescription().getDataType(), PortDirection.OUTPUT)); } }