kopia lustrzana https://github.com/onthegomap/planetiler
Upgrade eclipse formatter (#696)
rodzic
b108f88453
commit
a0cd4fa864
|
@ -86,7 +86,7 @@ public class ConfigExpressionParser<I extends ScriptContext> {
|
|||
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);
|
||||
|
|
|
@ -65,7 +65,7 @@ public class TypeConversion {
|
|||
return d % 1 == 0 ? Long.toString(d.longValue()) : d.toString();
|
||||
}
|
||||
|
||||
private record Converter<I, O> (Class<I> in, Class<O> out, Function<I, O> fn) implements Function<Object, O> {
|
||||
private record Converter<I, O>(Class<I> in, Class<O> out, Function<I, O> fn) implements Function<Object, O> {
|
||||
@Override
|
||||
public O apply(Object in) {
|
||||
@SuppressWarnings("unchecked") I converted = (I) in;
|
||||
|
|
|
@ -15,7 +15,7 @@ import java.util.Objects;
|
|||
*
|
||||
* @param <T> Type of the expression context
|
||||
*/
|
||||
public record BooleanExpressionScript<T extends ScriptContext> (
|
||||
public record BooleanExpressionScript<T extends ScriptContext>(
|
||||
String expressionText,
|
||||
ConfigExpressionScript<T, Boolean> expression,
|
||||
Class<T> inputClass
|
||||
|
|
|
@ -70,7 +70,7 @@ public interface ConfigExpression<I extends ScriptContext, O>
|
|||
}
|
||||
|
||||
/** An expression that always returns {@code value}. */
|
||||
record Const<I extends ScriptContext, O> (O value) implements ConfigExpression<I, O> {
|
||||
record Const<I extends ScriptContext, O>(O value) implements ConfigExpression<I, O> {
|
||||
|
||||
@Override
|
||||
public O apply(I i) {
|
||||
|
@ -79,7 +79,7 @@ public interface ConfigExpression<I extends ScriptContext, O>
|
|||
}
|
||||
|
||||
/** An expression that returns the value associated with the first matching boolean expression. */
|
||||
record Match<I extends ScriptContext, O> (
|
||||
record Match<I extends ScriptContext, O>(
|
||||
Signature<I, O> signature,
|
||||
MultiExpression<ConfigExpression<I, O>> multiExpression,
|
||||
ConfigExpression<I, O> fallback,
|
||||
|
@ -146,7 +146,7 @@ public interface ConfigExpression<I extends ScriptContext, O>
|
|||
}
|
||||
|
||||
/** An expression that returns the first non-null result of evaluating each child expression. */
|
||||
record Coalesce<I extends ScriptContext, O> (List<? extends ConfigExpression<I, O>> children)
|
||||
record Coalesce<I extends ScriptContext, O>(List<? extends ConfigExpression<I, O>> children)
|
||||
implements ConfigExpression<I, O> {
|
||||
|
||||
@Override
|
||||
|
@ -184,7 +184,7 @@ public interface ConfigExpression<I extends ScriptContext, O>
|
|||
}
|
||||
|
||||
/** An expression that returns the value associated a given variable name at runtime. */
|
||||
record Variable<I extends ScriptContext, O> (
|
||||
record Variable<I extends ScriptContext, O>(
|
||||
Signature<I, O> signature,
|
||||
String name
|
||||
) implements ConfigExpression<I, O> {
|
||||
|
@ -202,7 +202,7 @@ public interface ConfigExpression<I extends ScriptContext, O>
|
|||
}
|
||||
|
||||
/** An expression that returns the value associated a given tag of the input feature at runtime. */
|
||||
record GetTag<I extends ScriptContext, O> (
|
||||
record GetTag<I extends ScriptContext, O>(
|
||||
Signature<I, O> signature,
|
||||
ConfigExpression<I, String> tag
|
||||
) implements ConfigExpression<I, O> {
|
||||
|
@ -219,7 +219,7 @@ public interface ConfigExpression<I extends ScriptContext, O>
|
|||
}
|
||||
|
||||
/** An expression that returns the value associated a given argument at runtime. */
|
||||
record GetArg<I extends ScriptContext, O> (
|
||||
record GetArg<I extends ScriptContext, O>(
|
||||
Signature<I, O> signature,
|
||||
ConfigExpression<I, String> arg
|
||||
) implements ConfigExpression<I, O> {
|
||||
|
@ -242,7 +242,7 @@ public interface ConfigExpression<I extends ScriptContext, O>
|
|||
}
|
||||
|
||||
/** An expression that converts the input to a desired output {@link DataType} at runtime. */
|
||||
record Cast<I extends ScriptContext, O> (
|
||||
record Cast<I extends ScriptContext, O>(
|
||||
Signature<I, O> signature,
|
||||
ConfigExpression<I, ?> input,
|
||||
DataType output
|
||||
|
@ -268,7 +268,7 @@ public interface ConfigExpression<I extends ScriptContext, O>
|
|||
}
|
||||
}
|
||||
|
||||
record Signature<I extends ScriptContext, O> (ScriptEnvironment<I> in, Class<O> out) {
|
||||
record Signature<I extends ScriptContext, O>(ScriptEnvironment<I> in, Class<O> out) {
|
||||
|
||||
public <O2> Signature<I, O2> withOutput(Class<O2> newOut) {
|
||||
return new Signature<>(in, newOut);
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.util.stream.Stream;
|
|||
* @param clazz Class of the input context type
|
||||
* @param <T> The runtime expression context type
|
||||
*/
|
||||
public record ScriptEnvironment<T extends ScriptContext> (List<Decl> declarations, Class<T> clazz, Contexts.Root root) {
|
||||
public record ScriptEnvironment<T extends ScriptContext>(List<Decl> declarations, Class<T> clazz, Contexts.Root root) {
|
||||
private static <T> List<T> concat(List<T> a, List<T> b) {
|
||||
return Stream.concat(a.stream(), b.stream()).toList();
|
||||
}
|
||||
|
|
|
@ -64,11 +64,11 @@ public class BikeRouteOverlay implements Profile {
|
|||
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";
|
||||
}
|
||||
));
|
||||
}
|
||||
|
|
10
pom.xml
10
pom.xml
|
@ -175,10 +175,16 @@
|
|||
<version>2.40.0</version>
|
||||
<configuration>
|
||||
<java>
|
||||
<includes>
|
||||
<include>*.java</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>planetiler-openmaptiles/**/*.java</exclude>
|
||||
</excludes>
|
||||
<importOrder/>
|
||||
<removeUnusedImports/>
|
||||
<eclipse>
|
||||
<version>4.21.0</version>
|
||||
<version>4.29</version>
|
||||
<!--suppress UnresolvedMavenProperty -->
|
||||
<file>${maven.multiModuleProjectDirectory}/eclipse-formatter.xml</file>
|
||||
</eclipse>
|
||||
|
@ -256,7 +262,7 @@
|
|||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
|
Ładowanie…
Reference in New Issue