Package org.drools.lang.descr

Examples of org.drools.lang.descr.RelationalExprDescr


                expr = expr.substring( expr.indexOf( '(' ) + 1,
                                       expr.lastIndexOf( ')' ) );
            }
            sbuilder.append( expr );
        } else if ( base instanceof RelationalExprDescr ) {
            RelationalExprDescr red = (RelationalExprDescr) base;
            String left = dump( red.getLeft(),
                                Integer.MAX_VALUE ); // maximum precedence, so wrap any child connective in parenthesis
            String right = dump( red.getRight(),
                                Integer.MAX_VALUE );
            processRestriction( context,
                                sbuilder,
                                left,
                                red.getOperatorDescr(),
                                right );// maximum precedence, so wrap any child connective in parenthesis
        } else if ( base instanceof ExprConstraintDescr ) {
            DrlExprParser expr = new DrlExprParser();
            ConstraintConnectiveDescr result = expr.parse( ((ExprConstraintDescr) base).getExpression() );
            if ( result.getDescrs().size() == 1 ) {
View Full Code Here


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

                  }
View Full Code Here

                    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

                    state._fsp--;
                    if (state.failed) return result;
                    if ( state.backtracking==0 ) {
                         descr = ConstraintConnectiveDescr.newAnd();
                                  RelationalExprDescr rel = new RelationalExprDescr( "!=", false, null, left, (e1!=null?e1.result:null) );
                                  descr.addOrMerge( rel );
                                  result = descr;
                             
                    }
                    // /home/etirelli/workspace/jboss/drools/core/drools-compiler/src/main/resources/org/drools/lang/DRLExpressions.g:242:7: ( COMMA e2= expression )*
                    loop27:
                    do {
                        int alt27=2;
                        int LA27_0 = input.LA(1);

                        if ( (LA27_0==COMMA) ) {
                            alt27=1;
                        }


                        switch (alt27) {
                      case 1 :
                          // /home/etirelli/workspace/jboss/drools/core/drools-compiler/src/main/resources/org/drools/lang/DRLExpressions.g:242:8: COMMA e2= expression
                          {
                          match(input,COMMA,FOLLOW_COMMA_in_inExpression1274); if (state.failed) return result;
                          pushFollow(FOLLOW_expression_in_inExpression1278);
                          e2=expression();

                          state._fsp--;
                          if (state.failed) return result;
                          if ( state.backtracking==0 ) {
                               RelationalExprDescr rel = new RelationalExprDescr( "!=", false, null, left, (e2!=null?e2.result:null) );
                                        descr.addOrMerge( rel );
                                   
                          }

                          }
                          break;

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

                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_inExpression1299); if (state.failed) return result;

                    }
                    break;
                case 2 :
                    // /home/etirelli/workspace/jboss/drools/core/drools-compiler/src/main/resources/org/drools/lang/DRLExpressions.g:247:7: in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN
                    {
                    pushFollow(FOLLOW_in_key_in_inExpression1309);
                    in_key();

                    state._fsp--;
                    if (state.failed) return result;
                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_inExpression1311); if (state.failed) return result;
                    pushFollow(FOLLOW_expression_in_inExpression1315);
                    e1=expression();

                    state._fsp--;
                    if (state.failed) return result;
                    if ( state.backtracking==0 ) {
                         descr = ConstraintConnectiveDescr.newOr();
                                  RelationalExprDescr rel = new RelationalExprDescr( "==", false, null, left, (e1!=null?e1.result:null) );
                                  descr.addOrMerge( rel );
                                  result = descr;
                             
                    }
                    // /home/etirelli/workspace/jboss/drools/core/drools-compiler/src/main/resources/org/drools/lang/DRLExpressions.g:253:7: ( COMMA e2= expression )*
                    loop28:
                    do {
                        int alt28=2;
                        int LA28_0 = input.LA(1);

                        if ( (LA28_0==COMMA) ) {
                            alt28=1;
                        }


                        switch (alt28) {
                      case 1 :
                          // /home/etirelli/workspace/jboss/drools/core/drools-compiler/src/main/resources/org/drools/lang/DRLExpressions.g:253:8: COMMA e2= expression
                          {
                          match(input,COMMA,FOLLOW_COMMA_in_inExpression1335); if (state.failed) return result;
                          pushFollow(FOLLOW_expression_in_inExpression1339);
                          e2=expression();

                          state._fsp--;
                          if (state.failed) return result;
                          if ( state.backtracking==0 ) {
                               RelationalExprDescr rel = new RelationalExprDescr( "==", false, null, left, (e2!=null?e2.result:null) );
                                        descr.addOrMerge( rel );
                                   
                          }

                          }
View Full Code Here

                                     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), (op!=null?op.params:null), inp, descr );
                                 }
                              
                    }

                    }
