Package org.drools.reteoo

Examples of org.drools.reteoo.BetaNode


        // first share
        AlphaNode alphaNode1_1 = ( AlphaNode ) alphaNode1.getSinkPropagator().getSinks()[0];
        assertEquals( calculatePositiveMask(list("i"), sp), alphaNode1_1.getDeclaredMask( ) );
        assertEquals( calculatePositiveMask(list("a", "i", "b", "s", "j"), sp), alphaNode1_1.getInferredMask() )
       
        BetaNode betaNode1 = ( BetaNode alphaNode1_1.getSinkPropagator().getSinks()[1];       
        assertEqualscalculatePositiveMask(list("s"), sp), betaNode1.getRightDeclaredMask() );
        assertEqualscalculatePositiveMask(list("a", "i", "s"), sp), betaNode1.getRightInferredMask() );
       
        assertEqualscalculatePositiveMask(list("j"), sp), betaNode1.getLeftDeclaredMask() );
        assertEqualscalculatePositiveMask(list("b", "j"), sp), betaNode1.getLeftInferredMask() );       

        // second split, third alpha
        AlphaNode alphaNode1_2 = ( AlphaNode ) alphaNode1_1.getSinkPropagator().getSinks()[0];
        assertEquals( calculatePositiveMask(list("b"), sp), alphaNode1_2.getDeclaredMask( ) );
        assertEquals( calculatePositiveMask(list("a", "b", "i", "j"), sp), alphaNode1_2.getInferredMask() );

        BetaNode betaNode3 = ( BetaNode alphaNode1_2.getSinkPropagator().getSinks()[0];       
        assertEqualscalculatePositiveMask(list("j"), sp), betaNode3.getRightDeclaredMask() );
        assertEqualscalculatePositiveMask(list("a", "i", "b", "j"), sp), betaNode3.getRightInferredMask() );
       
        assertEqualscalculatePositiveMask(list("k"), sp), betaNode3.getLeftDeclaredMask() );
        assertEqualscalculatePositiveMask(list("c", "k"), sp), betaNode3.getLeftInferredMask() );       
    }      
View Full Code Here


        // first split
        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() )
       
        BetaNode betaNode1 = ( BetaNode alphaNode1_1.getSinkPropagator().getSinks()[0];       
        assertEqualscalculatePositiveMask(list("c"), sp), betaNode1.getRightDeclaredMask() );
        assertEqualscalculatePositiveMask(list("a", "b", "c"), sp), betaNode1.getRightInferredMask() );
       
        assertEqualscalculatePositiveMask(list("i"), sp), betaNode1.getLeftDeclaredMask() );
        assertEqualscalculatePositiveMask(list("b", "i"), sp), betaNode1.getLeftInferredMask() );       
       
        // fist share, second alpha
        AlphaNode alphaNode1_2 = ( AlphaNode ) alphaNode1.getSinkPropagator().getSinks()[1];
        assertEquals( calculatePositiveMask(list("i"), sp), alphaNode1_2.getDeclaredMask( ) );
        assertEquals( calculatePositiveMask(list("a", "i", "b", "j"), sp), alphaNode1_2.getInferredMask() )
       
        AlphaNode alphaNode1_3 = ( AlphaNode ) alphaNode1_2.getSinkPropagator().getSinks()[0];
        assertEquals( calculatePositiveMask(list("b"), sp), alphaNode1_3.getDeclaredMask( ) );
        assertEquals( calculatePositiveMask(list("a", "i", "b", "j"), sp), alphaNode1_3.getInferredMask() );        
       

        BetaNode betaNode2 = ( BetaNode alphaNode1_3.getSinkPropagator().getSinks()[0];       
        assertEqualscalculatePositiveMask(list("j"), sp), betaNode2.getRightDeclaredMask() );
        assertEqualscalculatePositiveMask(list("a", "i", "b", "j"), sp), betaNode2.getRightInferredMask() );
       
        assertEqualscalculatePositiveMask(list("k"), sp), betaNode2.getLeftDeclaredMask() );
        assertEqualscalculatePositiveMask(list("c", "k"), sp), betaNode2.getLeftInferredMask() );        
          
    }        
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() )
       
        // first split
        BetaNode betaNode1 = ( BetaNode alphaNode1_1.getSinkPropagator().getSinks()[0];       
        assertEqualscalculatePositiveMask(list("c"), sp), betaNode1.getRightDeclaredMask() );
        assertEqualscalculatePositiveMask(list("a", "b", "c"), sp), betaNode1.getRightInferredMask() );
       
        assertEqualscalculatePositiveMask(list("i"), sp), betaNode1.getLeftDeclaredMask() );
        assertEqualscalculatePositiveMask(list("b", "i"), sp), betaNode1.getLeftInferredMask() );       
       
        // second split
        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() );          
       

        BetaNode betaNode2 = ( BetaNode alphaNode1_2.getSinkPropagator().getSinks()[0];       
        assertEqualscalculatePositiveMask(list("s"), sp), betaNode2.getRightDeclaredMask() );
        assertEqualscalculatePositiveMask(list("a", "i", "s"), sp), betaNode2.getRightInferredMask() );
       
        assertEqualscalculatePositiveMask(list("j"), sp), betaNode2.getLeftDeclaredMask() );
        assertEqualscalculatePositiveMask(list("b", "j"), sp), betaNode2.getLeftInferredMask() );           
    }   
