|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sandev.basics.util.MatchUtil
Simple match expression evaluation. This class allows you to compare a a value to an expression through recursive evaluation of the tokenized expression form. This is NOT intended for use in
For information on more advanced matchers, contact
Structs And Nodes Development Services
| Constructor Summary | |
MatchUtil()
|
|
| Method Summary | |
static java.lang.String |
blend(java.lang.String attr,
java.lang.String val)
Given an attribute and a value in standard match expression form, convert the match expression to an infix form with the attribute specified. |
static boolean |
eval(java.util.Date val,
java.lang.String expr)
Return true if the given value matches the given expression, false otherwise. |
static boolean |
eval(java.util.Date val,
java.lang.String[] expr,
int index)
Return true if the given value matches the tokenized expression, false otherwise. |
static boolean |
eval(double val,
java.lang.String expr)
Return true if the given value matches the given expression, false otherwise. |
static boolean |
eval(double val,
java.lang.String[] expr,
int index)
Return true if the given value matches the tokenized expression, false otherwise. |
static boolean |
eval(int val,
java.lang.String expr)
Return true if the given value matches the given expression, false otherwise. |
static boolean |
eval(long val,
java.lang.String expr)
Return true if the given value matches the given expression, false otherwise. |
static boolean |
eval(long val,
java.lang.String[] expr,
int index)
Return true if the given value matches the tokenized expression, false otherwise. |
static boolean |
eval(java.lang.String val,
java.lang.String expr)
Return true if the given value matches the given expression, false otherwise. |
static boolean |
eval(java.lang.String val,
java.lang.String[] expr,
int index)
Return true if the given value matches the tokenized expression, false otherwise. |
static void |
insertImpliedEqualityOperators(java.util.ArrayList al)
Given a tokenized expression, insert any missing implied equality operators. |
static boolean |
isCompound(java.lang.String expr)
Return true if this is a compound expression, false otherwise. |
static boolean |
isOperator(java.lang.String oper)
Return true if this is a valid operator, false otherwise. |
static java.lang.String |
nextToken(java.util.StringTokenizer toker)
Given a StringTokenizer, return the next token taking into account quoted string values. |
static java.lang.String |
normalizeExprFormat(java.lang.String expr)
Return the normalized form of the expression so that the returned expression can be tokenized on whitespace. |
static int |
rangeDigitsInteger(java.lang.String rangeExpr,
int defaultVal)
Given an integer value range specification, return the likely number of digits necessary for display. |
static boolean |
startsWithOp(java.lang.String expr)
Returns true if the given expr string starts with an operator as defined by normalizeExprFormat. |
static java.lang.String[] |
tokenize(java.lang.String expr)
Given an expression, return an array of tokens. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public MatchUtil()
| Method Detail |
public static boolean eval(int val,
java.lang.String expr)
public static boolean eval(long val,
java.lang.String expr)
public static boolean eval(double val,
java.lang.String expr)
public static boolean eval(java.lang.String val,
java.lang.String expr)
public static boolean eval(java.util.Date val,
java.lang.String expr)
public static boolean eval(long val,
java.lang.String[] expr,
int index)
public static boolean eval(double val,
java.lang.String[] expr,
int index)
public static boolean eval(java.lang.String val,
java.lang.String[] expr,
int index)
public static boolean eval(java.util.Date val,
java.lang.String[] expr,
int index)
public static boolean isOperator(java.lang.String oper)
public static java.lang.String[] tokenize(java.lang.String expr)
public static void insertImpliedEqualityOperators(java.util.ArrayList al)
public static java.lang.String nextToken(java.util.StringTokenizer toker)
public static int rangeDigitsInteger(java.lang.String rangeExpr,
int defaultVal)
public static java.lang.String normalizeExprFormat(java.lang.String expr)
<, <=, >, >=, =, !=
AND, OR, NOT
This method may add additional whitespace around operators. Embedded whitespace is a possibility, and consuming methods must be prepared to handle any corresponding empty tokens from this formatting when tokenizing the resulting string on whitespace. This method ensures that operators are whitespace delimited, but does not trim whitespace or ensure minimum whitespace.
public static boolean startsWithOp(java.lang.String expr)
public static java.lang.String blend(java.lang.String attr,
java.lang.String val)
> 18 AND < 50
myAttr > 18 AND myAttr < 50
The value is assumed to be in normalized form so it can be tokenized on whitespace.
public static boolean isCompound(java.lang.String expr)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||