Package org.drools.core.common

Examples of org.drools.core.common.ActivationIterator


        ObjectMarshallingStrategyStore objectMarshallingStrategyStore = context.objectMarshallingStrategyStore;

        List<InternalFactHandle> matchFactHandles = null;
       
        if ( ((InternalAgenda) wm.getAgenda()).isDeclarativeAgenda() ) {
            ActivationIterator it = ActivationIterator.iterator( wm );
            matchFactHandles = new ArrayList<InternalFactHandle>( 100 );
            for ( Activation item = (Activation) it.next(); item != null; item = (Activation) it.next() ) {
                matchFactHandles.add( item.getFactHandle() );
            }
        }

        stream.writeInt( objectStore.size() + ((matchFactHandles == null) ? 0 : matchFactHandles.size()) );
View Full Code Here


            }
            _ab.addRuleFlowGroup( _rfgb.build() );
        }

        // serialize all dormant activations
        ActivationIterator it = ActivationIterator.iterator( wm );
        List<org.drools.core.spi.Activation> dormant = new ArrayList<org.drools.core.spi.Activation>();
        for ( org.drools.core.spi.Activation item = (org.drools.core.spi.Activation) it.next(); item != null; item = (org.drools.core.spi.Activation) it.next() ) {
            if ( !item.isActive() ) {
                dormant.add( item );
            }
        }
        Collections.sort( dormant, ActivationsSorter.INSTANCE );
View Full Code Here

        ObjectMarshallingStrategyStore objectMarshallingStrategyStore = context.objectMarshallingStrategyStore;

        List<InternalFactHandle> matchFactHandles = null;
       
        if ( ((InternalAgenda) wm.getAgenda()).isDeclarativeAgenda() ) {
            ActivationIterator it = ActivationIterator.iterator( wm );
            matchFactHandles = new ArrayList<InternalFactHandle>( 100 );
            for ( Activation item = (Activation) it.next(); item != null; item = (Activation) it.next() ) {
                matchFactHandles.add( item.getFactHandle() );
            }
        }

        stream.writeInt( objectStore.size() + ((matchFactHandles == null) ? 0 : matchFactHandles.size()) );
View Full Code Here

            }
            _ab.addRuleFlowGroup( _rfgb.build() );
        }

        // serialize all dormant activations
        ActivationIterator it = ActivationIterator.iterator( wm );
        List<org.drools.core.spi.Activation> dormant = new ArrayList<org.drools.core.spi.Activation>();
        for ( org.drools.core.spi.Activation item = (org.drools.core.spi.Activation) it.next(); item != null; item = (org.drools.core.spi.Activation) it.next() ) {
            if ( !item.isQueued() ) {
                dormant.add( item );
            }
        }
        Collections.sort( dormant, ActivationsSorter.INSTANCE );
View Full Code Here

        StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        for ( int i = 0; i < 5; i++ ) {
            ksession.insert( new String( "" + i ) );
        }

        ActivationIterator it = ActivationIterator.iterator( ksession );
        List list = new ArrayList();
        for ( Match act = (Match) it.next(); act != null; act = (Match) it.next() ) {
            list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s" ) + ":" + act.isActive() );
        }
        assertContains( new String[]{"rule1:0:true", "rule1:1:true", "rule1:2:true", "rule1:3:true", "rule1:4:true"},
                        list );

        ksession.fireAllRules();

        it = ActivationIterator.iterator( ksession );
        list = new ArrayList();
        for ( Match act = (Match) it.next(); act != null; act = (Match) it.next() ) {
            list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s" ) + ":" + act.isActive() );
        }
        assertContains( new String[]{"rule1:0:false", "rule1:1:false", "rule1:2:false", "rule1:3:false", "rule1:4:false"},
                        list );
    }
View Full Code Here

        StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        for ( int i = 0; i < 5; i++ ) {
            ksession.insert( new String( "" + i ) );
        }

        ActivationIterator it = ActivationIterator.iterator( ksession );
        List list = new ArrayList();
        for ( Match act = (Match) it.next(); act != null; act = (Match) it.next() ) {
            list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s" ) + ":" + act.isActive() );
        }
        assertContains( new String[]{"rule1:0:true", "rule1:1:true", "rule1:2:true", "rule1:3:true", "rule1:4:true"},
                        list );

        ksession.fireAllRules();

        it = ActivationIterator.iterator( ksession );
        list = new ArrayList();
        for ( Match act = (Match) it.next(); act != null; act = (Match) it.next() ) {
            list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s" ) + ":" + act.isActive() );
        }
        assertContains( new String[]{"rule1:0:false", "rule1:1:false", "rule1:2:false", "rule1:3:false", "rule1:4:false"},
                        list );
    }
