Package org.drools.compiler.lang.descr

Examples of org.drools.compiler.lang.descr.RelationalExprDescr


        }

        int i = 0;
        StringBuilder sb = new StringBuilder();
        for (BaseDescr subDescr : subDescrs) {
            RelationalExprDescr relDescr = (RelationalExprDescr)subDescr;
            String[] values = new String[2];
            findExpressionValues(relDescr, values);
            String normalizedExpr;

            if (!getExprBindings(context, pattern, values[1]).isConstant()) {
                normalizedExpr = subExprs[i++];
            } else {
                InternalReadAccessor extractor = getFieldReadAccessor( context, relDescr, pattern.getObjectType(), values[0], null, true );
                if (extractor == null) {
                    normalizedExpr = subExprs[i++];
                } else {
                    ValueType vtype = extractor.getValueType();
                    LiteralRestrictionDescr restrictionDescr = new LiteralRestrictionDescr( relDescr.getOperator(),
                                                                                            relDescr.isNegated(),
                                                                                            relDescr.getParameters(),
                                                                                            values[1],
                                                                                            LiteralRestrictionDescr.TYPE_STRING );
                    normalizedExpr = normalizeMVELLiteralExpression( vtype,
                                                                     getFieldValue(context, vtype, restrictionDescr),
                                                                     subExprs[i++],
                                                                     values[0],
                                                                     relDescr.getOperator(),
                                                                     values[1],
                                                                     restrictionDescr );
                }
            }
View Full Code Here


                                  final Pattern pattern,
                                  final BaseDescr d,
                                  final String expr,
                                  final Map<String, OperatorDescr> aliases ) {

        RelationalExprDescr relDescr = d instanceof RelationalExprDescr ? (RelationalExprDescr) d : null;
        boolean simple = isSimpleExpr( relDescr );

        if ( simple && // simple means also relDescr is != null
                !ClassObjectType.Map_ObjectType.isAssignableFrom( pattern.getObjectType() ) &&
                !ClassObjectType.Match_ObjectType.isAssignableFrom( pattern.getObjectType() ) ) {
View Full Code Here

                                  final Pattern pattern,
                                  final BaseDescr d,
                                  final String expr,
                                  final Map<String, OperatorDescr> aliases ) {

        RelationalExprDescr relDescr = d instanceof RelationalExprDescr ? (RelationalExprDescr) d : null;
        boolean simple = isSimpleExpr( relDescr );

        if ( simple && // simple means also relDescr is != null
                !ClassObjectType.Map_ObjectType.isAssignableFrom( pattern.getObjectType() ) &&
                !ClassObjectType.Match_ObjectType.isAssignableFrom( pattern.getObjectType() ) ) {
View Full Code Here

          pushFollow(FOLLOW_instanceOfExpression_in_equalityExpression1397);
          right=instanceOfExpression();
          state._fsp--;
          if (state.failed) return result;
          if ( state.backtracking==0 ) { if( buildDescr  ) {
                         result = new RelationalExprDescr( (op!=null?op.getText():null), false, null, left, right );
                     }
                   }
          }
          break;
View Full Code Here

          pushFollow(FOLLOW_type_in_instanceOfExpression1456);
          right=type();
          state._fsp--;
          if (state.failed) return result;
          if ( state.backtracking==0 ) { if( buildDescr  ) {
                         result = new RelationalExprDescr( (op!=null?input.toString(op.start,op.stop):null), false, null, left, new AtomicExprDescr((right!=null?input.toString(right.start,right.stop):null)) );
                     }
                   }
          }
          break;
View Full Code Here

          pushFollow(FOLLOW_expression_in_inExpression1549);
          e1=expression();
          state._fsp--;
          if (state.failed) return result;
          if ( state.backtracking==0 ) {   descr = ConstraintConnectiveDescr.newAnd();
                      RelationalExprDescr rel = new RelationalExprDescr( "!=", false, null, leftDescr, (e1!=null?((DRL6Expressions.expression_return)e1).result:null) );
                      descr.addOrMerge( rel );
                      result = descr;
                  }
          // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:329:7: ( COMMA e2= expression )*
          loop32:
          while (true) {
            int alt32=2;
            int LA32_0 = input.LA(1);
            if ( (LA32_0==COMMA) ) {
              alt32=1;
            }

            switch (alt32) {
            case 1 :
              // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:329:8: COMMA e2= expression
              {
              match(input,COMMA,FOLLOW_COMMA_in_inExpression1568); if (state.failed) return result;
              pushFollow(FOLLOW_expression_in_inExpression1572);
              e2=expression();
              state._fsp--;
              if (state.failed) return result;
              if ( state.backtracking==0 ) {   RelationalExprDescr rel = new RelationalExprDescr( "!=", false, null, leftDescr, (e2!=null?((DRL6Expressions.expression_return)e2).result:null) );
                          descr.addOrMerge( rel );
                      }
              }
              break;

            default :
              break loop32;
            }
          }

          match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_inExpression1593); if (state.failed) return result;
          if ( state.backtracking==0 ) { helper.emit( Location.LOCATION_LHS_INSIDE_CONDITION_END ); }
          }
          break;
        case 2 :
          // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:335:7: in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN
          {
          pushFollow(FOLLOW_in_key_in_inExpression1609);
          in_key();
          state._fsp--;
          if (state.failed) return result;
          match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_inExpression1611); if (state.failed) return result;
          if ( state.backtracking==0 ) {   helper.emit( Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT ); }
          pushFollow(FOLLOW_expression_in_inExpression1633);
          e1=expression();
          state._fsp--;
          if (state.failed) return result;
          if ( state.backtracking==0 ) {   descr = ConstraintConnectiveDescr.newOr();
                      RelationalExprDescr rel = new RelationalExprDescr( "==", false, null, leftDescr, (e1!=null?((DRL6Expressions.expression_return)e1).result:null) );
                      descr.addOrMerge( rel );
                      result = descr;
                  }
          // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:343:7: ( COMMA e2= expression )*
          loop33:
          while (true) {
            int alt33=2;
            int LA33_0 = input.LA(1);
            if ( (LA33_0==COMMA) ) {
              alt33=1;
            }

            switch (alt33) {
            case 1 :
              // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:343:8: COMMA e2= expression
              {
              match(input,COMMA,FOLLOW_COMMA_in_inExpression1652); if (state.failed) return result;
              pushFollow(FOLLOW_expression_in_inExpression1656);
              e2=expression();
              state._fsp--;
              if (state.failed) return result;
              if ( state.backtracking==0 ) {   RelationalExprDescr rel = new RelationalExprDescr( "==", false, null, leftDescr, (e2!=null?((DRL6Expressions.expression_return)e2).result:null) );
                          descr.addOrMerge( rel );
                      }
              }
              break;

View Full Code Here

                         BaseDescr descr = ( (value!=null?((DRL6Expressions.shiftExpression_return)value).result:null) != null &&
                                           ( (!((value!=null?((DRL6Expressions.shiftExpression_return)value).result:null) instanceof AtomicExprDescr)) ||
                                             ((value!=null?input.toString(value.start,value.stop):null).equals(((AtomicExprDescr)(value!=null?((DRL6Expressions.shiftExpression_return)value).result:null)).getExpression())) )) ?
                                  (value!=null?((DRL6Expressions.shiftExpression_return)value).result:null) :
                                  new AtomicExprDescr( (value!=null?input.toString(value.start,value.stop):null) ) ;
                         result = new RelationalExprDescr( (op!=null?((DRL6Expressions.operator_return)op).opr:null), (op!=null?((DRL6Expressions.operator_return)op).negated:false), sa, relationalExpression_stack.peek().lsd, descr );
                   if( relationalExpression_stack.peek().lsd instanceof BindingDescr ) {
                       relationalExpression_stack.peek().lsd = new AtomicExprDescr( ((BindingDescr)relationalExpression_stack.peek().lsd).getExpression() );
                   }
                     }
                     helper.emit( Location.LOCATION_LHS_INSIDE_CONDITION_END );
View Full Code Here

          pushFollow(FOLLOW_instanceOfExpression_in_equalityExpression1397);
          right=instanceOfExpression();
          state._fsp--;
          if (state.failed) return result;
          if ( state.backtracking==0 ) { if( buildDescr  ) {
                         result = new RelationalExprDescr( (op!=null?op.getText():null), false, null, left, right );
                     }
                   }
          }
          break;
