Class SearchPattern
- java.lang.Object
-
- jetbrains.buildServer.util.pathMatcher.SearchPattern
-
public class SearchPattern extends Object
Parses pattern into pieces and provides methods to check whether a certain directory can contain useful files or whether a file matches the pattern.
Also offers a way to check whether a certain pattern is a super-pattern of this one (any file matching this pattern will always match the super-pattern).
isSubPatternOf(SearchPattern)
- Author:
- Sergey.Pak Date: 6/24/13 Time: 7:19 PM
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
SearchPattern.PatternPart
Represents the part of pattern during search as we narrow it down during traversing through the path tree.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
String[]
getFullPatternPath()
String
getFullPatternString()
SearchPattern.PatternPart
getInitialState()
Returns the initial state with given indexjetbrains.buildServer.util.pathMatcher.RuleType
getRuleType()
int
hashCode()
boolean
isSubPatternOf(SearchPattern widePattern)
checks whether this pattern is a subpattern (more narrow) than given onestatic SearchPattern
patternFromString(String patternString)
Initializes a pattern, catches wrong patterns and returns nullstatic void
populatePatternsList(List<SearchPattern> source, List<SearchPattern> destination, Condition<SearchPattern> condition, boolean strictRulesApplyFirst)
String
toString()
static boolean
wildcardMatch(String dirOrSubpattern, String pattern)
Checks whether subpattern's match area lays completely in pattern's one.
-
-
-
Method Detail
-
patternFromString
@Nullable public static SearchPattern patternFromString(String patternString)
Initializes a pattern, catches wrong patterns and returns null- Parameters:
patternString
- string to create a pattern from- Returns:
- SearchPattern, if string is properly formatted
false otherwise
-
wildcardMatch
public static boolean wildcardMatch(@NotNull String dirOrSubpattern, @NotNull String pattern)
Checks whether subpattern's match area lays completely in pattern's one. This method is also used to check whether the directory matches against the pattern (wildcard)- Parameters:
dirOrSubpattern
- subpattern or directory to match againstpattern
- pattern to match against- Returns:
- true if subpattern or directory matches against the pattern
false otherwise
-
getFullPatternString
public String getFullPatternString()
- Returns:
- The string (normalized) the pattern was created from
-
getFullPatternPath
public String[] getFullPatternPath()
- Returns:
- The string (normalized) the pattern was created from
-
getRuleType
public jetbrains.buildServer.util.pathMatcher.RuleType getRuleType()
- Returns:
- rule type (INCLUDE or EXCLUDE. See
RuleType
)
-
isSubPatternOf
public boolean isSubPatternOf(SearchPattern widePattern)
checks whether this pattern is a subpattern (more narrow) than given one- Parameters:
widePattern
- super-pattern candidate- Returns:
- true, when candidate matches all this pattern can match.
Also returns true when candidate is the same as this.
false otherwise
-
getInitialState
public SearchPattern.PatternPart getInitialState()
Returns the initial state with given index- Returns:
- the initial state
-
populatePatternsList
public static void populatePatternsList(@NotNull List<SearchPattern> source, @NotNull List<SearchPattern> destination, @NotNull Condition<SearchPattern> condition, boolean strictRulesApplyFirst)
-
-