Correctly count nodes (for addresses)

Signed-off-by: Taylor Smock <smocktaylor@gmail.com>
pull/1/head
Taylor Smock 2020-02-05 19:32:46 -07:00
rodzic 6f1f282605
commit b7a19df0cc
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: D916A88DCF9ADF8D
1 zmienionych plików z 7 dodań i 4 usunięć

Wyświetl plik

@ -165,16 +165,19 @@ public class MapWithAIAddCommand extends Command implements Runnable {
returnLong = Long.valueOf(primitives.size());
} else {
returnLong = primitives.stream().map(editable::getPrimitiveById).filter(Objects::nonNull)
.filter(prim -> !prim.isDeleted()).count();
.filter(MapWithAIAddCommand::validPrimitive).count();
}
return returnLong;
}
public Collection<String> getSourceTags() {
return sources.entrySet().parallelStream()
.filter(entry -> editable.getPrimitiveById(entry.getKey()) != null
&& !editable.getPrimitiveById(entry.getKey()).isDeleted())
.map(Entry::getValue).filter(Objects::nonNull).distinct().sorted().collect(Collectors.toList());
.filter(entry -> validPrimitive(editable.getPrimitiveById(entry.getKey()))).map(Entry::getValue)
.filter(Objects::nonNull).distinct().sorted().collect(Collectors.toList());
}
private static boolean validPrimitive(OsmPrimitive prim) {
return prim != null && (!prim.isDeleted() || prim instanceof Node);
}
@Override