Package org.drools.util

Examples of org.drools.util.Iterator


    public void updateSink(final TupleSink sink,
                           final PropagationContext context,
                           final InternalWorkingMemory workingMemory) {
        final AccumulateMemory memory = (AccumulateMemory) workingMemory.getNodeMemory( this );

        final Iterator it = memory.betaMemory.getCreatedHandles().iterator();

        for ( ObjectEntry entry = (ObjectEntry) it.next(); entry != null; entry = (ObjectEntry) it.next() ) {
            AccumulateResult accresult = (AccumulateResult) entry.getValue();
            sink.assertTuple( new ReteTuple( (ReteTuple) entry.getKey(),
                                             accresult.handle ),
                              context,
                              workingMemory );
View Full Code Here


                               this.context,
                               this.workingMemory );
        assertEquals( 2,
                      this.memory.getTupleMemory().size() );

        final Iterator it = this.memory.getTupleMemory().iterator();
        assertEquals( tuple0,
                      it.next() );
        assertEquals( tuple1,
                      it.next() );
    }
View Full Code Here

                                this.context,
                                this.workingMemory );
        assertEquals( 2,
                      this.memory.getFactHandleMemory().size() );

        final Iterator it = this.memory.getFactHandleMemory().iterator( new ReteTuple( f0 ) );

        final InternalFactHandle rf0 = ((FactEntry) it.next()).getFactHandle();
        final InternalFactHandle rf1 = ((FactEntry) it.next()).getFactHandle();

        assertEquals( f0,
                      rf0 );
        assertEquals( f1,
                      rf1 );
View Full Code Here

                       final InternalWorkingMemory[] workingMemories) {
        for ( int i = 0, length = workingMemories.length; i < length; i++ ) {
            final InternalWorkingMemory workingMemory = workingMemories[i];

            final TerminalNodeMemory memory = (TerminalNodeMemory) workingMemory.getNodeMemory( this );
            final Iterator it = memory.getTupleMemory().iterator();
            for ( ReteTuple tuple = (ReteTuple) it.next(); tuple != null; tuple = (ReteTuple) it.next() ) {
                final Activation activation = tuple.getActivation();

                if ( activation.isActivated() ) {
                    activation.remove();
                    ((EventSupport) workingMemory).getAgendaEventSupport().fireActivationCancelled( activation,
View Full Code Here

        final int index = fieldIndex.getIndex();

        final List sinks = new ArrayList();

        //iterate twice as custom iterator is immutable
        final Iterator mapIt = this.hashedSinkMap.newIterator();
        for ( ObjectHashMap.ObjectEntry e = (ObjectHashMap.ObjectEntry) mapIt.next(); e != null; ) {

            sinks.add( e.getValue() );
            e = (ObjectHashMap.ObjectEntry) mapIt.next();
        }

        for ( final java.util.Iterator iter = sinks.iterator(); iter.hasNext(); ) {
            final AlphaNode sink = (AlphaNode) iter.next();
            final AlphaNode alphaNode = sink;
View Full Code Here

                                            context,
                                            workingMemory );
                    }
                }
            } else if ( this.hashedSinkMap != null ) {
                final Iterator it = this.hashedSinkMap.newIterator();
                for ( ObjectEntry entry = (ObjectEntry) it.next(); entry != null; entry = (ObjectEntry) it.next() ) {
                    final ObjectSink sink = (ObjectSink) entry.getValue();
                    sink.retractObject( handle,
                                        context,
                                        workingMemory );
                }
View Full Code Here

                list.add( sink );
            }
        }

        if ( this.hashedSinkMap != null ) {
            final Iterator it = this.hashedSinkMap.newIterator();
            for ( ObjectEntry entry = (ObjectEntry) it.next(); entry != null; entry = (ObjectEntry) it.next() ) {
                final ObjectSink sink = (ObjectSink) entry.getValue();
                list.add( sink );
            }
        }
View Full Code Here

                           final PropagationContext context,
                           final InternalWorkingMemory workingMemory) {

        final FromMemory memory = (FromMemory) workingMemory.getNodeMemory( this );

        final Iterator tupleIter = memory.betaMemory.getTupleMemory().iterator();
        for ( ReteTuple tuple = (ReteTuple) tupleIter.next(); tuple != null; tuple = (ReteTuple) tupleIter.next() ) {
            final LinkedList list = (LinkedList) memory.betaMemory.getCreatedHandles().remove( tuple );
            if ( list == null ) {
                continue;
            }
            for ( LinkedListEntry entry = (LinkedListEntry) list.getFirst(); entry != null; entry = (LinkedListEntry) entry.getNext() ) {
View Full Code Here

       
        if ( this.tupleMemoryEnabled ) {
            memory.getTupleMemory().add( leftTuple );
        }

        final Iterator it = memory.getFactHandleMemory().iterator( leftTuple );
        this.constraints.updateFromTuple( memory.getContext(),
                                          workingMemory,
                                          leftTuple );
        for ( FactEntry entry = (FactEntry) it.next(); entry != null; entry = (FactEntry) it.next() ) {
            final InternalFactHandle handle = entry.getFactHandle();
           
            if ( this.constraints.isAllowedCachedLeft(memory.getContext(), handle.getObject() ) ) {
           
                this.sink.propagateAssertTuple( leftTuple,
View Full Code Here

        if ( ! this.tupleMemoryEnabled ) {
            // do nothing here, as we know there are no left tuples at this stage in sequential mode.
            return;
        }

        final Iterator it = memory.getTupleMemory().iterator( handle );
        this.constraints.updateFromFactHandle( memory.getContext(),
                                               workingMemory,
                                               handle );
        for ( ReteTuple tuple = (ReteTuple) it.next(); tuple != null; tuple = (ReteTuple) it.next() ) {
            if ( this.constraints.isAllowedCachedRight( memory.getContext(),
                                                        tuple ) ) {
                this.sink.propagateAssertTuple( tuple,
                                                handle,
                                                context,
View Full Code Here

TOP

Related Classes of org.drools.util.Iterator

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.