Examples of RiaNodeMemory


Examples of org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory

            } else if (NodeTypeEnums.isTerminalNode(sink)) {
                // getting will cause an initialization of rtn, which will recursively initialise rians too.
                PathMemory pmem = (PathMemory) wm.getNodeMemory((MemoryFactory) sink);
                return pmem;
            } else if (NodeTypeEnums.RightInputAdaterNode == sink.getType()) {
                RiaNodeMemory riaMem = (RiaNodeMemory) wm.getNodeMemory((MemoryFactory) sink);
                return riaMem.getRiaPathMemory();
            } else {
                throw new RuntimeException("Error: Unknown Node. Defensive programming test..");
            }
        }
        return null;
View Full Code Here

Examples of org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory

                updateBitInNewSegment = false;
                BetaNode bn = ( BetaNode) tupleSource;
                if ( bn.isRightInputIsRiaNode() ) {
                    // only ria's without reactive subnetworks can be disabled and thus need checking
                    // The getNodeMemory will7 call this method recursive for sub networks it reaches
                    RiaNodeMemory rnmem = ( RiaNodeMemory ) wm.getNodeMemory((MemoryFactory) bn.getRightInput());
                    if ( rnmem.getRiaPathMemory().getAllLinkedMaskTest() != 0 ) {
                        allLinkedTestMask = allLinkedTestMask | 1;
                    }
                } else if ( ( !(NodeTypeEnums.NotNode == bn.getType() && !((NotNode)bn).isEmptyBetaConstraints()) &&
                              NodeTypeEnums.AccumulateNode != bn.getType()) )  {
                    // non empty not nodes and accumulates can never be disabled and thus don't need checking
View Full Code Here

Examples of org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory

                    bms[i - 1] = (BetaMemory) nodeMem2;
                }
            }
        }

        RiaNodeMemory rnm = (RiaNodeMemory) wm.getNodeMemory( riaNode );

        length--; // subtract one, as first is not in the array;
        for (LeftTuple leftTuple = srcTuples.getInsertFirst(); leftTuple != null; ) {
            LeftTuple next = leftTuple.getStagedNext();

            PropagationContext pctx = leftTuple.getPropagationContext();
            InternalFactHandle handle = riaNode.createFactHandle(leftTuple, pctx, wm);
       
            // this is required for serialization support
            rnm.getMap().put( leftTuple, handle );

            RightTuple rightTuple = new RightTuple(handle, betaNode);
            leftTuple.setObject(rightTuple);
            rightTuple.setPropagationContext(pctx);
            bm.getStagedRightTuples().addInsert(rightTuple);

            if (bns != null) {
                // Add peered RightTuples, they are attached to FH - unlink LeftTuples that has a peer ref
                for (int i = 0; i < length; i++) {
                    rightTuple = new RightTuple(handle, bns[i]);
                    rightTuple.setPropagationContext(pctx);
                    bms[i].getStagedRightTuples().addInsert(rightTuple);
                }
            }


            leftTuple.clearStaged();
            leftTuple = next;
        }

        for (LeftTuple leftTuple = srcTuples.getDeleteFirst(); leftTuple != null; ) {
            LeftTuple next = leftTuple.getStagedNext();

            // this is required for serialization support
            rnm.getMap().remove( leftTuple );

            RightTuple rightTuple = (RightTuple) leftTuple.getObject();
            RightTupleSets rightTuples = bm.getStagedRightTuples();
            rightTuples.addDelete(rightTuple);
View Full Code Here

Examples of org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory

            } else if (NodeTypeEnums.isTerminalNode(sink)) {
                // getting will cause an initialization of rtn, which will recursively initialise rians too.
                PathMemory pmem = (PathMemory) wm.getNodeMemory((MemoryFactory) sink);
                pathMems.add(pmem);
            } else if (NodeTypeEnums.RightInputAdaterNode == sink.getType()) {
                RiaNodeMemory riaMem = (RiaNodeMemory) wm.getNodeMemory((MemoryFactory) sink);
                pathMems.add(riaMem.getRiaPathMemory());
            } else {
                throw new RuntimeException("Error: Unknown Node. Defensive programming test..");
            }
        }
    }
View Full Code Here

