Package org.kie.api.runtime

Examples of org.kie.api.runtime.KieSession.update()


            agenda.setFocus( group2 );

            agenda.activateRuleFlowGroup( "ruleflow2" );
            agenda.fireNextItem( null, 0, 0 );
            assertEquals( 2, group2.size() );
            ksession.update( brieHandle, brie );
            assertEquals( 2, group2.size() );
        } else {
            agenda.setFocus( group1 );
            assertEquals( 1, group1.size() );
            RuleAgendaItem ruleItem1 = (RuleAgendaItem) group1.getActivations()[0];
View Full Code Here


            agenda.fireNextItem( null, 0, 0 );
            assertEquals( 1, group1.size() );
            assertEquals( 2, ruleItem1.getRuleExecutor().getLeftTupleList().size() );

            ksession.update( brieHandle, brie );
            assertEquals( 1, group1.size() );
            ruleItem1.getRuleExecutor().evaluateNetwork(wm);
            assertEquals(2, ruleItem1.getRuleExecutor().getLeftTupleList().size());

            AgendaGroup group2 = agenda.getAgendaGroup( "group2" );
View Full Code Here

            agenda.fireNextItem( null, 0, 0 );
            assertEquals( 1, group2.size() );
            assertEquals( 2, ruleItem2.getRuleExecutor().getLeftTupleList().size() );

            ksession.update( brieHandle, brie );
            assertEquals( 1, group2.size() );
            assertEquals( 2, ruleItem2.getRuleExecutor().getLeftTupleList().size() );
        }
    }
View Full Code Here

        assertEquals( 0, fired );
        assertEquals("MAIN", ((AgendaImpl) ksession.getAgenda()).getAgenda().getFocusName());

        // on the fifth day God created the birds and sea creatures
        cells[0][0].setState( Cell.LIVE );
        ksession.update( handles[0][0], cells[0][0] );
        ksession.getAgenda().getAgendaGroup("birth").setFocus();
        ksession.getAgenda().getAgendaGroup("calculate").setFocus();
        fired = ksession.fireAllRules( 100 );

        // logger.writeToDisk();
View Full Code Here

        assertEquals( "MAIN", ((AgendaImpl)ksession.getAgenda()).getAgenda().getFocusName() );

        // on the sixth day God created the animals that walk over the land and
        // the Man
        cells[1][1].setState( Cell.LIVE );
        ksession.update( handles[1][1], cells[1][1] );
        ksession.getAgenda().getAgendaGroup("calculate").setFocus();
        ksession.fireAllRules( 100 );
        // logger.writeToDisk();

        expected = new int[][]{{1, 2, 1}, {2, 1, 1}, {1, 1, 1}};
View Full Code Here

        assertEquals( "MAIN", ((AgendaImpl)ksession.getAgenda()).getAgenda().getFocusName()  );
        System.out.println( "--------" );

        // on the seventh day, while God rested, man start killing them all
        cells[0][0].setState( Cell.DEAD );
        ksession.update( handles[0][0], cells[0][0] );
        ksession.getAgenda().getAgendaGroup("calculate").setFocus();
        ksession.fireAllRules( 100 );

        expected = new int[][]{{3, 2, 2}, {2, 2, 2}, {2, 2, 1}};
        assertEqualsMatrix( size, cells, expected );
View Full Code Here

        org.kie.api.runtime.rule.FactHandle bartHandle = ksession.insert(bart);
        ksession.fireAllRules();
        assertEquals(0, ((TotalHolder) ksession.getGlobal("totalHolder")).getTotal());

        bart.setFather(abraham);
        ksession.update(bartHandle, bart);
        ksession.fireAllRules();
        assertEquals(100, ((TotalHolder) ksession.getGlobal("totalHolder")).getTotal());

        bart.setFather(null);
        ksession.update(bartHandle, bart);
View Full Code Here

        ksession.update(bartHandle, bart);
        ksession.fireAllRules();
        assertEquals(100, ((TotalHolder) ksession.getGlobal("totalHolder")).getTotal());

        bart.setFather(null);
        ksession.update(bartHandle, bart);
        ksession.fireAllRules();
        assertEquals(0, ((TotalHolder) ksession.getGlobal("totalHolder")).getTotal());

        bart.setFather(abraham);
        ksession.update(bartHandle, bart);
View Full Code Here

        ksession.update(bartHandle, bart);
        ksession.fireAllRules();
        assertEquals(0, ((TotalHolder) ksession.getGlobal("totalHolder")).getTotal());

        bart.setFather(abraham);
        ksession.update(bartHandle, bart);
        ksession.fireAllRules();
        assertEquals(100, ((TotalHolder) ksession.getGlobal("totalHolder")).getTotal());

        org.kie.api.runtime.rule.FactHandle homerHandle = ksession.insert(homer);
        homer.setFather(abraham);
View Full Code Here

        ksession.fireAllRules();
        assertEquals(100, ((TotalHolder) ksession.getGlobal("totalHolder")).getTotal());

        org.kie.api.runtime.rule.FactHandle homerHandle = ksession.insert(homer);
        homer.setFather(abraham);
        ksession.update(homerHandle, homer);
        bart.setFather(homer);
        ksession.update(bartHandle, bart);
        ksession.fireAllRules();
        assertEquals(120, ((TotalHolder) ksession.getGlobal("totalHolder")).getTotal());
    }   
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.