示例#1
0
文件: Car.java 项目: JMRI/jmri-test
  public void reset() {
    setScheduleItemId(getPreviousScheduleId()); // revert to previous
    setNextLoadName(NONE);
    setNextWait(0);
    setFinalDestination(getPreviousFinalDestination()); // revert to previous
    setFinalDestinationTrack(getPreviousFinalDestinationTrack()); // revert to previous
    if (isLoadGeneratedFromStaging()) {
      setLoadGeneratedFromStaging(false);
      setLoadName(CarLoads.instance().getDefaultEmptyName());
    }

    super.reset();
  }
示例#2
0
文件: Car.java 项目: JMRI/jmri-test
 public void loadNext(Track destTrack) {
   setLoadGeneratedFromStaging(false);
   // update wait count
   setWait(getNextWait());
   setNextWait(0);
   // and the pickup day
   setPickupScheduleId(getNextPickupScheduleId());
   setNextPickupScheduleId(NONE);
   // arrived at spur?
   if (destTrack != null && destTrack.getTrackType().equals(Track.SPUR)) {
     updateLoad();
   } // update load optionally when car reaches staging
   else if (destTrack != null && destTrack.getTrackType().equals(Track.STAGING)) {
     if (destTrack.isLoadSwapEnabled() && getLoadName().equals(carLoads.getDefaultEmptyName())) {
       setLoadName(carLoads.getDefaultLoadName());
     } else if (destTrack.isLoadSwapEnabled()
         && getLoadName().equals(carLoads.getDefaultLoadName())) {
       setLoadEmpty();
     } else if (destTrack.isLoadEmptyEnabled()
         && getLoadName().equals(carLoads.getDefaultLoadName())) {
       setLoadEmpty();
     } // empty car if it has a custom load
     else if (destTrack.isRemoveCustomLoadsEnabled()
         && !getLoadName().equals(carLoads.getDefaultEmptyName())
         && !getLoadName().equals(carLoads.getDefaultLoadName())) {
       // remove this car's final destination if it has one
       setFinalDestination(null);
       setFinalDestinationTrack(null);
       // car arriving into staging with the RWE load?
       if (getLoadName().equals(getReturnWhenEmptyLoadName())) {
         setLoadName(carLoads.getDefaultEmptyName());
       } else {
         setLoadEmpty(); // note that RWE sets the car's final destination
       }
     }
   }
 }