Package org.grouplens.lenskit.indexes

Examples of org.grouplens.lenskit.indexes.IdIndexMapping


        assertTrue(items.contains(11));
    }

    @Test
    public void testUserIndex() {
        IdIndexMapping ind = snap.userIndex();
        assertEquals(6, ind.size());
        assertTrue(ind.getIdList().contains(1));
        assertTrue(ind.getIdList().contains(3));
        assertTrue(ind.getIdList().contains(4));
        assertTrue(ind.getIdList().contains(5));
        assertTrue(ind.getIdList().contains(6));
        assertTrue(ind.getIdList().contains(7));
        assertEquals(0, ind.getIndex(1));
        assertEquals(1, ind.getIndex(3));
        assertEquals(2, ind.getIndex(4));
        assertEquals(3, ind.getIndex(5));
        assertEquals(4, ind.getIndex(6));
        assertEquals(5, ind.getIndex(7));
        assertEquals(1, ind.getId(0));
        assertEquals(3, ind.getId(1));
        assertEquals(4, ind.getId(2));
        assertEquals(5, ind.getId(3));
        assertEquals(6, ind.getId(4));
        assertEquals(7, ind.getId(5));
    }
View Full Code Here


        assertEquals(7, ind.getId(5));
    }

    @Test
    public void testItemIndex() {
        IdIndexMapping ind = snap.itemIndex();
        assertEquals(5, ind.size());
        assertTrue(ind.getIdList().contains(7));
        assertTrue(ind.getIdList().contains(8));
        assertTrue(ind.getIdList().contains(9));
        assertTrue(ind.getIdList().contains(10));
        assertTrue(ind.getIdList().contains(11));
        assertEquals(0, ind.getIndex(7));
        assertEquals(1, ind.getIndex(8));
        assertEquals(2, ind.getIndex(9));
        assertEquals(3, ind.getIndex(10));
        assertEquals(4, ind.getIndex(11));
        assertEquals(7, ind.getId(0));
        assertEquals(8, ind.getId(1));
        assertEquals(9, ind.getId(2));
        assertEquals(10, ind.getId(3));
        assertEquals(11, ind.getId(4));
    }
View Full Code Here

TOP

Related Classes of org.grouplens.lenskit.indexes.IdIndexMapping

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.