Package org.drools.reteoo

Examples of org.drools.reteoo.LeftTuple


        final Person p = new Person( "mark",
                                     "",
                                     31 );
        final InternalFactHandle f0 = (InternalFactHandle) wm.insert( p );
        final LeftTuple tuple = new LeftTuple( f0,
                                               null,
                                               true );

        assertEquals( 25,
                      context.getRule().getSalience().getValue( tuple,
View Full Code Here


                                 Rule rule,
                                 Salience salience,
                                 Person person) {
            wm = ruleBase.newStatefulSession();
            final InternalFactHandle f0 = (InternalFactHandle) wm.insert( person );
            tuple = new LeftTuple( f0,
                                   null,
                                   true );
            this.salience = salience;
            this.halt = false;
            this.error = false;
View Full Code Here

        final Cheese cheddar2 = new Cheese( "cheddar",
                                            8 );
        final InternalFactHandle f0 = (InternalFactHandle) wm.insert( new InitialFactImpl() );
        final InternalFactHandle f1 = (InternalFactHandle) wm.insert( cheddar1 );
        final InternalFactHandle f2 = (InternalFactHandle) wm.insert( cheddar2 );
        final LeftTuple tuple = new LeftTuple( f0,
                                               sink,
                                               true );

        Object[] wmContext = acc.createWorkingMemoryContext();
        Object[] accContext = acc.createContext();
View Full Code Here

       
        MockLeftTupleSink sink = new MockLeftTupleSink();
       
        final InternalFactHandle f0 = (InternalFactHandle) wm.insert( cheddar );
        final InternalFactHandle f1 = (InternalFactHandle) wm.insert( stilton );
        final LeftTuple tuple = new LeftTuple( f0, sink, true );

        final PredicateContextEntry predicateContext = (PredicateContextEntry) predicate.createContextEntry();
        predicateContext.leftTuple = tuple;
        predicateContext.workingMemory = wm;
View Full Code Here

        LeftTuple[] result = new LeftTuple[this.factSize];
        int index = 0;
        for ( int i = 0; i < this.table.length; i++ ) {
            LeftTupleList bucket = (LeftTupleList) this.table[i];
            while ( bucket != null ) {
                LeftTuple entry = (LeftTuple) bucket.getFirst( null );
                while ( entry != null ) {
                    result[index++] = entry;
                    entry = (LeftTuple) entry.getNext();
                }
                bucket = (LeftTupleList) bucket.getNext();
            }
        }
        return result;
View Full Code Here

        this.size++;
    }

    public void remove(final LeftTuple leftTuple) {
        LeftTuple previous = (LeftTuple) leftTuple.getPrevious();
        LeftTuple next = (LeftTuple) leftTuple.getNext();

        if ( previous != null && next != null ) {
            //remove  from middle
            previous.setNext( next );
            next.setPrevious( previous );
        } else if ( next != null ) {
            //remove from first
            this.first = next;
            next.setPrevious( null );
        } else if ( previous != null ) {
            //remove from end
            previous.setNext( null );
        } else {
            this.first = null;
View Full Code Here

    public boolean contains(final LeftTuple leftTuple) {
        return get( leftTuple ) != null;
    }

    public Object get(final LeftTuple leftTtuple) {
        LeftTuple current = this.first;
        while ( current != null ) {
            if ( leftTtuple.equals( current ) ) {
                return current;
            }
            current = (LeftTuple) current.getNext();
        }
        return null;
    }
View Full Code Here

    }

    public LeftTuple[] toArray() {
        LeftTuple[] tuples = new LeftTuple[this.size];

        LeftTuple current = first;
        for ( int i = 0; i < this.size; i++ ) {
            tuples[i] = current;
            current = (LeftTuple) current.getNext();
        }

        return tuples;
    }
View Full Code Here

            this.current = first;
        }

        public Object next() {
            if ( this.current != null ) {
                LeftTuple returnValue = this.current;
                this.current = (LeftTuple) current.getNext();
                return returnValue;
            } else {
                return null;
            }
View Full Code Here

                       
                    }

                    // we always lookup from the first element, in case it's indexed
                    List<InternalFactHandle> first = (List<InternalFactHandle>) expectedLeftTuples.get( 0 );
                    LeftTuple firstTuple = new LeftTupleImpl( first.get( 0 ),
                                                              null,
                                                              false);
                    for ( int i = 1; i < first.size(); i++ ) {
                        firstTuple = new LeftTupleImpl( firstTuple,
                                                        new RightTuple( first.get( i )),
View Full Code Here

TOP

Related Classes of org.drools.reteoo.LeftTuple

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.