/** * Sets the inputs of the given {@link Operator}.<br> * Currently, the list can have 0, 1, or 2 elements and the number of elements must match the type of the contract. * * @param contract * the Operator whose inputs should be set * @param inputs * all input contracts to this contract */ @SuppressWarnings({ "deprecation", "rawtypes", "unchecked" }) public static void setInputs(final Operator<?> contract, final List<List<Operator>> inputs) { if (contract instanceof GenericDataSinkBase) { if (inputs.size() != 1) { throw new IllegalArgumentException("wrong number of inputs"); } ((GenericDataSinkBase) contract).setInputs(inputs.get(0)); } else if (contract instanceof SingleInputOperator) { if (inputs.size() != 1) { throw new IllegalArgumentException("wrong number of inputs"); } ((SingleInputOperator) contract).setInputs(inputs.get(0)); } else if (contract instanceof DualInputOperator) { if (inputs.size() != 2) { throw new IllegalArgumentException("wrong number of inputs"); } ((DualInputOperator) contract).setFirstInputs(inputs.get(0)); ((DualInputOperator) contract).setSecondInputs(inputs.get(1)); } } }
/** * Sets the inputs of the given {@link Operator}.<br> * Currently, the list can have 0, 1, or 2 elements and the number of elements must match the type of the contract. * * @param contract * the Operator whose inputs should be set * @param inputs * all input contracts to this contract */ @SuppressWarnings({ "deprecation", "rawtypes", "unchecked" }) public static void setInputs(final Operator<?> contract, final List<List<Operator>> inputs) { if (contract instanceof GenericDataSinkBase) { if (inputs.size() != 1) { throw new IllegalArgumentException("wrong number of inputs"); } ((GenericDataSinkBase) contract).setInputs(inputs.get(0)); } else if (contract instanceof SingleInputOperator) { if (inputs.size() != 1) { throw new IllegalArgumentException("wrong number of inputs"); } ((SingleInputOperator) contract).setInputs(inputs.get(0)); } else if (contract instanceof DualInputOperator) { if (inputs.size() != 2) { throw new IllegalArgumentException("wrong number of inputs"); } ((DualInputOperator) contract).setFirstInputs(inputs.get(0)); ((DualInputOperator) contract).setSecondInputs(inputs.get(1)); } } }