improve collect vendors list on search
This commit is contained in:
@@ -56,6 +56,10 @@ public class FilteredMarket {
|
|||||||
return vendor instanceof TransitVendor;
|
return vendor instanceof TransitVendor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Stream<Vendor> getMarkets(){
|
||||||
|
return getMarkets(false);
|
||||||
|
}
|
||||||
|
|
||||||
public Stream<Vendor> getMarkets(boolean withTransit){
|
public Stream<Vendor> getMarkets(boolean withTransit){
|
||||||
Predicate<Vendor> transitOrMarket = v -> withTransit && isTransit(v) || isMarket(v);
|
Predicate<Vendor> transitOrMarket = v -> withTransit && isTransit(v) || isMarket(v);
|
||||||
if (disableFilter){
|
if (disableFilter){
|
||||||
|
|||||||
@@ -285,13 +285,15 @@ public class MarketAnalyzer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Collection<Vendor> getVendors(CrawlerSpecificator specificator, boolean withTransit){
|
private Collection<Vendor> getVendors(CrawlerSpecificator specificator, boolean withTransit){
|
||||||
|
List<Vendor> transits = withTransit ? market.get().map(Place::asTransit).collect(Collectors.toList()) : new ArrayList<>();
|
||||||
Collection<Vendor> vendors;
|
Collection<Vendor> vendors;
|
||||||
if (!specificator.isFullScan() || specificator.getMinHop() >= profile.getLands()){
|
if (!specificator.isFullScan() || specificator.getMinHop() >= profile.getLands()){
|
||||||
vendors = withTransit ? market.get().map(Place::asTransit).collect(Collectors.toList()) : new ArrayList<>();
|
vendors = market.getMarkets().filter(specificator::contains).collect(Collectors.toList());
|
||||||
} else {
|
} else {
|
||||||
vendors = market.getMarkets(withTransit).collect(Collectors.toList());
|
vendors = market.getMarkets().collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
vendors = specificator.getVendors(vendors);
|
vendors = specificator.getVendors(vendors);
|
||||||
|
vendors.addAll(transits);
|
||||||
return vendors;
|
return vendors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user