Class TokenizedPattern
java.lang.Object
org.apache.tools.ant.types.selectors.TokenizedPattern
Provides reusable path pattern matching. 
TokenizedPattern
 is preferable to equivalent SelectorUtils methods if you need to
 execute multiple matching with the same pattern because here the pattern
 itself will be parsed only once.- Since:
- 1.8.0
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final TokenizedPatternInstance that holds no tokens at all.
- 
Constructor SummaryConstructorsConstructorDescriptionTokenizedPattern(String pattern) Initialize theTokenizedPatternby parsing it.
- 
Method SummaryModifier and TypeMethodDescriptionbooleancontainsPattern(String pat) Does the tokenized pattern contain the given string?intdepth()Get the depth (or length) of a pattern.booleanLearn whether the last token equals the given string.booleantrueif the original patterns are equal.Get the pattern.inthashCode()booleanmatchPath(TokenizedPath path, boolean isCaseSensitive) Tests whether or not a given path matches a given pattern.booleanmatchStartOf(TokenizedPath path, boolean caseSensitive) Tests whether or not this pattern matches the start of a path.Returns a newTokenizedPathwhere all tokens of this pattern to the right containing wildcards have been removed.toString()Returns a new pattern without the last token of this pattern.
- 
Field Details- 
EMPTY_PATTERNInstance that holds no tokens at all.
 
- 
- 
Constructor Details- 
TokenizedPatternInitialize theTokenizedPatternby parsing it.- Parameters:
- pattern- The pattern to match against. Must not be- null.
 
 
- 
- 
Method Details- 
matchPathTests whether or not a given path matches a given pattern.- Parameters:
- path- The path to match, as a- String. Must not be- null.
- isCaseSensitive- Whether or not matching should be performed case sensitively.
- Returns:
- trueif the pattern matches against the string, or- falseotherwise.
 
- 
matchStartOfTests whether or not this pattern matches the start of a path.- Parameters:
- path-- TokenizedPath
- caseSensitive-- boolean
- Returns:
- boolean
 
- 
toString
- 
getPatternGet the pattern.- Returns:
- String
 
- 
equalstrueif the original patterns are equal.
- 
hashCodepublic int hashCode()
- 
depthpublic int depth()Get the depth (or length) of a pattern.- Returns:
- int
 
- 
containsPatternDoes the tokenized pattern contain the given string?- Parameters:
- pat-- String
- Returns:
- boolean
 
- 
rtrimWildcardTokensReturns a newTokenizedPathwhere all tokens of this pattern to the right containing wildcards have been removed.- Returns:
- the leftmost part of the pattern without wildcards
 
- 
endsWithLearn whether the last token equals the given string.- Parameters:
- s-- String
- Returns:
- boolean
 
- 
withoutLastTokenReturns a new pattern without the last token of this pattern.- Returns:
- TokenizedPattern
 
 
-