Package org.drools.spi

Examples of org.drools.spi.AgendaFilter


        agenda.clearAgenda( );

        /*
         * True filter, activations should always add
         */
        AgendaFilter filterTrue = new AgendaFilter( )
        {
            public boolean accept(Activation item)
            {
                return true;
            }
        };
        rule.setNoLoop( false );
        agenda.addToAgenda( tuple,
                            rule );
        assertEquals( 1,
                      agenda.size( ) );
        agenda.fireNextItem( filterTrue );
        assertEquals( 1,
                      agenda.size( ) );
        agenda.clearAgenda( );

        /*
         * False filter, activations should always be denied
         */
        AgendaFilter filterFalse = new AgendaFilter( )
        {
            public boolean accept(Activation item)
            {
                return false;
            }
View Full Code Here


                      agenda.focusSize() );

        /*
         * True filter, activations should always add
         */
        AgendaFilter filterTrue = new AgendaFilter() {
            public boolean accept(Activation item)
            {
                return true;
            }
        };
        rule.setNoLoop( false );
        agenda.addToAgenda( tuple,
                            context,
                            rule );
        /* check there is an item to fire */
        assertEquals( 1,
                      agenda.focusSize() );
        agenda.fireNextItem( filterTrue );
        /* check focus is empty */
        assertEquals( 0,
                      agenda.focusSize() );
        /* make sure it also fired */
        assertEquals( new Boolean( true ),
                      results.get( "fired" ) );

        /* clear the agenda and the result map */
        agenda.clearAgenda();
        results.clear();

        /*
         * False filter, activations should always be denied
         */
        AgendaFilter filterFalse = new AgendaFilter() {
            public boolean accept(Activation item)
            {
                return false;
            }
        };
