Increase speed of TOP100 search
This commit is contained in:
@@ -196,15 +196,11 @@ public class MarketAnalyzer {
|
|||||||
public Collection<Route> getTopRoutes(int limit){
|
public Collection<Route> getTopRoutes(int limit){
|
||||||
LOG.debug("Get top {}", limit);
|
LOG.debug("Get top {}", limit);
|
||||||
LimitedQueue<Route> top = new LimitedQueue<>(limit);
|
LimitedQueue<Route> top = new LimitedQueue<>(limit);
|
||||||
Collection<Vendor> vendors = getVendors(new CrawlerSpecificator(), true);
|
Collection<Vendor> vendors = getVendors(new CrawlerSpecificator(), false, 9);
|
||||||
callback.start(vendors.size());
|
callback.start(vendors.size());
|
||||||
Iterator<Vendor> iterator = market.getMarkets(false).iterator();
|
for (Vendor vendor : vendors) {
|
||||||
while (iterator.hasNext()){
|
|
||||||
Vendor vendor = iterator.next();
|
|
||||||
if (callback.isCancel()) break;
|
if (callback.isCancel()) break;
|
||||||
CrawlerSpecificator specificator = new CrawlerSpecificator();
|
Collection<Route> paths = getRoutes(vendor, vendor);
|
||||||
specificator.target(vendor);
|
|
||||||
Collection<Route> paths = searcher.search(vendor, vendor, vendors, 3, specificator);
|
|
||||||
top.addAll(paths);
|
top.addAll(paths);
|
||||||
callback.inc();
|
callback.inc();
|
||||||
}
|
}
|
||||||
@@ -295,6 +291,10 @@ public class MarketAnalyzer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Collection<Vendor> getVendors(CrawlerSpecificator specificator, boolean withTransit){
|
private Collection<Vendor> getVendors(CrawlerSpecificator specificator, boolean withTransit){
|
||||||
|
return getVendors(specificator, withTransit, profile.getMinVendorRating());
|
||||||
|
|
||||||
|
}
|
||||||
|
private Collection<Vendor> getVendors(CrawlerSpecificator specificator, boolean withTransit, double minRating){
|
||||||
List<Vendor> transits = withTransit ? market.get().map(Place::asTransit).collect(Collectors.toList()) : new ArrayList<>();
|
List<Vendor> transits = withTransit ? market.get().map(Place::asTransit).collect(Collectors.toList()) : new ArrayList<>();
|
||||||
Set<Vendor> vendors;
|
Set<Vendor> vendors;
|
||||||
if (!specificator.isFullScan() || specificator.getMinHop() >= profile.getLands()){
|
if (!specificator.isFullScan() || specificator.getMinHop() >= profile.getLands()){
|
||||||
@@ -306,7 +306,7 @@ public class MarketAnalyzer {
|
|||||||
Collection<Scorer.Rating> removes = new ArrayList<>(500);
|
Collection<Scorer.Rating> removes = new ArrayList<>(500);
|
||||||
vendors.removeIf(v -> {
|
vendors.removeIf(v -> {
|
||||||
Scorer.Rating rating = ratings.getRating(v);
|
Scorer.Rating rating = ratings.getRating(v);
|
||||||
if (rating.getRate() <= profile.getMinVendorRating()){
|
if (rating.getRate() <= minRating){
|
||||||
if (specificator.contains(v)){
|
if (specificator.contains(v)){
|
||||||
removes.add(rating);
|
removes.add(rating);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user