Class ExpressionLexicalAnalyzer

  • All Implemented Interfaces:
    NFEExpressionAnalyzer

    public class ExpressionLexicalAnalyzer
    extends java.lang.Object
    implements NFEExpressionAnalyzer

    Skip navigation links

    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.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.
    • 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 expression
      void setExpression​(java.lang.String expression)
      Sets the expression to analyze.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.
    • Constructor Detail

      • ExpressionLexicalAnalyzer

        public ExpressionLexicalAnalyzer()