public class ExpressionLexicalAnalyzer extends java.lang.Object implements NFEExpressionAnalyzer
The supported operators are AND, OR, AND NOT, OR NOT, =, !=, >, <, >=, <=, *, /, +, -, (, )
If you want to get as result a double us only *, /, +, -, (, ) and numbers. The most common case is when evaluating an attribute expression to apply a customized cost based on numerical attributes.
Examples of valid expressions that will return a double, COST is an attribute of the feature used to build the expression:
1) COST*5/4 2) 8*(4-3)
You may want to get a boolean as returned value. The most common case is when evaluating NFE rules attributes expressions. Note that any string has to be quoted.
Examples of valid expression that will return a boolean, LENGTH and NAME are attributes of the feature used to build the expression:
1) LENGTH = 1 2) (LENGTH + 2) = 5 AND (NAME = 'Peter' OR NAME = 'John')
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AND
AND operator.
|
static java.lang.String |
AND_NOT
AND NOT operator.
|
static java.lang.String |
BIGGER_OR_EQUALS_THAN
BIGGER OR EQUALS THAN operator.
|
static java.lang.String |
BIGGER_THAN
BIGGER THAN operator.
|
static java.lang.String |
DIVISION
DIVISION operator.
|
static java.lang.String |
EQUALS
EQUALS operator.
|
static java.lang.String |
MINUS
MINUS operator.
|
static java.lang.String |
MULTIPLICITY
MULTIPLICITY operator.
|
static java.lang.String |
NOT_EQUALS
NOT EQUALS operator.
|
static java.lang.String |
OR
OR operator.
|
static java.lang.String |
OR_NOT
OR NOT operator.
|
static java.lang.String |
PLUS
PLUS operator.
|
static java.lang.String |
SMALLER_OR_EQUALS_THAN
SMALLER OR EQUALS THAN operator.
|
static java.lang.String |
SMALLER_THAN
SMALLER THAN operator.
|
Constructor and Description |
---|
ExpressionLexicalAnalyzer() |
Modifier and Type | Method and Description |
---|---|
ReturnValue |
build(NFEFeature feature)
Builds the expression and return the expression value.
|
java.lang.String |
getExpression()
Returns the expression
|
void |
setExpression(java.lang.String expression)
Sets the expression to analyze.
|
public static java.lang.String AND
public static java.lang.String OR
public static java.lang.String AND_NOT
public static java.lang.String OR_NOT
public static java.lang.String EQUALS
public static java.lang.String NOT_EQUALS
public static java.lang.String BIGGER_THAN
public static java.lang.String SMALLER_THAN
public static java.lang.String BIGGER_OR_EQUALS_THAN
public static java.lang.String SMALLER_OR_EQUALS_THAN
public static java.lang.String MULTIPLICITY
public static java.lang.String DIVISION
public static java.lang.String PLUS
public static java.lang.String MINUS
public java.lang.String getExpression()
public void setExpression(java.lang.String expression)
NFEExpressionAnalyzer
setExpression
in interface NFEExpressionAnalyzer
expression
- expressionpublic ReturnValue build(NFEFeature feature) throws InvalidExpressionException
NFEExpressionAnalyzer
build
in interface NFEExpressionAnalyzer
feature
- feature to use in the expression.InvalidExpressionException
- if the expression is not valid