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; }
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; }
public Set<Integer> querySpeedIds() { return m_config.getSpeeds().keySet(); }