Class Glob
java.lang.Object
ch.tocco.nice2.types.api.Glob
- All Implemented Interfaces:
Cloneable
A glob implementation. Globs are simple patterns supporting the wildcards '?' (match
any single character) and '*' (match any number of arbitrary characters). The two
wildcards may actually be replaced by whatever you like.
See http://en.wikipedia.org/wiki/Glob_(programming)
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionGlob(CharSequence pattern) Create a case insensitive Glob from the given pattern using the default wildcard characters.Glob(CharSequence pattern, boolean caseSensitive) Create a Glob from the given pattern using the default wildcard characters.Glob(CharSequence pattern, boolean caseSensitive, char substring, char character) Create a Glob from the given pattern.Glob(CharSequence pattern, char substring, char character) Create a Glob from the given pattern using the specified wildcard characters. -
Method Summary
Modifier and TypeMethodDescriptionclone()booleanCheck whether the string contains this Glob's pattern.booleanObject[]Get an array of this Glob's segments.inthashCode()booleanbooleanCheck whether the string matches this Glob's pattern.Get a Glob surrounded bySUBSTRINGwildcards.toString()Convert the Glob back to a pattern string.toString(char substring, char character) Convert the Glob back to a pattern string using the specified wildcard characters.
-
Constructor Details
-
Glob
Create a case insensitive Glob from the given pattern using the default wildcard characters.- Parameters:
pattern- The pattern.
-
Glob
Create a Glob from the given pattern using the default wildcard characters.- Parameters:
pattern- The pattern.caseSensitive-truefor case sensitive mode.
-
Glob
Create a Glob from the given pattern using the specified wildcard characters.- Parameters:
pattern- The pattern.substring- The substring wildcard ('*').character- The single character wildcard ('?').
-
Glob
Create a Glob from the given pattern.- Parameters:
pattern- The pattern.caseSensitive-truefor case sensitive mode.substring- The substring wildcard ('*').character- The single character wildcard ('?').
-
-
Method Details
-
equals
-
hashCode
-
toString
-
toString
Convert the Glob back to a pattern string using the specified wildcard characters.- Parameters:
substring- The substring wildcard ('*').character- The single character wildcard ('?').- Returns:
- The pattern string.
-
isCaseSensitive
public boolean isCaseSensitive() -
matches
Check whether the string matches this Glob's pattern.- Parameters:
match- The string to match.- Returns:
true, if the string matches.
-
contains
Check whether the string contains this Glob's pattern.- Parameters:
match- The string to match.- Returns:
true, if the string contains the pattern.
-
toContainsGlob
-
getSegments
Get an array of this Glob's segments. This is anObject[], where each element is either a string or aGlob.Wildcardvalue.- Returns:
- The array of this Glob's segments.
-
clone
-