@Test public void testQuest2() { String regex = "abc?pqr?"; GramBooleanQuery exactQuery = RegexToGramQueryTranslator.translate(regex); GramBooleanQuery expectedQuery = new GramBooleanQuery(GramBooleanQuery.QueryOp.OR); GramBooleanQuery expectedFirstAnd = new GramBooleanQuery(GramBooleanQuery.QueryOp.AND); expectedQuery.subQuerySet.add(expectedFirstAnd); expectedFirstAnd.subQuerySet.addAll(getLeafNodeList("abp", "bpq")); GramBooleanQuery expectedSecondAnd = new GramBooleanQuery(GramBooleanQuery.QueryOp.AND); expectedQuery.subQuerySet.add(expectedSecondAnd); expectedSecondAnd.subQuerySet.addAll(getLeafNodeList("abc", "bcp", "cpq")); printTranslatorResult(regex); Assert.assertEquals(expectedQuery, exactQuery); Assert.assertEquals(exactQuery, expectedQuery); }
public static GramBooleanQuery translate(String regex) throws com.google.re2j.PatternSyntaxException { return translate(regex, TranslatorUtils.DEFAULT_GRAM_LENGTH); }
RegexToGramQueryTranslator { public static GramBooleanQuery translate(String regex) throws com.google.re2j.PatternSyntaxException { return translate(regex, TranslatorUtils.DEFAULT_GRAM_LENGTH); } }
RegexToGramQueryTranslator { public static GramBooleanQuery translate(String regex) throws com.google.re2j.PatternSyntaxException { return translate(regex, TranslatorUtils.DEFAULT_GRAM_LENGTH); }  }
RegexToGramQueryTranslator { public static GramBooleanQuery translate(String regex) throws com.google.re2j.PatternSyntaxException { return translate(regex, TranslatorUtils.DEFAULT_GRAM_LENGTH); }  static GramBooleanQuery translate(String regex); static GramBooleanQuery translate(String regex, int gramLength); }
RegexToGramQueryTranslator { public static GramBooleanQuery translate(String regex) throws com.google.re2j.PatternSyntaxException { return translate(regex, TranslatorUtils.DEFAULT_GRAM_LENGTH); }  static GramBooleanQuery translate(String regex); static GramBooleanQuery translate(String regex, int gramLength);  }