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.newAnd();
                                   descr.addOrMerge( result );
                                   descr.addOrMerge( right );
                                   if ( args != null ) { descr.addAnnotation( args ); }
                                   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:314: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:314: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_inExpression1524);
            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:323: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 alt36=3;
            int LA36_0 = input.LA(1);

            if ( (LA36_0==ID) ) {
                int LA36_1 = input.LA(2);

                if ( (LA36_1==ID) ) {
                    int LA36_3 = input.LA(3);

                    if ( (LA36_3==LEFT_PAREN) && ((synpred7_DRLExpressions()&&((helper.validateIdentifierKey(DroolsSoftKeywords.NOT)))))) {
                        alt36=1;
                    }
                }
                else if ( (LA36_1==LEFT_PAREN) && (((helper.validateIdentifierKey(DroolsSoftKeywords.IN))))) {
                    alt36=2;
                }
            }
            switch (alt36) {
                case 1 :
                    // src/main/resources/org/drools/lang/DRLExpressions.g:323:6: ( not_key in_key )=> not_key in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN
                    {
                    pushFollow(FOLLOW_not_key_in_inExpression1544);
                    not_key();

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

                    state._fsp--;
                    if (state.failed) return result;
                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_inExpression1550); if (state.failed) return result;
                    if ( state.backtracking==0 ) {
                         helper.emit( Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT );
                    }
                    pushFollow(FOLLOW_expression_in_inExpression1572);
                    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:331:7: ( COMMA e2= expression )*
                    loop34:
                    do {
                        int alt34=2;
                        int LA34_0 = input.LA(1);

                        if ( (LA34_0==COMMA) ) {
                            alt34=1;
                        }


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

                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_inExpression1616); 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/lang/DRLExpressions.g:337:7: in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN
                    {
                    pushFollow(FOLLOW_in_key_in_inExpression1632);
                    in_key();

                    state._fsp--;
                    if (state.failed) return result;
                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_inExpression1634); if (state.failed) return result;
                    if ( state.backtracking==0 ) {
                         helper.emit( Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT );
                    }
                    pushFollow(FOLLOW_expression_in_inExpression1656);
                    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:345:7: ( COMMA e2= expression )*
                    loop35:
                    do {
                        int alt35=2;
                        int LA35_0 = input.LA(1);

                        if ( (LA35_0==COMMA) ) {
                            alt35=1;
                        }


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

                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_inExpression1700); if (state.failed) return result;
                    if ( state.backtracking==0 ) {
                       helper.emit( Location.LOCATION_LHS_INSIDE_CONDITION_END );
                    }

                    }
                    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 );
                                   if ( args != null ) { descr.addAnnotation( args ); }
                                   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 );
                                   if ( args != null ) { descr.addAnnotation( args ); }
                                   result = descr;
                               }
                            
                  }
View Full Code Here

    @Test
    public void testDump() throws Exception {
        String input = "price > 10 && < 20 || == $val || == 30";
        String expected = "( price > 10 && price < 20 || price == $val || price == 30 )";

        ConstraintConnectiveDescr descr = parse( input );
        String result = dumper.dump( descr );

        assertEquals( expected,
                      result );
    }
View Full Code Here

    @Test
    public void testDumpMatches() throws Exception {
        String input = "type.toString matches \"something\\swith\\tsingle escapes\"";
        String expected = "type.toString ~= \"something\\swith\\tsingle escapes\"";

        ConstraintConnectiveDescr descr = parse( input );
        String result = dumper.dump( descr );

        assertEquals( expected,
                      result );
    }
View Full Code Here

    @Test
    public void testDumpMatches2() throws Exception {
        String input = "type.toString matches 'something\\swith\\tsingle escapes'";
        String expected = "type.toString ~= \"something\\swith\\tsingle escapes\"";

        ConstraintConnectiveDescr descr = parse( input );
        String result = dumper.dump( descr );

        assertEquals( expected,
                      result );
    }
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.