SearchQuery implements Serializable { public static SearchQuery searchTanaka(final DictTypeEnum sampleDictType, final String word, final boolean isJapanese, final RomanizationEnum romanization, final String langCode) { if(sampleDictType!=DictTypeEnum.Tanaka && sampleDictType!=DictTypeEnum.Tatoeba) { throw new RuntimeException("Invalid dictionary type: "+sampleDictType); } final SearchQuery result = new SearchQuery(sampleDictType); result.query = parseQuery(word, isJapanese, romanization); result.isJapanese = isJapanese; result.matcher = MatcherEnum.Substring; result.langCode = langCode; return result; } SearchQuery(final DictTypeEnum dictType);  SearchQuery(SearchQuery other); boolean requiresKanjidic(); SearchQuery trim(); String prettyPrintQuery(); static SearchQuery kanjiSearch(final char kanji, final Integer strokes, final Integer strokesPlusMinus); static SearchQuery searchEnEdict(final String word, final boolean exact); static SearchQuery searchJpEdict(final String text, final MatcherEnum matcher); static SearchQuery searchTanaka(final DictTypeEnum sampleDictType, final String word, final boolean isJapanese, final RomanizationEnum romanization, final String langCode); static SearchQuery searchJpRomaji(final String word, final RomanizationEnum romanization, final MatcherEnum matcher); void validate(); public String[] query; public boolean isJapanese; public String langCode; public MatcherEnum matcher; public Integer strokeCount; public String skip; public Integer radical; public Integer strokesPlusMinus; final DictTypeEnum dictType; }
@Test public void tanakaAndParserEn() { final SearchQuery q = SearchQuery.searchTanaka(DictTypeEnum.Tanaka, "mother AND father", false, null, null); Assert.assertArrayEquals(q.query, new String[]{"mother AND father"}); }
@Test public void tanakaAndParserJp() { final RomanizationEnum r = RomanizationEnum.NihonShiki; final SearchQuery q = SearchQuery.searchTanaka(DictTypeEnum.Tanaka, "haha AND chichi", true, r, null); Assert.assertArrayEquals(q.query, new String[]{r.toKatakana("haha") + " AND " + r.toKatakana("chichi"), r.toHiragana("haha") + " AND " + r.toHiragana("chichi")}); }