예제 #1
0
  /**
   * Adds valid aliases to one of per-RawOffset table and removes invalid aliases from aliases List.
   * Aliases referring to excluded zones are not added to a per-RawOffset table.
   */
  void resolve() {
    int index = rawOffsetsIndexTable.size();
    List<String> toBeRemoved = new ArrayList<String>();
    for (String key : aliases.keySet()) {
      boolean validname = false;
      for (int j = 0; j < index; j++) {
        Set<String> perRO = rawOffsetsIndexTable.get(j);
        boolean isExcluded = (excludeList == null) ? false : excludeList.contains(key);

        if ((perRO.contains(aliases.get(key)) || isExcluded) && Zone.isTargetZone(key)) {
          validname = true;
          if (!isExcluded) {
            perRO.add(key);
            Main.info("Alias <" + key + "> added to the list.");
          }
          break;
        }
      }

      if (!validname) {
        Main.info("Alias <" + key + "> removed from the list.");
        toBeRemoved.add(key);
      }
    }

    // Remove zones, if any, from the list.
    for (String key : toBeRemoved) {
      aliases.remove(key);
    }
  }