tile-stats
Mike Barry 2023-09-21 21:17:23 -04:00
rodzic 080045bc54
commit 119211c5e1
2 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -108,7 +108,7 @@ public class TileWeights {
}
public boolean isEmpty() {
return byZoom.entrySet().stream().anyMatch(e -> e.getValue() > 0);
return byZoom.values().stream().noneMatch(e -> e > 0);
}
@JsonPropertyOrder({"z", "x", "y", "loads"})

Wyświetl plik

@ -1,6 +1,8 @@
package com.onthegomap.planetiler.util;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import com.onthegomap.planetiler.geo.TileCoord;
import java.io.IOException;
@ -20,12 +22,14 @@ class TileWeightsTest {
assertEquals(0, weights.getWeight(TileCoord.ofXYZ(0, 0, 1)));
assertEquals(0, weights.getWeight(TileCoord.ofXYZ(1, 0, 1)));
assertEquals(0, weights.getZoomWeight(1));
assertTrue(weights.isEmpty());
weights.put(TileCoord.ofXYZ(0, 0, 0), 1);
weights.put(TileCoord.ofXYZ(0, 0, 0), 2);
weights.put(TileCoord.ofXYZ(0, 0, 1), 3);
weights.put(TileCoord.ofXYZ(1, 0, 1), 4);
assertFalse(weights.isEmpty());
assertEquals(3, weights.getWeight(TileCoord.ofXYZ(0, 0, 0)));
assertEquals(3, weights.getZoomWeight(0));
assertEquals(3, weights.getWeight(TileCoord.ofXYZ(0, 0, 1)));