Package org.drools.core.util

Examples of org.drools.core.util.LinkedList


    private final LinkedList list;

    public ActivationGroupImpl(final String name) {
        this.name = name;
        this.list = new LinkedList();
    }


    }
   
    public TripleNonIndexSkipBetaConstraints(TripleBetaConstraints constraints) {
        this.constraints = constraints;
        LinkedList list = constraints.getConstraints();
        this.constraint0 = (BetaNodeFieldConstraint) ((LinkedListEntry)list.getFirst()).getObject();
        this.constraint1 = (BetaNodeFieldConstraint) ((LinkedListEntry)list.getFirst().getNext()).getObject();
        this.constraint2 = (BetaNodeFieldConstraint) ((LinkedListEntry)list.getFirst().getNext().getNext()).getObject();
    }

   
    public void removeLogicalDependency(final Activation activation,
                                        final LogicalDependency node,
                                        final PropagationContext context) {
        final InternalFactHandle handle = (InternalFactHandle) node.getJustified();
        final LinkedList list = (LinkedList) this.justifiedMap.get( handle.getId() );
        if ( list != null ) {
            list.remove( node.getJustifierEntry() );
            WorkingMemoryAction action = new LogicalRetractCallback( this,
                                                                     node,
                                                                     list,
                                                                     handle,
                                                                     context,

     *
     * @param handle - The FactHandle to be removed
     * @throws FactException
     */
    public void removeLogicalDependencies(final InternalFactHandle handle) throws FactException {
        final LinkedList list = (LinkedList) this.justifiedMap.remove( handle.getId() );
        if ( list != null && !list.isEmpty() ) {
            for ( LinkedListEntry entry = (LinkedListEntry) list.getFirst(); entry != null; entry = (LinkedListEntry) entry.getNext() ) {
                final LogicalDependency node = (LogicalDependency) entry.getObject();
                node.getJustifier().getLogicalDependencies().remove( node );
            }
        }
    }

                                                              handle );
        activation.getRule().setHasLogicalDependency( true );

        activation.addLogicalDependency( node );
       
        LinkedList list = (LinkedList) this.justifiedMap.get( handle.getId() );
        if ( list == null ) {
            if ( context.getType() == PropagationContext.MODIFICATION ) {
                // if this was a  update, chances  are its trying  to retract a logical assertion
            }
            list = new LinkedList();
            this.justifiedMap.put( handle.getId(),
                                   list );
        }
        list.add( node.getJustifierEntry() );
    }

    /* (non-Javadoc)
     * @see org.drools.common.BetaNodeConstraints#getConstraints()
     */
    public LinkedList getConstraints() {
        final LinkedList list = new LinkedList();
        list.add( new LinkedListEntry( this.constraint0 ) );
        list.add( new LinkedListEntry( this.constraint1 ) );
        return list;
    }

    public DefaultBetaConstraints(final BetaNodeFieldConstraint[] constraints,
                                  final RuleBaseConfiguration conf,
                                  final boolean disableIndexing) {
        this.indexed = -1;
        this.constraints = new LinkedList();
        int depth = conf.getCompositeKeyDepth();
       
        if ( !compositeAllowed(constraints) ) {
            // UnificationRestrictions cannot be allowed in composite indexes
            // We also ensure that if there is a mixture that standard restriction is first

    }
   
    public QuadroupleNonIndexSkipBetaConstraints(QuadroupleBetaConstraints constraints) {
        this.constraints = constraints;
        LinkedList list = constraints.getConstraints();
        this.constraint0 = (BetaNodeFieldConstraint) ((LinkedListEntry)list.getFirst()).getObject();
        this.constraint1 = (BetaNodeFieldConstraint) ((LinkedListEntry)list.getFirst().getNext()).getObject();
        this.constraint2 = (BetaNodeFieldConstraint) ((LinkedListEntry)list.getFirst().getNext().getNext()).getObject();
        this.constraint3 = (BetaNodeFieldConstraint) ((LinkedListEntry)list.getFirst().getNext().getNext().getNext()).getObject();
    }

    /* (non-Javadoc)
     * @see org.drools.common.BetaNodeConstraints#getConstraints()
     */
    public LinkedList getConstraints() {
        final LinkedList list = new LinkedList();
        return list;
    }

    }
   
    public void addBlocked(final LinkedListNode node) {       
        // Adds the blocked to the blockers list
        if ( this.blocked == null ) {
            this.blocked = new LinkedList();
        }

        this.blocked.add( node );
        LogicalDependency dep = ( LogicalDependency ) node;
       
        // now ad the blocker to the blocked's list - we need to check that references are null first
        AgendaItem blocked = (AgendaItem)dep.getJustified();
        if ( blocked.blockers == null ) {
            blocked.blockers = new LinkedList();
            blocked.blockers.add( dep.getJustifierEntry() );
        } else if ( dep.getJustifierEntry().getNext() == null && dep.getJustifierEntry().getPrevious() == null && blocked.getBlockers().getFirst() != dep.getJustifierEntry() ) {           
            blocked.blockers.add( dep.getJustifierEntry() );
        }
    }

TOP

Related Classes of org.drools.core.util.LinkedList

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.