Exemplo n.º 1
0
  /**
   * Retrieves a collection of the tags defined for a race grouped by the age brackets.
   *
   * @param region The region of the race
   * @param race The name of the race.
   * @param includeGenericMatches Should generic race references such as Elf% be included
   * @return SortedMap A map of the gae brackets. Within each age bracket is a sorted map of the
   *     races (one only) and wihtin this is the tags for that race and age.
   */
  private SortedMap<Integer, SortedMap<String, SortedMap<String, String>>> getRaceTagsByAge(
      Region region, String race) {
    // setup a mapped structure
    final SortedMap<Integer, SortedMap<String, SortedMap<String, String>>> ageSets =
        new TreeMap<Integer, SortedMap<String, SortedMap<String, String>>>();
    // Read in the user settings, split where necessary and add to the appropriate age bracket
    for (String key : userMap.getTertiaryKeySet(region, race)) {
      addTagToAgeSet(ageSets, race, key, userMap.getListFor(region, race, key));
    }

    return ageSets;
  }
Exemplo n.º 2
0
 /**
  * Copies the bio data for one race to a new race.
  *
  * @param origRegion The region of the original race
  * @param origRace The name of the original race
  * @param copyRegion The region of the target race
  * @param copyRace The name of the target race
  */
 public void copyRaceTags(
     final String origRegion,
     final String origRace,
     final String copyRegion,
     final String copyRace) {
   Region oldr = Region.getConstant(origRegion);
   Region newr = Region.getConstant(copyRegion);
   for (String key : userMap.getTertiaryKeySet(oldr, origRace)) {
     userMap.addAllToListFor(newr, copyRace, key, userMap.getListFor(oldr, origRace, key));
   }
   final int idx = origRace.indexOf('(');
   String otherRace;
   if (idx >= 0) {
     otherRace = origRace.substring(0, idx).trim() + '%';
   } else {
     otherRace = origRace + '%';
   }
   for (String key : userMap.getTertiaryKeySet(oldr, otherRace)) {
     userMap.addAllToListFor(newr, copyRace, key, userMap.getListFor(oldr, otherRace, key));
   }
 }