|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.cosylab.util.WildcharMatcher
public class WildcharMatcher
A Unix-like wildchar matcher. Supported wild-characters: '', '?'; sets: [a-z], '!' negation Examples: '[a-g]li?n' matches 'florian' '[!abc]e' matches 'smile' '[-z] matches 'a' Rules for sets: RegEx definition of the valid set is: [!]?(-.)?((.-.)|(.))(.-)? a-z : match any letter between 'a' and 'z' inclusively [-a : match everything up to and including 'a' (only valid at beginning) a-] : match everything from 'a' (only valid at the end) a : match exactly 'a' !a : not operator, match everything except 'a' (only allowed at beginning) \a : treat a literally (useful for specifying '!]-' in sets. Note that \t\b\n... are not processed. Wildchar rules: : match any number (0..inf) number of occurences of any character ? : match exactly and only one occurence of any character ab : match exactly 'ab' [..]: same as , but character must match the set.
Constructor Summary | |
---|---|
WildcharMatcher()
|
Method Summary | |
---|---|
static void |
main(java.lang.String[] args)
Run test applet. |
static boolean |
match(java.lang.String pattern,
java.lang.String str)
DOCUMENT ME! |
static boolean |
parse(java.lang.String pattern,
int ofp,
java.lang.String str,
int ofs)
Recursive method for parsing the string. |
static boolean |
testSet(java.lang.String pattern,
int offset,
char ch)
DFA for parsing set strings. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WildcharMatcher()
Method Detail |
---|
public static boolean testSet(java.lang.String pattern, int offset, char ch)
pattern
- DOCUMENT ME!offset
- DOCUMENT ME!ch
- DOCUMENT ME!
public static boolean parse(java.lang.String pattern, int ofp, java.lang.String str, int ofs)
pattern
- Pattern used in parsingofp
- Offset into pattern string (ofp > 0)str
- String to testofs
- Offset into test string (ofs > 0);
public static boolean match(java.lang.String pattern, java.lang.String str)
pattern
- DOCUMENT ME!str
- DOCUMENT ME!
public static void main(java.lang.String[] args)
args
- command line parameters
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |