|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--kirk.util.Wildcard
This class represents a wildcard. You construct this class by supplying the wildcard String, and then you can use it to check whether Strings comply to the wildcard. The default values for single character checking and any amount of character checking are ? and *, but you can specify your own when constructing.
Field Summary | |
protected char |
anyamount
The character that indicates any amount of characters. |
protected char |
single
The character that indicates any single character. |
protected java.lang.String |
wildcard
The wildcard this class represents. |
Constructor Summary | |
Wildcard(java.lang.String wildcard)
Constructs a new Wildcard with the specified wildcard, and the default character values. |
|
Wildcard(java.lang.String wildcard,
char single,
char anyamount)
Constructs a new Wildcard with the specified wildcard, and the specified character values. |
Method Summary | |
java.lang.String |
getWildcard()
Returns the wildcard this object represents. |
boolean |
test(java.lang.String line)
Returns whether the passed line complies with this wildcard. |
protected boolean |
testAnyAmount(java.util.StringTokenizer tokenizer,
java.lang.String line,
int index)
Returns whether the passed line complies to the passed wildcard indicated by tokenizer, up to the point where a string token appears in the wildcard. |
protected boolean |
testSingle(java.util.StringTokenizer tokenizer,
java.lang.String line,
int index)
Returns whether the passed line complies to the passed wildcard indicated by tokenizer, up to the point where an anyamount token appears in the wildcard. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.String wildcard
protected char single
protected char anyamount
Constructor Detail |
public Wildcard(java.lang.String wildcard, char single, char anyamount)
wildcard
- The wildcard that strings that are tested with this object
must comply with to pass.single
- The character that specifies a single character in a wildcard.anyamount
- The character that specifies any amount of characters in a
wildcard.public Wildcard(java.lang.String wildcard)
wildcard
- The wildcard that strings that are tested with this object
must comply with to pass.Method Detail |
public boolean test(java.lang.String line)
line
- The line to be checked.
protected boolean testSingle(java.util.StringTokenizer tokenizer, java.lang.String line, int index)
tokenizer
- The wildcard in a StringTokenizer.line
- The line to be tested.index
- The current position into line.
protected boolean testAnyAmount(java.util.StringTokenizer tokenizer, java.lang.String line, int index)
tokenizer
- The wildcard in a StringTokenizer.line
- The line to be tested.index
- The current position into line.
public java.lang.String getWildcard()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |