Package org.drools.core.reteoo.LeftInputAdapterNode

Examples of org.drools.core.reteoo.LeftInputAdapterNode.LiaNodeMemory


        out.writeObject( handle );
        out.writeObject( context );
    }

    public void doPropagation(InternalWorkingMemory workingMemory) {
        LiaNodeMemory memory = ( LiaNodeMemory ) workingMemory.getNodeMemory( node );
        if ( memory.getSegmentMemory() == null ) {
            SegmentUtilities.createSegmentMemory( node, workingMemory ); // initialises for all nodes in segment, including this one
        }
        node.getSinkPropagator().createAndPropagateAssertLeftTuple( handle,
                                                                    context,
                                                                    workingMemory,
View Full Code Here


        modifyPreviousTuples.retractTuples( pctx, wm );
    }

    public void doDeleteObject(PropagationContext pctx, InternalWorkingMemory wm, LeftTuple leftTuple) {
        LeftInputAdapterNode liaNode = (LeftInputAdapterNode) leftTuple.getLeftTupleSink().getLeftTupleSource();
        LiaNodeMemory lm = ( LiaNodeMemory wm.getNodeMemory( liaNode );
        LeftInputAdapterNode.doDeleteObject( leftTuple, pctx, lm.getSegmentMemory(), wm, liaNode, true, lm );
    }
View Full Code Here

        AbstractWorkingMemory wm = new AbstractWorkingMemory( 1, (ReteooRuleBase) RuleBaseFactory.newRuleBase((RuleBaseConfiguration)kconf) );
        SegmentUtilities.createSegmentMemory( liaNode, wm );
        liaNode.assertObject( (InternalFactHandle) wm.insert( "str" ), context, wm );
       

        LiaNodeMemory liaMem = (LiaNodeMemory) wm.getNodeMemory( liaNode );
        assertEquals( 1, liaMem.getNodePosMaskBit() );
        assertEquals( 3, liaMem.getSegmentMemory().getAllLinkedMaskTest() );
       
        BetaMemory bm1 = (BetaMemory) wm.getNodeMemory( n1 );
        assertEquals( 2, bm1.getNodePosMaskBit() );
        assertEquals( 3, bm1.getSegmentMemory().getAllLinkedMaskTest() );        
       
        // Initialise from n1    
        wm = new AbstractWorkingMemory( 1, (ReteooRuleBase) RuleBaseFactory.newRuleBase((RuleBaseConfiguration)kconf) );
        n1.assertObject( (InternalFactHandle) wm.insert( "str" ), context, wm );
       

        liaMem = (LiaNodeMemory) wm.getNodeMemory( liaNode );
        assertEquals( 1, liaMem.getNodePosMaskBit() );
        assertEquals( 3, liaMem.getSegmentMemory().getAllLinkedMaskTest() );
       
        bm1 = (BetaMemory) wm.getNodeMemory( n1 );
        assertEquals( 2, bm1.getNodePosMaskBit() );
        assertEquals( 3, bm1.getSegmentMemory().getAllLinkedMaskTest() );          
    }
View Full Code Here

        SegmentUtilities.createSegmentMemory( liaNode, wm );
       
        InternalFactHandle fh1 = (InternalFactHandle) wm.insert( "str1" );
        n1.assertObject( fh1, context, wm );   
       
        LiaNodeMemory liaMem = (LiaNodeMemory) wm.getNodeMemory( liaNode );
        assertEquals( 1, liaMem.getNodePosMaskBit() );
        assertEquals( 3, liaMem.getSegmentMemory().getAllLinkedMaskTest() );
       
        BetaMemory bm1 = (BetaMemory) wm.getNodeMemory( n1 );
        assertEquals( 2, bm1.getNodePosMaskBit() );
        assertEquals( 3, bm1.getSegmentMemory().getAllLinkedMaskTest() );    
       
        // still unlinked
        assertFalse( liaMem.getSegmentMemory().isSegmentLinked() );
       
        // now linked
        InternalFactHandle fh2 = (InternalFactHandle) wm.insert( "str2" );
        liaNode.assertObject( fh2, context, wm );
        assertTrue( liaMem.getSegmentMemory().isSegmentLinked() );
       
        // test unlink after one retract
        liaNode.retractLeftTuple( fh2.getFirstLeftTuple(), context, wm );
        assertFalse( liaMem.getSegmentMemory().isSegmentLinked() );
       
        // check counter, after multiple asserts
        InternalFactHandle fh3 = (InternalFactHandle) wm.insert( "str3" );
        InternalFactHandle fh4 = (InternalFactHandle) wm.insert( "str4" );
        liaNode.assertObject( fh3, context, wm );
        liaNode.assertObject( fh4, context, wm );
       
        assertTrue( liaMem.getSegmentMemory().isSegmentLinked() );
       
        liaNode.retractLeftTuple( fh3.getFirstLeftTuple(), context, wm );
        assertTrue( liaMem.getSegmentMemory().isSegmentLinked() );

        liaNode.retractLeftTuple( fh4.getFirstLeftTuple(), context, wm );
        assertFalse( liaMem.getSegmentMemory().isSegmentLinked() );
    }
