Package org.drools

Examples of org.drools.RuleBase.newWorkingMemory()


        Rete rete = new Rete();
        ObjectTypeNode objectTypeNode = rete.getOrCreateObjectTypeNode( new ClassObjectType( String.class ) );
        MockObjectSink sink = new MockObjectSink();
        objectTypeNode.addObjectSink( sink );
        RuleBase ruleBase = new RuleBaseImpl( rete );
        WorkingMemoryImpl workingMemory = (WorkingMemoryImpl) ruleBase.newWorkingMemory();

        final Agenda agenda = workingMemory.getAgenda();

        Consequence consequence = new Consequence() {
            public void invoke(Activation activation)
View Full Code Here


        Rete rete = new Rete();
        ObjectTypeNode objectTypeNode = rete.getOrCreateObjectTypeNode( new ClassObjectType( String.class ) );
        MockObjectSink sink = new MockObjectSink();
        objectTypeNode.addObjectSink( sink );
        RuleBase ruleBase = new RuleBaseImpl( rete );
        WorkingMemoryImpl workingMemory = (WorkingMemoryImpl) ruleBase.newWorkingMemory();

        final Agenda agenda = workingMemory.getAgenda();

        Consequence consequence = new Consequence() {
            public void invoke(Activation activation)
View Full Code Here

        Rete rete = new Rete();
        ObjectTypeNode objectTypeNode = rete.getOrCreateObjectTypeNode( new ClassObjectType( String.class ) );
        MockObjectSink sink = new MockObjectSink();
        objectTypeNode.addObjectSink( sink );
        RuleBase ruleBase = new RuleBaseImpl( rete );
        WorkingMemoryImpl workingMemory = (WorkingMemoryImpl) ruleBase.newWorkingMemory();

        Consequence consequence = new Consequence() {
            public void invoke(Activation activation)
            {
                // do nothing
View Full Code Here

        Rete rete = new Rete();
        ObjectTypeNode objectTypeNode = rete.getOrCreateObjectTypeNode( new ClassObjectType( String.class ) );
        MockObjectSink sink = new MockObjectSink();
        objectTypeNode.addObjectSink( sink );
        RuleBase ruleBase = new RuleBaseImpl( rete );
        WorkingMemoryImpl workingMemory = (WorkingMemoryImpl) ruleBase.newWorkingMemory();

        final Agenda agenda = workingMemory.getAgenda();

        Consequence consequence = new Consequence() {
            public void invoke(Activation activation)
View Full Code Here

        // test context before serlisation
        assertSame( urlClassLoader,
                    ruleBase.getRuleBaseContext( ).get( "java-classLoader" ) );

        // test context before serlisation
        WorkingMemory workingMemory = ruleBase.newWorkingMemory( );
        assertSame( urlClassLoader,
                    workingMemory.getRuleBase( ).getRuleBaseContext( ).get( "java-classLoader" ) );

        // Dumper dumper = new Dumper( ruleBase );
        // dumper.dumpReteToDot( System.err );
View Full Code Here

        InstrumentedTupleSink sink = new InstrumentedTupleSink( );

        node.addTupleSink( sink );

        FactHandleImpl handle = new FactHandleImpl( 1 );
        WorkingMemoryImpl memory = (WorkingMemoryImpl) ruleBase.newWorkingMemory( );
        memory.putObject(handle, object1);

        node.assertObject( handle, object1, memory );

        List asserted = sink.getAssertedTuples( );
View Full Code Here

        node.addTupleSink( sink );

        try
        {
            RuleBase ruleBase = new RuleBaseImpl( new Rete( ) );
            node.assertTuple( this.tuple, ( WorkingMemoryImpl ) ruleBase.newWorkingMemory( ) );

            List asserted = sink.getAssertedTuples( );

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

        ruleSet.addRule( rule );
        Builder builder = new Builder( );
        builder.addRuleSet( ruleSet );
        RuleBase ruleBase = builder.buildRuleBase( );

        WorkingMemoryImpl workingMemory = (WorkingMemoryImpl) ruleBase.newWorkingMemory( );
        TestWorkingMemoryEventListener listener = new TestWorkingMemoryEventListener( );
        workingMemory.addEventListener( listener );

        /*
         * This is not recursive so a rule should not be able to activate itself
View Full Code Here

   
    public void testAddToAgenda() throws Exception
    {
        RuleBase ruleBase = new RuleBaseImpl( new Rete() );

        WorkingMemoryImpl workingMemory = (WorkingMemoryImpl) ruleBase.newWorkingMemory();

        final Agenda agenda = workingMemory.getAgenda();

        final Rule rule1 = new Rule( "test-rule1" );
View Full Code Here

    public void testClearAgenda()
    {
        RuleBase ruleBase = new RuleBaseImpl( new Rete() );

        WorkingMemoryImpl workingMemory = (WorkingMemoryImpl) ruleBase.newWorkingMemory();

        final Agenda agenda = workingMemory.getAgenda();

        final Rule rule1 = new Rule( "test-rule1" );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.