Class ExpressionLexicalAnalyzer
- java.lang.Object
-
- oracle.spatial.network.nfe.expression.ExpressionLexicalAnalyzer
-
- All Implemented Interfaces:
NFEExpressionAnalyzer
public class ExpressionLexicalAnalyzer extends java.lang.Object implements NFEExpressionAnalyzer
Default implementation for 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.StringANDAND operator.static java.lang.StringAND_NOTAND NOT operator.static java.lang.StringBIGGER_OR_EQUALS_THANBIGGER OR EQUALS THAN operator.static java.lang.StringBIGGER_THANBIGGER THAN operator.static java.lang.StringDIVISIONDIVISION operator.static java.lang.StringEQUALSEQUALS operator.static java.lang.StringMINUSMINUS operator.static java.lang.StringMULTIPLICITYMULTIPLICITY operator.static java.lang.StringNOT_EQUALSNOT EQUALS operator.static java.lang.StringOROR operator.static java.lang.StringOR_NOTOR NOT operator.static java.lang.StringPLUSPLUS operator.static java.lang.StringSMALLER_OR_EQUALS_THANSMALLER OR EQUALS THAN operator.static java.lang.StringSMALLER_THANSMALLER THAN operator.
-
Constructor Summary
Constructors Constructor Description ExpressionLexicalAnalyzer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ReturnValuebuild(NFEFeature feature)Builds the expression and return the expression value.java.lang.StringgetExpression()Returns the expressionvoidsetExpression(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:NFEExpressionAnalyzerSets the expression to analyze.- Specified by:
setExpressionin interfaceNFEExpressionAnalyzer- Parameters:
expression- expression
-
build
public ReturnValue build(NFEFeature feature) throws InvalidExpressionException
Description copied from interface:NFEExpressionAnalyzerBuilds the expression and return the expression value.- Specified by:
buildin 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
-
-