public void clear() { for (ObjectArrayList<Block> channel : channels) { channel.clear(); channel.trim(); } valueAddresses.clear(); valueAddresses.trim(); positionCount = 0; nextBlockToCompact = 0; pagesMemorySize = 0; estimatedSize = calculateEstimatedSize(); }
/** * Trims this array list so that the capacity is equal to the size. * * @see java.util.ArrayList#trimToSize() */ public void trim() { trim(0); } /**
/** * Pours an iterator, returning a type-specific list, with a limit on the number * of elements. * * <p> * This method iterates over the given type-specific iterator and returns a * type-specific list containing the returned elements (up to {@code max}). * Iteration on the returned list is guaranteed to produce the elements in the * same order in which they appeared in the iterator. * * * @param i * a type-specific iterator. * @param max * the maximum number of elements to be poured. * @return a type-specific list containing the returned elements, up to * {@code max}. */ public static <K> ObjectList<K> pour(final Iterator<K> i, int max) { final ObjectArrayList<K> l = new ObjectArrayList<>(); pour(i, l, max); l.trim(); return l; } /**
public void clear() { for (ObjectArrayList<Block> channel : channels) { channel.clear(); channel.trim(); } valueAddresses.clear(); valueAddresses.trim(); positionCount = 0; nextBlockToCompact = 0; pagesMemorySize = 0; estimatedSize = calculateEstimatedSize(); }
public void clear() { for (ObjectArrayList<Block> channel : channels) { channel.clear(); channel.trim(); } valueAddresses.clear(); valueAddresses.trim(); positionCount = 0; nextBlockToCompact = 0; pagesMemorySize = 0; estimatedSize = calculateEstimatedSize(); }
nextExampleArrays.trim(); if (nextExampleIds.size() == 0) { return null;
metricsNoScore.remove("AUC"); metricsNoScore.remove("AUC+F1"); metricsNoScore.trim(); String[] elements = metricsNoScore.toArray(new String[metricsNoScore.size()]); DoubleArrayList all = DoubleArrayList.wrap(delegate.getMetricValues(elements));
protected ObjectArrayList<? extends GenotypeCount> getAllCounts(BaseInformationRecords.BaseInformationOrBuilder record, GenotypeCountFactory factory, boolean isTumor, boolean sort) { int sampleIndex = isTumor ? 1 : 0; ObjectArrayList<GenotypeCount> list = new ObjectArrayList<>(); int genotypeIndex = 0; for (int i = 0; i < record.getSamples(0).getCountsCount(); i++) { int germCount = record.getSamples(0).getCounts(i).getGenotypeCountForwardStrand() + record.getSamples(0).getCounts(i).getGenotypeCountReverseStrand(); BaseInformationRecords.CountInfo genoInfo = record.getSamples(sampleIndex).getCounts(i); int forwCount = genoInfo.getGenotypeCountForwardStrand(); int revCount = genoInfo.getGenotypeCountReverseStrand(); GenotypeCount count = factory.create(); count.set(forwCount, revCount, genoInfo.getToSequence(), i, germCount); initializeCount(record.getSamples(sampleIndex).getCounts(i), count); list.add(count); } // DO not increment genotypeIndex. It must remain constant for all N bases int genotypeIndexFor_Ns = N_GENOTYPE_INDEX; // pad with zero until we have 10 elements: while (list.size() < MAX_GENOTYPES) { final GenotypeCount genotypeCount = getGenotypeCountFactory().create(); genotypeCount.set(0, 0, "N", genotypeIndexFor_Ns, 0); list.add(genotypeCount); } //sort in decreasing order of counts: if (sort) { Collections.sort(list); } // trim the list at 5 elements because we will consider only the 5 genotypes with largest total counts: list.trim(MAX_GENOTYPES); return list; }
list.trim(MAX_GENOTYPES);