View Full Code Here

                BindingDescr bind = (BindingDescr) base;
                String expr = bind.getExpression().trim();
                sbuilder.append( expr );
            }
        } else if ( base instanceof RelationalExprDescr ) {
            RelationalExprDescr red = (RelationalExprDescr) base;
            String left = dump( new StringBuilder(),
                                red.getLeft(),
                                Integer.MAX_VALUE,
                                true,
                                context ).toString(); // maximum precedence, so wrap any child connective in parenthesis
            String right = dump( new StringBuilder(),
                                 red.getRight(),
                                 Integer.MAX_VALUE,
                                 true,
                                 context ).toString();
            processRestriction( context,
                                sbuilder,
                                left,
                                red.getOperatorDescr(),
                                right );// maximum precedence, so wrap any child connective in parenthesis
        } else if ( base instanceof ExprConstraintDescr ) {
            DrlExprParser expr = new DrlExprParser();
            ConstraintConnectiveDescr result = expr.parse( ((ExprConstraintDescr) base).getExpression() );
            if ( result.getDescrs().size() == 1 ) {
View Full Code Here

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

                  }
View Full Code Here

                // it is an atomic expression
                continue;
            }

            // check if it is a simple expression or not
            RelationalExprDescr relDescr = d instanceof RelationalExprDescr ? (RelationalExprDescr) d : null;
            simple = isSimpleExpr( relDescr );

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

                    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

                    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/lang/DRLExpressions.g:265:7: ( COMMA e2= expression )*
                    loop27:
                    do {
                        int alt27=2;
                        int LA27_0 = input.LA(1);

                        if ( (LA27_0==COMMA) ) {
                            alt27=1;
                        }


                        switch (alt27) {
                      case 1 :
                          // src/main/resources/org/drools/lang/DRLExpressions.g:265:8: COMMA e2= expression
                          {
                          match(input,COMMA,FOLLOW_COMMA_in_inExpression1331); if (state.failed) return result;
                          pushFollow(FOLLOW_expression_in_inExpression1335);
                          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 loop27;
                        }
                    } while (true);

                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_inExpression1356); if (state.failed) return result;

                    }
                    break;
                case 2 :
                    // src/main/resources/org/drools/lang/DRLExpressions.g:270:7: in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN
                    {
                    pushFollow(FOLLOW_in_key_in_inExpression1366);
                    in_key();

                    state._fsp--;
                    if (state.failed) return result;
                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_inExpression1368); if (state.failed) return result;
                    pushFollow(FOLLOW_expression_in_inExpression1372);
                    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/lang/DRLExpressions.g:276:7: ( COMMA e2= expression )*
                    loop28:
                    do {
                        int alt28=2;
                        int LA28_0 = input.LA(1);

                        if ( (LA28_0==COMMA) ) {
                            alt28=1;
                        }


                        switch (alt28) {
                      case 1 :
                          // src/main/resources/org/drools/lang/DRLExpressions.g:276:8: COMMA e2= expression
                          {
                          match(input,COMMA,FOLLOW_COMMA_in_inExpression1392); if (state.failed) return result;
                          pushFollow(FOLLOW_expression_in_inExpression1396);
                          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

TOP

Related Classes of org.drools.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.