Package org.drools.reteoo

Examples of org.drools.reteoo.RuleTerminalNode$SortDeclarations


        AlphaNode alphaNode1_1 = ( AlphaNode ) alphaNode1.getSinkPropagator().getSinks()[0];
        assertEquals( calculatePositiveMask(list("b"), sp), alphaNode1_1.getDeclaredMask( ) );
        assertEquals( calculatePositiveMask(list("a", "b"), sp), alphaNode1_1.getInferredMask() )
       
        LeftInputAdapterNode liaNode1 = ( LeftInputAdapterNode ) alphaNode1_1.getSinkPropagator().getSinks()[0];
        RuleTerminalNode rtNode1 = ( RuleTerminalNode ) liaNode1.getSinkPropagator().getSinks()[0];
       
        assertEquals( 0, rtNode1.getDeclaredMask() );
        assertEqualscalculatePositiveMask(list("a", "b"), sp), rtNode1.getInferredMask() );
       
       
        // second share
        AlphaNode alphaNode1_2 = ( AlphaNode ) alphaNode1.getSinkPropagator().getSinks()[1];
        assertEquals( calculatePositiveMask(list("i"), sp), alphaNode1_2.getDeclaredMask( ) );
        assertEquals( calculatePositiveMask(list("a", "i"), sp), alphaNode1_2.getInferredMask() );
       
        LeftInputAdapterNode liaNode2 = ( LeftInputAdapterNode ) alphaNode1_2.getSinkPropagator().getSinks()[0];
        RuleTerminalNode rtNode2 = ( RuleTerminalNode ) liaNode2.getSinkPropagator().getSinks()[0];
       
        assertEquals( 0, rtNode2.getDeclaredMask() );
        assertEqualscalculatePositiveMask(list("a", "i"), sp), rtNode2.getInferredMask() );
       
        // test rule removal       
        kbase.removeRule( "org.drools", "r0" );
        assertEquals( calculatePositiveMask(list("a"), sp), alphaNode1.getDeclaredMask( ) );
        assertEquals( calculatePositiveMask(list("a", "i"), sp), alphaNode1.getInferredMask() );

        assertEquals( calculatePositiveMask(list("i"), sp), alphaNode1_2.getDeclaredMask( ) );
        assertEquals( calculatePositiveMask(list("a", "i"), sp), alphaNode1_2.getInferredMask() );
       
        assertEquals0, rtNode2.getDeclaredMask() );
        assertEqualscalculatePositiveMask(list("a", "i"), sp), rtNode2.getInferredMask() );
       
        // have to rebuild to remove r1
        kbase = getKnowledgeBase(rule1, rule2);
       
        kbase.removeRule( "org.drools", "r1" );
View Full Code Here


        AlphaNode alphaNode1_1 = ( AlphaNode ) alphaNode1.getSinkPropagator().getSinks()[0];
        assertEquals( calculatePositiveMask(list("b"), sp), alphaNode1_1.getDeclaredMask( ) );
        assertEquals( calculatePositiveMask(list("a", "b", "c"), sp), alphaNode1_1.getInferredMask() )
       
        LeftInputAdapterNode liaNode1 = ( LeftInputAdapterNode ) alphaNode1_1.getSinkPropagator().getSinks()[0];
        RuleTerminalNode rtNode1 = ( RuleTerminalNode ) liaNode1.getSinkPropagator().getSinks()[0];
       
        assertEqualscalculatePositiveMask(list("c"), sp), rtNode1.getDeclaredMask() );
        assertEqualscalculatePositiveMask(list("b", "c"), sp), rtNode1.getInferredMask() );
        assertEqualscalculateNegativeMask(list("!a"), sp), rtNode1.getNegativeMask() );

       
        // second share
        AlphaNode alphaNode1_2 = ( AlphaNode ) alphaNode1.getSinkPropagator().getSinks()[1];
        assertEquals( calculatePositiveMask(list("i"), sp), alphaNode1_2.getDeclaredMask( ) );
        assertEquals( calculatePositiveMask(list("a", "i", "s"), sp), alphaNode1_2.getInferredMask() )
       
        LeftInputAdapterNode liaNode2 = ( LeftInputAdapterNode ) alphaNode1_2.getSinkPropagator().getSinks()[0];
        RuleTerminalNode rtNode2 = ( RuleTerminalNode ) liaNode2.getSinkPropagator().getSinks()[0];
       
        assertEqualscalculatePositiveMask(list("s"), sp), rtNode2.getDeclaredMask() );
        assertEqualscalculatePositiveMask(list("a", "s"), sp), rtNode2.getInferredMask() );
        assertEqualscalculateNegativeMask(list("!i"), sp), rtNode2.getNegativeMask() );

        // test rule removal       
        kbase.removeRule( "org.drools", "r0" );
        assertEquals( calculatePositiveMask(list("a"), sp), alphaNode1.getDeclaredMask( ) );
        assertEquals( calculatePositiveMask(list("a", "i", "s"), sp), alphaNode1.getInferredMask() );

        assertEquals( calculatePositiveMask(list("i"), sp), alphaNode1_2.getDeclaredMask( ) );
        assertEquals( calculatePositiveMask(list("a", "i", "s"), sp), alphaNode1_2.getInferredMask() );
       
        assertEqualscalculatePositiveMask(list("s"), sp), rtNode2.getDeclaredMask() );
        assertEqualscalculatePositiveMask(list("a", "s"), sp), rtNode2.getInferredMask() );
        assertEqualscalculateNegativeMask(list("!i"), sp), rtNode2.getNegativeMask() );

        // have to rebuild to remove r1
        kbase = getKnowledgeBase(rule1, rule2);
       
        kbase.removeRule( "org.drools", "r1" );
