Examples of LongList


Examples of it.unimi.dsi.fastutil.longs.LongList

   * Constructs with the given input.
   *
   * @param indexInputSupplier Provides {@link InputStream} for reading the index.
   */
  StreamDataFileIndex(InputSupplier<? extends InputStream> indexInputSupplier) {
    LongList timestamps;
    LongList positions;

    // Load the whole index into memory.
    try {
      Map.Entry<LongList, LongList> index;
      InputStream indexInput = indexInputSupplier.getInput();
View Full Code Here

Examples of it.unimi.dsi.fastutil.longs.LongList

    // Decode the properties map. In current version, it is not used.
    StreamUtils.decodeMap(new BinaryDecoder(input));

    // Read in all index (timestamp, position pairs).
    LongList timestamps = new LongArrayList(1000);
    LongList positions = new LongArrayList(1000);
    byte[] buf = new byte[Longs.BYTES * 2];

    while (ByteStreams.read(input, buf, 0, buf.length) == buf.length) {
      timestamps.add(Bytes.toLong(buf, 0));
      positions.add(Bytes.toLong(buf, Longs.BYTES));
    }

    return Maps.immutableEntry(timestamps, positions);
  }
View Full Code Here

Examples of it.unimi.dsi.fastutil.longs.LongList

                   closeTo(-1, EPSILON));
    }

    @Test
    public void testVectorPredict() {
        LongList keys = new LongArrayList();
        keys.add(1);
        keys.add(2);
        keys.add(3);
        keys.add(4);
        MutableSparseVector v = MutableSparseVector.create(keys);
        pred.predict(40, v);
        assertThat(v.get(1),
                   closeTo(4.0, EPSILON));
        assertThat(v.get(2),
View Full Code Here

Examples of it.unimi.dsi.fastutil.longs.LongList

            typedChans = tcbld.build();
        } else {
            chans = Collections.emptyMap();
            typedChans = Collections.emptyMap();
        }
        LongList builtIds;
        DoubleList builtScores;
        if (reuse) {
            ids.trim();
            builtIds = ids;
            scores.trim();
View Full Code Here

Examples of it.unimi.dsi.fastutil.longs.LongList

* @author <a href="http://www.grouplens.org">GroupLens Research</a>
*/
public class CompactableLongArrayListTest {
    @Test
    public void testEmptyList() {
        LongList list = new CompactableLongArrayList();
        assertThat(list.size(), equalTo(0));
        assertThat(list.isEmpty(), equalTo(true));
    }
View Full Code Here

Examples of it.unimi.dsi.fastutil.longs.LongList

        assertThat(list.isEmpty(), equalTo(true));
    }

    @Test
    public void testSingleton() {
        LongList list = new CompactableLongArrayList();
        list.add(42L);
        assertThat(list.size(), equalTo(1));
        assertThat(list.isEmpty(), equalTo(false));
        assertThat(list, contains(42L));
    }
View Full Code Here

Examples of it.unimi.dsi.fastutil.longs.LongList

        assertThat(list, contains(42L));
    }

    @Test
    public void testSingletonLong() {
        LongList list = new CompactableLongArrayList();
        long val = Integer.MAX_VALUE + 42L;
        list.add(val);
        assertThat(list.size(), equalTo(1));
        assertThat(list.isEmpty(), equalTo(false));
        assertThat(list, contains(val));
    }
View Full Code Here

Examples of it.unimi.dsi.fastutil.longs.LongList

        assertThat(list, contains(val));
    }

    @Test
    public void testSingletonNegativeLong() {
        LongList list = new CompactableLongArrayList();
        long val = Integer.MIN_VALUE - 42L;
        list.add(val);
        assertThat(list.size(), equalTo(1));
        assertThat(list.isEmpty(), equalTo(false));
        assertThat(list, contains(val));
    }
View Full Code Here

Examples of it.unimi.dsi.fastutil.longs.LongList

        assertThat(list, contains(val));
    }

    @Test
    public void testAddTwo() {
        LongList list = new CompactableLongArrayList();
        long val = Integer.MAX_VALUE + 42L;
        list.add(42);
        list.add(val);
        assertThat(list.size(), equalTo(2));
        assertThat(list, contains(42L, val));
    }
View Full Code Here

Examples of it.unimi.dsi.fastutil.longs.LongList

        assertThat(list, contains(42L, val));
    }

    @Test
    public void testAddAndPrepend() {
        LongList list = new CompactableLongArrayList();
        long val = 67L;
        list.add(42);
        list.add(0, val);
        assertThat(list.size(), equalTo(2));
        assertThat(list, contains(val, 42L));
    }
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.