Package org.drools.core.phreak

Examples of org.drools.core.phreak.RuleAgendaItem


    }

    public void evaluateEagerList() {
        synchronized (eager) {
            while ( !eager.isEmpty() ) {
                RuleAgendaItem item = eager.removeFirst();
                item.getRuleExecutor().evaluateNetwork(this.workingMemory);
            }
        }
    }
View Full Code Here


        Match[] matches = ((InternalAgendaGroup)systemRuleFlowGroup).getActivations();
        for ( Match match : matches ) {
            Activation act = ( Activation ) match;
            if ( act.isRuleAgendaItem() ) {
                // The lazy RuleAgendaItem must be fully evaluated, to see if there is a rule match
                RuleAgendaItem ruleAgendaItem = (RuleAgendaItem) act;
                ruleAgendaItem.getRuleExecutor().evaluateNetwork(workingMemory);
                LeftTupleList list = ruleAgendaItem.getRuleExecutor().getLeftTupleList();
                for (RuleTerminalNodeLeftTuple lt = (RuleTerminalNodeLeftTuple) list.getFirst(); lt != null; lt = (RuleTerminalNodeLeftTuple) lt.getNext()) {
                    if ( ruleName.equals( lt.getRule().getName() ) ) {
                        if ( checkProcessInstance( lt, processInstanceId ) ) {
                            return true;
                        }
View Full Code Here

            ((AgendaItem)dep.getJustifier()).removeBlocked( dep );
            entry = tmp;
        }
       
        if ( wasBlocked ) {
            RuleAgendaItem ruleAgendaItem = targetMatch.getRuleAgendaItem();
            InternalAgenda agenda = (InternalAgenda) workingMemory.getAgenda();
            agenda.stageLeftTuple(ruleAgendaItem, targetMatch);
        }
    }
View Full Code Here

                this.previousBlocked.remove( dep );

                AgendaItem justified = ( AgendaItem ) dep.getJustified();
                justified.getBlockers().remove( dep.getJustifierEntry() );
                if (justified.getBlockers().isEmpty() ) {
                    RuleAgendaItem ruleAgendaItem = justified.getRuleAgendaItem();
                    ((InternalAgenda) workingMemory.getAgenda()).stageLeftTuple(ruleAgendaItem, justified);
                }
                dep = tmp;
            }
        }       
View Full Code Here

    public RuleAgendaItem createRuleAgendaItem(final int salience,
                                               final PathMemory rs,
                                               final TerminalNode rtn) {
        InternalAgendaGroup agendaGroup = (InternalAgendaGroup) getAgendaGroup( rtn.getRule().getAgendaGroup() );
        InternalRuleFlowGroup ruleflowGroup = (InternalRuleFlowGroup) getRuleFlowGroup(rtn.getRule().getRuleFlowGroup());
        RuleAgendaItem lazyAgendaItem = new RuleAgendaItem( activationCounter++, null, salience, null, rs, rtn, isDeclarativeAgenda(), agendaGroup, ruleflowGroup );
        return lazyAgendaItem;
    }
View Full Code Here

        boolean tryagain;
        int localFireCount = 0;
        try {
            do {
                while ( !eager.isEmpty() ) {
                    RuleAgendaItem item = eager.removeFirst();
                    log.trace("Eager Evaluating rule {}.", item.getRule().getName() );
                    item.getRuleExecutor().evaluateNetwork(this.workingMemory);
                }
                this.workingMemory.prepareToFireActivation();
                tryagain = false;
                final InternalAgendaGroup group = (InternalAgendaGroup) getNextFocus();

                // if there is a group with focus
                if ( group != null ) {
                    if ( this.unlinkingEnabled ) {
                        final RuleAgendaItem item = (RuleAgendaItem) group.peekNext();
                        localFireCount = item.getRuleExecutor().evaluateNetworkAndFire(this.workingMemory, filter,
                                                                                       fireCount, fireLimit);
                        if ( localFireCount == 0 ) {
                            // nothing matched
                            tryagain = true; // will force the next Activation of the agenda, without going to outer loop which checks halt
                            this.workingMemory.executeQueuedActions(); // There may actions to process, which create new rule matches
                        }
                    } else {
                        final AgendaItem item = (AgendaItem) group.getNext();
                        // if there is an item to fire from that group
                        if ( item != null ) {
                            // if that item is allowed to fire
                            // The routine bellow cleans up ruleflow activations
                            InternalRuleFlowGroup ruleFlowGroup = null;
                            if ( item.getActivationNode() != null ) {
                                ruleFlowGroup = (InternalRuleFlowGroup) item.getActivationNode().getParentContainer();
                                // it is possible that the ruleflow group is no longer active if it was
                                // cleared during execution of this activation
                                ruleFlowGroup.removeActivation( item );
                            }
View Full Code Here

        return localFireCount;
    }

    public void xxx() {
        InternalAgendaGroup group = (InternalAgendaGroup) getNextFocus();
        RuleAgendaItem item = (RuleAgendaItem) (AgendaItem) group.peekNext();




    }
View Full Code Here

        public Map<ActivationKey, ProtobufMessages.Activation> getRneActivations() {
            return rneActivations;
        }

        public void fireRNEAs(final InternalWorkingMemory wm) {
            RuleAgendaItem rnea = null;
            while ((rnea = rneaToFire.poll()) != null) {
                rnea.remove();
                rnea.setQueued(false);
                rnea.getRuleExecutor().evaluateNetworkAndFire(wm, null, 0, -1);
            }
        }
View Full Code Here

        }

        List<PathMemory> pmems =  lmem.getSegmentMemory().getPathMemories();
        for ( int i = 0, length = pmems.size(); i < length; i++ ) {
            PathMemory rm = pmems.get( i );
            RuleAgendaItem evaluator = agenda.createRuleAgendaItem(Integer.MAX_VALUE, rm, (TerminalNode) rm.getNetworkNode());
            evaluator.getRuleExecutor().setDirty(true);
            evaluator.getRuleExecutor().evaluateNetworkAndFire(this, null, 0, -1);
        }

        return tnodes;
    }
View Full Code Here

            List<PathMemory> pmems =  lmem.getSegmentMemory().getPathMemories();
            for ( int i = 0, length = pmems.size(); i < length; i++ ) {
                PathMemory rm = pmems.get( i );

                RuleAgendaItem evaluator = agenda.createRuleAgendaItem(Integer.MAX_VALUE, rm, (TerminalNode) rm.getNetworkNode());
                evaluator.getRuleExecutor().setDirty(true);
                evaluator.getRuleExecutor().evaluateNetworkAndFire(this, null, 0, -1);
            }

            getFactHandleFactory().destroyFactHandle( factHandle );

        } finally {
View Full Code Here

TOP

Related Classes of org.drools.core.phreak.RuleAgendaItem

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.