public void mergeWith(SetDigest other) { hll.mergeWith(other.hll); LongBidirectionalIterator iterator = other.minhash.keySet().iterator(); while (iterator.hasNext()) { long key = iterator.nextLong(); int count = minhash.get(key) + other.minhash.get(key); minhash.put(key, Shorts.saturatedCast(count)); } while (minhash.size() > maxHashes) { minhash.remove(minhash.lastLongKey()); } }
@Override public long nextLong() { return i.nextLong(); } @Override
@Test public void testArrayCtor() { LongSortedSet set = new LongSortedArraySet(new long[]{2, 5, 6}); testSetSimple(set); LongBidirectionalIterator iter = set.iterator(); assertTrue(iter.hasNext()); assertEquals(2, iter.nextLong()); assertTrue(iter.hasPrevious()); assertEquals(2, iter.previousLong()); assertFalse(iter.hasPrevious()); }
@Test public void testTailIter() { long[] data = {0, 42, 5, 2, 6, 1, 7}; LongSortedSet set = new LongSortedArraySet(data); LongBidirectionalIterator iter = set.iterator(2); assertTrue(iter.hasNext()); assertTrue(iter.hasPrevious()); assertEquals(5, iter.nextLong()); iter = set.iterator(2); assertEquals(2, iter.previousLong()); iter = set.iterator(-5); assertFalse(iter.hasPrevious()); iter = set.iterator(100); assertFalse(iter.hasNext()); iter = set.iterator(3); assertEquals(5, iter.nextLong()); iter = set.iterator(3); assertEquals(2, iter.previousLong()); }
@Override public LongBidirectionalIterator iterator(long from) { LongBidirectionalIterator i = iterator(); if (compare(element, from) <= 0) i.nextLong(); return i; } @Override
public void mergeWith(SetDigest other) { hll.mergeWith(other.hll); LongBidirectionalIterator iterator = other.minhash.keySet().iterator(); while (iterator.hasNext()) { long key = iterator.nextLong(); int count = minhash.get(key) + other.minhash.get(key); minhash.put(key, Shorts.saturatedCast(count)); } while (minhash.size() > maxHashes) { minhash.remove(minhash.lastLongKey()); } }
public void mergeWith(SetDigest other) { hll.mergeWith(other.hll); LongBidirectionalIterator iterator = other.minhash.keySet().iterator(); while (iterator.hasNext()) { long key = iterator.nextLong(); int count = minhash.get(key) + other.minhash.get(key); minhash.put(key, Shorts.saturatedCast(count)); } while (minhash.size() > maxHashes) { minhash.remove(minhash.lastLongKey()); } }
it = s0.iterator(); documentIterator = AndDocumentIterator.getInstance( indexIterator, additionalIterator ); for( int j = s0.size(); j-- != 0; ) if ( it.nextLong() != documentIterator.nextDocument() ) throw new AssertionError(); for( int j = s2.size(); j-- != 0; ) if ( it.nextLong() != documentIterator.nextDocument() ) throw new AssertionError();