Examples of RelationalExprDescr


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

                    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)) );
                                 }
                              
                    }

                    }
View Full Code Here

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

                    state._fsp--;
                    if (state.failed) return result;
                    if ( state.backtracking==0 ) {
                         descr = ConstraintConnectiveDescr.newAnd();
                                  RelationalExprDescr rel = new RelationalExprDescr( "!=", false, null, leftDescr, (e1!=null?e1.result:null) );
                                  descr.addOrMerge( rel );
                                  result = descr;
                             
                    }
                    // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:329:7: ( COMMA e2= expression )*
                    loop32:
                    do {
                        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?e2.result:null) );
                                        descr.addOrMerge( rel );
                                   
                          }

                          }
                          break;

                      default :
                          break loop32;
                        }
                    } while (true);

                    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?e1.result:null) );
                                  descr.addOrMerge( rel );
                                  result = descr;
                             
                    }
                    // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:343:7: ( COMMA e2= expression )*
                    loop33:
                    do {
                        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?e2.result:null) );
                                        descr.addOrMerge( rel );
                                   
                          }

                          }
View Full Code Here

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

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

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

        String className = classAndField[0];
        String field2 = classAndField[1];

        String castedExpression = "((" + className + ")" + field1 + ")." + field2 + (sharpPos2 > 0 ? expr.substring(sharpPos2) : "");

        RelationalExprDescr check = new RelationalExprDescr( "instanceof",
                                                             false,
                                                             null,
                                                             new AtomicExprDescr( field1 ),
                                                             new AtomicExprDescr( className ) );

        String innerCheck = "";
        if ( ccd.getConnective() == ConnectiveType.AND || ccd.getConnective() == ConnectiveType.INC_AND ) {
            ccd.getDescrs().add( childIdx, check );
        } else {
            BaseDescr desc = ccd.getDescrs().get( parentIdx );
            if ( desc instanceof ConstraintConnectiveDescr ) {
                ((ConstraintConnectiveDescr) desc).getDescrs().add( childIdx, check );
            } else {
                ConstraintConnectiveDescr localAnd = new ConstraintConnectiveDescr( ConnectiveType.AND );
                BaseDescr original = ccd.getDescrs().remove( parentIdx );
                localAnd.getDescrs().add( check );
                localAnd.getDescrs().add( original );
                ccd.getDescrs().add( parentIdx, localAnd );
            }
        }
        innerCheck = check.toString() + " && ";

        atomicExpr.setRewrittenExpression(castedExpression);
        return new String[] { innerCheck, castedExpression };
    }
View Full Code Here

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

    private String[] processNullSafeDereferencing( String expr, AtomicExprDescr atomicExpr, ConstraintConnectiveDescr ccd, int nullSafePos, int parentIdx, int childIdx ) {
        // convert "field1!.field2" in ["field1 != null && ", "field1.field2"]
        String field1 = expr.substring( 0, nullSafePos ).trim();
        expr = field1 + "." + expr.substring( nullSafePos + 2 ).trim();
        RelationalExprDescr check = new RelationalExprDescr( "!=",
                                                             false,
                                                             null,
                                                             new AtomicExprDescr( getPreconditionsToAppend( field1 ) ),
                                                             new AtomicExprDescr( "null" ) );
        String innerCheck = "";
        if ( ccd.getConnective() == ConnectiveType.AND || ccd.getConnective() == ConnectiveType.INC_AND ) {
            ccd.getDescrs().add( childIdx, check );
        } else {
            BaseDescr desc = ccd.getDescrs().get( parentIdx );
            if ( desc instanceof ConstraintConnectiveDescr ) {
                ((ConstraintConnectiveDescr) desc).getDescrs().add( childIdx, check );
            } else {
                ConstraintConnectiveDescr localAnd = new ConstraintConnectiveDescr( ConnectiveType.AND );
                BaseDescr original = ccd.getDescrs().remove( parentIdx );
                localAnd.getDescrs().add( check );
                localAnd.getDescrs().add( original );
                ccd.getDescrs().add( parentIdx, localAnd );
            }
        }
        innerCheck = check.toString() + " && ";

        String[] nullCheckAndExpr = new String[] { innerCheck, expr };
        atomicExpr.setRewrittenExpression( expr );
        return nullCheckAndExpr;
    }
View Full Code Here

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

          pushFollow(FOLLOW_instanceOfExpression_in_equalityExpression1429);
          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

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

          pushFollow(FOLLOW_type_in_instanceOfExpression1488);
          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

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

          pushFollow(FOLLOW_expression_in_inExpression1581);
          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:332:7: ( COMMA e2= expression )*
          loop34:
          while (true) {
            int alt34=2;
            int LA34_0 = input.LA(1);
            if ( (LA34_0==COMMA) ) {
              alt34=1;
            }

            switch (alt34) {
            case 1 :
              // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:332:8: COMMA e2= expression
              {
              match(input,COMMA,FOLLOW_COMMA_in_inExpression1600); if (state.failed) return result;
              pushFollow(FOLLOW_expression_in_inExpression1604);
              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 loop34;
            }
          }

          match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_inExpression1625); 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:338:7: in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN
          {
          pushFollow(FOLLOW_in_key_in_inExpression1641);
          in_key();
          state._fsp--;
          if (state.failed) return result;
          match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_inExpression1643); if (state.failed) return result;
          if ( state.backtracking==0 ) {   helper.emit( Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT ); }
          pushFollow(FOLLOW_expression_in_inExpression1665);
          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:346:7: ( COMMA e2= expression )*
          loop35:
          while (true) {
            int alt35=2;
            int LA35_0 = input.LA(1);
            if ( (LA35_0==COMMA) ) {
              alt35=1;
            }

            switch (alt35) {
            case 1 :
              // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:346:8: COMMA e2= expression
              {
              match(input,COMMA,FOLLOW_COMMA_in_inExpression1684); if (state.failed) return result;
              pushFollow(FOLLOW_expression_in_inExpression1688);
              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

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

                         BaseDescr descr = ( (value!=null?((DRL5Expressions.shiftExpression_return)value).result:null) != null &&
                                           ( (!((value!=null?((DRL5Expressions.shiftExpression_return)value).result:null) instanceof AtomicExprDescr)) ||
                                             ((value!=null?input.toString(value.start,value.stop):null).equals(((AtomicExprDescr)(value!=null?((DRL5Expressions.shiftExpression_return)value).result:null)).getExpression())) )) ?
                                  (value!=null?((DRL5Expressions.shiftExpression_return)value).result:null) :
                                  new AtomicExprDescr( (value!=null?input.toString(value.start,value.stop):null) ) ;
                         result = new RelationalExprDescr( (op!=null?((DRL5Expressions.operator_return)op).opr:null), (op!=null?((DRL5Expressions.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

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

                                  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
TOP
Copyright © 2018 www.massapi.com. 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.