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 284baf0cb7c18d6348d13ae06f72b1c789a56fe5 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 +--------------------- 1 file changed, 1 insertion(+), 90 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(); - } }
