diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/FeatureMerge.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/FeatureMerge.java index 202178d8e1..1bfe565ca2 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/FeatureMerge.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/FeatureMerge.java @@ -572,5 +572,5 @@ public static List removePointsOutsideBuffer(List (T feature, int hilbert) {} + private record WithIndex(T feature, int hilbert) {} } diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/collection/LongLongMap.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/collection/LongLongMap.java index 381f197977..895cd2ec3f 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/collection/LongLongMap.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/collection/LongLongMap.java @@ -51,10 +51,10 @@ static LongLongMap from(Type type, Storage storage, Storage.Params params) { AppendStore.Longs.create(storage, params.resolve("values")) ); case ARRAY -> switch (storage) { - case MMAP -> new ArrayLongLongMapMmap(params.path(), params.madvise()); - case RAM -> new ArrayLongLongMapRam(false); - case DIRECT -> new ArrayLongLongMapRam(true); - }; + case MMAP -> new ArrayLongLongMapMmap(params.path(), params.madvise()); + case RAM -> new ArrayLongLongMapRam(false); + case DIRECT -> new ArrayLongLongMapRam(true); + }; }; } diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/expression/MultiExpression.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/expression/MultiExpression.java index 97bc6c7737..2de86b6ff4 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/expression/MultiExpression.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/expression/MultiExpression.java @@ -32,7 +32,7 @@ * * @param type of data value associated with each expression */ -public record MultiExpression (List> expressions) implements Simplifiable> { +public record MultiExpression(List> expressions) implements Simplifiable> { private static final Logger LOGGER = LoggerFactory.getLogger(MultiExpression.class); private static final Comparator BY_ID = Comparator.comparingInt(WithId::id); @@ -358,13 +358,13 @@ public List> getMatchesWithTriggers(WithTags input) { } /** An expression/value pair with unique ID to store whether we evaluated it yet. */ - private record EntryWithId (T result, Expression expression, @Override int id) implements WithId {} + private record EntryWithId(T result, Expression expression, @Override int id) implements WithId {} /** * An {@code expression} to evaluate on input elements and {@code result} value to return when the element matches. */ - public record Entry (T result, Expression expression) {} + public record Entry(T result, Expression expression) {} /** The result when an expression matches, along with the input element tag {@code keys} that triggered the match. */ - public record Match (T match, List keys, @Override int id) implements WithId {} + public record Match(T match, List keys, @Override int id) implements WithId {} } diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/geo/PointIndex.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/geo/PointIndex.java index 888d4b3ec3..026d93bf21 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/geo/PointIndex.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/geo/PointIndex.java @@ -21,7 +21,7 @@ @ThreadSafe public class PointIndex { - private record GeomWithData (Coordinate coord, T data) {} + private record GeomWithData(Coordinate coord, T data) {} private final STRtree index = new STRtree(); diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/geo/PolygonIndex.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/geo/PolygonIndex.java index 6a2bfd823f..848c1d137e 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/geo/PolygonIndex.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/geo/PolygonIndex.java @@ -19,7 +19,7 @@ @ThreadSafe public class PolygonIndex { - private record GeomWithData (Polygon poly, T data) {} + private record GeomWithData(Polygon poly, T data) {} private final STRtree index = new STRtree(); @@ -77,7 +77,7 @@ public List getContainingOrNearest(Point point) { List items = index.query(point.getEnvelopeInternal()); // optimization: if there's only one then skip checking contains/distance if (items.size() == 1) { - if (items.get(0)instanceof GeomWithData value) { + if (items.get(0) instanceof GeomWithData value) { @SuppressWarnings("unchecked") T t = (T) value.data; return List.of(t); } diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/SourceFeature.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/SourceFeature.java index 63c87a3415..4a474a9727 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/SourceFeature.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/SourceFeature.java @@ -128,7 +128,7 @@ public final Geometry pointOnSurface() throws GeometryException { private Geometry computeCentroidIfConvex() throws GeometryException { if (!canBePolygon()) { return centroid(); - } else if (polygon()instanceof Polygon poly && + } else if (polygon() instanceof Polygon poly && poly.getNumInteriorRing() == 0 && GeoUtils.isConvex(poly.getExteriorRing())) { return centroid(); diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/osm/OsmReader.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/osm/OsmReader.java index dbd3a97fbe..7a9789feea 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/osm/OsmReader.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/osm/OsmReader.java @@ -592,7 +592,7 @@ default CoordinateSequence getWayGeometry(LongArrayList nodeIds) { * @param role "role" of the relation member * @param relation user-provided data about the relation from pass1 */ - public record RelationMember (String role, T relation) {} + public record RelationMember(String role, T relation) {} /** Raw relation membership data that gets encoded/decoded into a long. */ private record RelationMembership(String role, long relationId) {} diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/stats/ProcessInfo.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/stats/ProcessInfo.java index 4dda00a326..29736ef493 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/stats/ProcessInfo.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/stats/ProcessInfo.java @@ -38,7 +38,7 @@ public class ProcessInfo { for (GarbageCollectorMXBean garbageCollectorMXBean : ManagementFactory.getGarbageCollectorMXBeans()) { if (garbageCollectorMXBean instanceof NotificationEmitter emitter) { emitter.addNotificationListener((notification, handback) -> { - if (notification.getUserData()instanceof CompositeData compositeData) { + if (notification.getUserData() instanceof CompositeData compositeData) { var info = GarbageCollectionNotificationInfo.from(compositeData); GcInfo gcInfo = info.getGcInfo(); postGcMemoryUsage.set(gcInfo.getMemoryUsageAfterGc().entrySet().stream() @@ -142,7 +142,7 @@ public static long getDirectUsedMemoryLimit() { * Returns the total amount of memory available on the system if available. */ public static OptionalLong getSystemMemoryBytes() { - if (ManagementFactory.getOperatingSystemMXBean()instanceof com.sun.management.OperatingSystemMXBean osBean) { + if (ManagementFactory.getOperatingSystemMXBean() instanceof com.sun.management.OperatingSystemMXBean osBean) { return OptionalLong.of(osBean.getTotalMemorySize()); } else { return OptionalLong.empty(); diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/util/Translations.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/util/Translations.java index c06a0fcec1..7e3c60b0f8 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/util/Translations.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/util/Translations.java @@ -128,7 +128,7 @@ public Map getNameTranslations(Map tags) { Map result = new HashMap<>(); for (var entry : tags.entrySet()) { String key = entry.getKey(); - if (key.startsWith("name:") && entry.getValue()instanceof String stringVal) { + if (key.startsWith("name:") && entry.getValue() instanceof String stringVal) { result.put(key, stringVal); } } diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/util/Try.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/util/Try.java index 4cef426313..a6fdfb2d92 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/util/Try.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/util/Try.java @@ -58,14 +58,14 @@ default Try cast(Class clazz) { */ Try map(FunctionThatThrows fn); - record Success (T get) implements Try { + record Success(T get) implements Try { @Override public Try map(FunctionThatThrows fn) { return Try.apply(() -> fn.apply(get)); } } - record Failure (@Override Exception exception) implements Try { + record Failure(@Override Exception exception) implements Try { @Override public T get() { diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/worker/WorkerPipeline.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/worker/WorkerPipeline.java index 9bdeede68b..683b06117b 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/worker/WorkerPipeline.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/worker/WorkerPipeline.java @@ -34,7 +34,7 @@ * * @param input type of this pipeline */ -public record WorkerPipeline ( +public record WorkerPipeline( String name, WorkerPipeline previous, WorkQueue inputQueue, @@ -219,7 +219,7 @@ public Builder readFromQueue(WorkQueue input) { * * @param type of elements that the next step must process */ - public record Builder ( + public record Builder( String prefix, String name, // keep track of previous elements so that build can wire-up the computation graph diff --git a/planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/ConfigExpressionParser.java b/planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/ConfigExpressionParser.java index beaf5bca74..1137bfffe9 100644 --- a/planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/ConfigExpressionParser.java +++ b/planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/ConfigExpressionParser.java @@ -86,7 +86,7 @@ private ConfigExpression parse(Object object, Class output) { return cast(signature(output), child, dataType); } else { var keys = map.keySet(); - if (keys.equals(Set.of("coalesce")) && map.get("coalesce")instanceof Collection cases) { + if (keys.equals(Set.of("coalesce")) && map.get("coalesce") instanceof Collection cases) { return coalesce(cases.stream().map(item -> parse(item, output)).toList()); } else if (keys.equals(Set.of("match"))) { return parseMatch(map.get("match"), true, output); diff --git a/planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/TypeConversion.java b/planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/TypeConversion.java index 124a4cfdb9..0b9b45eea2 100644 --- a/planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/TypeConversion.java +++ b/planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/TypeConversion.java @@ -65,7 +65,7 @@ private static String doubleToString(Double d) { return d % 1 == 0 ? Long.toString(d.longValue()) : d.toString(); } - private record Converter (Class in, Class out, Function fn) implements Function { + private record Converter(Class in, Class out, Function fn) implements Function { @Override public O apply(Object in) { @SuppressWarnings("unchecked") I converted = (I) in; diff --git a/planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/expression/BooleanExpressionScript.java b/planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/expression/BooleanExpressionScript.java index fbc2b9edd7..a8c5c5665a 100644 --- a/planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/expression/BooleanExpressionScript.java +++ b/planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/expression/BooleanExpressionScript.java @@ -15,7 +15,7 @@ * * @param Type of the expression context */ -public record BooleanExpressionScript ( +public record BooleanExpressionScript( String expressionText, ConfigExpressionScript expression, Class inputClass diff --git a/planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/expression/ConfigExpression.java b/planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/expression/ConfigExpression.java index 1ccf49948e..58bcf47343 100644 --- a/planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/expression/ConfigExpression.java +++ b/planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/expression/ConfigExpression.java @@ -70,7 +70,7 @@ static Signature signature(ScriptEnvironment< } /** An expression that always returns {@code value}. */ - record Const (O value) implements ConfigExpression { + record Const(O value) implements ConfigExpression { @Override public O apply(I i) { @@ -79,7 +79,7 @@ public O apply(I i) { } /** An expression that returns the value associated with the first matching boolean expression. */ - record Match ( + record Match( Signature signature, MultiExpression> multiExpression, ConfigExpression fallback, @@ -146,7 +146,7 @@ public Match withDefaultValue(ConfigExpression newFallback) { } /** An expression that returns the first non-null result of evaluating each child expression. */ - record Coalesce (List> children) + record Coalesce(List> children) implements ConfigExpression { @Override @@ -184,7 +184,7 @@ yield coalesce(result.stream().map(d -> { } /** An expression that returns the value associated a given variable name at runtime. */ - record Variable ( + record Variable( Signature signature, String name ) implements ConfigExpression { @@ -202,7 +202,7 @@ public O apply(I i) { } /** An expression that returns the value associated a given tag of the input feature at runtime. */ - record GetTag ( + record GetTag( Signature signature, ConfigExpression tag ) implements ConfigExpression { @@ -219,7 +219,7 @@ public ConfigExpression simplifyOnce() { } /** An expression that returns the value associated a given argument at runtime. */ - record GetArg ( + record GetArg( Signature signature, ConfigExpression arg ) implements ConfigExpression { @@ -242,7 +242,7 @@ public ConfigExpression simplifyOnce() { } /** An expression that converts the input to a desired output {@link DataType} at runtime. */ - record Cast ( + record Cast( Signature signature, ConfigExpression input, DataType output @@ -268,7 +268,7 @@ public ConfigExpression simplifyOnce() { } } - record Signature (ScriptEnvironment in, Class out) { + record Signature(ScriptEnvironment in, Class out) { public Signature withOutput(Class newOut) { return new Signature<>(in, newOut); diff --git a/planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/expression/ScriptEnvironment.java b/planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/expression/ScriptEnvironment.java index 244a4122bd..db56016d30 100644 --- a/planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/expression/ScriptEnvironment.java +++ b/planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/expression/ScriptEnvironment.java @@ -12,7 +12,7 @@ * @param clazz Class of the input context type * @param The runtime expression context type */ -public record ScriptEnvironment (List declarations, Class clazz, Contexts.Root root) { +public record ScriptEnvironment(List declarations, Class clazz, Contexts.Root root) { private static List concat(List a, List b) { return Stream.concat(a.stream(), b.stream()).toList(); } diff --git a/planetiler-examples/src/main/java/com/onthegomap/planetiler/examples/BikeRouteOverlay.java b/planetiler-examples/src/main/java/com/onthegomap/planetiler/examples/BikeRouteOverlay.java index 719b5629d6..46abb3b1d3 100644 --- a/planetiler-examples/src/main/java/com/onthegomap/planetiler/examples/BikeRouteOverlay.java +++ b/planetiler-examples/src/main/java/com/onthegomap/planetiler/examples/BikeRouteOverlay.java @@ -64,11 +64,11 @@ public List preprocessOsmRelation(OsmElement.Relation relation) relation.getString("route"), // except map network abbreviation to a human-readable value switch (relation.getString("network", "")) { - case "icn" -> "international"; - case "ncn" -> "national"; - case "rcn" -> "regional"; - case "lcn" -> "local"; - default -> "other"; + case "icn" -> "international"; + case "ncn" -> "national"; + case "rcn" -> "regional"; + case "lcn" -> "local"; + default -> "other"; } )); } diff --git a/pom.xml b/pom.xml index bd17f4d144..e8ee98b151 100644 --- a/pom.xml +++ b/pom.xml @@ -178,7 +178,7 @@ - 4.21.0 + 4.29 ${maven.multiModuleProjectDirectory}/eclipse-formatter.xml @@ -256,7 +256,7 @@ - +