public int askNumControlBits(String systemName){
  int iNum=selectNumberOfControlBits();
  if (iNum == javax.swing.JOptionPane.CLOSED_OPTION) {
    iNum=1;
    log.warn("User cancelled without selecting number of output bits. Defaulting to 1.");
  }
 else {
    iNum=iNum + 1;
  }
  if (iNum == 2) {
    int nAddress=-1;
    nAddress=SerialAddress.getNodeAddressFromSystemName(systemName);
    if (nAddress == -1) {
      return (0);
    }
    int bitNum=SerialAddress.getBitFromSystemName(systemName);
    if (bitNum == 0) {
      return (0);
    }
    bitNum=bitNum + 1;
    String conflict="";
    conflict=SerialAddress.isOutputBitFree(nAddress,bitNum);
    if (!conflict.equals("")) {
      log.error("Assignment conflict with " + conflict + ". Turnout not created.");
      notifySecondBitConflict(conflict,bitNum);
      return (0);
    }
  }
  return (iNum);
}

public int askNumControlBits ( String systemName ) { int iNum = selectNumberOfControlBits ( ) ; if ( iNum == javax . swing . JOptionPane . CLOSED_OPTION ) { iNum = 1 ; log . warn ( "User cancelled without selecting number of output bits. Defaulting to 1." ) ; } else { iNum = iNum + 1 ; } if ( iNum == 2 ) { int nAddress = - 1 ; nAddress = SerialAddress . getNodeAddressFromSystemName ( systemName ) ; if ( nAddress == - 1 ) { return ( 0 ) ; } int bitNum = SerialAddress . getBitFromSystemName ( systemName ) ; if ( bitNum == 0 ) { return ( 0 ) ; } bitNum = bitNum + 1 ; String conflict = "" ; conflict = SerialAddress . isOutputBitFree ( nAddress , bitNum ) ; if ( ! conflict . equals ( "" ) ) { log . error ( "Assignment conflict with " + conflict + ". Turnout not created." ) ; notifySecondBitConflict ( conflict , bitNum ) ; return ( 0 ) ; } } return ( iNum ) ; }
get from the user , the number of addressed bits used to control a turnout . normally this is 1 , and the default routine returns 1 automatically . turnout managers for systems that can handle multiple control bits should override this method with one which asks the user to specify the number of control bits . if the user specifies more than one control bit , this method should check if the additional bits are available ( not assigned to another object ) . if the bits are not available , this method should return 0 for number of control bits , after informing the user of the problem . this function is called whenever a new turnout is defined in the turnout table . it can also be used to set up other turnout control options , such as pulsed control of turnout machines .
