|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.lonniepryor.blues.util.Strings | +--com.lonniepryor.blues.util.TokenizedStrings
Specification interface for identifying Strings or parts of Strings that are delimeted by a paticular character. Canidate strings are parsed in the same form as by an instance of StringTokenizer set to not return tokens (leasding, trailing, and consecutive delimeters are ignored). Instances of this class may be logically combined using the AND, OR, and NOT operations. Instances may also be sequentially constructed using the Builder class. Many common use-cases are supplied via static accessor methods.
Nested Class Summary | |
static class |
TokenizedStrings.Builder
Helper class for sequentially constructing the elements of a common TokenizedStrings specification. |
Nested classes inherited from class com.lonniepryor.blues.util.Strings |
Strings.Builder |
Method Summary | |
static Strings |
anyTokens()
Returns a specification satisfied by any non-null string. |
protected boolean |
evaluate(java.lang.String canidate,
int begin,
int end)
Returns true if the specified range satisfies this specification. |
static Strings |
matchingToken(java.lang.String stringPattern,
char delimeter)
Returns a specification satisfied by single-token strings matching the specified string pattern. |
static Strings |
matchingToken(Strings specification,
char delimeter)
Returns a specification satisfied by single-token strings that satisfy the supplied specification. |
static Strings |
parse(java.lang.String tokStringPattern,
char delimeter)
Parses a delimeted string pattern containing the '*' wildcard. |
static Strings |
parseExpression(java.lang.String tokStringPatternExpr,
char delimeter)
Parses a logical expression as described in the Expression class, using this class's parse() method for creating values. |
static TokenizedStrings.Builder |
startingWithAnyTokens()
Returns a Builder whose resulting Strings specification will allow any number of inital tokens. |
static TokenizedStrings.Builder |
startingWithAtLeastNumTokens(int minTokens)
Returns a Builder whose resulting Strings specification will require at least the supplied number of inital tokens. |
static TokenizedStrings.Builder |
startingWithToken(java.lang.String stringPattern)
Returns a Builder whose resulting Strings specification will require the supplied pattern at the beginning of canidate strings. |
static TokenizedStrings.Builder |
startingWithToken(Strings specification)
Returns a Builder whose resulting Strings specification will require the supplied specification at the beginning of canidate strings. |
static Strings |
withAtLeastNumTokens(int minTokens,
char delimeter)
Returns a specification satisfied by strings with the specified minimum number of tokens. |
Methods inherited from class com.lonniepryor.blues.util.Strings |
and, any, isSatisfiedBy, isSatisfiedBy, isSatisfiedByAll, isSatisfiedByAny, matching, matching, not, notEmpty, or, parse, parseExpression, selectAll, selectFirst, startingWith, startingWith, startingWithAny, startingWithAtLeastNumChars, withAtLeastNumChars |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static Strings anyTokens()
public static Strings withAtLeastNumTokens(int minTokens, char delimeter)
minTokens
- The minimum number of tokens in valid strings.delimeter
- The token delimeter.
public static Strings matchingToken(java.lang.String stringPattern, char delimeter)
stringPattern
- The pattern for the single token canidates.delimeter
- The token delimeter.
Strings.parse(String)
public static Strings matchingToken(Strings specification, char delimeter)
specification
- The specification for the single token canidates.delimeter
- The token delimeter.
public static TokenizedStrings.Builder startingWithAnyTokens()
public static TokenizedStrings.Builder startingWithAtLeastNumTokens(int minTokens)
minTokens
- The minimum number of tokens to require.
public static TokenizedStrings.Builder startingWithToken(java.lang.String stringPattern)
stringPattern
- The pattern required at the beginning of canidates.
Strings.parse(String)
public static TokenizedStrings.Builder startingWithToken(Strings specification)
specification
- The specification required at the beginning of canidates.
public static Strings parse(java.lang.String tokStringPattern, char delimeter)
tok-strings ::= token [ delimiter token ]... token ::= See Strings.parse() delimiter ::= delim-char [ delim-char ] delim-char ::= Any single characterAstriks will match zero or more characters except the delimeter. Double delimeters will match any number of delimeted tokens, all other characters are matched exactly. Patterns may not start or end with the delimeter.
tokStringPattern
- The content of the pattern.delimeter
- The token delimeter.
ParseException
- if the pattern is invalid.Strings.parse(String)
public static Strings parseExpression(java.lang.String tokStringPatternExpr, char delimeter)
tokStringPatternExpr
- The content of the pattern expression.delimeter
- The token delimeter.
ParseException
- if the pattern expression is invalid.Expression
,
parse(String, char)
protected final boolean evaluate(java.lang.String canidate, int begin, int end)
Strings
evaluate
in class Strings
canidate
- The String to test.begin
- The beginning of the range (inclusive).end
- The end of the range(excusive).
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |