Class SearchPattern
- java.lang.Object
-
- jetbrains.buildServer.util.pathMatcher.SearchPattern
-
public class SearchPattern extends java.lang.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(java.lang.Object obj)
java.lang.String[]
getFullPatternPath()
java.lang.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(java.lang.String patternString)
Initializes a pattern, catches wrong patterns and returns nulljava.lang.String
toString()
static boolean
wildcardMatch(java.lang.String dirOrSubpattern, java.lang.String pattern)
Checks whether subpattern's match area lays completely in pattern's one.
-
-
-
Method Detail
-
patternFromString
@Nullable public static SearchPattern patternFromString(java.lang.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 java.lang.String dirOrSubpattern, @NotNull java.lang.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 java.lang.String getFullPatternString()
- Returns:
- The string (normalized) the pattern was created from
-
getFullPatternPath
public java.lang.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
)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
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
-
-