View Full Code Here

        if ( !(rule instanceof Query) ) {
            // Check a consequence is set
            if ( rule.getConsequence() == null ) {
                throw new InvalidPatternException( "Rule '" + rule.getName() + "' has no Consequence" );
            }
            terminal = new RuleTerminalNode( context.getNextId(),
                                             context.getTupleSource(),
                                             rule,
                                             subrule,
                                             context );
        } else {
View Full Code Here

        ObjectTypeNode otn = getObjectTypeNode(kbase, "InitialFactImpl" );
        assertNotNull( otn );

        LeftInputAdapterNode liaNode = ( LeftInputAdapterNode ) otn.getSinkPropagator().getSinks()[0];
       
        RuleTerminalNode rtNode = ( RuleTerminalNode ) liaNode.getSinkPropagator().getSinks()[0];
        assertEquals( Long.MAX_VALUE, rtNode.getDeclaredMask() );
        assertEquals( Long.MAX_VALUE, rtNode.getInferredMask() );
    }  
View Full Code Here

        ObjectTypeNode otn = getObjectTypeNode(kbase, "Person" );
        assertNotNull( otn );

        LeftInputAdapterNode liaNode = ( LeftInputAdapterNode ) otn.getSinkPropagator().getSinks()[0];
       
        RuleTerminalNode rtNode = ( RuleTerminalNode ) liaNode.getSinkPropagator().getSinks()[0];
        assertEquals( Long.MAX_VALUE, rtNode.getDeclaredMask() );
        assertEquals( Long.MAX_VALUE, rtNode.getInferredMask() );
    }  
View Full Code Here

        assertEquals( Long.MAX_VALUE, alphaNode.getInferredMask() );       
       
       
        LeftInputAdapterNode liaNode = ( LeftInputAdapterNode ) alphaNode.getSinkPropagator().getSinks()[0];
       
        RuleTerminalNode rtNode = ( RuleTerminalNode ) liaNode.getSinkPropagator().getSinks()[0];
        assertEquals( Long.MAX_VALUE, rtNode.getDeclaredMask() );
        assertEquals( Long.MAX_VALUE, rtNode.getInferredMask() );
   
View Full Code Here

        ObjectTypeNode otn = getObjectTypeNode(kbase, "A" );
        assertNotNull( otn );

        LeftInputAdapterNode liaNode = ( LeftInputAdapterNode ) otn.getSinkPropagator().getSinks()[0];
       
        RuleTerminalNode rtNode = ( RuleTerminalNode ) liaNode.getSinkPropagator().getSinks()[0];
        assertEquals( 0, rtNode.getDeclaredMask() );
        assertEquals( 0, rtNode.getInferredMask() );
    }  
View Full Code Here

        LeftInputAdapterNode liaNode = ( LeftInputAdapterNode ) otn.getSinkPropagator().getSinks()[0];
       
        List<String> sp = getSettableProperties(wm, otn);
       
        RuleTerminalNode rtNode = ( RuleTerminalNode ) liaNode.getSinkPropagator().getSinks()[0];
        assertEqualscalculatePositiveMask(list("a"), sp), rtNode.getDeclaredMask() );
        assertEqualscalculatePositiveMask(list("a"), sp), rtNode.getInferredMask() );       
    }      
View Full Code Here

        assertEquals( calculatePositiveMask(list("a"), sp), alphaNode.getDeclaredMask( ) );
        assertEquals( calculatePositiveMask(list("a"), sp), alphaNode.getInferredMask());
       
        LeftInputAdapterNode liaNode = ( LeftInputAdapterNode ) alphaNode.getSinkPropagator().getSinks()[0];       
       
        RuleTerminalNode rtNode = ( RuleTerminalNode ) liaNode.getSinkPropagator().getSinks()[0];
        assertEquals0, rtNode.getDeclaredMask() ); // rtn declares nothing
        assertEqualscalculatePositiveMask(list("a"), sp), rtNode.getInferredMask() ); // rtn infers from alpha
   
View Full Code Here

        assertEquals( calculatePositiveMask(list("a"), sp), alphaNode.getDeclaredMask( ) );
        assertEquals( calculatePositiveMask(list("a", "b"), sp), alphaNode.getInferredMask() );
       
        LeftInputAdapterNode liaNode = ( LeftInputAdapterNode ) alphaNode.getSinkPropagator().getSinks()[0];       
       
        RuleTerminalNode rtNode = ( RuleTerminalNode ) liaNode.getSinkPropagator().getSinks()[0];
        assertEqualscalculatePositiveMask(list("b"), sp), rtNode.getDeclaredMask() );
        assertEqualscalculatePositiveMask(list("a", "b"), sp), rtNode.getInferredMask() );        
    }     
View Full Code Here

TOP

Related Classes of org.drools.reteoo.RuleTerminalNode$SortDeclarations

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.