public boolean controlRunTrain(int idx){
  if (log.isDebugEnabled()) {
    log.debug("controlRunTrain= " + idx + " runMode= "+ _runMode+ " - warrant= "+ getDisplayName());
  }
  boolean ret=true;
  int oldIndex=-MODE_MANUAL;
  if (_engineer == null) {
switch (idx) {
case HALT:
case RESUME:
case RETRY:
      ret=false;
    break;
case ABORT:
  if (_runMode == Warrant.MODE_LEARN) {
    firePropertyChange("abortLearn",Integer.valueOf(-MODE_LEARN),Integer.valueOf(_idxCurrentOrder));
  }
 else {
    stopWarrant(true);
  }
break;
}
}
 else {
synchronized (_engineer) {
oldIndex=_engineer.getRunState();
switch (idx) {
case HALT:
_engineer.setHalt(true);
break;
case RESUME:
_engineer.setHalt(false);
restart();
ret=moveIntoNextBlock(MID);
break;
case RETRY:
BlockOrder bo=getBlockOrderAt(_idxCurrentOrder + 1);
ret=false;
if (bo != null) {
OBlock b=bo.getBlock();
if (b.allocate(this) == null && (b.getState() & OBlock.OCCUPIED) != 0) {
_idxCurrentOrder++;
if (b.equals(_stoppingBlock)) {
_stoppingBlock.removePropertyChangeListener(this);
_stoppingBlock=null;
}
bo.setPath(this);
restart();
goingActive(b);
ret=true;
}
}
break;
case ABORT:
stopWarrant(true);
break;
}
}
}
if (ret) {
firePropertyChange("controlChange",Integer.valueOf(oldIndex),Integer.valueOf(idx));
}
return ret;
}

public boolean controlRunTrain ( int idx ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "controlRunTrain= " + idx + " runMode= " + _runMode + " - warrant= " + getDisplayName ( ) ) ; } boolean ret = true ; int oldIndex = - MODE_MANUAL ; if ( _engineer == null ) { switch ( idx ) { case HALT : case RESUME : case RETRY : ret = false ; break ; case ABORT : if ( _runMode == Warrant . MODE_LEARN ) { firePropertyChange ( "abortLearn" , Integer . valueOf ( - MODE_LEARN ) , Integer . valueOf ( _idxCurrentOrder ) ) ; } else { stopWarrant ( true ) ; } break ; } } else { synchronized ( _engineer ) { oldIndex = _engineer . getRunState ( ) ; switch ( idx ) { case HALT : _engineer . setHalt ( true ) ; break ; case RESUME : _engineer . setHalt ( false ) ; restart ( ) ; ret = moveIntoNextBlock ( MID ) ; break ; case RETRY : BlockOrder bo = getBlockOrderAt ( _idxCurrentOrder + 1 ) ; ret = false ; if ( bo != null ) { OBlock b = bo . getBlock ( ) ; if ( b . allocate ( this ) == null && ( b . getState ( ) & OBlock . OCCUPIED ) != 0 ) { _idxCurrentOrder ++ ; if ( b . equals ( _stoppingBlock ) ) { _stoppingBlock . removePropertyChangeListener ( this ) ; _stoppingBlock = null ; } bo . setPath ( this ) ; restart ( ) ; goingActive ( b ) ; ret = true ; } } break ; case ABORT : stopWarrant ( true ) ; break ; } } } if ( ret ) { firePropertyChange ( "controlChange" , Integer . valueOf ( oldIndex ) , Integer . valueOf ( idx ) ) ; } return ret ; }
pause and resume auto - running train or abort any allocation state _engineer . abort ( ) calls setrunmode ( mode_none , . . . ) which calls deallocate all .
