protected void goingInactive(OBlock block){
  if (_runMode == MODE_NONE) {
    return;
  }
  if (!ThreadingUtil.isLayoutThread())   log.error("invoked on wrong thread",new Exception("traceback"));
  int idx=getIndexOfBlock(block,_idxLastOrder);
  if (log.isDebugEnabled()) {
    log.debug("Block \"" + block.getDisplayName() + "\" goingInactive. idx= "+ idx+ ", _idxCurrentOrder= "+ _idxCurrentOrder+ " - warrant= "+ getDisplayName());
  }
  if (idx < _idxCurrentOrder) {
    releaseBlock(block,idx);
  }
 else   if (idx == _idxCurrentOrder) {
    if (_idxCurrentOrder + 1 < _orders.size()) {
      OBlock nextBlock=getBlockAt(_idxCurrentOrder + 1);
      if ((nextBlock.getState() & OBlock.DARK) != 0) {
        if (_engineer != null) {
          goingActive(nextBlock);
          releaseBlock(block,idx);
        }
 else {
          if (_runMode == MODE_LEARN) {
            _idxCurrentOrder++;
            firePropertyChange("blockChange",block,nextBlock);
          }
 else           if (_runMode == MODE_RUN) {
            controlRunTrain(ABORT);
          }
        }
      }
 else {
        if (log.isDebugEnabled()) {
          log.debug("firePropertyChange(\"blockChange\", " + block.getDisplayName() + ", null) - warrant= "+ getDisplayName());
        }
        firePropertyChange("blockChange",block,null);
        if (_engineer != null) {
          _engineer.setHalt(true);
        }
 else {
          controlRunTrain(ABORT);
        }
        return;
      }
    }
 else {
      abortWarrant("Warrant " + getDisplayName() + " at last block "+ block.getDisplayName()+ " and going inactive!");
    }
  }
 else   if (idx == _idxCurrentOrder + 1) {
    restart();
    moveIntoNextBlock(END);
  }
 else {
    block.allocate(this);
  }
}

protected void goingInactive ( OBlock block ) { if ( _runMode == MODE_NONE ) { return ; } if ( ! ThreadingUtil . isLayoutThread ( ) ) log . error ( "invoked on wrong thread" , new Exception ( "traceback" ) ) ; int idx = getIndexOfBlock ( block , _idxLastOrder ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Block \"" + block . getDisplayName ( ) + "\" goingInactive. idx= " + idx + ", _idxCurrentOrder= " + _idxCurrentOrder + " - warrant= " + getDisplayName ( ) ) ; } if ( idx < _idxCurrentOrder ) { releaseBlock ( block , idx ) ; } else if ( idx == _idxCurrentOrder ) { if ( _idxCurrentOrder + 1 < _orders . size ( ) ) { OBlock nextBlock = getBlockAt ( _idxCurrentOrder + 1 ) ; if ( ( nextBlock . getState ( ) & OBlock . DARK ) != 0 ) { if ( _engineer != null ) { goingActive ( nextBlock ) ; releaseBlock ( block , idx ) ; } else { if ( _runMode == MODE_LEARN ) { _idxCurrentOrder ++ ; firePropertyChange ( "blockChange" , block , nextBlock ) ; } else if ( _runMode == MODE_RUN ) { controlRunTrain ( ABORT ) ; } } } else { if ( log . isDebugEnabled ( ) ) { log . debug ( "firePropertyChange(\"blockChange\", " + block . getDisplayName ( ) + ", null) - warrant= " + getDisplayName ( ) ) ; } firePropertyChange ( "blockChange" , block , null ) ; if ( _engineer != null ) { _engineer . setHalt ( true ) ; } else { controlRunTrain ( ABORT ) ; } return ; } } else { abortWarrant ( "Warrant " + getDisplayName ( ) + " at last block " + block . getDisplayName ( ) + " and going inactive!" ) ; } } else if ( idx == _idxCurrentOrder + 1 ) { restart ( ) ; moveIntoNextBlock ( END ) ; } else { block . allocate ( this ) ; } }
block in the route is going inactive