View Full Code Here

    public TestingEventListener() {
    }

    public AgendaFilter getAgendaFilter(final HashSet<String> ruleNames, final boolean inclusive) {
        return new AgendaFilter() {
            public boolean accept(Activation activation) {
                if (ruleNames.size() ==0) return true;
                String ruleName = activation.getRule().getName();

                http://www.wtf.com
View Full Code Here

        // test agenda is empty
        assertEquals( 0,
                      agenda.getFocus().size() );

        // True filter, activations should always add
        final AgendaFilter filterTrue = new AgendaFilter() {
            public boolean accept(Activation item) {
                return true;
            }
        };

        rule.setNoLoop( false );
        node.assertLeftTuple( tuple,
                              context,
                              workingMemory );
       
        agenda.unstageActivations();

        // check there is an item to fire
        assertEquals( 1,
                      agenda.getFocus().size() );
        agenda.fireNextItem( filterTrue );

        // check focus is empty
        assertEquals( 0,
                      agenda.getFocus().size() );

        // make sure it also fired
        assertEquals( new Boolean( true ),
                      results.get( "fired" ) );

        assertEquals( false,
                      filtered[0].booleanValue() );

        // clear the agenda and the result map
        agenda.clearAndCancel();
        results.clear();

        // False filter, activations should always be denied
        final AgendaFilter filterFalse = new AgendaFilter() {
            public boolean accept(Activation item) {
                return false;
            }
        };
View Full Code Here

        // test agenda is empty
        assertEquals( 0,
                      agenda.getFocus().size() );

        // True filter, activations should always add
        final AgendaFilter filterTrue = new AgendaFilter() {
            public boolean accept(Activation item) {
                return true;
            }
        };

        rule.setNoLoop( false );
        node.assertLeftTuple( tuple,
                              context,
                              workingMemory );

        // check there is an item to fire
        assertEquals( 1,
                      agenda.getFocus().size() );
        agenda.fireNextItem( filterTrue );

        // check focus is empty
        assertEquals( 0,
                      agenda.getFocus().size() );

        // make sure it also fired
        assertEquals( new Boolean( true ),
                      results.get( "fired" ) );
       
        assertEquals( false, filtered[0].booleanValue() );

        // clear the agenda and the result map
        agenda.clearAndCancel();
        results.clear();
       
        // False filter, activations should always be denied
        final AgendaFilter filterFalse = new AgendaFilter() {
            public boolean accept(Activation item) {
                return false;
            }
        };
View Full Code Here

        // test agenda is empty
        assertEquals( 0,
                      agenda.getFocus().size() );

        // True filter, activations should always add
        final AgendaFilter filterTrue = new AgendaFilter() {
            public boolean accept(Activation item) {
                return true;
            }
        };

        rule.setNoLoop( false );
        node.assertLeftTuple( tuple,
                              context,
                              workingMemory );
       
        agenda.unstageActivations();

        // check there is an item to fire
        assertEquals( 1,
                      agenda.getFocus().size() );
        agenda.fireNextItem( filterTrue );

        // check focus is empty
        assertEquals( 0,
                      agenda.getFocus().size() );

        // make sure it also fired
        assertEquals( new Boolean( true ),
                      results.get( "fired" ) );

        assertEquals( false,
                      filtered[0].booleanValue() );

        // clear the agenda and the result map
        agenda.clearAndCancel();
        results.clear();

        // False filter, activations should always be denied
        final AgendaFilter filterFalse = new AgendaFilter() {
            public boolean accept(Activation item) {
                return false;
            }
        };
View Full Code Here

    public TestingEventListener() {
    }

    public AgendaFilter getAgendaFilter(final HashSet<String> ruleNames, final boolean inclusive) {
      return new AgendaFilter() {
      public boolean accept(Activation activation) {
        if (ruleNames.size() ==0) return true;
        String ruleName = activation.getRule().getName();
       
        http://www.wtf.com
View Full Code Here

    public TestingEventListener() {
    }

    public AgendaFilter getAgendaFilter(final HashSet<String> ruleNames, final boolean inclusive) {
        return new AgendaFilter() {
            public boolean accept(Activation activation) {
                if (ruleNames.size() ==0) return true;
                String ruleName = activation.getRule().getName();

                //jdelong: please don't want to see records of cancelled activations
View Full Code Here

        // test agenda is empty
        assertEquals( 0,
                      agenda.getFocus().size() );

        // True filter, activations should always add
        final AgendaFilter filterTrue = new AgendaFilter() {
            public boolean accept(Activation item) {
                return true;
            }
        };

        rule.setNoLoop( false );
        node.assertLeftTuple( tuple,
                              context,
                              workingMemory );

        // check there is an item to fire
        assertEquals( 1,
                      agenda.getFocus().size() );
        agenda.fireNextItem( filterTrue );

        // check focus is empty
        assertEquals( 0,
                      agenda.getFocus().size() );

        // make sure it also fired
        assertEquals( new Boolean( true ),
                      results.get( "fired" ) );

        assertEquals( false,
                      filtered[0].booleanValue() );

        // clear the agenda and the result map
        agenda.clearAndCancel();
        results.clear();

        // False filter, activations should always be denied
        final AgendaFilter filterFalse = new AgendaFilter() {
            public boolean accept(Activation item) {
                return false;
            }
        };
View Full Code Here

        // test agenda is empty
        assertEquals( 0,
                      agenda.getFocus().size() );

        // True filter, activations should always add
        final AgendaFilter filterTrue = new AgendaFilter() {
            public boolean accept(Activation item) {
                return true;
            }
        };

        rule.setNoLoop( false );
        node.assertTuple( tuple,
                          context,
                          workingMemory );

        // check there is an item to fire
        assertEquals( 1,
                      agenda.getFocus().size() );
        agenda.fireNextItem( filterTrue );

        // check focus is empty
        assertEquals( 0,
                      agenda.getFocus().size() );

        // make sure it also fired
        assertEquals( new Boolean( true ),
                      results.get( "fired" ) );

        // clear the agenda and the result map
        agenda.clearAgenda();
        results.clear();

        // False filter, activations should always be denied
        final AgendaFilter filterFalse = new AgendaFilter() {
            public boolean accept(Activation item) {
                return false;
            }
        };
View Full Code Here

TOP

Related Classes of org.drools.spi.AgendaFilter

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.