Improve check for "all input ports are closed"
Current situation:
for (InputPort<?> inputPort : inputPorts) {
if (!inputPort.isClosed()) {
return;
}
}
Solution A: Use a bit set: each input port is represented by one digit. A 1 means opened, a 0 means closed. If the bit set is 0, all input ports are closed.
Advantages:
- A single check for 0
Disadvantages:
- Allows "only" 32 (using an int) oder 64 (using a long) input ports. In a few years, where a 128-core is common, this limitation could be a problem.
Solution B: Use two lists for ports: one for opened ports and one for closed ports.
Advantages:
- A single size check for 0
- Allows an arbitrary number of ports
- Allows to be used for iterating over opened ports, too
Disadvantages:
- iterating over all ports with one loop is not possible anymore (do we iterate over closed ports at all?)
Solution C: Use a counter for opened ports.
Advantages:
- A single check for 0
- Allows an arbitrary number of ports
Disadvantages:
- iterating over all open ports is inefficient since the port list contains opened and closed ports