コード例 #1
0
  public void addConnection(Connection conn) {
    if (conn.getProtocol() != Connection.Protocol.DICOM)
      throw new IllegalArgumentException("protocol != DICOM - " + conn.getProtocol());

    if (device != null && device != conn.getDevice())
      throw new IllegalStateException(conn + " not contained by Device: " + device.getDeviceName());
    connections.add(conn);
  }
コード例 #2
0
 /**
  * Set the device that is identified by this application entity.
  *
  * @param device The owning <code>Device</code>.
  */
 public void setDevice(Device device) {
   if (device != null) {
     if (this.device != null && this.device != device)
       throw new IllegalStateException("already owned by " + this.device.getDeviceName());
     for (Connection conn : connections)
       if (conn.getDevice() != device)
         throw new IllegalStateException(conn + " not owned by " + device.getDeviceName());
   }
   this.device = device;
 }