Пример #1
0
  @Override
  public Set<ChannelID> getInputChannelIDsOfGate(final GateID gateID) {

    InputGate<? extends IOReadableWritable> inputGate = null;
    final Iterator<InputGate<? extends IOReadableWritable>> gateIterator =
        this.inputGates.iterator();
    while (gateIterator.hasNext()) {
      final InputGate<? extends IOReadableWritable> candidateGate = gateIterator.next();
      if (candidateGate.getGateID().equals(gateID)) {
        inputGate = candidateGate;
        break;
      }
    }

    if (inputGate == null) {
      throw new IllegalArgumentException("Cannot find input gate with ID " + gateID);
    }

    final Set<ChannelID> inputChannelIDs = new HashSet<ChannelID>();

    for (int i = 0; i < inputGate.getNumberOfInputChannels(); ++i) {
      inputChannelIDs.add(inputGate.getInputChannel(i).getID());
    }

    return Collections.unmodifiableSet(inputChannelIDs);
  }