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 2e3d534bb8a613ad21830e3c9eb46d98ba015df9
Author: Bertil Chapuis <[email protected]>
AuthorDate: Thu Jun 13 01:01:07 2024 +0200

    Use record instead of class
---
 .../apache/baremaps/openstreetmap/model/Bound.java | 91 +---------------------
 .../baremaps/openstreetmap/OsmSampleTest.java      |  8 +-
 2 files changed, 5 insertions(+), 94 deletions(-)

diff --git 
a/baremaps-openstreetmap/src/main/java/org/apache/baremaps/openstreetmap/model/Bound.java
 
b/baremaps-openstreetmap/src/main/java/org/apache/baremaps/openstreetmap/model/Bound.java
index b30d5a4b..fc798f52 100644
--- 
a/baremaps-openstreetmap/src/main/java/org/apache/baremaps/openstreetmap/model/Bound.java
+++ 
b/baremaps-openstreetmap/src/main/java/org/apache/baremaps/openstreetmap/model/Bound.java
@@ -18,96 +18,7 @@
 package org.apache.baremaps.openstreetmap.model;
 
 
-
-import java.util.Objects;
-import java.util.StringJoiner;
-
 /** Represents the bounds of an OpenStreetMap dataset. */
-public final class Bound implements Entity {
-
-  private final double maxLat;
-
-  private final double maxLon;
-
-  private final double minLat;
-
-  private final double minLon;
-
-  /**
-   * Consturcts a {@code Bound} with the specified limits.
-   *
-   * @param maxLat the max latitude
-   * @param maxLon the max longitude
-   * @param minLat the min latitude
-   * @param minLon the max longitude
-   */
-  public Bound(double maxLat, double maxLon, double minLat, double minLon) {
-    this.maxLat = maxLat;
-    this.maxLon = maxLon;
-    this.minLat = minLat;
-    this.minLon = minLon;
-  }
-
-  /**
-   * Returns the max latitude.
-   *
-   * @return the max latitude
-   */
-  public double getMaxLat() {
-    return maxLat;
-  }
-
-  /**
-   * Returns the max longitude.
-   *
-   * @return the max longitude
-   */
-  public double getMaxLon() {
-    return maxLon;
-  }
-
-  /**
-   * Returns the min latitude.
-   *
-   * @return the min latitude
-   */
-  public double getMinLat() {
-    return minLat;
-  }
-
-  /**
-   * Returns the min longitude.
-   *
-   * @return the min longitude
-   */
-  public double getMinLon() {
-    return minLon;
-  }
-
-  /** {@inheritDoc} */
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (!(o instanceof Bound)) {
-      return false;
-    }
-    Bound bound = (Bound) o;
-    return Double.compare(bound.maxLat, maxLat) == 0 && 
Double.compare(bound.maxLon, maxLon) == 0
-        && Double.compare(bound.minLat, minLat) == 0 && 
Double.compare(bound.minLon, minLon) == 0;
-  }
-
-  /** {@inheritDoc} */
-  @Override
-  public int hashCode() {
-    return Objects.hash(maxLat, maxLon, minLat, minLon);
-  }
+public record Bound(double maxLat, double maxLon, double minLat, double 
minLon) implements Entity {
 
-  /** {@inheritDoc} */
-  @Override
-  public String toString() {
-    return new StringJoiner(", ", Bound.class.getSimpleName() + "[", 
"]").add("maxLat=" + maxLat)
-        .add("maxLon=" + maxLon).add("minLat=" + minLat).add("minLon=" + 
minLon).toString();
-  }
 }
diff --git 
a/baremaps-openstreetmap/src/test/java/org/apache/baremaps/openstreetmap/OsmSampleTest.java
 
b/baremaps-openstreetmap/src/test/java/org/apache/baremaps/openstreetmap/OsmSampleTest.java
index e5d02780..5d1b5d84 100644
--- 
a/baremaps-openstreetmap/src/test/java/org/apache/baremaps/openstreetmap/OsmSampleTest.java
+++ 
b/baremaps-openstreetmap/src/test/java/org/apache/baremaps/openstreetmap/OsmSampleTest.java
@@ -79,10 +79,10 @@ class OsmSampleTest {
         headers.incrementAndGet();
       } else if (entity instanceof Bound bound) {
         Assertions.assertNotNull(bound);
-        Assertions.assertEquals(0.0, bound.getMinLat(), 0.000001);
-        Assertions.assertEquals(0.0, bound.getMinLon(), 0.000001);
-        Assertions.assertEquals(20.0, bound.getMaxLat(), 0.000001);
-        Assertions.assertEquals(20.0, bound.getMaxLon(), 0.000001);
+        Assertions.assertEquals(0.0, bound.minLat(), 0.000001);
+        Assertions.assertEquals(0.0, bound.minLon(), 0.000001);
+        Assertions.assertEquals(20.0, bound.maxLat(), 0.000001);
+        Assertions.assertEquals(20.0, bound.maxLon(), 0.000001);
         bounds.incrementAndGet();
       } else if (entity instanceof Node node) {
         Assertions.assertNotNull(node);

Reply via email to