View Full Code Here

    @Override
    protected void doVisit(NetworkNode node,
                           Stack<NetworkNode> nodeStack,
                           StatefulKnowledgeSessionInfo info) {
        BetaNode bn = (BetaNode) node;
        DefaultNodeInfo ni = (DefaultNodeInfo) info.getNodeInfo( node );
        final BetaMemory memory = (BetaMemory) info.getSession().getNodeMemory( bn );
       
        ni.setMemoryEnabled( true );
       
        if( bn.isObjectMemoryEnabled() ) {
            ni.setFactMemorySize( memory.getRightTupleMemory().size() );
        }
        if( bn.isLeftTupleMemoryEnabled() ) {
            ni.setTupleMemorySize( memory.getLeftTupleMemory().size() );
        }

    }
View Full Code Here

    }
   
    public static class BehaviorJobContextTimerInputMarshaller implements TimersInputMarshaller {
        public void read(MarshallerReaderContext inCtx) throws IOException, ClassNotFoundException {
            int sinkId = inCtx.readInt();
            BetaNode betaNode = (BetaNode) inCtx.sinks.get( sinkId );
           
            BetaMemory betaMemory = null;      
            if ( betaNode instanceof AccumulateNode ) {
                betaMemory = (( AccumulateMemory ) inCtx.wm.getNodeMemory( betaNode )).betaMemory;
            } else {
                betaMemory = ( BetaMemory ) inCtx.wm.getNodeMemory( betaNode );
            }
           
            Object[] behaviorContext = ( Object[]  ) betaMemory.getBehaviorContext();
           
            int i = inCtx.readInt();
            SlidingTimeWindowContext stwCtx = ( SlidingTimeWindowContext ) behaviorContext[i];
                      
            updateNextExpiration( ( RightTuple) stwCtx.queue.peek(),
                                  inCtx.wm,
                                  (SlidingTimeWindow) betaNode.getBehaviors()[i],
                                  stwCtx );
           
           
            //((ReteooRuleBase) inCtx.wm.getRuleBase()).getReteooBuilder().g
//            SlidingTimeWindow beh = ( SlidingTimeWindow) inCtx.readObject();
View Full Code Here

            this.context = context;
        }

        public BehaviorExpireWMAction(MarshallerReaderContext inCtx) throws IOException {
            int sinkId = inCtx.readInt();
            BetaNode betaNode = (BetaNode) inCtx.sinks.get( sinkId );
           
            BetaMemory betaMemory = null;      
            if ( betaNode instanceof AccumulateNode ) {
                betaMemory = (( AccumulateMemory ) inCtx.wm.getNodeMemory( betaNode )).betaMemory;
            } else {
                betaMemory = ( BetaMemory ) inCtx.wm.getNodeMemory( betaNode );
            }
           
            Object[] behaviorContext = ( Object[]  ) betaMemory.getBehaviorContext();
           
            int i = inCtx.readInt();
           
            this.behavior = (SlidingTimeWindow) betaNode.getBehaviors()[i];
            this.context =  ( SlidingTimeWindowContext ) behaviorContext[i];          
        }
View Full Code Here

            SlidingTimeWindowContext slCtx = ( SlidingTimeWindowContext ) context;
 
            RightTuple rightTuple = slCtx.getQueue().peek();
            //outputCtx.writeInt( rightTuple.getFactHandle().getId() );
           
            BetaNode node = (BetaNode) rightTuple.getRightTupleSink();
            outputCtx.writeInt( node.getId() );
           
            Behavior[] behaviors = node.getBehaviors();
            int i = 0;
            for ( ; i < behaviors.length; i++ ) {    
                if ( behaviors[i] == behavior ) {
                    break;
                }
View Full Code Here

            SlidingTimeWindowContext slCtx = ( SlidingTimeWindowContext ) bjobCtx.behaviorContext;
 
            RightTuple rightTuple = slCtx.getQueue().peek();
            //outputCtx.writeInt( rightTuple.getFactHandle().getId() );
           
            BetaNode node = (BetaNode) rightTuple.getRightTupleSink();
            outputCtx.writeInt( node.getId() );
           
            Behavior[] behaviors = node.getBehaviors();
            int i = 0;
            for ( ; i < behaviors.length; i++ ) {    
                if ( behaviors[i] == bjobCtx.behavior ) {
                    break;
                }
View Full Code Here

        ReteooWorkingMemoryInterface wm = ((StatefulKnowledgeSessionImpl)kbase.newStatefulKnowledgeSession()).session;
       
        ObjectTypeNode otn = getObjectTypeNode(kbase, "Cheese" );
        assertNotNull( otn );

        BetaNode betaNode = ( BetaNode ) otn.getSinkPropagator().getSinks()[0];
       
        assertEquals( Long.MAX_VALUE, betaNode.getRightDeclaredMask() );
        assertEquals( Long.MAX_VALUE, betaNode.getRightInferredMask() );
    }   
View Full Code Here

        AlphaNode alphaNode = ( AlphaNode ) otn.getSinkPropagator().getSinks()[0];
        assertEquals( Long.MAX_VALUE, alphaNode.getDeclaredMask() );
        assertEquals( Long.MAX_VALUE, alphaNode.getInferredMask() );
       
        BetaNode betaNode = ( BetaNode ) alphaNode.getSinkPropagator().getSinks()[0];
       
        assertEquals( Long.MAX_VALUE, betaNode.getRightDeclaredMask() );
        assertEquals( Long.MAX_VALUE, betaNode.getRightInferredMask() );
   
View Full Code Here

TOP

Related Classes of org.drools.reteoo.BetaNode

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.