This is an automated email from the ASF dual-hosted git repository.

bchapuis pushed a commit to branch sonar
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git

commit f6ad6ae275f01121c15f71c0f3aea37ec7c6fda7
Author: Bertil Chapuis <[email protected]>
AuthorDate: Thu Jun 13 00:58:36 2024 +0200

    Merge if statements
---
 .../baremaps/maplibre/expression/ExpressionsTest.java      | 14 +++++++-------
 .../function/RelationMultiPolygonBuilder.java              | 10 ++++------
 2 files changed, 11 insertions(+), 13 deletions(-)

diff --git 
a/baremaps-maplibre/src/test/java/org/apache/baremaps/maplibre/expression/ExpressionsTest.java
 
b/baremaps-maplibre/src/test/java/org/apache/baremaps/maplibre/expression/ExpressionsTest.java
index 06d05288..54d56bcb 100644
--- 
a/baremaps-maplibre/src/test/java/org/apache/baremaps/maplibre/expression/ExpressionsTest.java
+++ 
b/baremaps-maplibre/src/test/java/org/apache/baremaps/maplibre/expression/ExpressionsTest.java
@@ -29,13 +29,13 @@ import org.junit.jupiter.api.Test;
 class ExpressionsTest {
 
   @Test
-   void literal() {
+  void literal() {
     assertEquals(1, new Literal(1).evaluate(null));
     assertEquals("value", new Literal("value").evaluate(null));
   }
 
   @Test
-   void at()  {
+  void at() {
     var literal = new Literal(List.of(0, 1, 2));
     assertEquals(0, new At(0, literal).evaluate(null));
     assertEquals(1, new At(1, literal).evaluate(null));
@@ -45,21 +45,21 @@ class ExpressionsTest {
   }
 
   @Test
-   void get()  {
+  void get() {
     assertEquals("value",
         new Get("key").evaluate(new Feature(0L, Map.of("key", "value"), 
null)));
     assertEquals(null, new Get("key").evaluate(new Feature(0L, Map.of(), 
null)));
   }
 
   @Test
-   void has()  {
+  void has() {
     assertEquals(true,
         new Has("key").evaluate(new Feature(0L, Map.of("key", "value"), 
null)));
     assertEquals(false, new Has("key").evaluate(new Feature(0L, Map.of(), 
null)));
   }
 
   @Test
-   void inList() {
+  void inList() {
     var literal = new Literal(List.of(0, 1, 2));
     assertEquals(true, new In(0, literal).evaluate(null));
     assertEquals(true, new In(1, literal).evaluate(null));
@@ -76,7 +76,7 @@ class ExpressionsTest {
   }
 
   @Test
-   void indexOfList()  {
+  void indexOfList() {
     var literal = new Literal(List.of(0, 1, 2));
     assertEquals(0, new IndexOf(0, literal).evaluate(null));
     assertEquals(1, new IndexOf(1, literal).evaluate(null));
@@ -85,7 +85,7 @@ class ExpressionsTest {
   }
 
   @Test
-   void indexOfString() {
+  void indexOfString() {
     var literal = new Literal("foobar");
     assertEquals(0, new IndexOf("foo", literal).evaluate(null));
     assertEquals(3, new IndexOf("bar", literal).evaluate(null));
diff --git 
a/baremaps-openstreetmap/src/main/java/org/apache/baremaps/openstreetmap/function/RelationMultiPolygonBuilder.java
 
b/baremaps-openstreetmap/src/main/java/org/apache/baremaps/openstreetmap/function/RelationMultiPolygonBuilder.java
index 73a674f5..cdda73cf 100644
--- 
a/baremaps-openstreetmap/src/main/java/org/apache/baremaps/openstreetmap/function/RelationMultiPolygonBuilder.java
+++ 
b/baremaps-openstreetmap/src/main/java/org/apache/baremaps/openstreetmap/function/RelationMultiPolygonBuilder.java
@@ -192,12 +192,10 @@ public class RelationMultiPolygonBuilder implements 
Consumer<Entity> {
 
     // Merge the lines to build the polygons
     for (Object geometry : lineMerger.getMergedLineStrings()) {
-      if (geometry instanceof LineString lineString) {
-        if (lineString.isClosed()) {
-          var polygon =
-              
GeometryUtils.GEOMETRY_FACTORY_WGS84.createPolygon(lineString.getCoordinates());
-          repairPolygon(polygon, polygons);
-        }
+      if (geometry instanceof LineString lineString && lineString.isClosed()) {
+        var polygon =
+            
GeometryUtils.GEOMETRY_FACTORY_WGS84.createPolygon(lineString.getCoordinates());
+        repairPolygon(polygon, polygons);
       }
     }
 

Reply via email to