예제 #1
0
    /*
     * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
     */
    public boolean select(Viewer viewer, Object parentElement, Object element) {
      StringMatcher matcher = getMatcher();
      if (matcher == null || !(viewer instanceof TreeViewer)) return true;
      TreeViewer treeViewer = (TreeViewer) viewer;

      String matchName = ((ILabelProvider) treeViewer.getLabelProvider()).getText(element);
      matchName = TextProcessor.deprocess(matchName);
      if (matchName != null && matcher.match(matchName)) return true;

      return hasUnfilteredChild(treeViewer, element);
    }
예제 #2
0
 @Override
 public boolean match(final String text) {
   if (super.match(text)) {
     return true;
   } else {
     for (Filter filter : operationFilters) {
       if (filter.getEnabled()) {
         StringMatcher stringMatcher = new StringMatcher(filter.getPattern(), false, false);
         if (stringMatcher.match(text)) {
           return true;
         }
       }
     }
   }
   return false;
 }
예제 #3
0
 protected boolean matches(String string, int offset, int length) {
   return !matcher.matches(string, offset, length);
 }
예제 #4
0
 /**
  * Answers whether the given String matches the pattern.
  *
  * @param string the String to test
  * @return whether the string matches the pattern
  */
 protected boolean match(String string) {
   return matcher.match(string);
 }
 @Test(expected = IllegalArgumentException.class)
 public void testException() {
   StringMatcher.naiveMatcher(text1, pattern2);
   StringMatcher.finiteAutomataMatcher(text1, pattern2);
   StringMatcher.KMPmatcher(text2, pattern2);
 }
 private boolean accepted(String name) {
   return regularExpressionMatcher.matches(name);
 }
 @Test
 public void testKMP() {
   assertEquals(1, StringMatcher.KMPmatcher(text1, pattern1));
   assertEquals(1, StringMatcher.KMPmatcher(text2, pattern1));
   assertEquals(6, StringMatcher.KMPmatcher(text2, pattern3));
 }
 @Test
 public void testFiniteAutomata() {
   assertEquals(1, StringMatcher.finiteAutomataMatcher(text1, pattern1));
   assertEquals(1, StringMatcher.finiteAutomataMatcher(text2, pattern1));
   assertEquals(6, StringMatcher.finiteAutomataMatcher(text2, pattern3));
 }
 @Test
 public void testNaive() {
   assertEquals(1, StringMatcher.naiveMatcher(text1, pattern1));
   assertEquals(1, StringMatcher.naiveMatcher(text2, pattern1));
   assertEquals(6, StringMatcher.naiveMatcher(text2, pattern3));
 }
예제 #10
0
 public boolean matches(String string) {
   return matcher1.matches(string) || matcher2.matches(string);
 }
예제 #11
0
 public boolean matches(char[] string, int start, int end) {
   return matcher1.matches(string, start, end) || matcher2.matches(string, start, end);
 }