|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwebwork.util.SimpleTest
This class is used to handle test expressions in an efficient way. It is more than 5 times faster than the javacc generated Parser.java Instances of the class are retrieved through the static method getSimpleTest. If the method returns null it means the expression was too complex for this class too handle. Complex expressions are those using parenthesis to control the order of evaluation. Those expressions will instead be handled by the old javacc Parser.java class.
ValueStack
,
ComplexException
,
Parser
Field Summary | |
protected static int |
AND
|
protected static char |
AND_CHAR
|
protected static int |
CHECK_NULL
|
protected int |
condition
|
protected static int |
EQUAL
|
protected static char |
EQUAL_CHAR
|
protected java.lang.String |
exp1
|
protected java.lang.String |
exp2
|
protected static int |
GREATER
|
protected static char |
GREATER_CHAR
|
protected static int |
GREATER_EQUAL
|
protected static int |
LESS
|
protected static char |
LESS_CHAR
|
protected static int |
LESS_EQUAL
|
protected boolean |
neg1
|
protected boolean |
neg2
|
protected SimpleTest |
nextTest
|
protected static int |
NONE
|
protected static char |
NOT_CHAR
|
protected static int |
NOT_EQUAL
|
protected int |
operator
|
protected static int |
OR
|
protected static char |
OR_CHAR
|
protected Query |
q1
|
protected Query |
q2
|
protected static char |
QUOTE_CHAR
|
protected int |
sameVal1
|
protected int |
sameVal2
|
protected java.lang.Object |
value1
|
protected java.lang.Object |
value2
|
Constructor Summary | |
SimpleTest()
|
|
SimpleTest(SimpleTest prevTest,
java.lang.String exp)
Create a SimpleTest for the expression exp, and make use of the values found in the previously evaluated expression prevText if possible |
|
SimpleTest(java.lang.String exp)
|
Method Summary | |
protected int |
checkOperator(java.lang.String str)
Look through the expression to find any operators like && or ||, <, > etc. |
protected java.lang.Object |
getConstant(java.lang.String exp)
This method checks if the expression is a constant value. |
static SimpleTest |
getSimpleTest(java.lang.String expression)
Get a SimpleTest object for the expression. |
protected boolean |
resolve(int comp,
int condition)
determine true or false by comparing the comparison result with the operator. |
boolean |
test(ValueStack stack)
|
protected boolean |
test(ValueStack stack,
java.lang.Object prevVal1,
java.lang.Object prevVal2)
The values in prevVal1 and prevVal2 will always be sent in. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final int NONE
protected static final int AND
protected static final int OR
protected static final char AND_CHAR
protected static final char OR_CHAR
protected static final char QUOTE_CHAR
protected static final char EQUAL_CHAR
protected static final char NOT_CHAR
protected static final char GREATER_CHAR
protected static final char LESS_CHAR
protected static final int CHECK_NULL
protected static final int EQUAL
protected static final int NOT_EQUAL
protected static final int GREATER
protected static final int GREATER_EQUAL
protected static final int LESS
protected static final int LESS_EQUAL
protected int condition
protected boolean neg1
protected boolean neg2
protected Query q1
protected Query q2
protected java.lang.String exp1
protected java.lang.String exp2
protected java.lang.Object value1
protected java.lang.Object value2
protected SimpleTest nextTest
protected int operator
protected int sameVal1
protected int sameVal2
Constructor Detail |
public SimpleTest()
public SimpleTest(SimpleTest prevTest, java.lang.String exp) throws ComplexException
public SimpleTest(java.lang.String exp) throws ComplexException
Method Detail |
public static SimpleTest getSimpleTest(java.lang.String expression)
protected int checkOperator(java.lang.String str) throws ComplexException
ComplexException
protected java.lang.Object getConstant(java.lang.String exp)
public boolean test(ValueStack stack)
protected boolean test(ValueStack stack, java.lang.Object prevVal1, java.lang.Object prevVal2)
protected boolean resolve(int comp, int condition)
comp
- the comparison resultcondition
- the condition
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |