예제 #1
0
  public Map<Integer, List<LocationBean>> groupPointsByWeightForContours(int interval) {
    Map<Integer, List<LocationBean>> groupings = new HashMap<Integer, List<LocationBean>>();
    boolean flag = false;
    int minutes = interval;

    while (flag == false) {
      List<LocationBean> currentGroup = new ArrayList<LocationBean>();
      for (LocationBean location : locations) {
        if (location.getGoogleContourWeightFloor() >= minutes) {
          LocationBean newLocation = new LocationBean(location);
          double newWeight = (double) minutes;
          newLocation.setWeight(newWeight);
          currentGroup.add(newLocation);
        }
      }

      if (currentGroup.size() == 0) {
        flag = true;
      } else {
        groupings.put(minutes, currentGroup);
      }

      minutes += interval;
    }

    return groupings;
  }
예제 #2
0
  public Map<Integer, List<LocationBean>> groupLocationsByWeight() {
    Map<Integer, List<LocationBean>> groupings = new HashMap<Integer, List<LocationBean>>();

    for (LocationBean location : this.locations) {
      int weight = location.getGoogleContourWeightFloor();

      if (!groupings.containsKey(weight)) {
        System.out.println(
            "Creating new grouping for weight: " + weight + " from " + location.getWeight());
        groupings.put(weight, new ArrayList<LocationBean>());
      }
      groupings.get(weight).add(location);
    }

    return groupings;
  }