Package org.drools.core.common

Examples of org.drools.core.common.RightTupleSets


    }  
   
    public void doUpdateRightTuple(final RightTuple rightTuple,
                                    final InternalWorkingMemory wm,
                                    final BetaMemory memory) {
       RightTupleSets stagedRightTuples = memory.getStagedRightTuples();
      
       if ( stagedRightTuples.updateSize() == 0 || stagedRightTuples.insertSize() == 0 ) {
           // also check inserts, as we'll leave it in insert stage list, if it has not yet been processed
           // nothing staged before, notify rule, so it can evaluate network
           memory.getSegmentMemory().notifyRuleLinkSegment( wm );
       }
      
       if ( rightTuple.getStagedType() == LeftTuple.NONE ) {
           // only stage, if it's not already staged
           stagedRightTuples.addUpdate( rightTuple );
       }      
   }     
View Full Code Here


    public void retractRightTuple(final RightTuple rightTuple,
                                  final PropagationContext context,
                                  final InternalWorkingMemory workingMemory) {
        final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
        if ( isUnlinkingEnabled() ) {
            RightTupleSets stagedRightTuples = memory.getStagedRightTuples();
            switch ( rightTuple.getStagedType() ) {
                // handle clash with already staged entries
                case LeftTuple.INSERT:
                    stagedRightTuples.removeInsert( rightTuple );
                    break;
                case LeftTuple.UPDATE:
                    stagedRightTuples.removeUpdate( rightTuple );
                    break;
            }
           
            if memory.getAndDecCounter() == 1 && isEmptyBetaConstraints()  ) {
                // NotNodes can only be unlinked, if they have no variable constraints
                memory.linkNode( workingMemory );
            else if ( stagedRightTuples.deleteSize() == 0 ) {
                // nothing staged before, notify rule, so it can evaluate network
                memory.getSegmentMemory().notifyRuleLinkSegment( workingMemory );
            }
           
            stagedRightTuples.addDelete( rightTuple );
            return;
        }

        RightTupleMemory rtm = memory.getRightTupleMemory();
        if ( rightTuple.getBlocked() != null ) {
View Full Code Here

    public void retractRightTuple(final RightTuple rightTuple,
                                  final PropagationContext context,
                                  final InternalWorkingMemory workingMemory) {
        final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
        if ( isUnlinkingEnabled() ) {
            RightTupleSets stagedRightTuples = memory.getStagedRightTuples();
            switch ( rightTuple.getStagedType() ) {
                // handle clash with already staged entries
                case LeftTuple.INSERT:
                    stagedRightTuples.removeInsert( rightTuple );
                    break;
                case LeftTuple.UPDATE:
                    stagedRightTuples.removeUpdate( rightTuple );
                    break;
            }
           
            if memory.getAndDecCounter() == 1 && isEmptyBetaConstraints()  ) {
                // NotNodes can only be unlinked, if they have no variable constraints
                memory.linkNode( workingMemory );
            else if ( stagedRightTuples.deleteSize() == 0 ) {
                // nothing staged before, notify rule, so it can evaluate network
                memory.getSegmentMemory().notifyRuleLinkSegment( workingMemory );
            }
           
            stagedRightTuples.addDelete( rightTuple );
            return;
        }

        RightTupleMemory rtm = memory.getRightTupleMemory();
        if ( rightTuple.getBlocked() != null ) {
View Full Code Here

                      final RightTupleMemory objectMemory,
                      final ContextEntry[] context,
                      final short nodeType) {
        this.leftTupleMemory = tupleMemory;
        this.rightTupleMemory = objectMemory;
        this.stagedRightTuples = new RightTupleSets();
        this.context = context;
        this.nodeType = nodeType;
        this.dequeu = new ArrayDeque<RightTuple>();
    }
View Full Code Here

    public static void doDeleteRightTuple(final RightTuple rightTuple,
                                          final BetaNode bnode,
                                          final InternalWorkingMemory wm,
                                          final BetaMemory memory) {
        RightTupleSets stagedRightTuples = memory.getStagedRightTuples();

        RightTuple deleteFirst = stagedRightTuples.getDeleteFirst();

        if ( !memory.getDequeu().isEmpty() || (bnode.isStreamMode() && deleteFirst != null && deleteFirst.getPropagationContext() != rightTuple.getPropagationContext() )) {
            memory.getDequeu().add( rightTuple );
            return;
        }

        switch ( rightTuple.getStagedType() ) {
            // handle clash with already staged entries
            case LeftTuple.INSERT:
                stagedRightTuples.removeInsert( rightTuple );
                break;
            case LeftTuple.UPDATE:
                stagedRightTuples.removeUpdate( rightTuple );
                break;
        }

        if ( memory.getAndDecCounter() == 1 ) {
            memory.unlinkNode( wm );
        } else if ( stagedRightTuples.deleteSize() == 0 ) {
            // nothing staged before, notify rule, so it can evaluate network
            memory.getSegmentMemory().notifyRuleLinkSegment( wm );
        }

        stagedRightTuples.addDelete( rightTuple );
    }
View Full Code Here

    }

    public void doUpdateRightTuple(final RightTuple rightTuple,
                                    final InternalWorkingMemory wm,
                                    final BetaMemory memory) {
        RightTupleSets stagedRightTuples = memory.getStagedRightTuples();

        if ( stagedRightTuples.updateSize() == 0 || stagedRightTuples.insertSize() == 0 ) {
            // also check inserts, as we'll leave it in insert stage list, if it has not yet been processed
            // nothing staged before, notify rule, so it can evaluate network
            memory.getSegmentMemory().notifyRuleLinkSegment( wm );
        }
View Full Code Here

        this.betaNode = betaNode;
        this.sinkNode = sinkNode;
        this.bm = bm;
        this.wm = wm;
        this.leftTuples = new LeftTupleSets();
        this.rightRuples = new RightTupleSets();
        this.preStagedBuilders = new ArrayList<StagedBuilder>();
        this.postStagedBuilders = new ArrayList<StagedBuilder>();
       
        this.bm.setStagedRightTuples( rightRuples );
        this.leftMemory = new ArrayList<LeftTuple>();
View Full Code Here

                                  final PropagationContext context,
                                  final InternalWorkingMemory workingMemory) {
        final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
        rightTuple.setPropagationContext( context );
        if ( isUnlinkingEnabled() ) {
            RightTupleSets stagedRightTuples = memory.getStagedRightTuples();
            boolean  stagedDeleteWasEmpty = false;
            if ( streamMode ) {
                stagedDeleteWasEmpty = memory.getSegmentMemory().getTupleQueue().isEmpty();
                memory.getSegmentMemory().getTupleQueue().add(new RightTupleEntry(rightTuple, context, memory ));
                //log.trace( "NotNode delete queue={} size={} lt={}", System.identityHashCode( memory.getSegmentMemory().getTupleQueue() ), memory.getSegmentMemory().getTupleQueue().size(), rightTuple );
            } else {
                stagedDeleteWasEmpty = stagedRightTuples.addDelete( rightTuple );
            }
           
            if memory.getAndDecCounter() == 1 && isEmptyBetaConstraints()  ) {
                // NotNodes can only be unlinked, if they have no variable constraints
                memory.linkNode( workingMemory );
View Full Code Here

    public static void doDeleteRightTuple(final RightTuple rightTuple,
                                          final BetaNode bnode,
                                          final InternalWorkingMemory wm,
                                          final BetaMemory memory) {
        RightTupleSets stagedRightTuples = memory.getStagedRightTuples();

        boolean stagedDeleteWasEmpty = false;
        if ( bnode.isStreamMode() ) {
            stagedDeleteWasEmpty = memory.getSegmentMemory().getTupleQueue().isEmpty();
            memory.getSegmentMemory().getTupleQueue().add(new RightTupleEntry(rightTuple, rightTuple.getPropagationContext(), memory ));
            log.trace( "JoinNode delete queue={} size={} pctx={} lt={}", System.identityHashCode( memory.getSegmentMemory().getTupleQueue() ), memory.getSegmentMemory().getTupleQueue().size(), PropagationContextImpl.intEnumToString( rightTuple.getPropagationContext() ), rightTuple );
        } else {
            stagedDeleteWasEmpty = stagedRightTuples.addDelete( rightTuple );
        }

        if ( memory.getAndDecCounter() == 1 ) {
            memory.unlinkNode( wm );
        } else if ( stagedDeleteWasEmpty ) {
View Full Code Here

    }

    public void doUpdateRightTuple(final RightTuple rightTuple,
                                    final InternalWorkingMemory wm,
                                    final BetaMemory memory) {
        RightTupleSets stagedRightTuples = memory.getStagedRightTuples();


        boolean stagedUpdateWasEmpty = false;
        if ( streamMode ) {
            stagedUpdateWasEmpty = memory.getSegmentMemory().getTupleQueue().isEmpty();
            memory.getSegmentMemory().getTupleQueue().add(new RightTupleEntry(rightTuple, rightTuple.getPropagationContext(), memory ));
        } else {
            stagedUpdateWasEmpty = stagedRightTuples.addUpdate( rightTuple );
        }

        if ( stagedUpdateWasEmpty  ) {
            memory.getSegmentMemory().notifyRuleLinkSegment( wm );
        }
View Full Code Here

TOP

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

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.