refactoring

This commit is contained in:
Kseniia 2021-01-05 23:29:26 +02:00
parent d74e57db84
commit be80a4c574

View file

@ -34,6 +34,7 @@ import org.json.JSONObject;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashSet; import java.util.HashSet;
@ -71,7 +72,7 @@ public class SearchUICore {
private static boolean debugMode = false; private static boolean debugMode = false;
private static final Set<String> FILTER_DUPLICATE_POI_SUBTYPE = Stream.of("building").collect((Collectors.toCollection(TreeSet::new))); private static final Set<String> FILTER_DUPLICATE_POI_SUBTYPE = new TreeSet<String>(Arrays.asList("building", "internet_access_yes"));
public SearchUICore(MapPoiTypes poiTypes, String locale, boolean transliterate) { public SearchUICore(MapPoiTypes poiTypes, String locale, boolean transliterate) {
this.poiTypes = poiTypes; this.poiTypes = poiTypes;
@ -258,7 +259,8 @@ public class SearchUICore {
} }
if (!type1.equals(type2)) { if (!type1.equals(type2)) {
if (isEqualId && (subType1.contains("internet") || subType2.contains("internet"))) { if (isEqualId && (FILTER_DUPLICATE_POI_SUBTYPE.contains(subType1)
|| FILTER_DUPLICATE_POI_SUBTYPE.contains(subType2))) {
return true; return true;
} }
return false; return false;
@ -1007,9 +1009,9 @@ public class SearchUICore {
int cmp; int cmp;
if(FILTER_DUPLICATE_POI_SUBTYPE.contains(subType1) || subType1.contains("internet")) { if (FILTER_DUPLICATE_POI_SUBTYPE.contains(subType1)) {
cmp = 1; cmp = 1;
} else if(FILTER_DUPLICATE_POI_SUBTYPE.contains(subType2) || subType2.contains("internet")) { } else if (FILTER_DUPLICATE_POI_SUBTYPE.contains(subType2)) {
cmp = -1; cmp = -1;
} else { } else {
cmp = c.collator.compare(subType1, subType2); cmp = c.collator.compare(subType1, subType2);