use of it.unimi.dsi.fastutil.longs.LongList in project presto by prestodb.
the class TestColumnIndexFilter method assertAllRows.
private static void assertAllRows(RowRanges ranges, long rowCount) {
LongList actualList = new LongArrayList();
ranges.iterator().forEachRemaining((long value) -> actualList.add(value));
LongList expectedList = new LongArrayList();
LongStream.range(0, rowCount).forEach(expectedList::add);
assertArrayEquals(expectedList + " != " + actualList, expectedList.toLongArray(), actualList.toLongArray());
}
use of it.unimi.dsi.fastutil.longs.LongList in project snow-owl by b2ihealthcare.
the class LongArrayDequeWrapper method addLast.
@Override
public void addLast(long value) {
final LongList delegate = delegate();
delegate.add(delegate.size(), value);
}
use of it.unimi.dsi.fastutil.longs.LongList in project cdap by caskdata.
the class StreamDataFileIndex method loadIndex.
private Map.Entry<LongList, LongList> loadIndex(InputStream input) throws IOException {
byte[] magic = new byte[INDEX_MAGIC_HEADER.length];
ByteStreams.readFully(input, magic);
if (!Arrays.equals(magic, INDEX_MAGIC_HEADER)) {
throw new IOException("Unsupported index file format. Expected magic bytes as 'I' '1'");
}
// 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);
}
use of it.unimi.dsi.fastutil.longs.LongList in project gridss by PapenfussLab.
the class MisassemblyFixer method createContigTransitionOffsetLookup.
private static NavigableMap<Integer, ImmutableTriple<Integer, LongList, LongList>> createContigTransitionOffsetLookup(List<KmerPathSubnode> contig) {
NavigableMap<Integer, ImmutableTriple<Integer, LongList, LongList>> lookup = new TreeMap<Integer, ImmutableTriple<Integer, LongList, LongList>>();
int snoffset = 0;
for (int i = 0; i < contig.size() - 1; i++) {
KmerPathSubnode sn = contig.get(i);
LongArrayList snendkmers = new LongArrayList();
snendkmers.add(sn.lastKmer());
for (int j = 0; j < sn.node().collapsedKmerOffsets().size(); j++) {
int offset = sn.node().collapsedKmerOffsets().getInt(j);
if (offset == sn.length() - 1) {
snendkmers.add(sn.node().collapsedKmers().getLong(j));
}
}
KmerPathSubnode snext = contig.get(i + 1);
LongArrayList snextstartkmers = new LongArrayList();
snextstartkmers.add(snext.firstKmer());
for (int j = 0; j < snext.node().collapsedKmerOffsets().size(); j++) {
int offset = snext.node().collapsedKmerOffsets().getInt(j);
if (offset == 0) {
snextstartkmers.add(snext.node().collapsedKmers().getLong(j));
}
}
lookup.put(snoffset + sn.length() - 1, new ImmutableTriple<Integer, LongList, LongList>(i, snendkmers, snextstartkmers));
snoffset += sn.length();
}
return lookup;
}
use of it.unimi.dsi.fastutil.longs.LongList in project presto by prestodb.
the class TestColumnIndexFilter method assertRows.
private static void assertRows(RowRanges ranges, long... expectedRows) {
LongList actualList = new LongArrayList();
ranges.iterator().forEachRemaining((long value) -> actualList.add(value));
assertArrayEquals(Arrays.toString(expectedRows) + " != " + actualList, expectedRows, actualList.toLongArray());
}
Aggregations