Пример #1
0
  private boolean hasFireProbability(Building b) {
    if (b.getEstimator() != null || b.getSOSEstimateFireSite() != null) return false;

    if ((int) b.virtualData[0].getTemperature() == 0) return false;

    if (b.getFieryness() > 0 && b.getFieryness() != 4) return false;

    //		if (b.getFieryness() == 4 && agent instanceof FireBrigadeAgent)
    //			return false;

    for (Building near : b.neighbors_Building()) {
      if ((near.virtualData[0].getFieryness() > 0 && near.virtualData[0].getFieryness() != 4)
          || (near.getFieryness() > 0 && near.getFieryness() != 4)) return false;
    }

    return true;
  }
Пример #2
0
  /**
   * merge array of fire zone in one fire zone
   *
   * @param target
   */
  private void mergeEstimateFireaite(
      ArrayList<Pair<ArrayList<SOSRealFireZone>, SOSEstimatedFireZone>> target) {

    ArrayList<SOSRealFireZone> realZones = new ArrayList<SOSRealFireZone>();

    getFireSites().removeAll(target);

    SOSEstimatedFireZone newEstimateFireSite = new SOSEstimatedFireZone(lastAssignedIndex++, this);
    SOSEstimatedFireZone fz;

    for (Pair<ArrayList<SOSRealFireZone>, SOSEstimatedFireZone> zone : target) {
      fz = zone.second();

      for (Building b : fz.getAllBuildings()) {
        if (!b.getSOSEstimateFireSite().equals(newEstimateFireSite)) {
          b.setSOSEstimateFireSite(newEstimateFireSite);
          newEstimateFireSite.getAllBuildings().add(b);
          newEstimateFireSite.updateXY(b, 1);
        }
      }

      for (Building b : fz.getEstimatorBuilding()) {
        if (!b.getEstimator().equals(newEstimateFireSite)) {
          b.addToEstimator(newEstimateFireSite);
          newEstimateFireSite.getEstimatorBuilding().add(b);
        }
      }

      realZones.addAll(zone.first());
    }
    newEstimateFireSite.update(model.time());
    getFireSites()
        .add(
            new Pair<ArrayList<SOSRealFireZone>, SOSEstimatedFireZone>(
                realZones, newEstimateFireSite));
  }