Class ExpressionLexicalAnalyzer
- java.lang.Object
-
- oracle.spatial.network.nfe.expression.ExpressionLexicalAnalyzer
-
- All Implemented Interfaces:
NFEExpressionAnalyzer
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')
-
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description ExpressionLexicalAnalyzer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ReturnValue
build(NFEFeature feature)
Builds the expression and return the expression value.java.lang.String
getExpression()
Returns the expressionvoid
setExpression(java.lang.String expression)
Sets the expression to analyze.
-
-
-
Field Detail
-
AND
public static java.lang.String AND
AND operator.
-
OR
public static java.lang.String OR
OR operator.
-
AND_NOT
public static java.lang.String AND_NOT
AND NOT operator.
-
OR_NOT
public static java.lang.String OR_NOT
OR NOT operator.
-
EQUALS
public static java.lang.String EQUALS
EQUALS operator.
-
NOT_EQUALS
public static java.lang.String NOT_EQUALS
NOT EQUALS operator.
-
BIGGER_THAN
public static java.lang.String BIGGER_THAN
BIGGER THAN operator.
-
SMALLER_THAN
public static java.lang.String SMALLER_THAN
SMALLER THAN operator.
-
BIGGER_OR_EQUALS_THAN
public static java.lang.String BIGGER_OR_EQUALS_THAN
BIGGER OR EQUALS THAN operator.
-
SMALLER_OR_EQUALS_THAN
public static java.lang.String SMALLER_OR_EQUALS_THAN
SMALLER OR EQUALS THAN operator.
-
MULTIPLICITY
public static java.lang.String MULTIPLICITY
MULTIPLICITY operator.
-
DIVISION
public static java.lang.String DIVISION
DIVISION operator.
-
PLUS
public static java.lang.String PLUS
PLUS operator.
-
MINUS
public static java.lang.String MINUS
MINUS operator.
-
-
Method Detail
-
getExpression
public java.lang.String getExpression()
Returns the expression- Returns:
- expression
-
setExpression
public void setExpression(java.lang.String expression)
Description copied from interface:NFEExpressionAnalyzer
Sets the expression to analyze.- Specified by:
setExpression
in interfaceNFEExpressionAnalyzer
- Parameters:
expression
- expression
-
build
public ReturnValue build(NFEFeature feature) throws InvalidExpressionException
Description copied from interface:NFEExpressionAnalyzer
Builds the expression and return the expression value.- Specified by:
build
in interfaceNFEExpressionAnalyzer
- Parameters:
feature
- feature to use in the expression.- Returns:
- return value, the value can be a boolean or a double.
- Throws:
InvalidExpressionException
- if the expression is not valid
-
-