Examples of PrimitiveLongMap


Examples of org.drools.core.util.PrimitiveLongMap

        assertNull( map.remove( -1 ) );
    }

    public void testPutWithNegativeKeyThrowsIllegalArgumentException() {
        final PrimitiveLongMap map = new PrimitiveLongMap( 2,
                                                           1 );

        try {
            map.put( -1,
                     new Object() );
            fail();
        } catch ( final IllegalArgumentException e ) {
            // expected
        }
View Full Code Here

Examples of org.drools.core.util.PrimitiveLongMap

     * return null; }
     *
     */
    public void testMaxKey() {

        final PrimitiveLongMap map = new PrimitiveLongMap( 8,
                                                           4 );

        // Test maxKey for key 0
        map.put( 0,
                 new Integer( 0 ) );

        assertEquals( new Integer( 0 ),
                      map.get( 0 ) );
        assertNull( map.remove( 1 ) );
        assertEquals( new Integer( 0 ),
                      map.get( 0 ) );
        assertNotNull( map.remove( 0 ) );
        assertNull( map.get( 0 ) );

        // Test maxKey for key 1
        map.put( 1,
                 new Integer( 1 ) );
        assertEquals( new Integer( 1 ),
                      map.get( 1 ) );
        assertNull( map.remove( 2 ) );
        assertEquals( new Integer( 1 ),
                      map.get( 1 ) );
        assertNotNull( map.remove( 1 ) );
        assertNull( map.get( 1 ) );

        // Test maxKey for key 127, an end to a page border
        map.put( 127,
                 new Integer( 127 ) );
        assertEquals( new Integer( 127 ),
                      map.get( 127 ) );
        assertNull( map.remove( 128 ) );
        assertEquals( new Integer( 127 ),
                      map.get( 127 ) );
        assertNotNull( map.remove( 127 ) );
        assertNull( map.get( 127 ) );

        // Test maxKey for key 128, a start to a new page
        map.put( 128,
                 new Integer( 128 ) );
        assertEquals( new Integer( 128 ),
                      map.get( 128 ) );
        assertNull( map.remove( 129 ) );
        assertEquals( new Integer( 128 ),
                      map.get( 128 ) );
        assertNotNull( map.remove( 128 ) );
        assertNull( map.get( 128 ) );
    }
View Full Code Here

Examples of org.drools.core.util.PrimitiveLongMap

     */


    public SequentialAgendaGroupImpl(final String name, final ConflictResolver conflictResolver) {
        this.name = name;
        this.queue = new PrimitiveLongMap();//new BinaryHeapQueue( conflictResolver );
    }
View Full Code Here

Examples of org.drools.core.util.PrimitiveLongMap

import static org.junit.Assert.*;

public class PrimitiveLongMapTest {
    @Test
    public void testValues() {
        final PrimitiveLongMap map = new PrimitiveLongMap();
        assertNotNull( "MapNotNullTest ",
                       map );

        final Collection values = map.values();
        assertNotNull( "ValuesNotNullTest ",
                       values );
        assertEquals( "ValuesZeroSizeTest ",
                      0,
                      values.size() );
View Full Code Here

Examples of org.drools.core.util.PrimitiveLongMap

                      values.size() );
    }

    @Test
    public void testPaging() {
        final PrimitiveLongMap map = new PrimitiveLongMap( 32,
                                                           8 );

        for ( int i = 0; i < 512; i++ ) {
            final Integer value = new Integer( i );

            final Object oldValue = map.put( i,
                                             value );
            assertNull( "OldValueNullTest ",
                        oldValue );
            assertEquals( "OldValueNullTest ",
                          value,
                          map.get( i ) );
        }

    }
View Full Code Here

Examples of org.drools.core.util.PrimitiveLongMap

    }

    @Test
    public void testGetWithNegativeKeyReturnsNull() {
        final PrimitiveLongMap map = new PrimitiveLongMap( 2,
                                                           1 );

        assertNull( map.get( -1 ) );
    }
View Full Code Here

Examples of org.drools.core.util.PrimitiveLongMap

        assertNull( map.get( -1 ) );
    }

    @Test
    public void testRemoveWithNegativeReturnsNull() {
        final PrimitiveLongMap map = new PrimitiveLongMap( 2,
                                                           1 );

        assertNull( map.remove( -1 ) );
    }
View Full Code Here

Examples of org.drools.core.util.PrimitiveLongMap

        assertNull( map.remove( -1 ) );
    }

    @Test
    public void testPutWithNegativeKeyThrowsIllegalArgumentException() {
        final PrimitiveLongMap map = new PrimitiveLongMap( 2,
                                                           1 );

        try {
            map.put( -1,
                     new Object() );
            fail();
        } catch ( final IllegalArgumentException e ) {
            // expected
        }
View Full Code Here

Examples of org.drools.core.util.PrimitiveLongMap

     * return null; }
     */
    @Test
    public void testMaxKey() {

        final PrimitiveLongMap map = new PrimitiveLongMap( 8,
                                                           4 );

        // Test maxKey for key 0
        map.put( 0,
                 new Integer( 0 ) );

        assertEquals( new Integer( 0 ),
                      map.get( 0 ) );
        assertNull( map.remove( 1 ) );
        assertEquals( new Integer( 0 ),
                      map.get( 0 ) );
        assertNotNull( map.remove( 0 ) );
        assertNull( map.get( 0 ) );

        // Test maxKey for key 1
        map.put( 1,
                 new Integer( 1 ) );
        assertEquals( new Integer( 1 ),
                      map.get( 1 ) );
        assertNull( map.remove( 2 ) );
        assertEquals( new Integer( 1 ),
                      map.get( 1 ) );
        assertNotNull( map.remove( 1 ) );
        assertNull( map.get( 1 ) );

        // Test maxKey for key 127, an end to a page border
        map.put( 127,
                 new Integer( 127 ) );
        assertEquals( new Integer( 127 ),
                      map.get( 127 ) );
        assertNull( map.remove( 128 ) );
        assertEquals( new Integer( 127 ),
                      map.get( 127 ) );
        assertNotNull( map.remove( 127 ) );
        assertNull( map.get( 127 ) );

        // Test maxKey for key 128, a start to a new page
        map.put( 128,
                 new Integer( 128 ) );
        assertEquals( new Integer( 128 ),
                      map.get( 128 ) );
        assertNull( map.remove( 129 ) );
        assertEquals( new Integer( 128 ),
                      map.get( 128 ) );
        assertNotNull( map.remove( 128 ) );
        assertNull( map.get( 128 ) );
    }
View Full Code Here

Examples of org.drools.core.util.PrimitiveLongMap

        assertNull( map.get( 128 ) );
    }

    @Test
    public void testLastIndexBoundary() {
        final PrimitiveLongMap map = new PrimitiveLongMap( 32,
                                                           8 );
        map.put( 8192,
                 new Object() );
        map.remove( 8192 );
        map.put( 8192,
                 new Object() );
        map.put( 8191,
                 new Object() );
    }
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.