コード例 #1
0
 private static void outputNames(GeoSkillsParseListener.NamesMap map) {
   for (Iterator<String> it = map.getLanguages(); it.hasNext(); ) {
     String lang = it.next();
     for (Iterator<GeoSkillsParseListener.NameWithFrequency> i = map.getNames(lang);
         i.hasNext(); ) {
       System.out.print(lang + " : ");
       GeoSkillsParseListener.NameWithFrequency nf = i.next();
       System.out.print(nf.getFrequency());
       System.out.print(" : ");
       System.out.println(nf.getName());
     }
   }
 }
コード例 #2
0
 private static void assertNoDuplicateNames(GeoSkillsParseListener.NamesMap map, String uri) {
   Set set = new HashSet();
   for (Iterator<String> it = map.getLanguages(); it.hasNext(); ) {
     String lang = it.next();
     set.clear();
     for (Iterator<GeoSkillsParseListener.NameWithFrequency> namesIt = map.getNames(lang);
         namesIt.hasNext(); ) {
       GeoSkillsParseListener.NameWithFrequency nwf = namesIt.next();
       String name = nwf.getName();
       if (set.contains(name))
         throw new AssertionFailedError("Name \"" + name + "\" is duplicate in " + uri + ".");
     }
   }
 }