FuzzyMatcher implements CompletionMatcher { @Override public boolean match(CandidateUnit c) { String name = c.getName(); boolean first = true; if (c instanceof ClassIndex) { ClassIndex index = (ClassIndex) c; String indexPackage = index.getPackage(); } return this.matchString(name); } FuzzyMatcher(final String query);  FuzzyMatcher(final String query, final Double factor);  FuzzyMatcher(final String query, final boolean advanced, Source source); @Override boolean matchString(String s); @Override boolean match(CandidateUnit c); @Override Predicate<CandidateUnit> filter(); @Override Comparator<CandidateUnit> comparator(); static Comparator<CandidateUnit> simpleComparator(final String k);  }
@Test public void match1() { CompletionMatcher matcher = new FuzzyMatcher("Map"); ClassIndex c = new ClassIndex("Main", Collections.emptyList(), Collections.emptyList()); boolean b = matcher.match(c); assertFalse(b); }
@Test public void match2() { CompletionMatcher matcher = new FuzzyMatcher("Map"); ClassIndex c = new ClassIndex("MallocParser", Collections.emptyList(), Collections.emptyList()); boolean b = matcher.match(c); assertTrue(b); c = new ClassIndex("AbstractMap", Collections.emptyList(), Collections.emptyList()); b = matcher.match(c); assertFalse(b); matcher = new FuzzyMatcher("Map", true, null); b = matcher.match(c); assertTrue(b); }
@Test public void match3() { CompletionMatcher matcher = new FuzzyMatcher("is"); ClassIndex c = new ClassIndex("isNull", Collections.emptyList(), Collections.emptyList()); boolean b = matcher.match(c); assertFalse(b); matcher = new FuzzyMatcher("ia"); b = matcher.match(c); assertFalse(b); matcher = new FuzzyMatcher("isN"); b = matcher.match(c); assertTrue(b); matcher = new FuzzyMatcher("isn", 1.9); b = matcher.match(c); assertTrue(b); }