if ((alleleCountArray.length & 1) != 0) throw new IllegalArgumentException("the allele counts array cannot have odd length"); alleleHeap.clear(); for (int i = 0; i < alleleCountArray.length; i += 2) { final int index = alleleCountArray[i];
/** * Give a list of alleles, returns the likelihood array index. * * <p>This operation is <b>thread-unsafe</b>.</p> * * @param alleleIndices the indices of the alleles in the genotype, there should be as many repetition of an * index as copies of that allele in the genotype. Allele indices do not need to be sorted in * any particular way. * * @return never {@code null}. */ public int allelesToIndex(final int... alleleIndices) { // Special case ploidy == 0. if (ploidy == 0) return 0; alleleHeap.clear(); alleleHeap.add(alleleIndices); return alleleHeapToIndex(); }
alleleHeap.clear(); GenotypeAlleleCounts alleleCounts = genotypeAlleleCounts[0]; for (int i = 0; i < resultLength; i++) {
@Test(dataProvider = "capacityData", dependsOnMethods = {"testEmptynessAndSize"}) public void testClear(final int initialCapacity, final int elementCount) { final IntMaxHeap heap = new IntMaxHeap(initialCapacity); final Random rnd = Utils.getRandomGenerator(); for (int i = 0; i < elementCount; i++) { final int v = rnd.nextInt(); heap.add(v); } heap.clear(); Assert.assertEquals(heap.size(),0); Assert.assertTrue(heap.isEmpty()); }