Package org.drools.core.util.index

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


                      betaConstraints.getIndexCount() );
        BetaMemory betaMemory = betaConstraints.createBetaMemory( config, NodeTypeEnums.JoinNode );

        if ( indexedPositions.length > 0 ) {
            if (((IndexableConstraint)constraints[indexedPositions[0]]).getConstraintType() == ConstraintType.EQUAL) {
                LeftTupleIndexHashTable tupleHashTable = (LeftTupleIndexHashTable) betaMemory.getLeftTupleMemory();
                assertTrue( tupleHashTable.isIndexed() );
                Index index = tupleHashTable.getIndex();

                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


        }

        assertEquals( numEntries * 3, list.size() );
       
        // test normal
        LeftTupleIndexHashTable lthTable = new LeftTupleIndexHashTable();   
        lthTable.init( table, 3, numEntries * 3 );
        LeftTupleIndexHashTable.FieldIndexHashTableFullIterator iter2 = new LeftTupleIndexHashTable.FieldIndexHashTableFullIterator( lthTable );
        list = new ArrayList<LeftTupleImpl>();
        for ( LeftTupleImpl leftTuple = (LeftTupleImpl) iter2.next( ); leftTuple != null; leftTuple = (LeftTupleImpl) iter2.next( ) ) {
            assertFalse( contains( list, leftTuple ) ); // ensure no duplicate
            list.add( leftTuple );
View Full Code Here

                                                            true ) );
        betaMemory.getLeftTupleMemory().add( new LeftTupleImpl( fh9,
                                                            null,
                                                            true ) );

        LeftTupleIndexHashTable hashTable = (LeftTupleIndexHashTable) betaMemory.getLeftTupleMemory();
        // can't create a 0 hashCode, so forcing
        LeftTupleList leftTupleList = new LeftTupleList();
        leftTupleList.add( new LeftTupleImpl( fh10,
                                          null,
                                          true ) );
        hashTable.getTable()[0] = leftTupleList;
        leftTupleList = new LeftTupleList();
        leftTupleList.add( new LeftTupleImpl( fh11,
                                          null,
                                          true ) );
        leftTupleList.add( new LeftTupleImpl( fh12,
                                          null,
                                          true ) );
        leftTupleList.add( new LeftTupleImpl( fh13,
                                          null,
                                          true ) );
        ((LeftTupleList) hashTable.getTable()[0]).setNext( leftTupleList );

        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

                                                            true ) );
        betaMemory.getLeftTupleMemory().add( new LeftTupleImpl( fh9,
                                                            null,
                                                            true ) );

        LeftTupleIndexHashTable hashTable = (LeftTupleIndexHashTable) betaMemory.getLeftTupleMemory();
        // can't create a 0 hashCode, so forcing
        LeftTupleList leftTupleList = new LeftTupleList();
        leftTupleList.add( new LeftTupleImpl( fh10,
                                          null,
                                          true ) );
        hashTable.getTable()[0] = leftTupleList;
        leftTupleList = new LeftTupleList();
        leftTupleList.add( new LeftTupleImpl( fh11,
                                          null,
                                          true ) );
        leftTupleList.add( new LeftTupleImpl( fh12,
                                          null,
                                          true ) );
        leftTupleList.add( new LeftTupleImpl( fh13,
                                          null,
                                          true ) );
        ((LeftTupleList) hashTable.getTable()[0]).setNext( leftTupleList );

        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

                                                            true ) );
        betaMemory.getLeftTupleMemory().add( new LeftTupleImpl( fh9,
                                                            null,
                                                            true ) );

        LeftTupleIndexHashTable hashTable = (LeftTupleIndexHashTable) betaMemory.getLeftTupleMemory();
        // can't create a 0 hashCode, so forcing
        LeftTupleList leftTupleList = new LeftTupleList();
        leftTupleList.add( new LeftTupleImpl( fh10,
                                          null,
                                          true ) );
        hashTable.getTable()[0] = leftTupleList;
        leftTupleList = new LeftTupleList();
        leftTupleList.add( new LeftTupleImpl( fh11,
                                          null,
                                          true ) );
        leftTupleList.add( new LeftTupleImpl( fh12,
                                          null,
                                          true ) );
        leftTupleList.add( new LeftTupleImpl( fh13,
                                          null,
                                          true ) );
        ((LeftTupleList) hashTable.getTable()[0]).setNext( leftTupleList );

        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

                      betaConstraints.getIndexCount() );
        BetaMemory betaMemory = betaConstraints.createBetaMemory( config, NodeTypeEnums.JoinNode );

        if ( indexedPositions.length > 0 ) {
            if (((IndexableConstraint)constraints[indexedPositions[0]]).getConstraintType() == ConstraintType.EQUAL) {
                LeftTupleIndexHashTable tupleHashTable = (LeftTupleIndexHashTable) betaMemory.getLeftTupleMemory();
                assertTrue( tupleHashTable.isIndexed() );
                Index index = tupleHashTable.getIndex();

                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

        }

        assertEquals( numEntries * 3, list.size() );
       
        // test normal
        LeftTupleIndexHashTable lthTable = new LeftTupleIndexHashTable();   
        lthTable.init( table, 3, numEntries * 3 );
        LeftTupleIndexHashTable.FieldIndexHashTableFullIterator iter2 = new LeftTupleIndexHashTable.FieldIndexHashTableFullIterator( lthTable );
        list = new ArrayList<LeftTupleImpl>();
        for ( LeftTupleImpl leftTuple = (LeftTupleImpl) iter2.next( ); leftTuple != null; leftTuple = (LeftTupleImpl) iter2.next( ) ) {
            assertFalse( contains( list, leftTuple ) ); // ensure no duplicate
            list.add( leftTuple );
View Full Code Here

TOP

Related Classes of org.drools.core.util.index.LeftTupleIndexHashTable

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.