1
2
3
4
5
6
7
8
9
10 package org.eclipse.jgit.ignore.internal;
11
12 import static org.eclipse.jgit.ignore.internal.Strings.convertGlob;
13
14 import java.util.regex.Pattern;
15
16 import org.eclipse.jgit.errors.InvalidPatternException;
17
18
19
20
21
22
23
24 public class WildCardMatcher extends NameMatcher {
25
26 final Pattern p;
27
28 WildCardMatcher(String pattern, Character pathSeparator, boolean dirOnly)
29 throws InvalidPatternException {
30 super(pattern, pathSeparator, dirOnly, false);
31 p = convertGlob(subPattern);
32 }
33
34
35 @Override
36 public boolean matches(String segment, int startIncl, int endExcl) {
37 return p.matcher(segment.substring(startIncl, endExcl)).matches();
38 }
39 }