View Full Code Here

          pushFollow(FOLLOW_type_in_instanceOfExpression1456);
          right=type();
          state._fsp--;
          if (state.failed) return result;
          if ( state.backtracking==0 ) { if( buildDescr  ) {
                         result = new RelationalExprDescr( (op!=null?input.toString(op.start,op.stop):null), false, null, left, new AtomicExprDescr((right!=null?input.toString(right.start,right.stop):null)) );
                     }
                   }
          }
          break;
View Full Code Here

          pushFollow(FOLLOW_expression_in_inExpression1549);
          e1=expression();
          state._fsp--;
          if (state.failed) return result;
          if ( state.backtracking==0 ) {   descr = ConstraintConnectiveDescr.newAnd();
                      RelationalExprDescr rel = new RelationalExprDescr( "!=", false, null, leftDescr, (e1!=null?((DRL5Expressions.expression_return)e1).result:null) );
                      descr.addOrMerge( rel );
                      result = descr;
                  }
          // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:330:7: ( COMMA e2= expression )*
          loop32:
          while (true) {
            int alt32=2;
            int LA32_0 = input.LA(1);
            if ( (LA32_0==COMMA) ) {
              alt32=1;
            }

            switch (alt32) {
            case 1 :
              // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:330:8: COMMA e2= expression
              {
              match(input,COMMA,FOLLOW_COMMA_in_inExpression1568); if (state.failed) return result;
              pushFollow(FOLLOW_expression_in_inExpression1572);
              e2=expression();
              state._fsp--;
              if (state.failed) return result;
              if ( state.backtracking==0 ) {   RelationalExprDescr rel = new RelationalExprDescr( "!=", false, null, leftDescr, (e2!=null?((DRL5Expressions.expression_return)e2).result:null) );
                          descr.addOrMerge( rel );
                      }
              }
              break;

            default :
              break loop32;
            }
          }

          match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_inExpression1593); if (state.failed) return result;
          if ( state.backtracking==0 ) { helper.emit( Location.LOCATION_LHS_INSIDE_CONDITION_END ); }
          }
          break;
        case 2 :
          // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:336:7: in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN
          {
          pushFollow(FOLLOW_in_key_in_inExpression1609);
          in_key();
          state._fsp--;
          if (state.failed) return result;
          match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_inExpression1611); if (state.failed) return result;
          if ( state.backtracking==0 ) {   helper.emit( Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT ); }
          pushFollow(FOLLOW_expression_in_inExpression1633);
          e1=expression();
          state._fsp--;
          if (state.failed) return result;
          if ( state.backtracking==0 ) {   descr = ConstraintConnectiveDescr.newOr();
                      RelationalExprDescr rel = new RelationalExprDescr( "==", false, null, leftDescr, (e1!=null?((DRL5Expressions.expression_return)e1).result:null) );
                      descr.addOrMerge( rel );
                      result = descr;
                  }
          // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:344:7: ( COMMA e2= expression )*
          loop33:
          while (true) {
            int alt33=2;
            int LA33_0 = input.LA(1);
            if ( (LA33_0==COMMA) ) {
              alt33=1;
            }

            switch (alt33) {
            case 1 :
              // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:344:8: COMMA e2= expression
              {
              match(input,COMMA,FOLLOW_COMMA_in_inExpression1652); if (state.failed) return result;
              pushFollow(FOLLOW_expression_in_inExpression1656);
              e2=expression();
              state._fsp--;
              if (state.failed) return result;
              if ( state.backtracking==0 ) {   RelationalExprDescr rel = new RelationalExprDescr( "==", false, null, leftDescr, (e2!=null?((DRL5Expressions.expression_return)e2).result:null) );
                          descr.addOrMerge( rel );
                      }
              }
              break;

View Full Code Here

TOP

Related Classes of org.drools.compiler.lang.descr.RelationalExprDescr

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.