示例#1
0
文件: BioSet.java 项目: kidaa/pcgen
  public AgeSet getAgeSet(Region region, int index) {
    AgeSet ageSet = ageMap.get(region, index);

    if ((ageSet == null) || !ageSet.hasBonuses()) {
      ageSet = ageMap.get(Region.getConstant("None"), index);
    }

    return ageSet;
  }
示例#2
0
文件: BioSet.java 项目: kidaa/pcgen
 public AgeSet addToAgeMap(String regionName, AgeSet ageSet, URI sourceURI) {
   AgeSet old = ageMap.get(Region.getConstant(regionName), ageSet.getIndex());
   if (old != null) {
     if (ageSet.hasBonuses()
         || !ageSet.getKits().isEmpty()
         || !ageSet.getName().equals(old.getName())) {
       Logging.errorPrint(
           "Found second (non-identical) AGESET "
               + "in Bio Settings "
               + sourceURI
               + " for Region: "
               + regionName
               + " Index: "
               + ageSet.getIndex()
               + " using the existing "
               + old.getLSTformat());
     }
     return old;
   }
   ageMap.put(Region.getConstant(regionName), ageSet.getIndex(), ageSet);
   return ageSet;
 }
示例#3
0
文件: BioSet.java 项目: kidaa/pcgen
  private String appendAgesetInfo(
      Region region,
      final SortedMap<Integer, SortedMap<String, SortedMap<String, String>>> ageSets,
      final StringBuilder sb) {
    Set<Integer> ageIndices = new TreeSet<Integer>();
    ageIndices.addAll(ageSets.keySet());
    ageIndices.addAll(ageNames.values());
    // Iterate through ages, outputing the info
    for (Integer key : ageIndices) {
      final SortedMap<String, SortedMap<String, String>> races = ageSets.get(key);
      if (races == null) {
        continue;
      }

      sb.append("AGESET:");
      sb.append(ageMap.get(region, key).getLSTformat()).append("\n");

      for (Iterator<String> raceIt = races.keySet().iterator(); raceIt.hasNext(); ) {
        final String aRaceName = raceIt.next();

        if (!"AGESET".equals(aRaceName)) {
          final SortedMap<String, String> tags = races.get(aRaceName);

          for (Iterator<String> tagIt = tags.keySet().iterator(); tagIt.hasNext(); ) {
            final String tagName = tagIt.next();
            sb.append("RACENAME:").append(aRaceName).append("\t\t");
            sb.append(tagName).append(':').append(tags.get(tagName)).append("\n");
          }
        }
      }

      sb.append("\n");
    }

    return sb.toString();
  }
示例#4
0
 /**
  * Returns a copy of the List contained in this MapKeyMap for the given ListKey. This method
  * returns null if the given key is not in this MapKeyMap.
  *
  * <p>This method is value-semantic in that no changes are made to the object passed into the
  * method and ownership of the returned List is transferred to the class calling this method.
  *
  * @param key The ListKey for which a copy of the list should be returned.
  * @return a copy of the List contained in this MapKeyMap for the given key; null if the given key
  *     is not a key in this MapKeyMap.
  */
 public <K, V> V get(MapKey<K, V> key1, K key2) {
   return (V) map.get(key1, key2);
 }