Examples of FileNameMatcher


Examples of ch.powerunit.matchers.file.FileNameMatcher

   * @param matcher
   *            the matcher on the name.
   * @return the matcher on the file.
   */
  default Matcher<File> fileNamed(Matcher<? super String> matcher) {
    return new FileNameMatcher(matcher);
  }
View Full Code Here

Examples of ch.powerunit.matchers.file.FileNameMatcher

     * @param matcher
     *            the matcher on the name.
     * @return the matcher on the file.
     */
    default Matcher<File> fileNamed(Matcher<? super String> matcher) {
        return new FileNameMatcher(matcher);
    }
View Full Code Here

Examples of floobits.common.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.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) {
        e.printStackTrace();
      }
    }
  }
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.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

public class FileNameMatcherTest extends TestCase {

  private void assertMatch(final String pattern, final String input,
      final boolean matchExpected, final boolean appendCanMatchExpected)
      throws InvalidPatternException {
    final FileNameMatcher matcher = new FileNameMatcher(pattern, null);
    matcher.append(input);
    assertEquals(matchExpected, matcher.isMatch());
    assertEquals(appendCanMatchExpected, matcher.canAppendMatch());
  }
View Full Code Here

Examples of org.eclipse.jgit.fnmatch.FileNameMatcher

  private void assertFileNameMatch(final String pattern, final String input,
      final char excludedCharacter, final boolean matchExpected,
      final boolean appendCanMatchExpected)
      throws InvalidPatternException {
    final FileNameMatcher matcher = new FileNameMatcher(pattern,
        new Character(excludedCharacter));
    matcher.append(input);
    assertEquals(matchExpected, matcher.isMatch());
    assertEquals(appendCanMatchExpected, matcher.canAppendMatch());
  }
View Full Code Here

Examples of org.eclipse.jgit.fnmatch.FileNameMatcher

    assertFileNameMatch("a?b", "a\\b", '\\', false, false);
  }

  public void testReset() throws Exception {
    final String pattern = "helloworld";
    final FileNameMatcher matcher = new FileNameMatcher(pattern, null);
    matcher.append("helloworld");
    assertEquals(true, matcher.isMatch());
    assertEquals(false, matcher.canAppendMatch());
    matcher.reset();
    matcher.append("hello");
    assertEquals(false, matcher.isMatch());
    assertEquals(true, matcher.canAppendMatch());
    matcher.append("world");
    assertEquals(true, matcher.isMatch());
    assertEquals(false, matcher.canAppendMatch());
    matcher.append("to much");
    assertEquals(false, matcher.isMatch());
    assertEquals(false, matcher.canAppendMatch());
    matcher.reset();
    matcher.append("helloworld");
    assertEquals(true, matcher.isMatch());
    assertEquals(false, matcher.canAppendMatch());
  }
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.