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(); }
/** * Updates all cars in a kernel. After the update, the cars will all have the same final * destination, load, and next load. */ public void updateKernel() { if (getKernel() != null && getKernel().isLead(this)) { for (Car car : getKernel().getCars()) { car.setFinalDestination(getFinalDestination()); car.setFinalDestinationTrack(getFinalDestinationTrack()); car.setLoadGeneratedFromStaging(isLoadGeneratedFromStaging()); if (CarLoads.instance().containsName(car.getTypeName(), getLoadName())) { car.setLoadName(getLoadName()); } if (CarLoads.instance().containsName(car.getTypeName(), getNextLoadName())) { car.setNextLoadName(getNextLoadName()); } } } }
/** * Updates a car's load when placed at a spur. Load change delayed if wait count is greater than * zero. */ public void updateLoad() { if (getWait() > 0) { return; // change load when wait count reaches 0 } // arriving at spur with a schedule? if (!getNextLoadName().equals(NONE)) { setLoadName(getNextLoadName()); setNextLoadName(NONE); // RWE load and no destination? if (getLoadName().equals(getReturnWhenEmptyLoadName()) && getFinalDestination() == null) { setReturnWhenEmpty(); } return; } // flip load names if (getLoadType().equals(CarLoad.LOAD_TYPE_EMPTY)) { setLoadName(carLoads.getDefaultLoadName()); } else { setLoadEmpty(); } }