Archived
0

don't add duplicates to specificator

This commit is contained in:
Mo
2015-10-23 21:43:00 +03:00
parent 7ce10465af
commit 88fd3ed317

View File

@@ -9,17 +9,17 @@ import java.util.function.Consumer;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class CrawlerSpecificator { public class CrawlerSpecificator {
private final List<Vendor> any; private final Set<Vendor> any;
private final List<Vendor> containsAny; private final Set<Vendor> containsAny;
private final List<Vendor> all; private final Set<Vendor> all;
private final Collection<Offer> offers; private final Collection<Offer> offers;
private int groupCount; private int groupCount;
private boolean byTime; private boolean byTime;
public CrawlerSpecificator() { public CrawlerSpecificator() {
any = new ArrayList<>(); any = new HashSet<>();
all = new ArrayList<>(); all = new HashSet<>();
containsAny = new ArrayList<>(); containsAny = new HashSet<>();
offers = new ArrayList<>(); offers = new ArrayList<>();
byTime = false; byTime = false;
} }
@@ -119,7 +119,7 @@ public class CrawlerSpecificator {
res = spec; res = spec;
} }
if (!any.isEmpty()){ if (!any.isEmpty()){
spec = any.size() > 1 ? RouteSpecificationByTargets.any(any) : new RouteSpecificationByTarget<>(any.get(0)); spec = any.size() > 1 ? RouteSpecificationByTargets.any(any) : new RouteSpecificationByTarget<>(any.iterator().next());
if (res != null){ if (res != null){
res = res.and(spec); res = res.and(spec);
} else { } else {