add full scan options to specificator
This commit is contained in:
@@ -15,6 +15,7 @@ public class CrawlerSpecificator {
|
||||
private final Collection<Offer> offers;
|
||||
private int groupCount;
|
||||
private boolean byTime;
|
||||
private boolean fullScan;
|
||||
|
||||
public CrawlerSpecificator() {
|
||||
any = new HashSet<>();
|
||||
@@ -22,12 +23,21 @@ public class CrawlerSpecificator {
|
||||
containsAny = new HashSet<>();
|
||||
offers = new ArrayList<>();
|
||||
byTime = false;
|
||||
fullScan = true;
|
||||
}
|
||||
|
||||
public void setByTime(boolean byTime){
|
||||
this.byTime = byTime;
|
||||
}
|
||||
|
||||
public void setFullScan(boolean fullScan) {
|
||||
this.fullScan = fullScan;
|
||||
}
|
||||
|
||||
public boolean isFullScan() {
|
||||
return fullScan;
|
||||
}
|
||||
|
||||
public void all(Collection<Vendor> vendors){
|
||||
all.addAll(vendors);
|
||||
}
|
||||
|
||||
@@ -86,6 +86,7 @@ public class RouteSearcher {
|
||||
VendorsCrawlerSpecification specification = specificator.build(vendors, collector::add);
|
||||
Crawler<Vendor> crawler = vGraph.crawler(specification, callback);
|
||||
int lands = Math.max(scorer.getProfile().getLands(), specification.getMinLands());
|
||||
if (!specificator.isFullScan()) lands = specificator.getMinHop();
|
||||
crawler.setMaxSize(lands);
|
||||
crawler.findMin(target, count);
|
||||
return collector.get();
|
||||
@@ -108,6 +109,7 @@ public class RouteSearcher {
|
||||
crawler.findMin(source, vendors.size());
|
||||
specification = specificator.build(vendors, collector::add, new RouteSpecificationByTarget<>(source), false);
|
||||
lands = Math.max(scorer.getProfile().getLands(), specification.getMinLands());
|
||||
if (!specificator.isFullScan()) lands = specificator.getMinHop();
|
||||
crawler = vGraph.crawler(specification, callback);
|
||||
crawler.setMaxSize(lands);
|
||||
crawler.findMin(source, 1);
|
||||
|
||||
@@ -286,13 +286,12 @@ public class MarketAnalyzer {
|
||||
|
||||
private Collection<Vendor> getVendors(CrawlerSpecificator specificator, boolean withTransit){
|
||||
Collection<Vendor> vendors;
|
||||
if (specificator.getMinHop() >= profile.getLands()){
|
||||
if (!specificator.isFullScan() || specificator.getMinHop() >= profile.getLands()){
|
||||
vendors = withTransit ? market.get().map(Place::asTransit).collect(Collectors.toList()) : new ArrayList<>();
|
||||
market.getVendors().filter(specificator::contains).forEach(vendors::add);
|
||||
} else {
|
||||
vendors = market.getMarkets(withTransit).collect(Collectors.toList());
|
||||
vendors = specificator.getVendors(vendors);
|
||||
}
|
||||
vendors = specificator.getVendors(vendors);
|
||||
return vendors;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user