Пример #1
0
 public <V> BloomMap<K, V> newMap(Storage<V> storage, Lattice<V> lattice) {
   if (storage == null) throw new IllegalArgumentException("null storage");
   if (lattice == null) throw new IllegalArgumentException("null lattice");
   if (!lattice.isBoundedBelow()) throw new IllegalArgumentException("lattice not bounded below");
   Store<V> values = storage.newStore(config.capacity());
   if (values.type().nullGettable()) throw new IllegalArgumentException("null values possible");
   return new BloomMapImpl<K, V>(config, values, lattice);
 }
Пример #2
0
 static void checkCompatible(BloomConfig<?> ac, BloomConfig<?> bc) {
   if (ac.hashCount() != bc.hashCount())
     throw new IllegalArgumentException(
         "Incompatible set, hashCount was " + bc.hashCount() + ", expected " + ac.hashCount());
   if (!ac.hasher().equals(bc.hasher()))
     throw new IllegalArgumentException("Incompatible set, hashers were not equal");
 }
Пример #3
0
 public BloomSet<K> newSet() {
   BitStore bits = Bits.store(config.capacity());
   return new BloomSetImpl<>(bits, config);
 }
Пример #4
0
 public BloomSet<K> newSet(BitStore bits) {
   if (bits == null) throw new IllegalArgumentException("null bits");
   return new BloomSetImpl<>(bits, config.withCapacity(bits.size()));
 }