Package org.drools.common

Examples of org.drools.common.LogicalDependency


        List<LogicalDependency> justifiers = new ArrayList<LogicalDependency>();
        LinkedList entryList = (LinkedList) jhm.get( handle.getId() );
        Iterator sub = entryList.iterator();
        LinkedListEntry lle;
        while ( ( lle = (LinkedListEntry) sub.next() ) != null ) {
            LogicalDependency dep = (LogicalDependency) lle.getObject();
            justifiers.add( dep );
        }

        return justifiers;
    }
View Full Code Here


    }
     
    public void blockActivation(org.drools.runtime.rule.Activation act) {
        AgendaItem targetMatch = ( AgendaItem ) act;
        // iterate to find previous equal logical insertion
        LogicalDependency dep = null;
        if ( this.previousJustified != null ) {
            for ( dep = (LogicalDependency) this.previousJustified.getFirst(); dep != null; dep = (LogicalDependency) dep.getNext() ) {
                if ( targetMatch ==  dep.getJustified() ) {
                    this.previousJustified.remove( dep );
                    break;
                }
            }
        }
       
        if ( dep == null ) {
            dep = new LogicalDependency( activation, targetMatch );
        }
        this.activation.addBlockeddep );
       
        if ( targetMatch.getBlockers().size() == 1 && targetMatch.isActive()  ) {
            // it wasn't blocked before, but is now, so we must remove it from all groups, so it cannot be executed.
View Full Code Here

        AgendaItem targetMatch = ( AgendaItem ) act;
        boolean wasBlocked = (targetMatch.getBlockers() != null && !targetMatch.getBlockers().isEmpty() );
       
        for ( LinkedListEntry entry = ( LinkedListEntry ) targetMatch.getBlockers().getFirst(); entry != null) {
            LinkedListEntry tmp = ( LinkedListEntry ) entry.getNext();
            LogicalDependency dep = ( LogicalDependency ) entry.getObject();
            ((AgendaItem)dep.getJustifier()).removeBlocked( dep );
            entry = tmp;
        }
       
        if ( wasBlocked ) {
            // the match is no longer blocked, so stage it
View Full Code Here

        if ( !activation.isMatched() ) {
            // Activation is already unmatched, can't do logical insertions against it
            return;
        }
        // iterate to find previous equal logical insertion
        LogicalDependency dep = null;
        if ( this.previousJustified != null ) {
            for ( dep = (LogicalDependency) this.previousJustified.getFirst(); dep != null; dep = (LogicalDependency) dep.getNext() ) {
                if ( object.equals( ((InternalFactHandle) dep.getJustified()).getObject() ) ) {
                    this.previousJustified.remove( dep );
                    break;
                }
            }
        }
View Full Code Here

            }
        }
       
        if ( this.previousBlocked != null ) {
            for ( LogicalDependency dep = (LogicalDependency) this.previousBlocked.getFirst(); dep != null; ) {
                LogicalDependency tmp = ( LogicalDependency ) dep.getNext();
                this.previousBlocked.remove( dep );
               
                AgendaItem justified = ( AgendaItem ) dep.getJustified();
                justified.getBlockers().remove( dep.getJustifierEntry() );
                if (justified.getBlockers().isEmpty() ) {
View Full Code Here

    }
   
    public void blockMatch(Match act) {
        AgendaItem targetMatch = ( AgendaItem ) act;
        // iterate to find previous equal logical insertion
        LogicalDependency dep = null;
        if ( this.previousJustified != null ) {
            for ( dep = this.previousJustified.getFirst(); dep != null; dep = dep.getNext() ) {
                if ( targetMatch ==  dep.getJustified() ) {
                    this.previousJustified.remove( dep );
                    break;
                }
            }
        }
View Full Code Here

    }
   
    public void remove( LinkedListNode node ) {
        super.remove(node);

        LogicalDependency ld = (LogicalDependency) ((LinkedListEntry) node).getObject();

        boolean neg = ld.getValue() != null && MODE.NEGATIVE.getId().equals( ld.getValue().toString() );
        if ( neg ) {
            negCounter--;
        } else {
            posCounter--;
        }
View Full Code Here

    public void cancel(PropagationContext context) {       
        // get all but last, as that we'll do via the BeliefSystem, for cleanup
        // note we don't update negative, conflict counters. It's needed for the last cleanup operation
        for ( LinkedListEntry entry = (LinkedListEntry) getFirst(); entry != getLast()) {
            LinkedListEntry temp = (LinkedListEntry) entry.getNext(); // get next, as we are about to remove it
            final LogicalDependency node = (LogicalDependency) entry.getObject();
            node.getJustifier().getLogicalDependencies().remove( node );
            remove( entry );
            entry = temp;
        }
       
        LinkedListEntry last = (LinkedListEntry) getFirst();
        final LogicalDependency node = (LogicalDependency) last.getObject();
        node.getJustifier().getLogicalDependencies().remove( node );
        beliefSystem.delete( node, this, context );
        positiveFactHandle = null;
        negativeFactHandle = null;
    }
View Full Code Here

   
    public void clear(PropagationContext context) {
        // remove all, but don't allow the BeliefSystem to clean up, the FH is most likely going to be used else where
        for ( LinkedListEntry entry = (LinkedListEntry) getFirst(); entry != null) {
            LinkedListEntry temp = (LinkedListEntry) entry.getNext(); // get next, as we are about to remove it
            final LogicalDependency node = (LogicalDependency) entry.getObject();
            node.getJustifier().getLogicalDependencies().remove( node );
            remove( entry );
            entry = temp;
        }
    }   
View Full Code Here

                ProtobufMessages.Justification.Builder _justification = ProtobufMessages.Justification.newBuilder();
                _justification.setHandleId( ((Integer) entry.getKey()).intValue() );
               
                org.drools.core.util.LinkedList list = (org.drools.core.util.LinkedList) entry.getValue();
                for ( LinkedListEntry node = (LinkedListEntry) list.getFirst(); node != null; node =  (LinkedListEntry) node.getNext() ) {
                    LogicalDependency dependency = (LogicalDependency) node.getObject();
                    org.drools.spi.Activation activation = dependency.getJustifier();
                    ProtobufMessages.Activation _activation = ProtobufMessages.Activation.newBuilder()
                            .setPackageName( activation.getRule().getPackage() )
                            .setRuleName( activation.getRule().getName() )
                            .setTuple( PersisterHelper.createTuple( activation.getTuple() ) )
                            .build();
View Full Code Here

TOP

Related Classes of org.drools.common.LogicalDependency

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.