Package org.drools

Examples of org.drools.Person


        final List list = new ArrayList();
        workingMemory.setGlobal( "results",
                                 list );

        final Person bob = new Person( "bob",
                                       "stilton" );
        final Cheese stilton = new Cheese( "stilton",
                                           12 );
        workingMemory.insert( bob );
        workingMemory.insert( stilton );
View Full Code Here


        KnowledgeBase kbase = loadKnowledgeBaseFromString( text );
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

        ksession.insert( "b" );

        ksession.insert( new Person( "mark",
                                     50 ) );
        int rules = ksession.fireAllRules();
        assertEquals( 0,
                      rules );

        ksession.insert( new Person( "bob",
                                     18 ) );
        rules = ksession.fireAllRules();
        assertEquals( 1,
                      rules );
View Full Code Here

                            "then\n" +
                            "end";
        KnowledgeBase kbase = loadKnowledgeBaseFromString( text );
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

        ksession.insert( new Person( "mark",
                                     50 ) );
        int rules = ksession.fireAllRules();
        assertEquals( 0,
                      rules );

        ksession.insert( new Person( "bob",
                                     18 ) );
        rules = ksession.fireAllRules();
        assertEquals( 1,
                      rules );
View Full Code Here

                            "then\n" +
                            "end";
        KnowledgeBase kbase = loadKnowledgeBaseFromString( text );
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

        ksession.insert( new Person( "mark",
                                     50 ) );
        int rules = ksession.fireAllRules();
        assertEquals( 1,
                      rules );
View Full Code Here

        KnowledgeBase kbase = loadKnowledgeBaseFromString( text );
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

        ksession.insert( "b" );

        ksession.insert( new Person( "mark",
                                     50 ) );
        int rules = ksession.fireAllRules();
        assertEquals( 0,
                      rules );

        ksession.insert( new Person( "bob",
                                     18 ) );
        rules = ksession.fireAllRules();
        assertEquals( 1,
                      rules );
View Full Code Here

        new WorkingMemoryConsoleLogger( ksession );

        Map addresses = new HashMap();
        addresses.put( "home",
                       new Address( "home street" ) );
        Person bob = new Person( "Bob" );
        bob.setNamedAddresses( addresses );

        ksession.insert( bob );
        ksession.fireAllRules();

        ArgumentCaptor<org.drools.event.rule.AfterActivationFiredEvent> arg = ArgumentCaptor.forClass( org.drools.event.rule.AfterActivationFiredEvent.class );
View Full Code Here

        List list = new ArrayList();
        ksession.setGlobal( "list",
                            list );

        Address a = new Address( "s1" );
        Person p = new Person( "yoda" );
        p.setObject( a );

        ksession.insert( p );
        ksession.fireAllRules();
        assertEquals( p,
                      list.get( 0 ) );
View Full Code Here

        final List results = new ArrayList();
        workingMemory.setGlobal( "results",
                                 results );

        Person p1 = new Person( "bob",
                                5 );
        workingMemory.insert( p1 );

        workingMemory.fireAllRules();
View Full Code Here

        List list = new ArrayList();
        ksession.setGlobal( "list",
                            list );

        Person p1 = new Person( "darth",
                                30 );
        org.drools.runtime.rule.FactHandle fh1 = ksession.insert( p1 );

        Person p2 = new Person( "darth",
                                25 );
        org.drools.runtime.rule.FactHandle fh2 = ksession.insert( p2 ); // creates activation.

        p1.setName( "yoda" );
        ksession.update( fh1,
View Full Code Here

        List list = new ArrayList();
        ksession.setGlobal( "list",
                            list );

        Person p0 = new Person( "yoda",
                                0 );
        p0.setLikes( "cheddar" );
        org.drools.runtime.rule.FactHandle fh0 = ksession.insert( p0 );

        Person p1 = new Person( "darth",
                                15 );
        p1.setLikes( "cheddar" );
        org.drools.runtime.rule.FactHandle fh1 = ksession.insert( p1 );

        Person p2 = new Person( "darth",
                                25 );
        p2.setLikes( "cheddar" );
        org.drools.runtime.rule.FactHandle fh2 = ksession.insert( p2 ); // creates activation.

        Person p3 = new Person( "darth",
                                30 );
        p3.setLikes( "brie" );
        org.drools.runtime.rule.FactHandle fh3 = ksession.insert( p3 );

        ksession.fireAllRules();
        assertEquals( 2,
                      list.size() );
View Full Code Here

TOP

Related Classes of org.drools.Person

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.