Package org.drools.core.common

Examples of org.drools.core.common.Memory


         for ( int i = 0,length = smNodeMemories1.size(); i < length; i++) {
             nodePosMask = nodePosMask >> 1;
         }

         for ( Memory mem = smNodeMemories2.getFirst(); mem != null; ) {
             Memory next = mem.getNext();
             smNodeMemories2.remove(mem);
             smNodeMemories1.add(mem);
             mem.setSegmentMemory(sm1);

             // correct the NodePosMaskBit
View Full Code Here


        InternalWorkingMemory wm = context.wm;
        NodeMemories memories = wm.getNodeMemories();
        // only some of the node memories require special serialization handling
        // so we iterate over all of them and process only those that require it
        for ( int i = 0; i < memories.length(); i++ ) {
            Memory memory = memories.peekNodeMemory( i );
            // some nodes have no memory, so we need to check for nulls
            if ( memory != null ) {
                ProtobufMessages.NodeMemory _node = null;
                switch ( memory.getNodeType() ) {
                    case NodeTypeEnums.AccumulateNode : {
                        _node = writeAccumulateNodeMemory( i, memory );
                        break;
                    }
                    case NodeTypeEnums.RightInputAdaterNode : {
View Full Code Here

        RightInputAdapterNode riaNode = (RightInputAdapterNode) node;

        ObjectSink[] sinks = riaNode.getSinkPropagator().getSinks();
        BetaNode betaNode = (BetaNode) sinks[0];

        Memory betaMemory = memories.peekNodeMemory( betaNode.getId() );
        if ( betaMemory == null ) {
            return null;
        }
        BetaMemory bm;
        if ( betaNode.getType() == NodeTypeEnums.AccumulateNode ) {
View Full Code Here

    public void setSinkFactory(LeftTupleSink sink) {
    }

    public Memory createNodeMemory(MemoryFactory memoryFactory,
                                   InternalWorkingMemory wm) {
        Memory memory = wm.getNodeMemory(memoryFactory);
        nodeMemories.add(memory);
        return memory;
    }
View Full Code Here

            smem.allLinkedMaskTest = allLinkedMaskTest;
            smem.segmentPosMaskBit = segmentPosMaskBit;
            smem.pos = pos;
            int i = 0;
            for (NetworkNode node : smem.getNodesInSegment()) {
                Memory mem = wm.getNodeMemory((MemoryFactory) node);
                mem.setSegmentMemory(smem);
                smem.getNodeMemories().add(mem);
                MemoryPrototype proto = memories.get(i++);
                if (proto != null) {
                    proto.populateMemory(wm, mem);
                }
View Full Code Here

        InternalWorkingMemory wm = context.wm;
        NodeMemories memories = wm.getNodeMemories();
        // only some of the node memories require special serialization handling
        // so we iterate over all of them and process only those that require it
        for ( int i = 0; i < memories.length(); i++ ) {
            Memory memory = memories.peekNodeMemory( i );
            // some nodes have no memory, so we need to check for nulls
            if ( memory != null ) {
                ProtobufMessages.NodeMemory _node = null;
                switch ( memory.getNodeType() ) {
                    case NodeTypeEnums.AccumulateNode : {
                        _node = writeAccumulateNodeMemory( i, memory );
                        break;
                    }
                    case NodeTypeEnums.RightInputAdaterNode : {
View Full Code Here

        RightInputAdapterNode riaNode = (RightInputAdapterNode) node;

        ObjectSink[] sinks = riaNode.getSinkPropagator().getSinks();
        BetaNode betaNode = (BetaNode) sinks[0];

        Memory betaMemory = memories.peekNodeMemory( betaNode.getId() );
        if ( betaMemory == null ) {
            return null;
        }
        BetaMemory bm;
        if ( betaNode.getType() == NodeTypeEnums.AccumulateNode ) {
View Full Code Here

                        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
                        Memory memory = wm.getNodeMemory((MemoryFactory) sink);
                        if (sink.getType() == NodeTypeEnums.RightInputAdaterNode) {
                            PathMemory riaPmem = ((RiaNodeMemory)memory).getRiaPathMemory();
                            smem.getNodeMemories().add( riaPmem );

                            RightInputAdapterNode rian = ( RightInputAdapterNode ) sink;
                            ObjectSink[] nodes = rian.getSinkPropagator().getSinks();
                            for ( ObjectSink node : nodes ) {
                                if ( NodeTypeEnums.isLeftTupleSource(node) )  {
                                    createSegmentMemory( (LeftTupleSource) node, wm );
                                }
                            }
                        } else if (NodeTypeEnums.isTerminalNode(sink)) {
                            smem.getNodeMemories().add(memory);
                        }
                        memory.setSegmentMemory(smem);
                        smem.setTipNode(sink);
                        break;
                    }
                } else {
                    // not in same segment
View Full Code Here

            LeftTupleSource subnetworkLts = riaNode.getLeftTupleSource();
            while (subnetworkLts.getLeftTupleSource() != riaNode.getStartTupleSource()) {
                subnetworkLts = subnetworkLts.getLeftTupleSource();
            }

            Memory rootSubNetwokrMem = wm.getNodeMemory((MemoryFactory) subnetworkLts);
            SegmentMemory subNetworkSegmentMemory = rootSubNetwokrMem.getSegmentMemory();
            if (subNetworkSegmentMemory == null) {
                // we need to stop recursion here
                createSegmentMemory(subnetworkLts, wm);
            }
View Full Code Here

        synchronized (smem) {
            if ( !smem.isEmpty() ) {
                  return; // this can happen when multiple threads are trying to initialize the segment
            }
            for (LeftTupleSinkNode sink = sinkProp.getFirstLeftTupleSink(); sink != null; sink = sink.getNextLeftTupleSinkNode()) {
                Memory memory = wm.getNodeMemory((MemoryFactory) sink);

                SegmentMemory childSmem = createChildSegment(wm, sink, memory);
                smem.add(childSmem);
            }
        }
View Full Code Here

TOP

Related Classes of org.drools.core.common.Memory

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.