Package org.drools.compiler

Examples of org.drools.compiler.Person


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

         final PersonInterface person = new Person( "michael",
                                                    "cheese" );
         person.setStatus( "start" );
         ksession.insert( person );

         ksession.fireAllRules();

         List<String> results = (List<String>) ksession.getGlobal( "list" );
View Full Code Here


                             list3 );
         final List list4 = new ArrayList();
         ksession.setGlobal( "list4",
                             list4 );

         final Person youngChili1 = new Person( "young chili1" );
         youngChili1.setAge( 12 );
         youngChili1.setHair( "blue" );
         final Person youngChili2 = new Person( "young chili2" );
         youngChili2.setAge( 25 );
         youngChili2.setHair( "purple" );

         final Person chili1 = new Person( "chili1" );
         chili1.setAge( 35 );
         chili1.setHair( "red" );

         final Person chili2 = new Person( "chili2" );
         chili2.setAge( 38 );
         chili2.setHair( "indigigo" );

         final Person oldChili1 = new Person( "old chili1" );
         oldChili1.setAge( 45 );
         oldChili1.setHair( "green" );

         final Person oldChili2 = new Person( "old chili2" );
         oldChili2.setAge( 48 );
         oldChili2.setHair( "blue" );

         ksession.insert( youngChili1 );
         ksession.insert( youngChili2 );
         ksession.insert( chili1 );
         ksession.insert( chili2 );
View Full Code Here

     public void testNullValuesIndexing() throws Exception {
         KnowledgeBase kbase = SerializationHelper.serializeObject( loadKnowledgeBase( "test_NullValuesIndexing.drl" ) );
         StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

         // Adding person with null name and likes attributes
         final PersonInterface bob = new Person( null,
                                                 null );
         bob.setStatus( "P1" );
         final PersonInterface pete = new Person( null,
                                                  null );
         bob.setStatus( "P2" );
         ksession.insert( bob );
         ksession.insert( pete );

         ksession.fireAllRules();

         assertEquals( "Indexing with null values is not working correctly.",
                       "OK",
                       bob.getStatus() );
         assertEquals( "Indexing with null values is not working correctly.",
                       "OK",
                       pete.getStatus() );
     }
View Full Code Here

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

         final Person hola = new Person( "hola" );
         ksession.insert( hola );

         ksession.fireAllRules();

         assertEquals( 0,
View Full Code Here

                             list );

         final State state = new State( "SP" );
         ksession.insert( state );

         final Person bob = new Person( "Bob" );
         bob.setStatus( state.getState() );
         bob.setLikes( "stilton" );
         ksession.insert( bob );

         ksession.fireAllRules();

         assertEquals( 0,
                       list.size() );

         ksession.insert( new Cheese( bob.getLikes(),
                                      10 ) );
         ksession.fireAllRules();

         assertEquals( 1,
                       list.size() );
View Full Code Here

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

         final Person person = new Person( "bob" );
         final Cheese cheese = new Cheese( "brie",
                                           10 );

         ksession.insert( person );
         ksession.insert( cheese );
View Full Code Here

                       ((Integer) result.get( brie )).intValue() );

         assertEquals( stilton.getPrice(),
                       ((Integer) result.get( "test3" + stilton.getType() )).intValue() );

         ksession.insert( new Person( "bob",
                                      brie.getType() ) );
         ksession.fireAllRules();

         assertEquals( 6,
                       result.size() );
View Full Code Here

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

         ksession.insert( new Person( "bob" ) );
         ksession.insert( new Person( null ) );

         ksession.fireAllRules();

         assertEquals( 1,
                       list.size() );
View Full Code Here

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

         final Person youngChili1 = new Person( "young chili1" );
         youngChili1.setAge( 12 );
         youngChili1.setHair( "blue" );
         final Person youngChili2 = new Person( "young chili2" );
         youngChili2.setAge( 25 );
         youngChili2.setHair( "purple" );

         final Person chili1 = new Person( "chili1" );
         chili1.setAge( 35 );
         chili1.setHair( "red" );

         final Person chili2 = new Person( "chili2" );
         chili2.setAge( 38 );
         chili2.setHair( "indigigo" );

         final Person oldChili1 = new Person( "old chili1" );
         oldChili1.setAge( 45 );
         oldChili1.setHair( "green" );

         final Person oldChili2 = new Person( "old chili2" );
         oldChili2.setAge( 48 );
         oldChili2.setHair( "blue" );

         final Person veryold = new Person( "very old" );
         veryold.setAge( 99 );
         veryold.setHair( "gray" );

         ksession.insert( youngChili1 );
         ksession.insert( youngChili2 );
         ksession.insert( chili1 );
         ksession.insert( chili2 );
View Full Code Here

         StatefulKnowledgeSession session = createKnowledgeSession( kbase );
         List results = new ArrayList();
         session.setGlobal( "results",
                            results );

         session.insert( new Person( "Michael" ) );

         session = SerializationHelper.getSerialisedStatefulKnowledgeSession( session,
                                                                              true );
         results = (List) session.getGlobal( "results" );
View Full Code Here

TOP

Related Classes of org.drools.compiler.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.