View Full Code Here

        AbstractWorkingMemory wm = new AbstractWorkingMemory( 1, (ReteooRuleBase) RuleBaseFactory.newRuleBase((RuleBaseConfiguration)kconf) );
        SegmentUtilities.createSegmentMemory( liaNode, wm );
        liaNode.assertObject( (InternalFactHandle) wm.insert( "str" ), context, wm );
       

        LiaNodeMemory liaMem = (LiaNodeMemory) wm.getNodeMemory( liaNode );
        assertEquals( 1, liaMem.getNodePosMaskBit() );
        assertEquals( 3, liaMem.getSegmentMemory().getAllLinkedMaskTest() );
       
        BetaMemory bm1 = (BetaMemory) wm.getNodeMemory( n1 );
        assertEquals( 2, bm1.getNodePosMaskBit() );
        assertEquals( 3, bm1.getSegmentMemory().getAllLinkedMaskTest() );        
       
        // Initialise from n1    
        wm = new AbstractWorkingMemory( 1, (ReteooRuleBase) RuleBaseFactory.newRuleBase((RuleBaseConfiguration)kconf) );
        n1.assertObject( (InternalFactHandle) wm.insert( "str" ), context, wm );
       

        liaMem = (LiaNodeMemory) wm.getNodeMemory( liaNode );
        assertEquals( 1, liaMem.getNodePosMaskBit() );
        assertEquals( 3, liaMem.getSegmentMemory().getAllLinkedMaskTest() );
       
        bm1 = (BetaMemory) wm.getNodeMemory( n1 );
        assertEquals( 2, bm1.getNodePosMaskBit() );
        assertEquals( 3, bm1.getSegmentMemory().getAllLinkedMaskTest() );          
    }
View Full Code Here

        SegmentUtilities.createSegmentMemory( liaNode, wm );
       
        InternalFactHandle fh1 = (InternalFactHandle) wm.insert( "str1" );
        n1.assertObject( fh1, context, wm );   
       
        LiaNodeMemory liaMem = (LiaNodeMemory) wm.getNodeMemory( liaNode );
        assertEquals( 1, liaMem.getNodePosMaskBit() );
        assertEquals( 3, liaMem.getSegmentMemory().getAllLinkedMaskTest() );
       
        BetaMemory bm1 = (BetaMemory) wm.getNodeMemory( n1 );
        assertEquals( 2, bm1.getNodePosMaskBit() );
        assertEquals( 3, bm1.getSegmentMemory().getAllLinkedMaskTest() );    
       
        // still unlinked
        assertFalse( liaMem.getSegmentMemory().isSegmentLinked() );
       
        // now linked
        InternalFactHandle fh2 = (InternalFactHandle) wm.insert( "str2" );
        liaNode.assertObject( fh2, context, wm );
        assertTrue( liaMem.getSegmentMemory().isSegmentLinked() );
       
        // test unlink after one retract
        liaNode.retractLeftTuple( fh2.getFirstLeftTuple(), context, wm );
        assertFalse( liaMem.getSegmentMemory().isSegmentLinked() );
       
        // check counter, after multiple asserts
        InternalFactHandle fh3 = (InternalFactHandle) wm.insert( "str3" );
        InternalFactHandle fh4 = (InternalFactHandle) wm.insert( "str4" );
        liaNode.assertObject( fh3, context, wm );
        liaNode.assertObject( fh4, context, wm );
       
        assertTrue( liaMem.getSegmentMemory().isSegmentLinked() );
       
        liaNode.retractLeftTuple( fh3.getFirstLeftTuple(), context, wm );
        assertTrue( liaMem.getSegmentMemory().isSegmentLinked() );

        liaNode.retractLeftTuple( fh4.getFirstLeftTuple(), context, wm );
        assertFalse( liaMem.getSegmentMemory().isSegmentLinked() );
    }
