Skip to content

Commit

Permalink
upgrade eclipse formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
msbarry committed Oct 26, 2023
1 parent b108f88 commit 6bb55dc
Show file tree
Hide file tree
Showing 18 changed files with 40 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -572,5 +572,5 @@ public static List<VectorTile.Feature> removePointsOutsideBuffer(List<VectorTile
return result;
}

private record WithIndex<T> (T feature, int hilbert) {}
private record WithIndex<T>(T feature, int hilbert) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*
* @param <T> type of data value associated with each expression
*/
public record MultiExpression<T> (List<Entry<T>> expressions) implements Simplifiable<MultiExpression<T>> {
public record MultiExpression<T>(List<Entry<T>> expressions) implements Simplifiable<MultiExpression<T>> {

private static final Logger LOGGER = LoggerFactory.getLogger(MultiExpression.class);
private static final Comparator<WithId> BY_ID = Comparator.comparingInt(WithId::id);
Expand Down Expand Up @@ -358,13 +358,13 @@ public List<Match<T>> getMatchesWithTriggers(WithTags input) {
}

/** An expression/value pair with unique ID to store whether we evaluated it yet. */
private record EntryWithId<T> (T result, Expression expression, @Override int id) implements WithId {}
private record EntryWithId<T>(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> (T result, Expression expression) {}
public record Entry<T>(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> (T match, List<String> keys, @Override int id) implements WithId {}
public record Match<T>(T match, List<String> keys, @Override int id) implements WithId {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@ThreadSafe
public class PointIndex<T> {

private record GeomWithData<T> (Coordinate coord, T data) {}
private record GeomWithData<T>(Coordinate coord, T data) {}

private final STRtree index = new STRtree();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
@ThreadSafe
public class PolygonIndex<T> {

private record GeomWithData<T> (Polygon poly, T data) {}
private record GeomWithData<T>(Polygon poly, T data) {}

private final STRtree index = new STRtree();

Expand Down Expand Up @@ -77,7 +77,7 @@ public List<T> 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<T extends OsmRelationInfo> (String role, T relation) {}
public record RelationMember<T extends OsmRelationInfo>(String role, T relation) {}

/** Raw relation membership data that gets encoded/decoded into a long. */
private record RelationMembership(String role, long relationId) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public Map<String, String> getNameTranslations(Map<String, Object> tags) {
Map<String, String> 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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ default <O> Try<O> cast(Class<O> clazz) {
*/
<O> Try<O> map(FunctionThatThrows<T, O> fn);

record Success<T> (T get) implements Try<T> {
record Success<T>(T get) implements Try<T> {

@Override
public <O> Try<O> map(FunctionThatThrows<T, O> fn) {
return Try.apply(() -> fn.apply(get));
}
}
record Failure<T> (@Override Exception exception) implements Try<T> {
record Failure<T>(@Override Exception exception) implements Try<T> {

@Override
public T get() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*
* @param <T> input type of this pipeline
*/
public record WorkerPipeline<T> (
public record WorkerPipeline<T>(
String name,
WorkerPipeline<?> previous,
WorkQueue<T> inputQueue,
Expand Down Expand Up @@ -219,7 +219,7 @@ public <T> Builder<T> readFromQueue(WorkQueue<T> input) {
*
* @param <O> type of elements that the next step must process
*/
public record Builder<O> (
public record Builder<O>(
String prefix,
String name,
// keep track of previous elements so that build can wire-up the computation graph
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private <O> ConfigExpression<I, O> parse(Object object, Class<O> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private static String doubleToString(Double d) {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static <I extends ScriptContext, O> Signature<I, O> signature(ScriptEnvironment<
}

/** 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) {
Expand All @@ -79,7 +79,7 @@ public O apply(I i) {
}

/** 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,
Expand Down Expand Up @@ -146,7 +146,7 @@ public Match<I, O> withDefaultValue(ConfigExpression<I, O> newFallback) {
}

/** 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
Expand Down Expand Up @@ -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<I extends ScriptContext, O> (
record Variable<I extends ScriptContext, O>(
Signature<I, O> signature,
String name
) implements ConfigExpression<I, O> {
Expand All @@ -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<I extends ScriptContext, O> (
record GetTag<I extends ScriptContext, O>(
Signature<I, O> signature,
ConfigExpression<I, String> tag
) implements ConfigExpression<I, O> {
Expand All @@ -219,7 +219,7 @@ public ConfigExpression<I, O> simplifyOnce() {
}

/** 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> {
Expand All @@ -242,7 +242,7 @@ public ConfigExpression<I, O> simplifyOnce() {
}

/** 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
Expand All @@ -268,7 +268,7 @@ public ConfigExpression<I, O> simplifyOnce() {
}
}

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ public List<OsmRelationInfo> 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";
}
));
}
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
<importOrder/>
<removeUnusedImports/>
<eclipse>
<version>4.21.0</version>
<version>4.29</version>
<!--suppress UnresolvedMavenProperty -->
<file>${maven.multiModuleProjectDirectory}/eclipse-formatter.xml</file>
</eclipse>
Expand Down Expand Up @@ -256,7 +256,7 @@
</configuration>
</plugin>
</plugins>

<pluginManagement>
<plugins>
<plugin>
Expand Down

0 comments on commit 6bb55dc

Please sign in to comment.