private void removeCaboosesAndCarsWithFredAndSaveFinalDestination() throws BuildFailedException {
  addLine(_buildReport,SEVEN,BLANK_LINE);
  addLine(_buildReport,SEVEN,Bundle.getMessage("buildRemoveCarsNotNeeded"));
  for (_carIndex=0; _carIndex < _carList.size(); _carIndex++) {
    Car car=_carList.get(_carIndex);
    if (car.isCaboose() || car.hasFred()) {
      addLine(_buildReport,SEVEN,MessageFormat.format(Bundle.getMessage("buildExcludeCarTypeAtLoc"),new Object[]{car.toString(),car.getTypeName(),(car.getLocationName() + ", " + car.getTrackName())}));
      if (car.getTrack() == _departStageTrack) {
        throw new BuildFailedException("ERROR: Attempt to removed car with FRED or Caboose from staging");
      }
      _carList.remove(car);
      _carIndex--;
    }
    car.setPreviousFinalDestination(car.getFinalDestination());
    car.setPreviousFinalDestinationTrack(car.getFinalDestinationTrack());
    car.setPreviousScheduleId(car.getScheduleItemId());
  }
}

private void removeCaboosesAndCarsWithFredAndSaveFinalDestination ( ) throws BuildFailedException { addLine ( _buildReport , SEVEN , BLANK_LINE ) ; addLine ( _buildReport , SEVEN , Bundle . getMessage ( "buildRemoveCarsNotNeeded" ) ) ; for ( _carIndex = 0 ; _carIndex < _carList . size ( ) ; _carIndex ++ ) { Car car = _carList . get ( _carIndex ) ; if ( car . isCaboose ( ) || car . hasFred ( ) ) { addLine ( _buildReport , SEVEN , MessageFormat . format ( Bundle . getMessage ( "buildExcludeCarTypeAtLoc" ) , new Object [ ] { car . toString ( ) , car . getTypeName ( ) , ( car . getLocationName ( ) + ", " + car . getTrackName ( ) ) } ) ) ; if ( car . getTrack ( ) == _departStageTrack ) { throw new BuildFailedException ( "ERROR: Attempt to removed car with FRED or Caboose from staging" ) ; } _carList . remove ( car ) ; _carIndex -- ; } car . setPreviousFinalDestination ( car . getFinalDestination ( ) ) ; car . setPreviousFinalDestinationTrack ( car . getFinalDestinationTrack ( ) ) ; car . setPreviousScheduleId ( car . getScheduleItemId ( ) ) ; } }
removes the remaining cabooses and cars with fred from consideration . also saves a car ' s final destination in case of train reset .
