Examples of Consequence


Examples of org.drools.spi.Consequence

                                                            buildContext );
        final ReteooWorkingMemory workingMemory = (ReteooWorkingMemory) ruleBase.newStatefulSession();

        final Agenda agenda = workingMemory.getAgenda();

        final Consequence consequence = new Consequence() {
            private static final long serialVersionUID = 510l;

            public void evaluate(KnowledgeHelper knowledgeHelper,
                                 WorkingMemory workingMemory) {
                // do nothing
View Full Code Here

Examples of org.drools.spi.Consequence

        // leftGuestName );
        //
        // count.setCount( countValue + 1 );
        // context.setPath( Context.MAKE_PATH );
        // ------------
        final Consequence consequence = new Consequence() {

            public void evaluate(KnowledgeHelper drools,
                                 WorkingMemory workingMemory) throws ConsequenceException {
                try {
                    //                    MemoryVisitor visitor = new MemoryVisitor( ( InternalWorkingMemory ) workingMemory );
View Full Code Here

Examples of org.drools.spi.Consequence

        rule.addPattern( not );

        // ------------
        // drools.assert( new Path( id, pathName, pathSeat ) );
        // ------------
        final Consequence consequence = new Consequence() {

            public void evaluate(KnowledgeHelper drools,
                                 WorkingMemory workingMemory) throws ConsequenceException {
                try {
                    Rule rule = drools.getRule();
View Full Code Here

Examples of org.drools.spi.Consequence

        // ------------
        // context.setName( Context.CHECK_DONE );
        // seating.setPathDone( true );
        // ------------
        final Consequence consequence = new Consequence() {

            public void evaluate(KnowledgeHelper drools,
                                 WorkingMemory workingMemory) throws ConsequenceException {
                try {
                    Rule rule = drools.getRule();
View Full Code Here

Examples of org.drools.spi.Consequence

        rule.addPattern( seatingPattern );

        // ------------
        // context.setName( Context.PRINT_RESULTS );
        // ------------
        final Consequence consequence = new Consequence() {

            public void evaluate(KnowledgeHelper drools,
                                 WorkingMemory workingMemory) throws ConsequenceException {
                try {
                    Rule rule = drools.getRule();
View Full Code Here

Examples of org.drools.template.model.Consequence

        Rule rule = (Rule) ruleset.getRules().get( 0 );
        Condition cond = (Condition) rule.getConditions().get( 0 );
        assertEquals( "Foo(myObject.getColour().equals(red), myObject.size () > 12\\\")",
                cond.getSnippet() );

        Consequence cons = (Consequence) rule.getConsequences().get( 0 );
        assertNotNull( cons );
        assertEquals( "myObject.setIsValid(Y);", cons.getSnippet() );

        rule = (Rule) ruleset.getRules().get( 5 );
        cond = (Condition) rule.getConditions().get( 1 );
        assertEquals( "myObject.size () > 7", cond.getSnippet() );
        cons = (Consequence) rule.getConsequences().get( 0 );
        assertEquals( "myObject.setIsValid(10-Jul-1974)", cons.getSnippet() );

    }
View Full Code Here

Examples of org.drools.template.model.Consequence

        assertEquals( 0, ruleset.getImports().size() );

        Rule rule = (Rule) ruleset.getRules().get( 0 );
        assertEquals( 3, rule.getConditions().size() );
        assertEquals( 2, rule.getConsequences().size() );
        final Consequence cons = (Consequence) rule.getConsequences().get( 1 );
        assertEquals( "myObject.setIsValid(1, 2)", cons.getSnippet() );
        final Condition con = (Condition) rule.getConditions().get( 2 );
        assertEquals( "myObject.size() < $3.00", con.getSnippet() );

        rule = (Rule) ruleset.getRules().get( 4 );
View Full Code Here

Examples of org.drools.template.model.Consequence

        rule.addCondition(condition);
    }

    @Override
    protected void addAdditionalReasonCodeConsequence(Rule rule, Scorecard scorecard) {
        Consequence consequence = new Consequence();
        consequence.setSnippet("$sc.setReasonCodes($reasons);");
        rule.addConsequence(consequence);
        consequence = new Consequence();
        consequence.setSnippet("$sc.sortReasonCodes();");
        rule.addConsequence(consequence);
    }
View Full Code Here

Examples of org.drools.template.model.Consequence

    }

    @Override
    protected void addAdditionalSummationConsequence(Rule calcTotalRule, Scorecard scorecard) {

        Consequence consequence = new Consequence();
        if (scorecard.getInitialScore() > 0) {
            consequence.setSnippet("$sc.setCalculatedScore(($calculatedScore+$initialScore));");
        } else {
            consequence.setSnippet("$sc.setCalculatedScore($calculatedScore);");
        }
        calcTotalRule.addConsequence(consequence);

    }
View Full Code Here

Examples of org.drools.template.model.Consequence

                }
                break;
            }
        }
        if ( reasonCodesField != null && externalClassName != null && fieldName != null) {
            Consequence consequence = new Consequence();
            StringBuilder stringBuilder = new StringBuilder("$");
            stringBuilder.append(fieldName).append("Var").append(".set").append(Character.toUpperCase(reasonCodesField.charAt(0))).append(reasonCodesField.substring(1));
            stringBuilder.append("($reasons);");
            consequence.setSnippet(stringBuilder.toString());
            rule.addConsequence(consequence);
        }

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.