Package org.drools.compiler

Examples of org.drools.compiler.Foo


            barList[i] = new Bar( String.valueOf( i ) );
        }

        Foo[] fooList = new Foo[4];
        for ( int i = 0; i < fooList.length; i++ ) {
            fooList[i] = new Foo( String.valueOf( i ), i == 3 ? barList[2] : barList[i] );
        }

        for ( Foo foo : fooList ) {
            ksession.insert( foo );
        }

        //the NPE is caused by exactly this sequence. of course there are more sequences but this
        //appears to be the most short one
        int[] magicFoos = new int[]{3, 3, 1, 1, 0, 0, 2, 2, 1, 1, 0, 0, 3, 3, 2, 2, 3, 1, 1};
        int[] magicBars = new int[]{1, 2, 0, 1, 1, 0, 1, 2, 2, 1, 2, 0, 0, 2, 0, 2, 0, 0, 1};

        //upon final rule firing an NPE will be thrown in org.drools.core.rule.Accumulate
        for ( int i = 0; i < magicFoos.length; i++ ) {
            Foo tehFoo = fooList[magicFoos[i]];
            org.kie.api.runtime.rule.FactHandle fooFactHandle = ksession.getFactHandle( tehFoo );
            tehFoo.setBar( barList[magicBars[i]] );
            ksession.update( fooFactHandle, tehFoo );
            ksession.fireAllRules();
        }
        ksession.dispose();
    }
View Full Code Here


        PseudoClockScheduler timeService = ( PseudoClockScheduler ) ksession.<SessionClock>getSessionClock();
        timeService.advanceTime( new Date().getTime(), TimeUnit.MILLISECONDS );
       
        List list = new ArrayList();
        ksession.setGlobal( "list", list );       
        ksession.insert ( new Foo(null, null) );
        ksession.insert ( new Pet(null) );
       
        FactA fact1 = new FactA();
        fact1.setField1( "f1" );
        fact1.setField2( 250 );
View Full Code Here

             barList[i] = new Bar( String.valueOf( i ) );
         }

         Foo[] fooList = new Foo[4];
         for ( int i = 0; i < fooList.length; i++ ) {
             fooList[i] = new Foo( String.valueOf( i ), i == 3 ? barList[2] : barList[i] );
         }

         for ( Foo foo : fooList ) {
             ksession.insert( foo );
         }

         //the NPE is caused by exactly this sequence. of course there are more sequences but this
         //appears to be the most short one
         int[] magicFoos = new int[]{3, 3, 1, 1, 0, 0, 2, 2, 1, 1, 0, 0, 3, 3, 2, 2, 3, 1, 1};
         int[] magicBars = new int[]{1, 2, 0, 1, 1, 0, 1, 2, 2, 1, 2, 0, 0, 2, 0, 2, 0, 0, 1};

         //upon final rule firing an NPE will be thrown in org.drools.core.rule.Accumulate
         for ( int i = 0; i < magicFoos.length; i++ ) {
             Foo tehFoo = fooList[magicFoos[i]];
             FactHandle fooFactHandle = ksession.getFactHandle( tehFoo );
             tehFoo.setBar( barList[magicBars[i]] );
             ksession.update( fooFactHandle, tehFoo );
             ksession.fireAllRules();
         }
         ksession.dispose();
     }
View Full Code Here

        PseudoClockScheduler timeService = ( PseudoClockScheduler ) ksession.<SessionClock>getSessionClock();
        timeService.advanceTime( new Date().getTime(), TimeUnit.MILLISECONDS );
       
        List list = new ArrayList();
        ksession.setGlobal( "list", list );       
        ksession.insert ( new Foo(null, null) );
        ksession.insert ( new Pet(null) );
       
        FactA fact1 = new FactA();
        fact1.setField1( "f1" );
        fact1.setField2( 250 );
View Full Code Here

        KnowledgeBase kbase = loadKnowledgeBaseFromString(text);
        KieSession ksession = createKnowledgeSession(kbase);
        List list = new ArrayList();
        ksession.setGlobal( "list", list );       
        ksession.insert ( new Foo(null, null) );
        ksession.insert ( new Pet(null) );
       
        FactA fact1 = new FactA();
        fact1.setField1( "f1" );
        fact1.setField2( 10 );
View Full Code Here

       
        KnowledgeBase kbase = loadKnowledgeBaseFromString(text);
        StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        List list = new ArrayList();
        ksession.setGlobal( "list", list );       
        ksession.insert ( new Foo(null, null) );
        ksession.insert ( new Pet(null) );
       
        FactA fact1 = new FactA();
        fact1.setField1( "f1" );
        fact1.setField2( 10 );
View Full Code Here

        PseudoClockScheduler timeService = ( PseudoClockScheduler ) ksession.<SessionClock>getSessionClock();
        timeService.advanceTime( new Date().getTime(), TimeUnit.MILLISECONDS );
       
        List list = new ArrayList();
        ksession.setGlobal( "list", list );       
        ksession.insert ( new Foo(null, null) );
        ksession.insert ( new Pet(null) );
       
        FactA fact1 = new FactA();
        fact1.setField1( "f1" );
        fact1.setField2( 250 );
View Full Code Here

        PseudoClockScheduler timeService = ( PseudoClockScheduler ) ksession.<SessionClock>getSessionClock();
        timeService.advanceTime( new Date().getTime(), TimeUnit.MILLISECONDS );
       
        List list = new ArrayList();
        ksession.setGlobal( "list", list );       
        ksession.insert ( new Foo(null, null) );
        ksession.insert ( new Pet(null) );
       
        FactA fact1 = new FactA();
        fact1.setField1( "f1" );
        fact1.setField2( 250 );
View Full Code Here

        KnowledgeBase kbase = loadKnowledgeBaseFromString(text);
        KieSession ksession = createKnowledgeSession(kbase);
        List list = new ArrayList();
        ksession.setGlobal( "list", list );       
        ksession.insert ( new Foo(null, null) );
        ksession.insert ( new Pet(null) );
       
        FactA fact1 = new FactA();
        fact1.setField1( "f1" );
        fact1.setField2( 10 );
View Full Code Here

       
        KnowledgeBase kbase = loadKnowledgeBaseFromString(text);
        StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        List list = new ArrayList();
        ksession.setGlobal( "list", list );       
        ksession.insert ( new Foo(null, null) );
        ksession.insert ( new Pet(null) );
       
        FactA fact1 = new FactA();
        fact1.setField1( "f1" );
        fact1.setField2( 10 );
View Full Code Here

TOP

Related Classes of org.drools.compiler.Foo

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.