|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjboolexpr.BooleanExpression
public abstract class BooleanExpression
The main class to evaluate Boolean String Expressions.
Example 1: read the Boolean String Expression from the left to the
right.
String strBoolExpr = "!true&&false||true";
BooleanExpression boolExpr = null;
try {
boolExpr = BooleanExpression.readLeftToRight(strBoolExpr);
boolean bool = boolExpr.booleanValue();
// bool == true
System.out.println(boolExpr.toString() + " == " + bool);
// (((!true)&&false)||true) == true
} catch (MalformedBooleanException e) {
e.printStackTrace();
}
Example 2: read the Boolean String Expression
from the right to the left.
String strBoolExpr = "!true&&false||true";
BooleanExpression boolExpr = null;
try {
boolExpr = BooleanExpression.readRightToLeft(strBoolExpr);
boolean bool = boolExpr.booleanValue();
// bool == false
System.out.println(boolExpr.toString() + " == " + bool);
// (!(true&&(false||true))) == false
} catch (MalformedBooleanException e) {
e.printStackTrace();
}
| Method Summary | |
|---|---|
boolean |
booleanValue()
|
static BooleanExpression |
readLeftToRight(java.lang.String booleanExpression)
Returns a BooleanExpression that read the Boolean String
Expression from left to right. |
static BooleanExpression |
readRightToLeft(java.lang.String booleanExpression)
Returns a BooleanExpression that read the Boolean String
Expression from right to left. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static BooleanExpression readLeftToRight(java.lang.String booleanExpression)
throws MalformedBooleanException
BooleanExpression that read the Boolean String
Expression from left to right.
booleanExpression - The boolean expression to evaluate.
BooleanExpression that read the Boolean String
Expression from left to right.
MalformedBooleanException - If the supplied boolean expression is malformed.
public static BooleanExpression readRightToLeft(java.lang.String booleanExpression)
throws MalformedBooleanException
BooleanExpression that read the Boolean String
Expression from right to left.
booleanExpression - The boolean expression to evaluate.
BooleanExpression that read the Boolean String
Expression from right to left.
MalformedBooleanException - If the supplied boolean expression is malformed.public boolean booleanValue()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||