Package org.drools

Examples of org.drools.WorkingMemory.update()


        Assert.assertEquals( 20,
                             ((Number) results.get( results.size() - 1 )).intValue() );

        // ---------------- 3rd scenario
        bob.setLikes( "brie" );
        wm.update( bobHandle,
                   bob );
        wm.fireAllRules();

        Assert.assertEquals( 3,
                             results.size() );
View Full Code Here


                             ((Number) results.get( results.size() - 1 )).intValue() );

        // ---------------- 2nd scenario
        final int index = 1;
        cheese[index].setPrice( 3 );
        wm.update( cheeseHandles[index],
                   cheese[index] );
        wm.fireAllRules();

        // 1 fire
        Assert.assertEquals( 2,
View Full Code Here

        Assert.assertEquals( 3,
                             ((Number) results.get( results.size() - 1 )).intValue() );

        // ---------------- 3rd scenario
        bob.setLikes( "brie" );
        wm.update( bobHandle,
                   bob );
        wm.fireAllRules();

        // 2 fires
        Assert.assertEquals( 3,
View Full Code Here

                             results.size() );

        // ---------------- 2nd scenario
        final int index = 1;
        cheese[index].setPrice( 9 );
        wm.update( cheeseHandles[index],
                   cheese[index] );
        wm.fireAllRules();

        // 1 fire
        Assert.assertEquals( 1,
View Full Code Here

        Assert.assertEquals( 10,
                             ((Number) results.get( results.size() - 1 )).intValue() );

        // ---------------- 3rd scenario
        bob.setLikes( "brie" );
        wm.update( bobHandle,
                   bob );
        wm.fireAllRules();

        // 2 fires
        Assert.assertEquals( 2,
View Full Code Here

       
        agendaList.clear();

        // update results in an ActivationCreatedEvent
        cheddar.setPrice( 14 );
        wm.update( cheddarHandle,
                   cheddar );
        assertEquals( 1,
                      agendaList.size() );
        createdEvent = (ActivationCreatedEvent) agendaList.get( 0 );
        assertSame( cheddar,
View Full Code Here

                    createdEvent.getActivation().getTuple().get( 0 ).getObject() );
        agendaList.clear();
       
        // update results in a ActivationCancelledEvent and an ActivationCreatedEvent, note the object is always resolvable
        cheddar.setPrice( 14 );
        wm.update( cheddarHandle,
                   cheddar );
        assertEquals( 2,
                      agendaList.size() );       
       
        cancelledEvent = (ActivationCancelledEvent) agendaList.get( 0 );
View Full Code Here

        assertTrue( eval.isAllowed( tuple,
                                    wm,
                                    evalContext ) );

        cheddar.setPrice( 9 );
        wm.update( f0,
                   cheddar );
        assertFalse( eval.isAllowed( tuple,
                                     wm,
                                     evalContext ) );
    }
View Full Code Here

        ObjectInsertedEvent oae = (ObjectInsertedEvent) wmList.get( 0 );
        assertSame( stiltonHandle,
                    oae.getFactHandle() );

        wm.update( stiltonHandle,
                   stilton );
        final ObjectUpdatedEvent ome = (ObjectUpdatedEvent) wmList.get( 1 );
        assertSame( stiltonHandle,
                    ome.getFactHandle() );
View Full Code Here

                System.err.println("Continuing without setting variable.");
            }
        }
        if (isInversionOfControl()) {
            WorkingMemory workingMemory = ((ProcessInstance) getProcessInstance()).getWorkingMemory();
            workingMemory.update(workingMemory.getFactHandle(this), this);
        } else {
            triggerCompleted();
        }
    }
   
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.