示例#1
0
  public int querySpeedId(String page, String step) {
    int value = -1;
    Speed speed = m_speeds.get(page + "-" + step);

    if (speed != null) {
      value = speed.getId();
    }
    return value;
  }
示例#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;
  }