kopia lustrzana https://github.com/onthegomap/planetiler
fix isEmpty
rodzic
080045bc54
commit
119211c5e1
|
@ -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"})
|
||||
|
|
|
@ -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)));
|
||||
|
|
Ładowanie…
Reference in New Issue