Package ch.tocco.nice2.types.api
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
-
Constructor Summary
ConstructorDescriptionGlob
(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()
boolean
Check whether the string contains this Glob's pattern.boolean
Object[]
Get an array of this Glob's segments.int
hashCode()
boolean
boolean
Check whether the string matches this Glob's pattern.Get a Glob surrounded bySUBSTRING
wildcards.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
-true
for 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
-true
for case sensitive mode.substring
- The substring wildcard ('*').character
- The single character wildcard ('?').
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
toString
Convert the Glob back to a pattern string. -
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
Get a Glob surrounded bySUBSTRING
wildcards.- Returns:
- The new Glob.
-
getSegments
Get an array of this Glob's segments. This is anObject
[], where each element is either a string or aGlob.Wildcard
value.- Returns:
- The array of this Glob's segments.
-
clone
-