Package krati.store

Examples of krati.store.ArrayStoreIndexIterator


        _store.set(randomIndex, randomBytes, System.currentTimeMillis());
       
        _store.sync();
       
        // Test ArrayStoreIndexIterator
        ArrayStoreIndexIterator iter1 = new ArrayStoreIndexIterator(_store);
        assertEquals(_store.getIndexStart(), iter1.index());
        assertTrue(iter1.hasNext());
       
        int cnt1 = 0;
        while(iter1.hasNext()) {
            iter1.next();
            cnt1++;
        }
        assertEquals(_store.capacity(), cnt1);
       
        for(int i = 0; i < 100; i++) {
            iter1.reset(getRandomIndex());
        }
       
        try {
            iter1.reset(_store.getIndexStart() - 1);
            assertTrue(false);
        } catch(ArrayIndexOutOfBoundsException e) {}
       
        try {
            iter1.reset(_store.getIndexStart() + _store.capacity());
            assertTrue(false);
        } catch(ArrayIndexOutOfBoundsException e) {}
       
        iter1.reset(randomIndex);
        assertTrue(iter1.hasNext());
        assertEquals(randomIndex, iter1.index());
        assertEquals(randomIndex, iter1.next().intValue());
       
        // Test ArrayStoreIndexIterator
        ArrayStoreIterator iter2 = new ArrayStoreIterator(_store);
        assertEquals(_store.getIndexStart(), iter2.index());
        assertTrue(iter2.hasNext());
View Full Code Here

TOP

Related Classes of krati.store.ArrayStoreIndexIterator

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.