protected void updatePorts(){
  if (!isChanging) {
    isChanging=true;
    boolean first=true;
    T foundDisconnected=null;
    Iterator<T> i=managedPorts.iterator();
    while (i.hasNext()) {
      T port=i.next();
      if (!port.isConnected() && !port.isLocked()) {
        if (first) {
          foundDisconnected=port;
          first=false;
        }
 else {
          if (minNumber == 0) {
            deletePort(port);
            i.remove();
          }
        }
      }
    }
    if ((foundDisconnected == null) || (managedPorts.size() < minNumber)) {
      do {
        managedPorts.add(createPort());
      }
 while (managedPorts.size() < minNumber);
    }
 else {
      if (minNumber == 0) {
        managedPorts.remove(foundDisconnected);
        managedPorts.add(foundDisconnected);
        ports.pushDown(foundDisconnected);
      }
    }
    fixNames();
    isChanging=false;
  }
}

protected void updatePorts ( ) { if ( ! isChanging ) { isChanging = true ; boolean first = true ; T foundDisconnected = null ; Iterator < T > i = managedPorts . iterator ( ) ; while ( i . hasNext ( ) ) { T port = i . next ( ) ; if ( ! port . isConnected ( ) && ! port . isLocked ( ) ) { if ( first ) { foundDisconnected = port ; first = false ; } else { if ( minNumber == 0 ) { deletePort ( port ) ; i . remove ( ) ; } } } } if ( ( foundDisconnected == null ) || ( managedPorts . size ( ) < minNumber ) ) { do { managedPorts . add ( createPort ( ) ) ; } while ( managedPorts . size ( ) < minNumber ) ; } else { if ( minNumber == 0 ) { managedPorts . remove ( foundDisconnected ) ; managedPorts . add ( foundDisconnected ) ; ports . pushDown ( foundDisconnected ) ; } } fixNames ( ) ; isChanging = false ; } }
deletes all unused ( = not connected and not locked ) ports , always keeping at least one free port available . < br / > override only in special cases , e . g . when needing to control the number of ports depending on parameters or other properties of the operator .
