Package org.drools.smf

Examples of org.drools.smf.SemanticConsequence


        JavaMethodGenerator methodGenerator = JavaMethodGenerator.getInstance();
        JavaInvokerGenerator invokerGenerator = JavaInvokerGenerator.getInstance();

        SemanticRule component = null;
        SemanticCondition condition = null;
        SemanticConsequence consequence = null;

        /* needs to be LinkedHashSet() to ensure the order is the same */
        Set usedApplicationData = new LinkedHashSet();
        List methods = new ArrayList();
        List invokers = new ArrayList();
        for ( int i = 0; i < components.length; i++ )
        {
            usedApplicationData.clear();
            component = (SemanticRule) components[i];
            if ( component instanceof Condition )
            {
                condition = (SemanticCondition) component;
                StringBuffer conditionBuffer = methodGenerator.generateMethod( condition.getName(),
                                                                               "boolean",
                                                                               condition.getThrownException(),
                                                                               condition.getText(),
                                                                               imports,
                                                                               usedApplicationData,
                                                                               null,
                                                                               applicationData,
                                                                               ((Condition) condition).getRequiredTupleMembers(),
                                                                               4 );
                String name = condition.getName();
                StringBuffer invokerBuffer = invokerGenerator.generateInvoker( className,
                                                                               name.toUpperCase().charAt( 0 ) + name.substring( 1 ),
                                                                               name,
                                                                               "boolean",
                                                                               null,
                                                                               applicationData,
                                                                               usedApplicationData,
                                                                               ((Condition) condition).getRequiredTupleMembers(),
                                                                               4 );
                methods.add( conditionBuffer );
                invokers.add( invokerBuffer );

            }
            else if ( component instanceof Consequence )
            {
                consequence = (SemanticConsequence) component;
                String name = consequence.getName();
                StringBuffer consequenceBuffer = methodGenerator.generateMethod( consequence.getName(),
                                                                                 "void",
                                                                                 consequence.getThrownException(),
                                                                                 consequence.getText(),
                                                                                 imports,
                                                                                 usedApplicationData,
                                                                                 knowledgeHelper,
                                                                                 applicationData,
                                                                                 declarations,
View Full Code Here

TOP

Related Classes of org.drools.smf.SemanticConsequence

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.