* @see net.tomp2p.dht.DigestStorage#digest(net.tomp2p.peers.Number320, net.tomp2p.rpc.SimpleBloomFilter, net.tomp2p.rpc.SimpleBloomFilter, int, boolean, boolean)
*/
@Override
public DigestInfo digest(Number320 locationAndDomainKey, SimpleBloomFilter<Number160> keyBloomFilter,
SimpleBloomFilter<Number160> contentBloomFilter, int limit, boolean ascending, boolean isBloomFilterAnd) {
DigestInfo digestInfo = new DigestInfo();
KeyLock<Number320>.RefCounterLock lock = dataLock320.lock(locationAndDomainKey);
try {
Number640 from = new Number640(locationAndDomainKey, Number160.ZERO, Number160.ZERO);
Number640 to = new Number640(locationAndDomainKey, Number160.MAX_VALUE, Number160.MAX_VALUE);
Map<Number640, Data> tmp = backend.subMap(from, to, limit, ascending);
for (Map.Entry<Number640, Data> entry : tmp.entrySet()) {
if (isBloomFilterAnd) {
if (keyBloomFilter == null || keyBloomFilter.contains(entry.getKey().contentKey())) {
if (contentBloomFilter == null || contentBloomFilter.contains(entry.getValue().hash())) {
if (!entry.getValue().hasPrepareFlag()) {
digestInfo.put(entry.getKey(), entry.getValue().basedOnSet());
}
}
}
} else {
if (keyBloomFilter == null || !keyBloomFilter.contains(entry.getKey().contentKey())) {
if (contentBloomFilter == null || !contentBloomFilter.contains(entry.getValue().hash())) {
if (!entry.getValue().hasPrepareFlag()) {
digestInfo.put(entry.getKey(),entry.getValue().basedOnSet());
}
}
}
}
}