Examples of FileNameMatcher


Examples of org.eclipse.jgit.fnmatch.FileNameMatcher

    assertEquals(false, matcher.canAppendMatch());
  }

  public void testCreateMatcherForSuffix() throws Exception {
    final String pattern = "helloworld";
    final FileNameMatcher matcher = new FileNameMatcher(pattern, null);
    matcher.append("hello");
    final FileNameMatcher childMatcher = matcher.createMatcherForSuffix();
    assertEquals(false, matcher.isMatch());
    assertEquals(true, matcher.canAppendMatch());
    assertEquals(false, childMatcher.isMatch());
    assertEquals(true, childMatcher.canAppendMatch());
    matcher.append("world");
    assertEquals(true, matcher.isMatch());
    assertEquals(false, matcher.canAppendMatch());
    assertEquals(false, childMatcher.isMatch());
    assertEquals(true, childMatcher.canAppendMatch());
    childMatcher.append("world");
    assertEquals(true, matcher.isMatch());
    assertEquals(false, matcher.canAppendMatch());
    assertEquals(true, childMatcher.isMatch());
    assertEquals(false, childMatcher.canAppendMatch());
    childMatcher.reset();
    assertEquals(true, matcher.isMatch());
    assertEquals(false, matcher.canAppendMatch());
    assertEquals(false, childMatcher.isMatch());
    assertEquals(true, childMatcher.canAppendMatch());
    childMatcher.append("world");
    assertEquals(true, matcher.isMatch());
    assertEquals(false, matcher.canAppendMatch());
    assertEquals(true, childMatcher.isMatch());
    assertEquals(false, childMatcher.canAppendMatch());
  }
View Full Code Here

Examples of org.eclipse.jgit.fnmatch.FileNameMatcher

    assertEquals(false, childMatcher.canAppendMatch());
  }

  public void testCopyConstructor() throws Exception {
    final String pattern = "helloworld";
    final FileNameMatcher matcher = new FileNameMatcher(pattern, null);
    matcher.append("hello");
    final FileNameMatcher copy = new FileNameMatcher(matcher);
    assertEquals(false, matcher.isMatch());
    assertEquals(true, matcher.canAppendMatch());
    assertEquals(false, copy.isMatch());
    assertEquals(true, copy.canAppendMatch());
    matcher.append("world");
    assertEquals(true, matcher.isMatch());
    assertEquals(false, matcher.canAppendMatch());
    assertEquals(false, copy.isMatch());
    assertEquals(true, copy.canAppendMatch());
    copy.append("world");
    assertEquals(true, matcher.isMatch());
    assertEquals(false, matcher.canAppendMatch());
    assertEquals(true, copy.isMatch());
    assertEquals(false, copy.canAppendMatch());
    copy.reset();
    assertEquals(true, matcher.isMatch());
    assertEquals(false, matcher.canAppendMatch());
    assertEquals(false, copy.isMatch());
    assertEquals(true, copy.canAppendMatch());
    copy.append("helloworld");
    assertEquals(true, matcher.isMatch());
    assertEquals(false, matcher.canAppendMatch());
    assertEquals(true, copy.isMatch());
    assertEquals(false, copy.canAppendMatch());
  }
View Full Code Here

Examples of org.eclipse.jgit.fnmatch.FileNameMatcher

      pattern = "/" + pattern;
    }

    if (pattern.contains("*") || pattern.contains("?") || pattern.contains("[")) {
      try {
        matcher = new FileNameMatcher(pattern, new Character('/'));
      } catch (InvalidPatternException e) {
        e.printStackTrace();
      }
    }
  }
View Full Code Here

Examples of org.eclipse.jgit.fnmatch.FileNameMatcher

  private static boolean isHostPattern(final String s) {
    return s.indexOf('*') >= 0 || s.indexOf('?') >= 0;
  }

  private static boolean isHostMatch(final String pattern, final String name) {
    final FileNameMatcher fn;
    try {
      fn = new FileNameMatcher(pattern, null);
    } catch (InvalidPatternException e) {
      return false;
    }
    fn.append(name);
    return fn.isMatch();
  }
View Full Code Here

Examples of org.eclipse.jgit.fnmatch.FileNameMatcher

      pattern = "/" + pattern;
    }

    if (pattern.contains("*") || pattern.contains("?") || pattern.contains("[")) {
      try {
        matcher = new FileNameMatcher(pattern, Character.valueOf('/'));
      } catch (InvalidPatternException e) {
        // Ignore pattern exceptions
      }
    }
  }
View Full Code Here

Examples of org.eclipse.jgit.fnmatch.FileNameMatcher

  private static boolean isHostPattern(final String s) {
    return s.indexOf('*') >= 0 || s.indexOf('?') >= 0;
  }

  private static boolean isHostMatch(final String pattern, final String name) {
    final FileNameMatcher fn;
    try {
      fn = new FileNameMatcher(pattern, null);
    } catch (InvalidPatternException e) {
      return false;
    }
    fn.append(name);
    return fn.isMatch();
  }
View Full Code Here

Examples of org.eclipse.jgit.fnmatch.FileNameMatcher

      pattern = "/" + pattern; //$NON-NLS-1$
    }

    if (pattern.contains("*") || pattern.contains("?") || pattern.contains("[")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
      try {
        matcher = new FileNameMatcher(pattern, Character.valueOf('/'));
      } catch (InvalidPatternException e) {
        // Ignore pattern exceptions
      }
    }
  }
View Full Code Here

Examples of org.spearce_voltpatches.jgit.fnmatch.FileNameMatcher

    private static boolean isHostPattern(final String s) {
        return s.indexOf('*') >= 0 || s.indexOf('?') >= 0;
    }

    private static boolean isHostMatch(final String pattern, final String name) {
        final FileNameMatcher fn;
        try {
            fn = new FileNameMatcher(pattern, null);
        }
        catch(InvalidPatternException e) {
            return false;
        }
        fn.append(name);
        return fn.isMatch();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.