@Override public void verifyCanStopTransmitting() { if (!isTransmitting()) { throw new IllegalStateException(this.getIdentifier() + " is not transmitting"); } }
@Override public void verifyCanUpdate() { readLock.lock(); try { if (isTransmitting()) { throw new IllegalStateException(this.getIdentifier() + " is currently transmitting"); } for (final Port port : inputPorts.values()) { if (port.isRunning()) { throw new IllegalStateException(this.getIdentifier() + " has running Port: " + port.getIdentifier()); } } for (final Port port : outputPorts.values()) { if (port.isRunning()) { throw new IllegalStateException(this.getIdentifier() + " has running Port: " + port.getIdentifier()); } } } finally { readLock.unlock(); } }
@Override public void verifyCanDelete(final boolean ignoreConnections) { readLock.lock(); try { if (isTransmitting()) { throw new IllegalStateException(this.getIdentifier() + " is transmitting"); } for (final Port port : inputPorts.values()) { if (!ignoreConnections && port.hasIncomingConnection()) { throw new IllegalStateException(this.getIdentifier() + " is the destination of another component"); } if (port.isRunning()) { throw new IllegalStateException(this.getIdentifier() + " has running Port: " + port.getIdentifier()); } } for (final Port port : outputPorts.values()) { if (!ignoreConnections) { for (final Connection connection : port.getConnections()) { connection.verifyCanDelete(); } } if (port.isRunning()) { throw new IllegalStateException(this.getIdentifier() + " has running Port: " + port.getIdentifier()); } } } finally { readLock.unlock(); } }
readLock.lock(); try { if (isTransmitting()) { throw new IllegalStateException(this.getIdentifier() + " is already transmitting");