Package org.drools.compiler.compiler

Examples of org.drools.compiler.compiler.BoundIdentifiers


            JavaExprAnalyzer analyzer = new JavaExprAnalyzer();
            Map<String, Class<?>> declrCls = new HashMap<String, Class<?>>();
            declrCls.put( "$cheese", Cheese.class );
           
            JavaAnalysisResult analysis = (JavaAnalysisResult) analyzer.analyzeBlock( (String) ruleDescr.getConsequence(),
                                                                                      new BoundIdentifiers(declrCls, new HashMap<String, Class<?>>() ) );
           
            BoundIdentifiers bindings = new BoundIdentifiers( new HashMap(), new HashMap() );
            bindings.getDeclrClasses().put( "$cheese", Cheese.class );
            bindings.getDeclrClasses().put( "age", int.class );
           
            // Set the inputs for each container, this is needed for modifes when the target context is the result of an expression
            List<JavaBlockDescr> descrs = new ArrayList<JavaBlockDescr>();
            setContainerBlockInputs(context,
                                            descrs,
View Full Code Here


        setupTest( "", new HashMap<String, Object>() );
        try {
            ruleDescr.setConsequence( consequence );
            JavaExprAnalyzer analyzer = new JavaExprAnalyzer();
            JavaAnalysisResult analysis = (JavaAnalysisResult) analyzer.analyzeBlock( (String) ruleDescr.getConsequence(),
                                                                                      new BoundIdentifiers( new HashMap<String, Class<?>>(), new HashMap<String, Class<?>>() ) );

            String fixed = fixBlockDescr( context, analysis, new HashMap<String,Declaration>() );

            String expected = " System.out.println(\"this is a test\");\n " +
                              " drools.getEntryPoint(\"foo\").insert( new Cheese() );\n " +
View Full Code Here

        JavaExprAnalyzer analyzer = new JavaExprAnalyzer();
        Map<String, Class<?>> declrCls = new HashMap<String, Class<?>>();
        declrCls.put( "$cheese", Cheese.class );
       
        JavaAnalysisResult analysis = (JavaAnalysisResult) analyzer.analyzeBlock( (String) ruleDescr.getConsequence(),
                                                                                  new BoundIdentifiers(declrCls, new HashMap<String, Class<?>>() ) );
       
        BoundIdentifiers bindings = new BoundIdentifiers( new HashMap(), new HashMap() );
        bindings.getDeclrClasses().put( "$cheese", Cheese.class );
        bindings.getDeclrClasses().put( "age", int.class );
       
        // Set the inputs for each container, this is needed for modifes when the target context is the result of an expression
        List<JavaBlockDescr> descrs = new ArrayList<JavaBlockDescr>();
        setContainerBlockInputs(context,
                                        descrs,
View Full Code Here

        JavaExprAnalyzer analyzer = new JavaExprAnalyzer();
        Map<String, Class<?>> declrCls = new HashMap<String, Class<?>>();
        declrCls.put( "$cheese", Cheese.class );
       
        JavaAnalysisResult analysis = (JavaAnalysisResult) analyzer.analyzeBlock( (String) ruleDescr.getConsequence(),
                                                                                  new BoundIdentifiers(declrCls, new HashMap<String, Class<?>>() ) );
       
        BoundIdentifiers bindings = new BoundIdentifiers( new HashMap(), new HashMap() );
        bindings.getDeclrClasses().put( "$cheese", Cheese.class );
        bindings.getDeclrClasses().put( "age", int.class );
       
        // Set the inputs for each container, this is needed for modifes when the target context is the result of an expression
        List<JavaBlockDescr> descrs = new ArrayList<JavaBlockDescr>();
        setContainerBlockInputs(context,
                                        descrs,
View Full Code Here

        JavaExprAnalyzer analyzer = new JavaExprAnalyzer();
        Map<String, Class<?>> declrCls = new HashMap<String, Class<?>>();
        declrCls.put( "$cheese", Cheese.class );
       
        JavaAnalysisResult analysis = (JavaAnalysisResult) analyzer.analyzeBlock( (String) ruleDescr.getConsequence(),
                                                                                  new BoundIdentifiers(declrCls, new HashMap<String, Class<?>>() ) );
       
        BoundIdentifiers bindings = new BoundIdentifiers( new HashMap(), new HashMap() );
        bindings.getDeclrClasses().put( "$cheese", Cheese.class );
        bindings.getDeclrClasses().put( "age", int.class );
       
        // Set the inputs for each container, this is needed for modifes when the target context is the result of an expression
        List<JavaBlockDescr> descrs = new ArrayList<JavaBlockDescr>();
        setContainerBlockInputs(context,
                                        descrs,
View Full Code Here

        JavaExprAnalyzer analyzer = new JavaExprAnalyzer();
        Map<String, Class<?>> declrCls = new HashMap<String, Class<?>>();
        declrCls.put( "$cheese", Cheese.class );
       
        JavaAnalysisResult analysis = (JavaAnalysisResult) analyzer.analyzeBlock( (String) ruleDescr.getConsequence(),
                                                                                  new BoundIdentifiers(declrCls, new HashMap<String, Class<?>>() ) );
       
        BoundIdentifiers bindings = new BoundIdentifiers( new HashMap(), new HashMap() );
        bindings.getDeclrClasses().put( "$cheese", Cheese.class );
        bindings.getDeclrClasses().put( "age", int.class );
       
        // Set the inputs for each container, this is needed for modifes when the target context is the result of an expression
        List<JavaBlockDescr> descrs = new ArrayList<JavaBlockDescr>();
        setContainerBlockInputs(context,
                                        descrs,
View Full Code Here

                                                                       localDeclarations );
       
        AnalysisResult analysis = context.getDialect().analyzeExpression( context,
                                                                          predicateDescr,
                                                                          predicateDescr.getContent(),
                                                                          new BoundIdentifiers( declarationResolver.getDeclarationClasses( (RuleImpl) null ), new HashMap(), null, Cheese.class ) );

        builder.build( context,
                       new BoundIdentifiers( declarationResolver.getDeclarationClasses( (RuleImpl) null ), new HashMap() ),
                       previousDeclarations,
                       localDeclarations,
                       predicate,
                       predicateDescr,
                       analysis );
View Full Code Here

        JavaExprAnalyzer analyzer = new JavaExprAnalyzer();
        JavaAccumulateBuilder builder = new JavaAccumulateBuilder();
       
        String code = "int x = 0;";
        String expected = "x = 0;";
        BoundIdentifiers bindings = new BoundIdentifiers( new HashMap<String, Class<?>>(), new HashMap<String, Class<?>>() );
        JavaAnalysisResult analysis = analyzer.analyzeBlock( code, bindings);
        String result = builder.fixInitCode( analysis, code );
        assertEquals( expected, result );
       
        code = "$anExternalVar.method(); \nint aVar = 0, anotherVar=10    ;Integer bla = new Integer( 25);functionCall();\n";
View Full Code Here

            " System.out.println(\"we are done with exitPoints\");\n ";
        setupTest( consequence, new HashMap<String, Object>() );
        try {
            JavaExprAnalyzer analyzer = new JavaExprAnalyzer();
            JavaAnalysisResult analysis = (JavaAnalysisResult) analyzer.analyzeBlock( (String) ruleDescr.getConsequence(),
                                                                                      new BoundIdentifiers( new HashMap<String, Class<?>>(), new HashMap<String, Class<?>>() ) );

            String fixed = fixBlockDescr(context, analysis, new HashMap<String, Declaration>());

            String expected = " System.out.println(\"this is a test\");\n " +
                              " drools.getExitPoint(\"foo\").insert( new Cheese() );\n " +
View Full Code Here

            JavaExprAnalyzer analyzer = new JavaExprAnalyzer();
            Map<String, Class<?>> declrCls = new HashMap<String, Class<?>>();
            declrCls.put( "$cheese", Cheese.class );
           
            JavaAnalysisResult analysis = (JavaAnalysisResult) analyzer.analyzeBlock( (String) ruleDescr.getConsequence(),
                                                                                      new BoundIdentifiers(declrCls, new HashMap<String, Class<?>>() ) );
           
            BoundIdentifiers bindings = new BoundIdentifiers( new HashMap(), new HashMap() );
            bindings.getDeclrClasses().put( "$cheese", Cheese.class );
            bindings.getDeclrClasses().put( "age", int.class );
           
            // Set the inputs for each container, this is needed for modifes when the target context is the result of an expression
            List<JavaBlockDescr> descrs = new ArrayList<JavaBlockDescr>();
            setContainerBlockInputs(context,
                                            descrs,
View Full Code Here

TOP

Related Classes of org.drools.compiler.compiler.BoundIdentifiers

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.