/** * merge real fire zones * * @param targets * @param mergeList */ private void mergeRealFireZones( Pair<ArrayList<SOSRealFireZone>, SOSEstimatedFireZone> target, ArrayList<SOSAbstractFireZone> mergeList) { if (target == null) return; ArrayList<SOSRealFireZone> realZones = target.first(); getFireSites().remove(target); SOSRealFireZone newRealFireSite = new SOSRealFireZone(lastAssignedIndex++, this); SOSRealFireZone real; for (SOSAbstractFireZone fz : mergeList) { real = (SOSRealFireZone) fz; realZones.remove(real); for (Building b : real.getAllBuildings()) { if (!b.getSOSRealFireSite().equals(newRealFireSite)) { b.setSOSRealFireSite(newRealFireSite); newRealFireSite.addFieryBuilding(b); newRealFireSite.updateXY(b, 1); } } real.update(model.time()); } realZones.add(newRealFireSite); getFireSites() .add( new Pair<ArrayList<SOSRealFireZone>, SOSEstimatedFireZone>(realZones, target.second())); }
private void updateNewSite(Building b, SOSAbstractFireZone f) { // TODO BFS log.info("updating building of new Site " + f + " checkin for " + b); if (f instanceof SOSEstimatedFireZone) { if ((b.virtualData[0].getFieryness() > 0) && b.getSOSEstimateFireSite() == null) { f.addFieryBuilding(b); log.info(b + " addet to fireSite " + f); b.setSOSEstimateFireSite((SOSEstimatedFireZone) f); for (Building b2 : b.realNeighbors_Building()) { updateNewSite(b2, f); } } } else if (f instanceof SOSRealFireZone) { if ((b.getFieryness() > 0) && b.getSOSRealFireSite() == null) { f.addFieryBuilding(b); log.info(b + " addet to fireSite " + f); b.setSOSRealFireSite((SOSRealFireZone) f); for (Building b2 : b.realNeighbors_Building()) { updateNewSite(b2, f); } } } }