Esempio n. 1
0
  private void updateData() {
    Map<Integer, Speed> speeds = m_config.getSpeeds();
    Map<String, Speed> tmp = new ConcurrentHashMap<String, Speed>();

    for (Entry<Integer, Speed> entry : speeds.entrySet()) {
      Speed s = entry.getValue();

      tmp.put(s.getPage() + "-" + s.getStep(), s);
    }
    m_speeds = tmp;
  }
Esempio n. 2
0
  public int generateId() {
    List<Integer> ids = new ArrayList<Integer>();

    for (Speed s : m_config.getSpeeds().values()) {
      ids.add(s.getId());
    }
    int max = 0;

    if (!ids.isEmpty()) {
      Collections.sort(ids);
      max = ids.get(ids.size() - 1);
    }

    if (ids.size() < max) {
      for (int i = 1; i <= max; i++) {
        if (!ids.contains(i)) {
          return i;
        }
      }
    }
    return max + 1;
  }
Esempio n. 3
0
 public Set<Integer> querySpeedIds() {
   return m_config.getSpeeds().keySet();
 }