Search in sources :

Example 26 with TLongArrayList

use of gnu.trove.list.array.TLongArrayList in project atlasdb by palantir.

the class SweepableCellFilterTest method conservative_getTimestampsToSweep_twoEntriesBelowSweepTimestamp_returnsLowerOne.

@Test
public void conservative_getTimestampsToSweep_twoEntriesBelowSweepTimestamp_returnsLowerOne() {
    long sweepTimestampHigherThanCommitTimestamp = HIGH_COMMIT_TS + 1;
    List<CandidateCellForSweeping> candidates = twoCommittedTimestampsForSingleCell();
    SweepableCellFilter filter = new SweepableCellFilter(mockTransactionService, Sweeper.CONSERVATIVE, sweepTimestampHigherThanCommitTimestamp);
    List<CellToSweep> cells = filter.getCellsToSweep(candidates).cells();
    assertThat(cells.size()).isEqualTo(1);
    assertThat(Iterables.getOnlyElement(cells).sortedTimestamps()).isEqualTo(new TLongArrayList(new long[] { LOW_START_TS }));
}
Also used : CandidateCellForSweeping(com.palantir.atlasdb.keyvalue.api.CandidateCellForSweeping) ImmutableCandidateCellForSweeping(com.palantir.atlasdb.keyvalue.api.ImmutableCandidateCellForSweeping) TLongArrayList(gnu.trove.list.array.TLongArrayList) Test(org.junit.Test)

Example 27 with TLongArrayList

use of gnu.trove.list.array.TLongArrayList in project atlasdb by palantir.

the class SweepableCellFilterTest method getTimestampsToSweep_onlyTransactionUncommitted_returnsIt.

@Test
public void getTimestampsToSweep_onlyTransactionUncommitted_returnsIt() {
    List<CandidateCellForSweeping> candidate = ImmutableList.of(ImmutableCandidateCellForSweeping.builder().cell(SINGLE_CELL).sortedTimestamps(ImmutableList.of(LOW_START_TS)).isLatestValueEmpty(false).build());
    when(mockTransactionService.get(anyCollection())).thenReturn(ImmutableMap.of(LOW_START_TS, TransactionConstants.FAILED_COMMIT_TS));
    SweepableCellFilter filter = new SweepableCellFilter(mockTransactionService, Sweeper.CONSERVATIVE, HIGH_START_TS);
    List<CellToSweep> cells = filter.getCellsToSweep(candidate).cells();
    assertThat(cells.size()).isEqualTo(1);
    assertThat(Iterables.getOnlyElement(cells).sortedTimestamps()).isEqualTo(new TLongArrayList(new long[] { LOW_START_TS }));
}
Also used : CandidateCellForSweeping(com.palantir.atlasdb.keyvalue.api.CandidateCellForSweeping) ImmutableCandidateCellForSweeping(com.palantir.atlasdb.keyvalue.api.ImmutableCandidateCellForSweeping) TLongArrayList(gnu.trove.list.array.TLongArrayList) Test(org.junit.Test)

Example 28 with TLongArrayList

use of gnu.trove.list.array.TLongArrayList in project mixcr by milaboratory.

the class RandomAccessVDJCAReaderTest method test1.

@Test
public void test1() throws Exception {
    RunMiXCR.RunMiXCRAnalysis params = new RunMiXCR.RunMiXCRAnalysis(RunMiXCR.class.getResource("/sequences/test_R1.fastq").getFile(), RunMiXCR.class.getResource("/sequences/test_R2.fastq").getFile());
    RunMiXCR.AlignResult align = RunMiXCR.align(params);
    File file = TempFileManager.getTempFile();
    try (VDJCAlignmentsWriter writer = new VDJCAlignmentsWriter(file)) {
        writer.header(align.aligner);
        for (VDJCAlignments alignment : align.alignments) writer.write(alignment);
    }
    TLongArrayList index = new TLongArrayList();
    try (VDJCAlignmentsReader reader = new VDJCAlignmentsReader(file)) {
        reader.setIndexer(index);
        int i = 0;
        VDJCAlignments alignments;
        while ((alignments = reader.take()) != null) Assert.assertEquals(align.alignments.get(i++), alignments);
    }
    try (RandomAccessVDJCAReader reader = new RandomAccessVDJCAReader(file, index.toArray())) {
        Assert.assertEquals(align.parameters.alignerParameters, reader.getParameters());
        for (int i = 0; i < 1000; i++) {
            int ind = ThreadLocalRandom.current().nextInt(align.alignments.size());
            VDJCAlignments alignment = reader.get(ind);
            Assert.assertEquals(alignment, align.alignments.get(ind));
        }
    }
}
Also used : TLongArrayList(gnu.trove.list.array.TLongArrayList) RunMiXCR(com.milaboratory.mixcr.util.RunMiXCR) File(java.io.File) Test(org.junit.Test)

Aggregations

TLongArrayList (gnu.trove.list.array.TLongArrayList)28 ArrayList (java.util.ArrayList)5 TIntArrayList (gnu.trove.list.array.TIntArrayList)4 Test (org.junit.Test)4 CandidateCellForSweeping (com.palantir.atlasdb.keyvalue.api.CandidateCellForSweeping)3 ImmutableCandidateCellForSweeping (com.palantir.atlasdb.keyvalue.api.ImmutableCandidateCellForSweeping)3 TLongList (gnu.trove.list.TLongList)3 Relation (net.osmand.osm.edit.Relation)3 RelationMember (net.osmand.osm.edit.Relation.RelationMember)3 TByteArrayList (gnu.trove.list.array.TByteArrayList)2 TLongObjectHashMap (gnu.trove.map.hash.TLongObjectHashMap)2 IOException (java.io.IOException)2 Node (net.osmand.osm.edit.Node)2 Way (net.osmand.osm.edit.Way)2 RunMiXCR (com.milaboratory.mixcr.util.RunMiXCR)1 TLongIterator (gnu.trove.iterator.TLongIterator)1 TDoubleArrayList (gnu.trove.list.array.TDoubleArrayList)1 TFloatArrayList (gnu.trove.list.array.TFloatArrayList)1 TShortArrayList (gnu.trove.list.array.TShortArrayList)1 TLongHashSet (gnu.trove.set.hash.TLongHashSet)1