Package org.drools.core.util.index

Examples of org.drools.core.util.index.LeftTupleList


                              LeftTupleSets srcLeftTuples,
                              LeftTupleSets trgLeftTuples,
                              LeftTupleSets stagedLeftTuples) {
        TimerService timerService = wm.getTimerService();

        LeftTupleList leftTuples = tm.getInsertOrUpdateLeftTuples();
        synchronized ( leftTuples ) {
            LeftTupleList deletes = tm.getDeleteLeftTuples();
            if ( !deletes.isEmpty() ) {
                for ( LeftTuple leftTuple = deletes.getFirst(); leftTuple != null; ) {
                    LeftTuple next = (LeftTuple) leftTuple.getNext();
                    srcLeftTuples.addDelete( leftTuple );
                    if ( log.isTraceEnabled() ) {
                        log.trace( "Timer Add Postponed Delete {}", leftTuple );
                    }
                    leftTuple.clear();
                    leftTuple = next;
                }
                deletes.clear();
            }
            for ( LeftTuple leftTuple = srcLeftTuples.getDeleteFirst(); leftTuple != null; ) {
                LeftTuple next = leftTuple.getStagedNext();

                DefaultJobHandle jobHandle = (DefaultJobHandle) leftTuple.getObject();
View Full Code Here


                                                  LeftTupleSink sink,
                                                  InternalWorkingMemory wm,
                                                  LeftTupleSets srcLeftTuples,
                                                  LeftTupleSets trgLeftTuples,
                                                  LeftTupleSets stagedLeftTuples) {
        LeftTupleList leftTuples = tm.getInsertOrUpdateLeftTuples();
        synchronized ( leftTuples ) {
            for ( LeftTuple leftTuple = leftTuples.getFirst(); leftTuple != null; ) {
                LeftTuple next = (LeftTuple) leftTuple.getNext();

                doPropagateChildLeftTuple( sink, trgLeftTuples, stagedLeftTuples, leftTuple, tm );

                leftTuple.clear();
                leftTuple = next;
            }
            // doLeftDeletes handles deletes, directly into the trgLeftTuples
            if ( tm.getDeleteLeftTuples().isEmpty() ) {
                // dirty bit can only be reset when there are no InsertOUdate LeftTuples and no Delete staged LeftTuples.
                tm.setNodeCleanWithoutNotify();
            }
            leftTuples.clear();
        }
    }
View Full Code Here

            Trigger trigger = timerJobCtx.getTrigger();

            final PathMemory pmem = timerJobCtx.getPathMemory();
            pmem.doLinkRule( timerJobCtx.getWorkingMemory() );

            LeftTupleList leftTuples = timerJobCtx.getTimerNodeMemory().getInsertOrUpdateLeftTuples();
            LeftTuple lt = timerJobCtx.getLeftTuple();

            if ( log.isTraceEnabled() ) {
                log.trace( "Timer Executor {} {}", timerJobCtx.getTrigger(), lt );
            }

            synchronized ( leftTuples ) {
                if ( timerJobCtx.getJobHandle().isCancel() ) {
                    // this is to force a sync point, as during update propagate it can cancel the FH
                    // we cannot have an update processed at the same timer is firing
                    return;
                }
                if ( lt.getMemory() == null ) {
                    // don't add it, if it's already added, which could happen with interval or cron timers
                    leftTuples.add( lt );
                }
            }

            timerJobCtx.getTimerNodeMemory().setNodeDirtyWithoutNotify();
View Full Code Here

    public RuleExecutor(final PathMemory pmem,
            RuleAgendaItem ruleAgendaItem,
            boolean declarativeAgendaEnabled) {
        this.pmem = pmem;
        this.ruleAgendaItem = ruleAgendaItem;
        this.tupleList = new LeftTupleList();
        this.declarativeAgendaEnabled = declarativeAgendaEnabled;
        if (ruleAgendaItem.getRule().getSalience().isDynamic()) {
            queue = new BinaryHeapQueue(SalienceComparator.INSTANCE);
        }
    }
View Full Code Here

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

            DefaultJobHandle jobHandle = (DefaultJobHandle) leftTuple.getObject();
            LeftTupleList leftTuples = tm.getInsertOrUpdateLeftTuples();
            synchronized ( leftTuples ) {
                // the job removal and memory check is done within a sync block, incase it is executing a trigger at the
                // same time we are procesing an update
                timerService.removeJob( jobHandle );

                if ( leftTuple.getMemory() != null ) {
                    // a previous timer has requested an eval, so remove, we don't want it processed twice
                    leftTuples.remove( leftTuple );
                }
            }
            scheduleLeftTuple( timerNode, tm, pmem, sink, wm, timer, timerService, timestamp, calendarNames, calendars, leftTuple, trgLeftTuples, stagedLeftTuples );

            leftTuple.clearStaged();
View Full Code Here

            this.betaConstraints.resetTuple( memory.betaMemory.getContext() );
        }
    }

    public Memory createMemory(final RuleBaseConfiguration config, InternalWorkingMemory wm) {
        BetaMemory beta = new BetaMemory( new LeftTupleList(),
                                          null,
                                          this.betaConstraints.createContext(),
                                          NodeTypeEnums.FromNode );
        return new FromMemory( beta,
                               this.dataProvider.createContext(),
View Full Code Here

            int salience = 0;
            if( declarativeAgendaEnabled && rtnNode.getType() == NodeTypeEnums.RuleTerminalNode ) {
                salience = rtnNode.getRule().getSalience().getValue(null, null, null); // currently all branches have the same salience for the same rule
            }

            LeftTupleList tupleList = ruleNetworkEvaluatorActivation.getLeftTupleList();
            for (LeftTuple leftTuple = srcLeftTuples.getInsertFirst(); leftTuple != null; ) {
                LeftTuple next = leftTuple.getStagedNext();
                tupleList.add(leftTuple);
                leftTuple.increaseActivationCountForEvents(); // increased here, decreased in Agenda's cancelActivation and fireActivation
                if( declarativeAgendaEnabled ) {
                    PropagationContext pctx = leftTuple.getPropagationContext();
                    AgendaItem item = agenda.createAgendaItem(leftTuple, salience, pctx,
                                                              rtnNode, ruleNetworkEvaluatorActivation );
View Full Code Here

                                  InternalWorkingMemory wm,
                                  LeftTupleSets srcLeftTuples, RuleNetworkEvaluatorActivation ruleNetworkEvaluatorActivation) {
            boolean declarativeAgendaEnabled = ruleNetworkEvaluatorActivation.isDeclarativeAgendaEnabled();
            InternalAgenda agenda = ( InternalAgenda ) wm.getAgenda();

            LeftTupleList tupleList = ruleNetworkEvaluatorActivation.getLeftTupleList();
            for (LeftTuple leftTuple = srcLeftTuples.getUpdateFirst(); leftTuple != null; ) {
                LeftTuple next = leftTuple.getStagedNext();
                boolean reAdd = true;
                AgendaItem item = null;
                if( declarativeAgendaEnabled && leftTuple.getObject() != null ) {
                   item = ( AgendaItem )leftTuple.getObject();
                   if ( item.getBlockers() != null && !item.getBlockers().isEmpty() ) {
                       reAdd = false; // declarativeAgenda still blocking LeftTuple, so don't add back ot list
                   }
                }
                if ( reAdd && leftTuple.getMemory() == null ) {
                    tupleList.add(leftTuple);
                }

                if( declarativeAgendaEnabled) {
                    agenda.modifyActivation(item, item.isActive());
                }
View Full Code Here

        }

        public void doLeftDeletes(TerminalNode rtnNode,
                                  InternalWorkingMemory wm,
                                  LeftTupleSets srcLeftTuples, RuleNetworkEvaluatorActivation activation) {
            LeftTupleList tupleList = activation.getLeftTupleList();
            for (LeftTuple leftTuple = srcLeftTuples.getDeleteFirst(); leftTuple != null; ) {
                LeftTuple next = leftTuple.getStagedNext();
                if ( leftTuple.getMemory() != null ) {
                    tupleList.remove(leftTuple);
                }
                rtnNode.retractLeftTuple(leftTuple, leftTuple.getPropagationContext(), wm);
                leftTuple.clearStaged();
                leftTuple.setObject(null);
                leftTuple = next;
View Full Code Here

                                          final PathMemory rmem,
                                          final TerminalNode rtn,
                                          boolean declarativeAgendaEnabled) {
        super(activationNumber, tuple, salience, context, rtn, null);
        this.rmem = rmem;
        tupleList = new LeftTupleList();
        this.declarativeAgendaEnabled = declarativeAgendaEnabled;
    }
View Full Code Here

TOP

Related Classes of org.drools.core.util.index.LeftTupleList

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.