Examples of RightTupleIndexHashTable


Examples of org.drools.core.util.RightTupleIndexHashTable

            for ( int i = 0; i < indexedPositions.length; i++ ) {
                checkSameConstraintForIndex( constraints[indexedPositions[i]],
                                             index.getFieldIndex( i ) );
            }

            RightTupleIndexHashTable factHashTable = (RightTupleIndexHashTable) betaMemory.getRightTupleMemory();
            assertTrue( factHashTable.isIndexed() );
            index = factHashTable.getIndex();

            for ( int i = 0; i < indexedPositions.length; i++ ) {
                checkSameConstraintForIndex( constraints[indexedPositions[i]],
                                             index.getFieldIndex( i ) );
            }
        } else {
            LeftTupleList tupleHashTable = (LeftTupleList) betaMemory.getLeftTupleMemory();
            assertFalse( tupleHashTable.isIndexed() );

            RightTupleList factHashTable = (RightTupleList) betaMemory.getRightTupleMemory();
            assertFalse( factHashTable.isIndexed() );
        }
    }
View Full Code Here

Examples of org.drools.core.util.RightTupleIndexHashTable

        betaMemory.getRightTupleMemory().add( new RightTuple( fh6, null ) );
        betaMemory.getRightTupleMemory().add( new RightTuple( fh7, null ) );
        betaMemory.getRightTupleMemory().add( new RightTuple( fh8, null ) );
        betaMemory.getRightTupleMemory().add( new RightTuple( fh9, null ) );
       
        RightTupleIndexHashTable hashTable = (RightTupleIndexHashTable) betaMemory.getRightTupleMemory();
        // can't create a 0 hashCode, so forcing
        RightTupleList rightTupleList = new RightTupleList();
        rightTupleList.add( new RightTuple( fh10, null) );
        hashTable.getTable()[0] = rightTupleList;
        rightTupleList = new RightTupleList();
        rightTupleList.add( new RightTuple( fh11, null ) );
        rightTupleList.add( new RightTuple( fh12, null ) );
        rightTupleList.add( new RightTuple( fh13, null ) );
        ((RightTupleList)hashTable.getTable()[0]).setNext( rightTupleList );
       
        Entry[] table = hashTable.getTable();
        List list = new ArrayList();
        for ( int i = 0; i < table.length; i++ ) {
            if ( table[i] != null ) {
                List entries = new ArrayList();
                entries.add( i );
View Full Code Here

Examples of org.drools.core.util.RightTupleIndexHashTable

            for ( int i = 0; i < indexedPositions.length; i++ ) {
                checkSameConstraintForIndex( constraints[indexedPositions[i]],
                                             index.getFieldIndex( i ) );
            }

            RightTupleIndexHashTable factHashTable = (RightTupleIndexHashTable) betaMemory.getRightTupleMemory();
            assertTrue( factHashTable.isIndexed() );
            index = factHashTable.getIndex();

            for ( int i = 0; i < indexedPositions.length; i++ ) {
                checkSameConstraintForIndex( constraints[indexedPositions[i]],
                                             index.getFieldIndex( i ) );
            }
        } else {
            LeftTupleList tupleHashTable = (LeftTupleList) betaMemory.getLeftTupleMemory();
            assertFalse( tupleHashTable.isIndexed() );

            RightTupleList factHashTable = (RightTupleList) betaMemory.getRightTupleMemory();
            assertFalse( factHashTable.isIndexed() );
        }
    }
View Full Code Here