Examples of org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory

    }

    private static ProtobufMessages.NodeMemory writeRIANodeMemory(final int nodeId,
                                                                  final Memory memory) {
        // for RIA nodes, we need to store the ID of the created handles
        RiaNodeMemory mem = (RiaNodeMemory) memory;
        if ( !mem.getMap().isEmpty() ) {
            ProtobufMessages.NodeMemory.RIANodeMemory.Builder _ria = ProtobufMessages.NodeMemory.RIANodeMemory.newBuilder();

            final org.drools.core.util.Iterator it = mem.getMap().iterator();
            // iterates over all propagated handles and assert them to the new sink
            for ( ObjectEntry entry = (ObjectEntry) it.next(); entry != null; entry = (ObjectEntry) it.next() ) {
                LeftTuple leftTuple = (LeftTuple) entry.getKey();
                InternalFactHandle handle = (InternalFactHandle) entry.getValue();
                FactHandle _handle = ProtobufMessages.FactHandle.newBuilder()
View Full Code Here

Examples of org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory

                updateBitInNewSegment = false;
                BetaNode bn = ( BetaNode) tupleSource;
                if ( bn.isRightInputIsRiaNode() ) {
                    // only ria's without reactive subnetworks can be disabled and thus need checking
                    // The getNodeMemory will7 call this method recursive for sub networks it reaches
                    RiaNodeMemory rnmem = ( RiaNodeMemory ) wm.getNodeMemory((MemoryFactory) bn.getRightInput());
                    if ( rnmem.getRiaPathMemory().getAllLinkedMaskTest() != 0 ) {
                        allLinkedTestMask = allLinkedTestMask | 1;
                    }
                } else if ( ( !(NodeTypeEnums.NotNode == bn.getType() && !((NotNode)bn).isEmptyBetaConstraints()) &&
                              NodeTypeEnums.AccumulateNode != bn.getType()) )  {
                    // non empty not nodes and accumulates can never be disabled and thus don't need checking
View Full Code Here

Examples of org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory

            if (subNetworkSegmentMemory == null) {
                // we need to stop recursion here
                createSegmentMemory((LeftTupleSource) subnetworkLts, wm);
            }

            RiaNodeMemory riaMem = (RiaNodeMemory) wm.getNodeMemory((MemoryFactory) riaNode);
            bm.setRiaRuleMemory(riaMem.getRiaPathMemory());
            if (updateNodeBit && riaMem.getRiaPathMemory().getAllLinkedMaskTest() > 0) {
                // only ria's with reactive subnetworks can be disabled and thus need checking
                allLinkedTestMask = allLinkedTestMask | nodePosMask;
            }
        } else if (updateNodeBit &&
                   (!(NodeTypeEnums.NotNode == tupleSource.getType() && !((NotNode) tupleSource).isEmptyBetaConstraints()) &&
View Full Code Here

Examples of org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory

                }
                updateRiaAndTerminalMemory((LeftTupleSource) sink, originalLt, smem, wm);
            } else if (sink.getType() == NodeTypeEnums.RightInputAdaterNode) {
                // Only add the RIANode, if the LeftTupleSource is part of the RIANode subnetwork.
                if (inSubNetwork((RightInputAdapterNode) sink, originalLt)) {
                    RiaNodeMemory riaMem = (RiaNodeMemory) wm.getNodeMemory((MemoryFactory) sink);
                    PathMemory pmem = (PathMemory) riaMem.getRiaPathMemory();
                    smem.getPathMemories().add(pmem);
                    pmem.getSegmentMemories()[smem.getPos()] = smem;
                }
            } else if (NodeTypeEnums.isTerminalNode(sink)) {
                PathMemory pmem = (PathMemory) wm.getNodeMemory((MemoryFactory) sink);
View Full Code Here

Examples of org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory

    }

    private static ProtobufMessages.NodeMemory writeRIANodeMemory(final int nodeId,
                                                                  final Memory memory) {
        // for RIA nodes, we need to store the ID of the created handles
        RiaNodeMemory mem = (RiaNodeMemory) memory;
        if( ! mem.getMap().isEmpty() ) {
            ProtobufMessages.NodeMemory.RIANodeMemory.Builder _ria = ProtobufMessages.NodeMemory.RIANodeMemory.newBuilder();
           
            final org.drools.core.util.Iterator it = mem.getMap().iterator();
            // iterates over all propagated handles and assert them to the new sink
            for ( ObjectEntry entry = (ObjectEntry) it.next(); entry != null; entry = (ObjectEntry) it.next() ) {
                LeftTuple leftTuple = (LeftTuple) entry.getKey();
                InternalFactHandle handle = (InternalFactHandle) entry.getValue();
                FactHandle _handle = ProtobufMessages.FactHandle.newBuilder()
View Full Code Here

Examples of org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory

                    if ( subNetworkSegmentMemory == null ) {
                        // we need to stop recursion here
                        createSegmentMemory( ( LeftTupleSource ) subnetworkLts, wm );
                    }

                    RiaNodeMemory riaMem = ( RiaNodeMemory ) wm.getNodeMemory( (MemoryFactory) riaNode );
                    bm.setRiaRuleMemory(riaMem.getRiaPathMemory());
                    if ( updateNodeBit && riaMem.getRiaPathMemory().getAllLinkedMaskTest() > 0 ) {
                        // only ria's with reactive subnetworks can be disabled and thus need checking
                        allLinkedTestMask = allLinkedTestMask | nodePosMask;
                    }
                } else if ( updateNodeBit &&
                            ( !(NodeTypeEnums.NotNode == tupleSource.getType() && !((NotNode)tupleSource).isEmptyBetaConstraints()) &&
                            NodeTypeEnums.AccumulateNode != tupleSource.getType()) ) {
                        // non empty not nodes and accumulates can never be disabled and thus don't need checking
                        allLinkedTestMask = allLinkedTestMask | nodePosMask;

                }
                bm.setNodePosMaskBit(nodePosMask);
                if ( NodeTypeEnums.NotNode == tupleSource.getType() ) {
                    // not nodes start up linked in
                    smem.linkNodeWithoutRuleNotify(bm.getNodePosMaskBit());
                }
            } else if ( tupleSource.getType() == NodeTypeEnums.LeftInputAdapterNode ) {               
                LiaNodeMemory liaMemory = ( LiaNodeMemory ) smem.createNodeMemory( ( LeftInputAdapterNode ) tupleSource, wm );
                liaMemory.setSegmentMemory( smem );
                liaMemory.setNodePosMaskBit( nodePosMask );
                allLinkedTestMask = allLinkedTestMask | nodePosMask;
            } else if ( tupleSource.getType() == NodeTypeEnums.EvalConditionNode ) {
                EvalMemory evalMem = ( EvalMemory ) smem.createNodeMemory( ( EvalConditionNode ) tupleSource, wm );
                evalMem.setSegmentMemory( smem );
            else if ( tupleSource.getType() == NodeTypeEnums.ConditionalBranchNode ) {
                ConditionalBranchMemory branchMem = ( ConditionalBranchMemory ) smem.createNodeMemory( ( ConditionalBranchNode ) tupleSource, wm );
                branchMem.setSegmentMemory( smem );
                updateNodeBit = false; // nodes after a branch CE can notify, but they cannot impact linking
            } else if ( tupleSource.getType() == NodeTypeEnums.FromNode ) {
                FromMemory fromMemory = ( FromMemory ) smem.createNodeMemory( ( FromNode ) tupleSource, wm );
                fromMemory.getBetaMemory().setSegmentMemory( smem );
            } else if ( tupleSource.getType() == NodeTypeEnums.QueryElementNode ) {
                // Initialize the QueryElementNode and have it's memory reference the actual query SegmentMemory
                QueryElementNode queryNode = ( QueryElementNode ) tupleSource;
                LeftInputAdapterNode liaNode = getQueryLiaNode(queryNode.getQueryElement().getQueryName(), getQueryOtn(segmentRoot));
                LiaNodeMemory liam = ( LiaNodeMemory ) wm.getNodeMemory( (MemoryFactory) liaNode );               
                SegmentMemory querySmem = liam.getSegmentMemory();
                if querySmem == null ) {
                    querySmem = createSegmentMemory( liaNode, wm );
                }                              
                QueryElementNodeMemory queryNodeMem = ( QueryElementNodeMemory ) smem.createNodeMemory( queryNode, wm );
                queryNodeMem.setQuerySegmentMemory( querySmem );
                queryNodeMem.setSegmentMemory( smem );
            }
            nodePosMask = nodePosMask << 1;

            if ( tupleSource.getSinkPropagator().size() == 1 ) {
                LeftTupleSinkNode sink = (LeftTupleSinkNode) tupleSource.getSinkPropagator().getFirstLeftTupleSink() ;
                if ( NodeTypeEnums.isLeftTupleSource( sink ) ) {
                    tupleSource = ( LeftTupleSource ) sink;
                } else {
                    // rtn or rian
                    // While not technically in a segment, we want to be able to iterate easily from the last node memory to the ria/rtn memory
                    // we don't use createNodeMemory, as these may already have been created by, but not added, by the method updateRiaAndTerminalMemory
                    if ( sink.getType() == NodeTypeEnums.RightInputAdaterNode) {
                        RiaNodeMemory memory = ( RiaNodeMemory) wm.getNodeMemory( (MemoryFactory) sink );
                        smem.getNodeMemories().add( memory.getRiaPathMemory() );
                        memory.getRiaPathMemory().setSegmentMemory( smem );
                    } else if ( NodeTypeEnums.isTerminalNode( sink) ) {
                        PathMemory rmem = (PathMemory) wm.getNodeMemory( (MemoryFactory) sink );
                        smem.getNodeMemories().add( rmem );
                        rmem.setSegmentMemory( smem );
                    }
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.