/** * Sets the final destination for a car. * * @param destination The final destination for this car. */ public void setFinalDestination(Location destination) { Location old = _finalDestination; if (old != null) { old.removePropertyChangeListener(this); } _finalDestination = destination; if (_finalDestination != null) { _finalDestination.addPropertyChangeListener(this); } // log.debug("Next destination for car ("+toString()+") old: "+old+" new: "+destination); if ((old != null && !old.equals(destination)) || (destination != null && !destination.equals(old))) { setDirtyAndFirePropertyChange(FINAL_DESTINATION_CHANGED_PROPERTY, old, destination); } }
private void removePropertyChangeLocations() { for (Location location : locationManager.getList()) { location.removePropertyChangeListener(this); } }
private synchronized void removePropertyChangeLocations() { List<Location> locations = locationManager.getList(); for (Location location : locations) { location.removePropertyChangeListener(this); } }