Package org.kie.api.runtime

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


                      cheeseList.size() );

        // europe=[ 1, 2 ], america=[ 3 ]
        p1.setStatus( "europe" );
        c1FactHandle = getFactHandle( c1FactHandle, ksession );
        ksession.update( c1FactHandle,
                              p1 );
        ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession(ksession, true);
        ksession.fireAllRules();
        ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession(ksession, true);
        cheeseList = ksession.getObjects(new ClassObjectFilter(Cheese.class));
View Full Code Here


                      cheeseList.size() );

        // europe=[ 1, 2, 3 ], america=[ ]
        p3.setStatus( "europe" );
        c3FactHandle = getFactHandle( c3FactHandle, ksession );
        ksession.update( c3FactHandle,
                              p3 );
        ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession(ksession, true);
        ksession.fireAllRules();
        ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession(ksession, true);
        cheeseList = ksession.getObjects(new ClassObjectFilter(Cheese.class));
View Full Code Here

                     ksession.getObjects().size());

        // modifying sensor
        sensor.setTemperature( 125 );
        sensorHandle = getFactHandle( sensorHandle, ksession );
        ksession.update( sensorHandle,
                              sensor );
        ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession(ksession, true);
        ksession.fireAllRules();
        ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession(ksession, true);
View Full Code Here

                      ksession.getObjects().size() );

        // modifying sensor
        sensor.setTemperature( 80 );
        sensorHandle = getFactHandle( sensorHandle, ksession );
        ksession.update( sensorHandle,
                              sensor );
        ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession(ksession, true);
        ksession.fireAllRules();

        // no alarms anymore
View Full Code Here

        if ( phreak == RuleEngineOption.RETEOO ) {
            agenda.setFocus( group1 );
            assertEquals( 3, group1.size() );
            agenda.fireNextItem( null, 0, 0 );
            assertEquals( 2, group1.size() );
            ksession.update( brieHandle, brie );
            assertEquals( 2, group1.size() );

            AgendaGroup group2 = agenda.getAgendaGroup( "group2" );
            assertEquals( 3, group2.size() );
            agenda.setFocus( group2 );
View Full Code Here

            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", ((InternalAgenda) ksession.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", ((InternalAgenda)ksession.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

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.