|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.twelvemonkeys.util.regex.WildcardStringParser
public class WildcardStringParser
This class parses arbitrary strings against a wildcard string mask provided. The wildcard characters are '*' and '?'.
The string masks provided are treated as case sensitive.This task is performed based on regular expression techniques. The possibilities of string generation with the well-known wildcard characters stated above, represent a subset of the possibilities of string generation with regular expressions.
Examples of usage:
WildcardStringParser parser = new WildcardStringParser("*_28????.jp*");
if (parser.parseString("gupu_280915.jpg")) {
System.out.println("Accepted!");
} else {
System.out.println("Not accepted!");
}
Theories and concepts are based on the book Elements of the Theory of Computation, by Harry l. Lewis and Christos H. Papadimitriou, (c) 1981 by Prentice Hall.
| Field Summary | |
|---|---|
static char[] |
ALPHABET
Deprecated. Field ALPHABET |
static char |
FREE_PASS_CHARACTER
Deprecated. Field FREE_PASS_CHARACTER |
static char |
FREE_RANGE_CHARACTER
Deprecated. Field FREE_RANGE_CHARACTER |
| Constructor Summary | |
|---|---|
WildcardStringParser(String pStringMask)
Deprecated. Creates a wildcard string parser. |
|
WildcardStringParser(String pStringMask,
boolean pDebugging)
Deprecated. Creates a wildcard string parser. |
|
WildcardStringParser(String pStringMask,
boolean pDebugging,
PrintStream pDebuggingPrintStream)
Deprecated. Creates a wildcard string parser. |
|
| Method Summary | |
|---|---|
protected Object |
clone()
Deprecated. |
boolean |
equals(Object pObject)
Deprecated. Method equals |
protected void |
finalize()
Deprecated. |
String |
getStringMask()
Deprecated. Gets the string mask that was used when building the parser atomaton. |
int |
hashCode()
Deprecated. Method hashCode |
static boolean |
isFreePassCharacter(char pCharToCheck)
Deprecated. Tests if a certain character is the designated "free-pass" character ('?'). |
static boolean |
isFreeRangeCharacter(char pCharToCheck)
Deprecated. Tests if a certain character is the designated "free-range" character ('*'). |
static boolean |
isInAlphabet(char pCharToCheck)
Deprecated. Tests if a certain character is a valid character in the alphabet that is applying for this automaton. |
static boolean |
isWildcardCharacter(char pCharToCheck)
Deprecated. Tests if a certain character is a wildcard character ('*' or '?'). |
boolean |
parseString(String pStringToParse)
Deprecated. Parses a string according to the rules stated above. |
String |
toString()
Deprecated. Method toString |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final char[] ALPHABET
public static final char FREE_RANGE_CHARACTER
public static final char FREE_PASS_CHARACTER
| Constructor Detail |
|---|
public WildcardStringParser(String pStringMask)
pStringMask - the wildcard string mask.
public WildcardStringParser(String pStringMask,
boolean pDebugging)
pStringMask - the wildcard string mask.pDebugging - true will cause debug messages to be emitted to System.out.
public WildcardStringParser(String pStringMask,
boolean pDebugging,
PrintStream pDebuggingPrintStream)
pStringMask - the wildcard string mask.pDebugging - true will cause debug messages to be emitted.pDebuggingPrintStream - the java.io.PrintStream to which the debug messages will be emitted.| Method Detail |
|---|
public static boolean isInAlphabet(char pCharToCheck)
public static boolean isFreeRangeCharacter(char pCharToCheck)
public static boolean isFreePassCharacter(char pCharToCheck)
public static boolean isWildcardCharacter(char pCharToCheck)
public String getStringMask()
public boolean parseString(String pStringToParse)
pStringToParse - the string to parse.
true if and only if the string are accepted by the automaton.public String toString()
toString in class Objectpublic boolean equals(Object pObject)
equals in class ObjectpObject -
public int hashCode()
hashCode in class Object
protected Object clone()
throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedException
protected void finalize()
throws Throwable
finalize in class ObjectThrowable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||