From f66a592b9d07a4bdd0b15c69854fd9ace6cf274b Mon Sep 17 00:00:00 2001 From: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com> Date: Thu, 22 Aug 2024 15:35:37 +0200 Subject: [PATCH] syntax improvements + add TODO --- .../analytics/tools/bpmn/generator/App.java | 2 -- .../bpmn/generator/BPMNLayoutGenerator.java | 21 +++++++------------ 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/java/src/main/java/io/process/analytics/tools/bpmn/generator/App.java b/java/src/main/java/io/process/analytics/tools/bpmn/generator/App.java index 96b4580..1c21936 100644 --- a/java/src/main/java/io/process/analytics/tools/bpmn/generator/App.java +++ b/java/src/main/java/io/process/analytics/tools/bpmn/generator/App.java @@ -21,7 +21,6 @@ import java.io.File; import java.nio.file.Files; import java.nio.file.NoSuchFileException; -import java.nio.file.Path; import java.util.concurrent.Callable; import io.process.analytics.tools.bpmn.generator.BPMNLayoutGenerator.ExportType; @@ -54,7 +53,6 @@ public class App implements Callable { private File[] inputFiles; public static void main(String[] args) throws Exception { - int exitCode = runApp(args); System.exit(exitCode); } diff --git a/java/src/main/java/io/process/analytics/tools/bpmn/generator/BPMNLayoutGenerator.java b/java/src/main/java/io/process/analytics/tools/bpmn/generator/BPMNLayoutGenerator.java index 7252ece..8848c2a 100644 --- a/java/src/main/java/io/process/analytics/tools/bpmn/generator/BPMNLayoutGenerator.java +++ b/java/src/main/java/io/process/analytics/tools/bpmn/generator/BPMNLayoutGenerator.java @@ -3,9 +3,6 @@ import static io.process.analytics.tools.bpmn.generator.export.BPMNExporter.defaultBpmnExporter; import static io.process.analytics.tools.bpmn.generator.internal.BpmnInOut.defaultBpmnInOut; -import java.io.File; -import java.io.IOException; - import io.process.analytics.tools.bpmn.generator.algo.ShapeLayouter; import io.process.analytics.tools.bpmn.generator.algo.ShapeSorter; import io.process.analytics.tools.bpmn.generator.converter.BpmnToAlgoModelConverter; @@ -13,7 +10,6 @@ import io.process.analytics.tools.bpmn.generator.export.SVGExporter; import io.process.analytics.tools.bpmn.generator.input.CSVtoBPMN; import io.process.analytics.tools.bpmn.generator.internal.BpmnInOut; -import io.process.analytics.tools.bpmn.generator.internal.FileUtils; import io.process.analytics.tools.bpmn.generator.internal.generated.model.TDefinitions; import io.process.analytics.tools.bpmn.generator.model.Diagram; import io.process.analytics.tools.bpmn.generator.model.Grid; @@ -93,20 +89,17 @@ private String exportToSvg(LayoutSortedDiagram diagram) { private String export(LayoutSortedDiagram layout, ExportType exportType) { - switch (exportType) { - case ASCII: - return exportToAscii(layout); - case BPMN: - return exportToBpmn(layout); - case SVG: - return exportToSvg(layout); - default: - throw new IllegalStateException("Unexpected Export Type: " + exportType); - } + return switch (exportType) { + case ASCII -> exportToAscii(layout); + case BPMN -> exportToBpmn(layout); + case SVG -> exportToSvg(layout); + default -> throw new IllegalStateException("Unexpected Export Type: " + exportType); + }; } @RequiredArgsConstructor @Getter + // TODO switch to record public static class LayoutSortedDiagram { private final TDefinitions originalDefinitions;