Package orestes.bloomfilter.redis

Examples of orestes.bloomfilter.redis.RedisBitSet


                }
            }
        }

        RedisPool pool = Helper.getPool();
        RedisBitSet bs = new RedisBitSet(pool, "test", primes.size());
        bs.overwriteBitSet(primes);
        BitSet read = bs.asBitSet();
        assertEquals(primes, read);
        assertEquals(primes, read);
    }
View Full Code Here


        BitSet b2 = new BitSet();
        IntStream.range(0, 100).forEach(i -> b1.set(i*10, true));
        IntStream.range(0, 100).forEach(i -> b2.set(i*99, true));

        RedisPool pool = Helper.getPool();
        RedisBitSet rb1 = new RedisBitSet(pool, "b1", b1.size());
        rb1.overwriteBitSet(b1);
        RedisBitSet rb2 = new RedisBitSet(pool, "b2", b2.size());
        rb2.overwriteBitSet(b2);

        assertEquals(b1, rb1.asBitSet());
        assertEquals(b2, rb2.asBitSet());
        assertThat(rb1, not(equalTo(rb2)));
        assertThat(b1, not(equalTo(b2)));
        assertThat(rb1, not(equalTo(b2)));
    }
View Full Code Here

    @Test
    public void testCardinality() {
        int max = 1_000_000;
        BitSet b1 = new BitSet();
        RedisBitSet b2 = new RedisBitSet(Helper.getPool(), "card", max);
        b2.clear();

        new Random().ints(1000).forEach(i -> {
            int index = Math.abs(i % max);
            b1.set(index, true);
            b2.set(index, true);
        });

        assertEquals(b1.cardinality(), b2.cardinality());
    }
View Full Code Here

TOP

Related Classes of orestes.bloomfilter.redis.RedisBitSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.