|
Web Site | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.codehaus.janino.util.StringPattern
Implementation of a UNIX shell-like string pattern algorithm.
Additionally, the concept of the "combined pattern" is supported (see
matches(StringPattern[], String).
| Field Summary | |
static int |
EXCLUDE
|
static int |
INCLUDE
|
| Constructor Summary | |
StringPattern(int mode,
String pattern)
|
|
| Method Summary | |
int |
getMode()
|
boolean |
matches(String text)
Match the given text against the pattern represented by the current instance,
as follows:
A * in the pattern matches any sequence of zero or more characters in the
text
A ? in the pattern matches exactly one character in the text
Any other character in the pattern must appear exactly as it is in the text
Notice: The mode flag of the current instance does not take any effect here. |
static boolean |
matches(StringPattern[] optionalPatterns,
String text)
Match a given text against an array of StringPatterns (which was
typically created by parseCombinedPattern(String). |
static StringPattern[] |
parseCombinedPattern(String combinedPattern)
Parse a "combined pattern" into an array of StringPatterns. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int INCLUDE
matches(StringPattern[], String),
Constant Field Valuespublic static final int EXCLUDE
matches(StringPattern[], String),
Constant Field Values| Constructor Detail |
public StringPattern(int mode,
String pattern)
| Method Detail |
public int getMode()
public boolean matches(String text)
text against the pattern represented by the current instance,
as follows:
* in the pattern matches any sequence of zero or more characters in the
text
? in the pattern matches exactly one character in the text
text
mode flag of the current instance does not take any effect here.
public static StringPattern[] parseCombinedPattern(String combinedPattern)
StringPatterns. A combined pattern
string is structured as follows:
combined-pattern :=
[ '+' | '-' ] pattern
{ ( '+' | '-' ) pattern }
If a pattern is preceeded with a '-', then the StringPattern is created with mode
EXCLUDE, otherwise with mode INCLUDE.
public static boolean matches(StringPattern[] optionalPatterns,
String text)
text against an array of StringPatterns (which was
typically created by parseCombinedPattern(String).
The last matching pattern takes effect; if its mode is INCLUDE, then
true is returned, if its mode is EXCLUDE, then false is
returned.
If optionalPatterns is null, or empty, or none of its patterns
matches, then false is returned.
public String toString()
|
Web Site | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||