private void checkBlock(IDBlock block) { assertTrue(blockSize<10000); LongSet ids = new LongHashSet((int)blockSize); checkBlock(block,ids); }
ConcurrentLinkedQueue<IDBlock> list = ids.get(i); assertEquals(numAcquisitionsPerThreadPartition * CONCURRENCY, list.size()); LongSet idset = new LongHashSet((int)blockSize*list.size()); for (IDBlock block : list) checkBlock(block,idset);
LongSet ids = new LongHashSet((int)blockSize*blocksPerThread*CONCURRENCY); for (IDBlock block : blocks) checkBlock(block,ids);
LongSet ids = new LongHashSet((int)blockSize*blocksPerThread*CONCURRENCY); for (IDBlock block : blocks) checkBlock(block,ids);
ConcurrentLinkedQueue<IDBlock> list = ids.get(i); assertEquals(numAcquisitionsPerThreadPartition * CONCURRENCY, list.size()); LongSet idSet = new LongHashSet((int)blockSize*list.size()); for (IDBlock block : list) checkBlock(block,idSet);
@Test public void testSimpleIDAcquisition() throws BackendException { final IDBlockSizer blockSizer = new InnerIDBlockSizer(); idAuthorities[0].setIDBlockSizer(blockSizer); int numTrials = 100; LongSet ids = new LongHashSet((int)blockSize*numTrials); long previous = 0; for (int i=0;i<numTrials;i++) { IDBlock block = idAuthorities[0].getIDBlock(0, 0, GET_ID_BLOCK_TIMEOUT); checkBlock(block,ids); if (hasEmptyUid) { if (previous!=0) assertEquals(previous+1, block.getId(0)); previous=block.getId(block.numIds()-1); } } }
private SetBackedLongFilter(int numValids, int numInvalids) { if (numValids > 0) { valids = new LongHashSet(numValids); } if (numInvalids > 0) { invalids = new LongHashSet(numInvalids); } }
@Test public void testSimpleIDAcquisition() throws BackendException { final IDBlockSizer blockSizer = new InnerIDBlockSizer(); idAuthorities[0].setIDBlockSizer(blockSizer); int numTrials = 100; LongSet ids = new LongHashSet((int)blockSize*numTrials); long previous = 0; for (int i=0;i<numTrials;i++) { IDBlock block = idAuthorities[0].getIDBlock(0, 0, GET_ID_BLOCK_TIMEOUT); checkBlock(block,ids); if (hasEmptyUid) { if (previous!=0) assertEquals(previous+1, block.getId(0)); previous=block.getId(block.numIds()-1); } } }
/** * Create a set from a variable number of arguments or an array of * <code>long</code>. The elements are copied from the argument to the * internal buffer. */ /* */ public static LongHashSet from(long... elements) { final LongHashSet set = new LongHashSet(elements.length); set.addAll(elements); return set; }
LongSet writtenTypes = new LongHashSet(sortKey.length + signature.length); if (sortKey.length > 0 || signature.length > 0) { for (long id : sortKey) writtenTypes.add(id);
LongSet writtenTypes = new LongHashSet(sortKey.length + signature.length); if (sortKey.length > 0 || signature.length > 0) { for (long id : sortKey) writtenTypes.add(id);
private SetBackedLongFilter(int numValids, int numInvalids) { if (numValids > 0) { valids = new LongHashSet(numValids); } if (numInvalids > 0) { invalids = new LongHashSet(numInvalids); } }
private SetBackedLongFilter(int numValids, int numInvalids) { if (numValids > 0) { valids = new LongHashSet(numValids); } if (numInvalids > 0) { invalids = new LongHashSet(numInvalids); } }
LongSet result = new LongHashSet(); for (Long index = 0L; index < 10000000L;) { result.add(index++); }
public void add(SortedMap<Long, LongSet> data) { for (Map.Entry<Long, LongSet> newEntry : data.entrySet()) { LongSet found = tokens.get(newEntry.getKey()); if (found == null) tokens.put(newEntry.getKey(), (found = new LongHashSet(4))); for (LongCursor offset : newEntry.getValue()) found.add(offset.value); } }
/** * Create a set from a variable number of arguments or an array of * <code>long</code>. The elements are copied from the argument to the * internal buffer. */ /* */ public static LongHashSet from(long... elements) { final LongHashSet set = new LongHashSet(elements.length); set.addAll(elements); return set; }
public void add(Long token, long keyPosition) { LongSet found = tokens.get(token); if (found == null) tokens.put(token, (found = new LongHashSet(2))); found.add(keyPosition); }
public static long intersection(LongHashSet targets1, LongHashSet targets2) { LongHashSet intersectionSet = new LongHashSet(targets1); intersectionSet.retainAll(targets2); return intersectionSet.size(); }
public static long intersection(LongHashSet targets1, LongHashSet targets2) { LongHashSet intersectionSet = new LongHashSet(targets1); intersectionSet.retainAll(targets2); return intersectionSet.size(); }
public LongSet getOffsets() { LongSet offsets = new LongHashSet(4); for (DecoratedKey key : keys) offsets.add((long) key.getToken().getTokenValue()); return offsets; }