Package org.drools.lang.descr

Examples of org.drools.lang.descr.ConstraintConnectiveDescr


                  state._fsp--;
                  if (state.failed) return result;
                  if ( state.backtracking==0 ) {
                     if( buildDescr  ) {
                                   ConstraintConnectiveDescr descr = ConstraintConnectiveDescr.newOr();
                                   descr.addOrMerge( result )
                                   descr.addOrMerge( right );
                                   result = descr;
                               }
                            
                  }
View Full Code Here


                  state._fsp--;
                  if (state.failed) return result;
                  if ( state.backtracking==0 ) {
                     if( buildDescr  ) {
                                   ConstraintConnectiveDescr descr = ConstraintConnectiveDescr.newAnd();
                                   descr.addOrMerge( result )
                                   descr.addOrMerge( right );
                                   result = descr;
                               }
                            
                  }
View Full Code Here

                  state._fsp--;
                  if (state.failed) return result;
                  if ( state.backtracking==0 ) {
                     if( buildDescr  ) {
                                   ConstraintConnectiveDescr descr = ConstraintConnectiveDescr.newIncOr();
                                   descr.addOrMerge( result )
                                   descr.addOrMerge( right );
                                   result = descr;
                               }
                            
                  }
View Full Code Here

                  state._fsp--;
                  if (state.failed) return result;
                  if ( state.backtracking==0 ) {
                     if( buildDescr  ) {
                                   ConstraintConnectiveDescr descr = ConstraintConnectiveDescr.newXor();
                                   descr.addOrMerge( result )
                                   descr.addOrMerge( right );
                                   result = descr;
                               }
                            
                  }
View Full Code Here

                  state._fsp--;
                  if (state.failed) return result;
                  if ( state.backtracking==0 ) {
                     if( buildDescr  ) {
                                   ConstraintConnectiveDescr descr = ConstraintConnectiveDescr.newIncAnd();
                                   descr.addOrMerge( result )
                                   descr.addOrMerge( right );
                                   result = descr;
                               }
                            
                  }
View Full Code Here

        DRLExpressions.expression_return e1 = null;

        DRLExpressions.expression_return e2 = null;


         ConstraintConnectiveDescr descr = null; BaseDescr leftDescr = null; BindingDescr binding = null;
        try {
            // src/main/resources/org/drools/lang/DRLExpressions.g:250:3: (left= relationalExpression ( ( not_key in_key )=> not_key in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN | in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN )? )
            // src/main/resources/org/drools/lang/DRLExpressions.g:250:5: left= relationalExpression ( ( not_key in_key )=> not_key in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN | in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN )?
            {
            pushFollow(FOLLOW_relationalExpression_in_inExpression1280);
            left=relationalExpression();

            state._fsp--;
            if (state.failed) return result;
            if ( state.backtracking==0 ) {
               if( buildDescr  ) { result = left; }
                    if( left instanceof BindingDescr ) {
                        binding = (BindingDescr)left;
                        leftDescr = new AtomicExprDescr( binding.getExpression() );
                    } else {
                        leftDescr = left;
                    }
                 
            }
            // src/main/resources/org/drools/lang/DRLExpressions.g:259:5: ( ( not_key in_key )=> not_key in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN | in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN )?
            int alt29=3;
            int LA29_0 = input.LA(1);

            if ( (LA29_0==ID) ) {
                int LA29_1 = input.LA(2);

                if ( (LA29_1==ID) ) {
                    int LA29_3 = input.LA(3);

                    if ( (LA29_3==LEFT_PAREN) && ((synpred9_DRLExpressions()&&((helper.validateIdentifierKey(DroolsSoftKeywords.NOT)))))) {
                        alt29=1;
                    }
                }
                else if ( (LA29_1==LEFT_PAREN) && (((helper.validateIdentifierKey(DroolsSoftKeywords.IN))))) {
                    alt29=2;
                }
            }
            switch (alt29) {
                case 1 :
                    // src/main/resources/org/drools/lang/DRLExpressions.g:259:6: ( not_key in_key )=> not_key in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN
                    {
                    pushFollow(FOLLOW_not_key_in_inExpression1301);
                    not_key();

                    state._fsp--;
                    if (state.failed) return result;
                    pushFollow(FOLLOW_in_key_in_inExpression1305);
                    in_key();

                    state._fsp--;
                    if (state.failed) return result;
                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_inExpression1307); if (state.failed) return result;
                    pushFollow(FOLLOW_expression_in_inExpression1311);
                    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?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 );
                                   
                          }

                          }
                          break;

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

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

                    }
                    break;

            }


            }

            if ( state.backtracking==0 ) {
               if( binding != null && descr != null ) descr.addOrMerge( binding );
            }
        }

        catch (RecognitionException re) {
            throw re;
View Full Code Here

                  state._fsp--;
                  if (state.failed) return result;
                  if ( state.backtracking==0 ) {
                     if( buildDescr  ) {
                                   ConstraintConnectiveDescr descr = ConstraintConnectiveDescr.newOr();
                                   descr.addOrMerge( result )
                                   descr.addOrMerge( right );
                                   result = descr;
                               }
                            
                  }
View Full Code Here

                  state._fsp--;
                  if (state.failed) return result;
                  if ( state.backtracking==0 ) {
                     if( buildDescr  ) {
                                   ConstraintConnectiveDescr descr = ConstraintConnectiveDescr.newAnd();
                                   descr.addOrMerge( result )
                                   descr.addOrMerge( right );
                                   result = descr;
                               }
                            
                  }
View Full Code Here

    public DrlExprParser() {
    }

    /** Parse an expression from text */
    public ConstraintConnectiveDescr parse( final String text ) {
        ConstraintConnectiveDescr constraint = null;
        try {
            DRLLexer lexer = new DRLLexer( new ANTLRStringStream( text ) );
            CommonTokenStream input = new CommonTokenStream( lexer );
            RecognizerSharedState state = new RecognizerSharedState();
            helper = new ParserHelper( input,
                                       state );
            DRLExpressions parser = new DRLExpressions( input, state, helper );
            parser.setBuildDescr( true );
            parser.setLeftMostExpr( null ); // setting initial value just in case
            BaseDescr expr = parser.conditionalOrExpression();
            if ( expr != null && !parser.hasErrors() ) {
                constraint = ConstraintConnectiveDescr.newAnd();
                constraint.addOrMerge( expr );
            }
        } catch ( RecognitionException e ) {
            helper.reportError( e );
        }
        return constraint;
View Full Code Here

        return sbuilder;
    }

    private void processConstraint(StringBuilder sbuilder, ExprConstraintDescr base, boolean isInsideRelCons, MVELDumperContext context) {
        DrlExprParser expr = new DrlExprParser();
        ConstraintConnectiveDescr result = expr.parse( base.getExpression() );
        if ( result.getDescrs().size() == 1 ) {
            dump( sbuilder,
                  result.getDescrs().get( 0 ),
                  0,
                  isInsideRelCons,
                  context );
        } else {
            dump( sbuilder,
View Full Code Here

TOP

Related Classes of org.drools.lang.descr.ConstraintConnectiveDescr

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.