Examples of org.drools.core.util.RightTupleIndexHashTable

                tupleMemory = new LeftTupleList();
            }

            RightTupleMemory factHandleMemory;
            if ( conf.isIndexRightBetaMemory() ) {
                factHandleMemory = new RightTupleIndexHashTable( indexes );
            } else {
                factHandleMemory = new RightTupleList();
            }
            memory = new BetaMemory( conf.isSequential() ? null : tupleMemory,
                                     factHandleMemory,
View Full Code Here

Examples of org.drools.core.util.index.RightTupleIndexHashTable

                for ( int i = 0; i < indexedPositions.length; i++ ) {
                    checkSameConstraintForIndex( (IndexableConstraint)constraints[indexedPositions[i]],
                                                 index.getFieldIndex( i ) );
                }

                RightTupleIndexHashTable factHashTable = (RightTupleIndexHashTable) betaMemory.getRightTupleMemory();
                assertTrue( factHashTable.isIndexed() );
                index = factHashTable.getIndex();

                for ( int i = 0; i < indexedPositions.length; i++ ) {
                    checkSameConstraintForIndex( (IndexableConstraint)constraints[indexedPositions[i]],
                                                 index.getFieldIndex( i ) );
                }
            } else {

            }
        } else {
            LeftTupleList tupleHashTable = (LeftTupleList) betaMemory.getLeftTupleMemory();
            assertFalse( tupleHashTable.isIndexed() );

            RightTupleList factHashTable = (RightTupleList) betaMemory.getRightTupleMemory();
            assertFalse( factHashTable.isIndexed() );
        }
    }
View Full Code Here