View Full Code Here

                    modifyPreviousTuples.removeLeftTuple();
                   
                   
                    if ( unlinkingEnabled ) {
                        LeftInputAdapterNode liaNode = (LeftInputAdapterNode) leftTuple.getLeftTupleSink().getLeftTupleSource();
                        LiaNodeMemory lm = ( LiaNodeMemory wm.getNodeMemory( liaNode );
                        LeftInputAdapterNode.doDeleteObject( leftTuple, pctx, lm.getSegmentMemory(), wm, liaNode, true, lm );
                    } else {
                        leftTuple.getLeftTupleSink().retractLeftTuple( leftTuple,
                                                                     pctx,
                                                                     wm );                   
                    }                  
View Full Code Here

                                                             qmem.getSegmentMemory().getPathMemories(),
                                                             qmem.getResultLeftTuples(),
                                                             stackEntry.getSink(), wm);

            LeftInputAdapterNode lian = (LeftInputAdapterNode) qmem.getQuerySegmentMemory().getRootNode();
            LiaNodeMemory lm = (LiaNodeMemory) qmem.getQuerySegmentMemory().getNodeMemories().get(0);
            LeftInputAdapterNode.doInsertObject(handle, pCtx, lian, wm, lm, false, dquery.isOpen());

            leftTuple.clearStaged();
            leftTuple = next;
        }
View Full Code Here

                LeftInputAdapterNode.doUpdateObject(childLeftTuple, childLeftTuple.getPropagationContext(), wm, lian, false, qmem.getQuerySegmentMemory());
            } else {
                if (fh.getFirstLeftTuple() != null) {
                    throw new RuntimeException("defensive programming while testing"); // @TODO remove later (mdp)
                }
                LiaNodeMemory lm = (LiaNodeMemory) qmem.getQuerySegmentMemory().getNodeMemories().get(0);
                LeftInputAdapterNode.doInsertObject(fh, leftTuple.getPropagationContext(), lian, wm, lm, false, dquery.isOpen());
            }


            leftTuple.clearStaged();
View Full Code Here

            InternalFactHandle fh = (InternalFactHandle) leftTuple.getObject();
            DroolsQuery dquery = (DroolsQuery) fh.getObject();
            if (dquery.isOpen()) {
                LeftInputAdapterNode lian = (LeftInputAdapterNode) qmem.getQuerySegmentMemory().getRootNode();
                LiaNodeMemory lm = (LiaNodeMemory) qmem.getQuerySegmentMemory().getNodeMemories().get(0);
                LeftTuple childLeftTuple = fh.getFirstLeftTuple(); // there is only one, all other LTs are peers
                LeftInputAdapterNode.doDeleteObject(childLeftTuple, childLeftTuple.getPropagationContext(), qmem.getQuerySegmentMemory(), wm, lian, false, lm);
            } else {
                LeftTuple childLeftTuple = leftTuple.getFirstChild();
                while (childLeftTuple != null) {
View Full Code Here

TOP

Related Classes of org.drools.core.reteoo.LeftInputAdapterNode.LiaNodeMemory

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.