From 8d972010646e2a637c899c19d42c38add6508fcb Mon Sep 17 00:00:00 2001 From: Joschka Bischoff Date: Thu, 11 Jan 2024 15:33:22 +0100 Subject: [PATCH 1/2] bugfix make coordAggregator actually accessible --- .../analysis/skims/CalculateSkimMatrices.java | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/contribs/sbb-extensions/src/main/java/ch/sbb/matsim/analysis/skims/CalculateSkimMatrices.java b/contribs/sbb-extensions/src/main/java/ch/sbb/matsim/analysis/skims/CalculateSkimMatrices.java index 2c608d83743..a6f809e6e76 100644 --- a/contribs/sbb-extensions/src/main/java/ch/sbb/matsim/analysis/skims/CalculateSkimMatrices.java +++ b/contribs/sbb-extensions/src/main/java/ch/sbb/matsim/analysis/skims/CalculateSkimMatrices.java @@ -453,10 +453,25 @@ public final void calculateAndWritePTMatrices(String networkFilename, double endTime, Config config, String outputPrefix, - BiPredicate trainDetector) throws IOException { + BiPredicate trainDetector, + PTSkimMatrices.CoordAggregator coordAggregator) throws IOException { var matrices = calculatePTMatrices(networkFilename, - transitScheduleFilename, startTime, endTime, config, trainDetector); + transitScheduleFilename, startTime, endTime, config, trainDetector, coordAggregator); + writePTMatricesAsCSV(matrices, outputPrefix); + } + public final void calculateAndWritePTMatrices(String networkFilename, + String transitScheduleFilename, + double startTime, + double endTime, + Config config, + String outputPrefix, + BiPredicate trainDetector + ) throws IOException { + + var matrices = calculatePTMatrices(networkFilename, + transitScheduleFilename, startTime, endTime, config, trainDetector, new PTSkimMatrices.CoordAggregator() { + }); writePTMatricesAsCSV(matrices, outputPrefix); } @@ -476,11 +491,12 @@ public final void writePTMatricesAsCSV(PTSkimMatrices.PtIndicators matri } public final PTSkimMatrices.PtIndicators calculatePTMatrices(String networkFilename, - String transitScheduleFilename, - double startTime, - double endTime, - Config config, - BiPredicate trainDetector) { + String transitScheduleFilename, + double startTime, + double endTime, + Config config, + BiPredicate trainDetector, + PTSkimMatrices.CoordAggregator coordAggregator) { Scenario scenario = ScenarioUtils.createScenario(config); log.info("loading schedule from " + transitScheduleFilename); new TransitScheduleReader(scenario).readFile(transitScheduleFilename); @@ -494,8 +510,7 @@ public final PTSkimMatrices.PtIndicators calculatePTMatrices(String netw log.info("calc PT matrices for " + Time.writeTime(startTime) + " - " + Time.writeTime(endTime)); PTSkimMatrices.PtIndicators matrices = PTSkimMatrices.calculateSkimMatrices( - raptorData, this.coordsPerZone, startTime, endTime, 120, raptorParameters, this.numberOfThreads, trainDetector, new PTSkimMatrices.CoordAggregator() { - }); + raptorData, this.coordsPerZone, startTime, endTime, 120, raptorParameters, this.numberOfThreads, trainDetector, coordAggregator); return matrices; } From db021eb29f574f7311bdc269974dec90a38c964f Mon Sep 17 00:00:00 2001 From: Joschka Bischoff Date: Thu, 11 Jan 2024 15:35:58 +0100 Subject: [PATCH 2/2] bugfix make coordAggregator actually accessible --- .../ch/sbb/matsim/analysis/skims/CalculateSkimMatrices.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contribs/sbb-extensions/src/main/java/ch/sbb/matsim/analysis/skims/CalculateSkimMatrices.java b/contribs/sbb-extensions/src/main/java/ch/sbb/matsim/analysis/skims/CalculateSkimMatrices.java index a6f809e6e76..c3ba439a7c7 100644 --- a/contribs/sbb-extensions/src/main/java/ch/sbb/matsim/analysis/skims/CalculateSkimMatrices.java +++ b/contribs/sbb-extensions/src/main/java/ch/sbb/matsim/analysis/skims/CalculateSkimMatrices.java @@ -321,7 +321,7 @@ public final void loadSamplingPointsFromFile(String filename) throws IOException int idx = Integer.parseInt(parts[1]); double x = Double.parseDouble(parts[2]); double y = Double.parseDouble(parts[3]); - final int length = idx > maxIdx ? idx : maxIdx; + final int length = Math.max(idx, maxIdx); Coord[] coords = this.coordsPerZone.computeIfAbsent(zoneId, k -> new Coord[length + 1]); if (coords.length < (idx + 1)) { Coord[] tmp = new Coord[idx + 1];