Examples of RightTuple


Examples of org.drools.core.reteoo.RightTuple

    }

    public void removeInsert(RightTuple rightTuple) {
        rightTuple.setStagedType( LeftTuple.NONE );
        if ( rightTuple == insertFirst ) {
            RightTuple next = rightTuple.getStagedNext();
            if ( next != null ) {
                next.setStagePrevious( null );
            }
            insertFirst = next;
        } else {
            RightTuple next = rightTuple.getStagedNext();
            RightTuple previous = rightTuple.getStagedPrevious();
            if ( next != null ) {
                next.setStagePrevious( previous );
            }
            previous.setStagedNext( next );
        }
        rightTuple.clearStaged();
    }
View Full Code Here

Examples of org.drools.core.reteoo.RightTuple

    }

    public void removeDelete(RightTuple rightTuple) {
        rightTuple.setStagedType( LeftTuple.NONE );
        if ( rightTuple == deleteFirst ) {
            RightTuple next = rightTuple.getStagedNext();
            if ( next != null ) {
                next.setStagePrevious( null );
            }
            deleteFirst = next;
        } else {
            RightTuple next = rightTuple.getStagedNext();
            RightTuple previous = rightTuple.getStagedPrevious();
            if ( next != null ) {
                next.setStagePrevious( previous );
            }
            previous.setStagedNext( next );

        }
        rightTuple.clearStaged();
    }
View Full Code Here

Examples of org.drools.core.reteoo.RightTuple

    }

    public void removeUpdate(RightTuple rightTuple) {
        rightTuple.setStagedType( LeftTuple.NONE );
        if ( rightTuple == updateFirst ) {
            RightTuple next = rightTuple.getStagedNext();
            if ( next != null ) {
                next.setStagePrevious( null );
            }
            updateFirst = next;
        } else {
            RightTuple next = rightTuple.getStagedNext();
            RightTuple previous = rightTuple.getStagedPrevious();
            if ( next != null ) {
                next.setStagePrevious( previous );
            }
            previous.setStagedNext( next );
        }
        rightTuple.clearStaged();
    }
View Full Code Here

Examples of org.drools.core.reteoo.RightTuple

        RightTupleSetsImpl tupleSetsImpl = (RightTupleSetsImpl) tupleSets;
        if ( insertFirst == null ) {
            insertFirst = tupleSetsImpl.getInsertFirst();
            insertSize = tupleSetsImpl.insertSize;
        } else {
            RightTuple current = insertFirst;
            RightTuple last = null;
            while ( current != null ) {
                last = current;
                current = current.getStagedNext();
            }
            RightTuple rightTuple = tupleSetsImpl.getInsertFirst();
            last.setStagedNext( rightTuple );
            rightTuple.setStagePrevious( last );
            insertSize = insertSize + tupleSetsImpl.insertSize();
        }
    }
View Full Code Here

Examples of org.drools.core.reteoo.RightTuple

        RightTupleSetsImpl tupleSetsImpl = (RightTupleSetsImpl) tupleSets;
        if ( deleteFirst == null ) {
            deleteFirst = tupleSetsImpl.getDeleteFirst();
            deleteSize = tupleSetsImpl.deleteSize;
        } else {
            RightTuple current = deleteFirst;
            RightTuple last = null;
            while ( current != null ) {
                last = current;
                current = current.getStagedNext();
            }
            RightTuple rightTuple = tupleSetsImpl.getDeleteFirst();
            last.setStagedNext( rightTuple );
            rightTuple.setStagePrevious( last );
            deleteSize = deleteSize + tupleSetsImpl.deleteSize();
        }
    }
View Full Code Here

Examples of org.drools.core.reteoo.RightTuple

        RightTupleSetsImpl tupleSetsImpl = (RightTupleSetsImpl) tupleSets;
        if ( updateFirst == null ) {
            updateFirst = tupleSetsImpl.getUpdateFirst();
            updateSize = tupleSetsImpl.updateSize;
        } else {
            RightTuple current = updateFirst;
            RightTuple last = null;
            while ( current != null ) {
                last = current;
                current = current.getStagedNext();
            }
            RightTuple rightTuple = tupleSetsImpl.getUpdateFirst();
            last.setStagedNext( rightTuple );
            rightTuple.setStagePrevious( last );
            updateSize = updateSize + tupleSetsImpl.updateSize();
        }
    }
View Full Code Here

Examples of org.drools.core.reteoo.RightTuple

