@Test public void testLanguagePivotWithOuterDialect() { LanguageIndex index = new LanguageIndex.Builder() .add(lp("en zh-CN")) .add(lp("en zh-TW")) .add(lp("it en")) .addRule(p("zh * HK"), l("zh-TW")) .addRule(p("zh * *"), l("zh-CN")) .build(true); assertEquals(lp("it zh-CN"), index.map(lp("it zh"))); assertEquals(lp("it zh-CN"), index.map(lp("it zh-CN"))); assertEquals(lp("it zh-CN"), index.map(lp("it zh-Hans-CN"))); assertEquals(lp("it zh-CN"), index.map(lp("it zh-XX"))); assertEquals(lp("it zh-TW"), index.map(lp("it zh-TW"))); assertEquals(lp("it zh-TW"), index.map(lp("it zh-HK"))); assertEquals(lp("it zh-TW"), index.map(lp("it-IT zh-HK"))); }
public LanguageDirection map(LanguageDirection pair) { return mappingCache.computeIfAbsent(pair, this::search); }
LanguageIndex { public LanguageDirection map(LanguageDirection pair) { return mappingCache.computeIfAbsent(pair, this::search); } }
LanguageIndex { public LanguageDirection map(LanguageDirection pair) { return mappingCache.computeIfAbsent(pair, this::search); } private  LanguageIndex(Map<SimpleLanguageDirection, List<LanguageDirection>> index, Map<String, List<LanguageRule>> rules, Map<LanguageDirection, LanguageBridge> pivots); }
LanguageIndex { public LanguageDirection map(LanguageDirection pair) { return mappingCache.computeIfAbsent(pair, this::search); } private  LanguageIndex(Map<SimpleLanguageDirection, List<LanguageDirection>> index, Map<String, List<LanguageRule>> rules, Map<LanguageDirection, LanguageBridge> pivots); Set<LanguageDirection> getLanguages(); int size(); LanguageDirection asSingleLanguagePair(); boolean hasPivotLanguage(LanguageDirection direction); LanguageBridge getLanguageBridge(LanguageDirection direction); LanguageDirection map(LanguageDirection pair); LanguageDirection mapIgnoringDirection(LanguageDirection pair); @Override String toString(); }
LanguageIndex { public LanguageDirection map(LanguageDirection pair) { return mappingCache.computeIfAbsent(pair, this::search); } private  LanguageIndex(Map<SimpleLanguageDirection, List<LanguageDirection>> index, Map<String, List<LanguageRule>> rules, Map<LanguageDirection, LanguageBridge> pivots); Set<LanguageDirection> getLanguages(); int size(); LanguageDirection asSingleLanguagePair(); boolean hasPivotLanguage(LanguageDirection direction); LanguageBridge getLanguageBridge(LanguageDirection direction); LanguageDirection map(LanguageDirection pair); LanguageDirection mapIgnoringDirection(LanguageDirection pair); @Override String toString();  }