@Test public void testMatchesExactly () throws Exception { NumberMatcher matcher = new NumberMatcher(); assertTrue(matcher.matches("Abraham Lincoln came 1834 to Ealing, 4 times in a row, riding 23 horses", "Abraham Lincoln came 1934 to Ealing, 4 times in a row, riding 23 horses")); assertTrue(matcher.matches("Abraham Lincoln came 1834 to Ealing, 4 times in a row", "1834 was the year of the goose in Chinese calendar. 4 geese where beatified.")); }
@Override public boolean matches(String s1, String s2) { if (s1 == null && s2 == null) return true; String no1 = removeNumbers.transform(s1); String no2 = removeNumbers.transform(s2); if (noNumbersRequireRestMatch && no1.length() == 0 && no2.length() == 0) { return (s1.equals(s2)); } else { return super.matches(no1, no2); } }
NumberMatcher extends CommonTokensMatcher { @Override public boolean matches(String s1, String s2) { if (s1 == null && s2 == null) return true; String no1 = removeNumbers.transform(s1); String no2 = removeNumbers.transform(s2); if (noNumbersRequireRestMatch && no1.length() == 0 && no2.length() == 0) { return (s1.equals(s2)); } else { return super.matches(no1, no2); } } }
NumberMatcher extends CommonTokensMatcher { @Override public boolean matches(String s1, String s2) { if (s1 == null && s2 == null) return true; String no1 = removeNumbers.transform(s1); String no2 = removeNumbers.transform(s2); if (noNumbersRequireRestMatch && no1.length() == 0 && no2.length() == 0) { return (s1.equals(s2)); } else { return super.matches(no1, no2); } }  }
NumberMatcher extends CommonTokensMatcher { @Override public boolean matches(String s1, String s2) { if (s1 == null && s2 == null) return true; String no1 = removeNumbers.transform(s1); String no2 = removeNumbers.transform(s2); if (noNumbersRequireRestMatch && no1.length() == 0 && no2.length() == 0) { return (s1.equals(s2)); } else { return super.matches(no1, no2); } }  @Override int getCost(); @Override boolean matches(String s1, String s2); @Override boolean isExact(); @Override String getExecutionReport(); boolean isNoNumbersRequireRestMatch(); void setNoNumbersRequireRestMatch(boolean noNumbersRequireRestMatch); }
NumberMatcher extends CommonTokensMatcher { @Override public boolean matches(String s1, String s2) { if (s1 == null && s2 == null) return true; String no1 = removeNumbers.transform(s1); String no2 = removeNumbers.transform(s2); if (noNumbersRequireRestMatch && no1.length() == 0 && no2.length() == 0) { return (s1.equals(s2)); } else { return super.matches(no1, no2); } }  @Override int getCost(); @Override boolean matches(String s1, String s2); @Override boolean isExact(); @Override String getExecutionReport(); boolean isNoNumbersRequireRestMatch(); void setNoNumbersRequireRestMatch(boolean noNumbersRequireRestMatch); static int COST; public boolean noNumbersRequireRestMatch; }