//        updateSize = updateSize - count;
//    }

    public void clear() {
        for ( RightTuple rightTuple = getInsertFirst(); rightTuple != null; ) {
            RightTuple next =  rightTuple.getStagedNext();
            rightTuple.clearStaged();
            rightTuple = next;
        }

        for ( RightTuple rightTuple = getDeleteFirst(); rightTuple != null; ) {
            RightTuple next =  rightTuple.getStagedNext();
            rightTuple.clearStaged();
            rightTuple = next;
        }

        for ( RightTuple rightTuple = getUpdateFirst(); rightTuple != null; ) {
            RightTuple next =  rightTuple.getStagedNext();
            rightTuple.clearStaged();
            rightTuple = next;
        }

        resetAll();
View Full Code Here

Examples of org.drools.core.reteoo.RightTuple

        unlinkNotNodeOnRightInsert(notNode,
                                   bm,
                                   wm);

        for (RightTuple rightTuple = srcRightTuples.getInsertFirst(); rightTuple != null; ) {
            RightTuple next = rightTuple.getStagedNext();

            rtm.add(rightTuple);
            if ( ltm == null || ltm.size() == 0 ) {
                // do nothing here, as no left memory
                rightTuple.clearStaged();
View Full Code Here

Examples of org.drools.core.reteoo.RightTuple

        for (LeftTuple leftTuple = srcLeftTuples.getUpdateFirst(); leftTuple != null; ) {
            LeftTuple next = leftTuple.getStagedNext();

            FastIterator rightIt = notNode.getRightIterator(rtm);
            RightTuple firstRightTuple = notNode.getFirstRightTuple(leftTuple, rtm, null, rightIt);

            // If in memory, remove it, because we'll need to add it anyway if it's not blocked, to ensure iteration order
            RightTuple blocker = leftTuple.getBlocker();
            if (blocker == null) {
                if (leftTuple.getMemory() != null) { // memory can be null, if blocker was deleted in same do loop
                    ltm.remove(leftTuple);
                }
            } else {
                // check if we changed bucket
                if (rtm.isIndexed() && !rightIt.isFullIterator()) {
                    // if newRightTuple is null, we assume there was a bucket change and that bucket is empty
                    if (firstRightTuple == null || firstRightTuple.getMemory() != blocker.getMemory()) {
                        blocker.removeBlocked(leftTuple);
                        blocker = null;
                    }
                }
            }

            constraints.updateFromTuple(contextEntry,
                                        wm,
                                        leftTuple);

            if ( !leftUpdateOptimizationAllowed && blocker != null ) {
                blocker.removeBlocked(leftTuple);
                blocker = null;
            }

            // if we where not blocked before (or changed buckets), or the previous blocker no longer blocks, then find the next blocker
            if (blocker == null || !constraints.isAllowedCachedLeft(contextEntry,
                                                                    blocker.getFactHandle())) {
                if (blocker != null) {
                    // remove previous blocker if it exists, as we know it doesn't block any more
                    blocker.removeBlocked(leftTuple);
                }

                // find first blocker, because it's a modify, we need to start from the beginning again
                for (RightTuple newBlocker = firstRightTuple; newBlocker != null; newBlocker = (RightTuple) rightIt.next(newBlocker)) {
                    if (constraints.isAllowedCachedLeft(contextEntry,
View Full Code Here

Examples of org.drools.core.reteoo.RightTuple

        BetaConstraints constraints = notNode.getRawConstraints();

        boolean iterateFromStart = notNode.isIndexedUnificationJoin() || rtm.getIndexType().isComparison();

        for (RightTuple rightTuple = srcRightTuples.getUpdateFirst(); rightTuple != null; ) {
            RightTuple next = rightTuple.getStagedNext();
            PropagationContext context = rightTuple.getPropagationContext();

            constraints.updateFromFactHandle(contextEntry,
                                             wm,
                                             rightTuple.getFactHandle());

            FastIterator leftIt = notNode.getLeftIterator(ltm);
            LeftTuple firstLeftTuple = notNode.getFirstLeftTuple(rightTuple, ltm, context, leftIt);

            LeftTuple firstBlocked = rightTuple.getTempBlocked();

            // first process non-blocked tuples, as we know only those ones are in the left memory.
            for (LeftTuple leftTuple = firstLeftTuple; leftTuple != null; ) {
                // preserve next now, in case we remove this leftTuple
                LeftTuple temp = (LeftTuple) leftIt.next(leftTuple);

                if (leftTuple.getStagedType() == LeftTuple.UPDATE) {
                    // ignore, as it will get processed via left iteration. Children cannot be processed twice
                    leftTuple = temp;
                    continue;
                }

                // we know that only unblocked LeftTuples are  still in the memory
                if (constraints.isAllowedCachedRight(contextEntry,
                                                     leftTuple)) {
                    leftTuple.setBlocker(rightTuple);
                    rightTuple.addBlocked(leftTuple);

                    // this is now blocked so remove from memory
                    ltm.remove(leftTuple);

                    LeftTuple childLeftTuple = leftTuple.getFirstChild();
                    if ( childLeftTuple != null) {
                        childLeftTuple.setPropagationContext(rightTuple.getPropagationContext());
                        RuleNetworkEvaluator.deleteRightChild(childLeftTuple, trgLeftTuples, stagedLeftTuples);
                    }
                }

                leftTuple = temp;
            }

            if (firstBlocked != null) {
                RightTuple rootBlocker = rightTuple.getTempNextRightTuple();
                if (rootBlocker == null ) {
                    iterateFromStart = true;
                }

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.