question: protected void waitUntilStopped ( ) { boolean doneWaiting = false ; while ( ! doneWaiting ) { if ( _autoEngineer != null ) { doneWaiting = _autoEngineer . isStopped ( ) ; } else { doneWaiting = true ; } if ( ! doneWaiting ) { try { Thread . sleep ( 50 ) ; } catch ( InterruptedException e ) { } } } }
target:  Returns when train is stopped Note: Provides for _autoEngineer becoming null during wait Ties up the current autoActiveTrain thread