Examples of ReteTuple


Examples of org.drools.reteoo.ReteTuple

                                           10 );

        final Cheese cheddar = new Cheese( "cheddar",
                                           10 );
        final InternalFactHandle f0 = (InternalFactHandle) wm.insert( cheddar );
        final ReteTuple tuple = new ReteTuple( f0 );

        final PredicateContextEntry predicateContext = (PredicateContextEntry) predicate.createContextEntry();
        predicateContext.leftTuple = tuple;

        assertTrue( predicate.isAllowedCachedLeft( predicateContext,
View Full Code Here

Examples of org.drools.reteoo.ReteTuple

        final WorkingMemory wm = ruleBase.newStatefulSession();

        final Cheese cheddar = new Cheese( "cheddar",
                                           10 );
        final InternalFactHandle f0 = (InternalFactHandle) wm.insert( cheddar );
        final ReteTuple tuple = new ReteTuple( f0 );
       
        Object evalContext = eval.createContext();

        assertTrue( eval.isAllowed( tuple,
                                    wm,
View Full Code Here

Examples of org.drools.reteoo.ReteTuple

                                           10 );

        final Cheese cheddar = new Cheese( "cheddar",
                                           10 );
        final InternalFactHandle f0 = (InternalFactHandle) wm.insert( cheddar );
        ReteTuple tuple = new ReteTuple( f0 );

        final InternalFactHandle f1 = (InternalFactHandle) wm.insert( stilton );
        tuple = new ReteTuple( tuple,
                               f1 );

        final Cheese brie = new Cheese( "brie",
                                        20 );
       
View Full Code Here

Examples of org.drools.reteoo.ReteTuple

    }

    public boolean isAllowedCachedLeft(final ContextEntry context,
                                       final Object object) {
        // object MUST be a ReteTuple
        final ReteTuple tuple = ((ReteTuple) object).getSubTuple( ((TupleStartEqualsConstraintContextEntry) context).compareSize );
        return ((TupleStartEqualsConstraintContextEntry) context).left.equals( tuple );
    }
View Full Code Here

Examples of org.drools.reteoo.ReteTuple

        final InternalFactHandle cheddarHandle1 = new DefaultFactHandle( 0,
                                                                         cheddar );

        assertEquals( 0,
                      map.size() );
        assertNull( map.get( new ReteTuple( cheddarHandle1 ) ) );

        final Cheese stilton1 = new Cheese( "stilton",
                                            35 );
        final InternalFactHandle stiltonHandle1 = new DefaultFactHandle( 1,
                                                                         stilton1 );
        map.add( stiltonHandle1 );

        assertEquals( 1,
                      map.size() );
        assertEquals( 1,
                      tablePopulationSize( map ) );

        final Cheese stilton2 = new Cheese( "stilton",
                                            80 );
        final InternalFactHandle stiltonHandle2 = new DefaultFactHandle( 2,
                                                                         stilton2 );

        final FieldIndexEntry stiltonEntry = map.get( new ReteTuple( stiltonHandle2 ) );
        assertSame( stiltonHandle1,
                    stiltonEntry.getFirst().getFactHandle() );
        assertNull( stiltonEntry.getFirst().getNext() );
    }
View Full Code Here

Examples of org.drools.reteoo.ReteTuple

        final Cheese stilton2 = new Cheese( "stilton",
                                            77 );
        final InternalFactHandle stiltonHandle2 = new DefaultFactHandle( 2,
                                                                         stilton2 );
        final FieldIndexEntry stiltonEntry = map.get( new ReteTuple( stiltonHandle2 ) );
        assertSame( stiltonHandle1,
                    stiltonEntry.getFirst().getFactHandle() );
        assertNull( stiltonEntry.getFirst().getNext() );

        final Cheese cheddar2 = new Cheese( "cheddar",
                                            5 );
        final InternalFactHandle cheddarHandle2 = new DefaultFactHandle( 2,
                                                                         cheddar2 );
        final FieldIndexEntry cheddarEntry = map.get( new ReteTuple( cheddarHandle2 ) );
        assertSame( cheddarHandle1,
                    cheddarEntry.getFirst().getFactHandle() );
        assertNull( cheddarEntry.getFirst().getNext() );
    }
View Full Code Here

Examples of org.drools.reteoo.ReteTuple

        final Cheese stilton3 = new Cheese( "stilton",
                                            89 );
        final InternalFactHandle stiltonHandle3 = new DefaultFactHandle( 4,
                                                                         stilton2 );

        final FieldIndexEntry stiltonEntry = map.get( new ReteTuple( stiltonHandle3 ) );
        assertSame( stiltonHandle2,
                    stiltonEntry.getFirst().getFactHandle() );
        assertSame( stiltonHandle1,
                    ((FactEntryImpl) stiltonEntry.getFirst().getNext()).getFactHandle() );
    }
View Full Code Here

Examples of org.drools.reteoo.ReteTuple

        final Cheese stilton = new Cheese( "stilton",
                                           55 );
        final InternalFactHandle stiltonHandle = new DefaultFactHandle( 2,
                                                                        stilton );

        final Iterator it = map.iterator( new ReteTuple( stiltonHandle ) );
        for ( ObjectEntry entry = (ObjectEntry) it.next(); entry != null; entry = (ObjectEntry) it.next() ) {
            fail( "Map is empty, there should be no iteration" );
        }
    }
View Full Code Here

Examples of org.drools.reteoo.ReteTuple

    public ReteTuple get(final ReteTuple tuple) {
        final int hashCode = tuple.hashCode();
        final int index = indexOf( hashCode,
                                   this.table.length );

        ReteTuple current = (ReteTuple) this.table[index];
        while ( current != null ) {
            if ( hashCode == current.hashCode() && tuple.equals( current ) ) {
                return current;
            }
            current = (ReteTuple) current.getNext();
        }
        return null;
    }
View Full Code Here

Examples of org.drools.reteoo.ReteTuple

    public ReteTuple remove(final ReteTuple tuple) {
        final int hashCode = tuple.hashCode();
        final int index = indexOf( hashCode,
                                   this.table.length );

        ReteTuple previous = (ReteTuple) this.table[index];
        ReteTuple current = previous;
        while ( current != null ) {
            final ReteTuple next = (ReteTuple) current.getNext();
            if ( hashCode == current.hashCode() && tuple.equals( current ) ) {
                if ( previous == current ) {
                    this.table[index] = next;
                } else {
                    previous.setNext( next );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.