View Full Code Here

        StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        for ( int i = 0; i < 5; i++ ) {
            ksession.insert( new String( "" + i ) );
        }

        ActivationIterator it = ActivationIterator.iterator( ksession );

        List list = new ArrayList();
        for ( Match act = (Match) it.next(); act != null; act = (Match) it.next() ) {
            list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s" ) + ":" + act.isActive() );
        }
        assertContains( new String[]{"rule0:0:true", "rule0:1:true", "rule0:2:true", "rule0:3:true", "rule0:4:true",
                                "rule1:0:true", "rule1:1:true", "rule1:2:true", "rule2:0:true", "rule2:1:true", "rule2:2:true",
                                "rule3:3:true", "rule3:4:true",
                                "rule3:4:true"},
                        list );

        ksession.fireAllRules();

        it = ActivationIterator.iterator( ksession );
        list = new ArrayList();
        for ( Match act = (Match) it.next(); act != null; act = (Match) it.next() ) {
            list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s" ) + ":" + act.isActive() );
        }
        assertContains( new String[]{"rule0:0:false", "rule0:1:false", "rule0:2:false", "rule0:3:false", "rule0:4:false",
                                "rule1:0:false", "rule1:1:false", "rule1:2:false", "rule2:0:false", "rule2:1:false", "rule2:2:false",
                                "rule3:3:false", "rule3:4:false",
View Full Code Here

        for ( int i = 0; i < 5; i++ ) {
            ksession.insert( new String( "" + i ) );
        }
        ksession.fireAllRules();

        ActivationIterator it = ActivationIterator.iterator( ksession );

        List list = new ArrayList();
        for ( Match act = (Match) it.next(); act != null; act = (Match) it.next() ) {
            list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s" ) + ":" + act.isActive() );
        }
        assertContains( new String[]{"rule0:0:true", "rule0:1:true", "rule0:2:true", "rule0:3:false", "rule0:4:false",
                                "rule1:0:true", "rule1:1:true", "rule1:2:true", "rule2:0:true", "rule2:1:true", "rule2:2:false",
                                "rule3:3:false", "rule3:4:false",
View Full Code Here

        StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        for ( int i = 0; i < 2; i++ ) {
            ksession.insert( new String( "" + i ) );
        }

        ActivationIterator it = ActivationIterator.iterator( ksession );
        List list = new ArrayList();
        for ( Match act = (Match) it.next(); act != null; act = (Match) it.next() ) {
            list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s1" ) + ":" + act.getDeclarationValue( "$s2" ) + ":" + act.isActive() );
        }
        assertContains( new String[]{"rule1:0:1:true", "rule1:1:0:true", "rule1:1:1:true", "rule1:0:0:true"},
                        list );

        ksession.fireAllRules();

        it = ActivationIterator.iterator( ksession );
        list = new ArrayList();
        for ( Match act = (Match) it.next(); act != null; act = (Match) it.next() ) {
            list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s1" ) + ":" + act.getDeclarationValue( "$s2" ) + ":" + act.isActive() );
        }
        assertContains( new String[]{"rule1:0:1:false", "rule1:1:0:false", "rule1:1:1:false", "rule1:0:0:false"},
                        list );
    }
View Full Code Here

        StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        for ( int i = 0; i < 2; i++ ) {
            ksession.insert( new String( "" + i ) );
        }

        ActivationIterator it = ActivationIterator.iterator( ksession );
        List list = new ArrayList();
        for ( Match act = (Match) it.next(); act != null; act = (Match) it.next() ) {
            list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s1" ) + ":" + act.getDeclarationValue( "$s2" ) + ":" + act.isActive() );
        }
        assertContains( new String[]{"rule1:0:1:true", "rule1:1:0:true", "rule1:1:1:true", "rule1:0:0:true"},
                        list );

        ksession.fireAllRules();

        it = ActivationIterator.iterator( ksession );
        list = new ArrayList();
        for ( Match act = (Match) it.next(); act != null; act = (Match) it.next() ) {
            list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s1" ) + ":" + act.getDeclarationValue( "$s2" ) + ":" + act.isActive() );
        }
        assertContains( new String[]{"rule1:0:1:false", "rule1:1:0:false", "rule1:1:1:false", "rule1:0:0:false"},
                        list );
    }
View Full Code Here

TOP

Related Classes of org.drools.core.common.ActivationIterator

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.