Package org.grouplens.lenskit.data.event

Examples of org.grouplens.lenskit.data.event.Rating


    }

    @Theory
    public void testRenderRating(BinaryFormat format) {
        long ts = format.hasTimestamps() ? 34208L : -1;
        Rating r = Ratings.make(42L, 39L, Math.PI, ts);
        ByteBuffer buf = ByteBuffer.allocate(format.getRatingSize());
        format.renderRating(r, buf);
        buf.flip();

        buf.mark();
        MutableRating r2 = new MutableRating();
        format.readRating(buf, r2);
        assertThat(r2, equalTo(r));

        buf.reset();
        Rating r3 = format.readRating(buf);
        assertThat(r3, equalTo(r));
    }
View Full Code Here


        assertThat(history.getUserId(), equalTo(42L));
    }

    @Test
    public void testSingletonList() {
        Rating r = Ratings.make(42, 39, 2.5);
        UserHistory<Rating> history = History.forUser(42, ImmutableList.of(r));
        assertThat(history.size(), equalTo(1));
        assertThat(history.isEmpty(), equalTo(false));
        assertThat(history.getUserId(), equalTo(42L));
        assertThat(history, contains(r));
View Full Code Here

TOP

Related Classes of org.grouplens.lenskit.data.event.Rating

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.