TemporalBinList extends AbstractList<TemporalBin> { static int computeBinsPerFile(int numberOfBins, int maxNumberOfCacheFiles, int preferredBinsPerFile) { int numCacheFiles = (int) Math.ceil(numberOfBins / (float) preferredBinsPerFile); numCacheFiles = Math.min(numCacheFiles, maxNumberOfCacheFiles); int binsPerFile = (int) Math.ceil(numberOfBins / (float) numCacheFiles); return binsPerFile < preferredBinsPerFile ? preferredBinsPerFile : binsPerFile; } TemporalBinList(int numberOfBins);   TemporalBinList(int numberOfBins, int maxNumberOfCacheFiles, int preferredBinsPerFile); @Override boolean add(TemporalBin temporalBin); @Override TemporalBin get(int index); @Override int size(); void close(); static final int DEFAULT_MAX_CACHE_FILES; static final int DEFAULT_BINS_PER_FILE; }
@Test public void testComputeBinsPerFile() throws Exception { assertEquals(15000, TemporalBinList.computeBinsPerFile(235000, 100, 15000)); assertEquals(23500, TemporalBinList.computeBinsPerFile(2350000, 100, TemporalBinList.DEFAULT_BINS_PER_FILE)); }