Examples of org.drools.core.util.index.RightTupleIndexHashTable

            assertFalse( contains( list, rightTuple ) ); // ensure no duplicate
            list.add( rightTuple );
        }
       
        // test normal
        RightTupleIndexHashTable rthTable = new RightTupleIndexHashTable();   
        rthTable.init( table, 3, numEntries * 3 );
        RightTupleIndexHashTable.FieldIndexHashTableFullIterator iter2 = new RightTupleIndexHashTable.FieldIndexHashTableFullIterator( rthTable );
        list = new ArrayList<RightTuple>();
        for ( RightTuple rightTuple = (RightTuple) iter2.next( ); rightTuple != null; rightTuple = (RightTuple) iter2.next( ) ) {
            assertFalse( contains( list, rightTuple ) ); // ensure no duplicate
            list.add( rightTuple );
View Full Code Here

Examples of org.drools.core.util.index.RightTupleIndexHashTable

        betaMemory.getRightTupleMemory().add( new RightTuple( fh6, null ) );
        betaMemory.getRightTupleMemory().add( new RightTuple( fh7, null ) );
        betaMemory.getRightTupleMemory().add( new RightTuple( fh8, null ) );
        betaMemory.getRightTupleMemory().add( new RightTuple( fh9, null ) );
       
        RightTupleIndexHashTable hashTable = (RightTupleIndexHashTable) betaMemory.getRightTupleMemory();
        // can't create a 0 hashCode, so forcing
        RightTupleList rightTupleList = new RightTupleList();
        rightTupleList.add( new RightTuple( fh10, null) );
        hashTable.getTable()[0] = rightTupleList;
        rightTupleList = new RightTupleList();
        rightTupleList.add( new RightTuple( fh11, null ) );
        rightTupleList.add( new RightTuple( fh12, null ) );
        rightTupleList.add( new RightTuple( fh13, null ) );
        ((RightTupleList)hashTable.getTable()[0]).setNext( rightTupleList );
       
        Entry[] table = hashTable.getTable();
        List list = new ArrayList();
        for ( int i = 0; i < table.length; i++ ) {
            if ( table[i] != null ) {
                List entries = new ArrayList();
                entries.add( i );
View Full Code Here

Examples of org.drools.core.util.index.RightTupleIndexHashTable

        final FieldIndex fieldIndex = new FieldIndex( extractor,
                                                      declaration,
                                                      MvelConstraint.INDEX_EVALUATOR );

        final RightTupleIndexHashTable map = new RightTupleIndexHashTable( new FieldIndex[]{fieldIndex} );

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

        assertEquals( 0,
                      map.size() );
        assertNull( map.get( new LeftTupleImpl( cheddarHandle1,
                                            null,
                                            true ), cheddarHandle1 ) );

        final Cheese stilton1 = new Cheese( "stilton",
                                            35 );
        RightTuple stiltonRighTuple = new RightTuple( new DefaultFactHandle( 1,
                                                                             stilton1 ),
                                                      null );

        map.add( stiltonRighTuple );

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

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

        final RightTupleList list = map.get( new LeftTupleImpl( stiltonHandle2,
                                                            null,
                                                            true ), stiltonHandle2 );
        assertSame( stiltonRighTuple.getFactHandle(),
                    list.first.getFactHandle() );
        assertNull( list.first.getNext() );
View Full Code Here

Examples of org.drools.core.util.index.RightTupleIndexHashTable

        final FieldIndex fieldIndex = new FieldIndex( extractor,
                                                      declaration,
                                                      MvelConstraint.INDEX_EVALUATOR );

        final RightTupleIndexHashTable map = new RightTupleIndexHashTable( new FieldIndex[]{fieldIndex} );

        assertEquals( 0,
                      map.size() );

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

        final Cheese cheddar1 = new Cheese( "cheddar",
                                            35 );
        final InternalFactHandle cheddarHandle1 = new DefaultFactHandle( 2,
                                                                         cheddar1 );
        map.add( new RightTuple( cheddarHandle1,
                                 null ) );

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

        final Cheese stilton2 = new Cheese( "stilton",
                                            77 );
        final InternalFactHandle stiltonHandle2 = new DefaultFactHandle( 2,
                                                                         stilton2 );
        RightTupleList list = map.get( new LeftTupleImpl( stiltonHandle2,
                                                      null,
                                                      true ),stiltonHandle2 );
        assertSame( stiltonHandle1,
                    list.first.getFactHandle() );
        assertNull( list.first.getNext() );

        final Cheese cheddar2 = new Cheese( "cheddar",
                                            5 );
        final InternalFactHandle cheddarHandle2 = new DefaultFactHandle( 2,
                                                                         cheddar2 );
        list = map.get( new LeftTupleImpl( cheddarHandle2,
                                       null,
                                       true ), cheddarHandle2 );
        assertSame( cheddarHandle1,
                    list.first.getFactHandle() );
        assertNull( list.first.getNext() );
View Full Code Here

Examples of org.drools.core.util.index.RightTupleIndexHashTable

        final FieldIndex fieldIndex = new FieldIndex( extractor,
                                                      declaration,
                                                      MvelConstraint.INDEX_EVALUATOR );

        final RightTupleIndexHashTable map = new RightTupleIndexHashTable( new FieldIndex[]{fieldIndex} );

        assertEquals( 0,
                      map.size() );

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

        final Cheese cheddar1 = new Cheese( "cheddar",
                                            35 );
        final InternalFactHandle cheddarHandle1 = new DefaultFactHandle( 2,
                                                                         cheddar1 );
        map.add( new RightTuple( cheddarHandle1,
                                 null ) );

        final Cheese stilton2 = new Cheese( "stilton",
                                            81 );
        final InternalFactHandle stiltonHandle2 = new DefaultFactHandle( 3,
                                                                         stilton2 );
        map.add( new RightTuple( stiltonHandle2,
                                 null ) );

        assertEquals( 3,
                      map.size() );
        assertEquals( 2,
                      tablePopulationSize( map ) );

        // Check they are correctly chained to the same FieldIndexEntry
        final Cheese stilton3 = new Cheese( "stilton",
                                            89 );
        final InternalFactHandle stiltonHandle3 = new DefaultFactHandle( 4,
                                                                         stilton2 );

        final RightTupleList list = map.get( new LeftTupleImpl( stiltonHandle3,
                                                            null,
                                                            true ), stiltonHandle3 );
        assertSame( stiltonHandle1,
                    list.first.getFactHandle() );
        assertSame( stiltonHandle2,
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.