diff --git a/.github/workflows/cibuild.yml b/.github/workflows/cibuild.yml index b69d998eca7..8dd856e3ba7 100644 --- a/.github/workflows/cibuild.yml +++ b/.github/workflows/cibuild.yml @@ -108,7 +108,7 @@ jobs: if: github.event_name == 'pull_request' - name: Install Python dependencies - run: pip install -r doc/user/requirements.txt + run: pip install --break-system-packages -r doc/user/requirements.txt - name: Build main documentation @@ -121,7 +121,7 @@ jobs: - name: Build GTFS GraphQL API documentation run: | - npm install -g @magidoc/cli@6.0.0 + npm install -g @magidoc/cli@6.1.0 magidoc generate --stacktrace - name: Deploy compiled HTML to Github pages @@ -154,7 +154,7 @@ jobs: # schema hasn't changed. # example commit: https://github.com/opentripplanner/docs/commit/45e6ddf8e4a4 - SCHEMA_FILE_MODIFIED=`git log -n 1 --pretty=format:%ct src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls` + SCHEMA_FILE_MODIFIED=`git log -n 1 --pretty=format:%ct application/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls` echo "schema modified at ${SCHEMA_FILE_MODIFIED}" git checkout $LOCAL_BRANCH DOCS_MODIFIED=`git log -n 1 --pretty=format:%ct api/dev-2.x/graphql-gtfs/introduction.html` @@ -181,7 +181,7 @@ jobs: with: node-version: 16 - name: Run code generator - working-directory: src/main/java/org/opentripplanner/apis/gtfs/generated + working-directory: application/src/main/java/org/opentripplanner/apis/gtfs/generated run: | yarn install yarn generate diff --git a/.github/workflows/debug-client.yml b/.github/workflows/debug-client.yml index 6857b56b161..3c87e1c1b5c 100644 --- a/.github/workflows/debug-client.yml +++ b/.github/workflows/debug-client.yml @@ -76,8 +76,8 @@ jobs: git checkout dev-2.x git pull --rebase - CLIENT_HTML_OUTPUT=src/client/index.html - mkdir -p src/client/ + CLIENT_HTML_OUTPUT=application/src/client/index.html + mkdir -p application/src/client/ cp client/output/index.html ${CLIENT_HTML_OUTPUT} # just to debug diff --git a/.github/workflows/performance-test.yml b/.github/workflows/performance-test.yml index bfddea1b408..d1ab0bff4ea 100644 --- a/.github/workflows/performance-test.yml +++ b/.github/workflows/performance-test.yml @@ -88,17 +88,18 @@ jobs: - name: Build graph if: matrix.profile == 'core' || github.ref == 'refs/heads/dev-2.x' run: | - cp target/otp-*-SNAPSHOT-shaded.jar otp.jar + cp application/target/otp-*-SNAPSHOT-shaded.jar otp.jar java -Xmx32G -jar otp.jar --build --save test/performance/${{ matrix.location }}/ - name: Run speed test if: matrix.profile == 'core' || github.ref == 'refs/heads/dev-2.x' + working-directory: application env: PERFORMANCE_INFLUX_DB_PASSWORD: ${{ secrets.PERFORMANCE_INFLUX_DB_PASSWORD }} SPEEDTEST_LOCATION: ${{ matrix.location }} MAVEN_OPTS: "-Xmx50g -XX:StartFlightRecording=delay=${{ matrix.jfr-delay }},duration=30m,filename=${{ matrix.location}}-speed-test.jfr -Dmaven.repo.local=/home/lenni/.m2/repository/" run: | - mvn exec:java -Dexec.mainClass="org.opentripplanner.transit.speed_test.SpeedTest" -Dexec.classpathScope=test -Dexec.args="--dir=test/performance/${{ matrix.location }} -p md -n ${{ matrix.iterations }} -i 3 -0" -P prettierSkip + mvn exec:java -Dexec.mainClass="org.opentripplanner.transit.speed_test.SpeedTest" -Dexec.classpathScope=test -Dexec.args="--dir=../test/performance/${{ matrix.location }} -p md -n ${{ matrix.iterations }} -i 3 -0" -P prettierSkip - name: Archive travel results file if: matrix.profile == 'core' || github.ref == 'refs/heads/dev-2.x' diff --git a/.github/workflows/prune-container-images.yml b/.github/workflows/prune-container-images.yml index c1653701c3b..54c450cea90 100644 --- a/.github/workflows/prune-container-images.yml +++ b/.github/workflows/prune-container-images.yml @@ -18,5 +18,5 @@ jobs: run: | # remove all snapshot container images that have not been pulled for over a year # --keep-semver makes sure that any image with a x.y.z version scheme is unaffected by this - pip install prune-container-repo==0.0.4 + pip install prune-container-repo==0.0.4 --break-system-packages prune-container-repo -u ${CONTAINER_REGISTRY_USER} -r ${CONTAINER_REPO} --days=365 --keep-semver --activate diff --git a/DEVELOPMENT_DECISION_RECORDS.md b/DEVELOPMENT_DECISION_RECORDS.md index 10b9e005809..44aa031954f 100644 --- a/DEVELOPMENT_DECISION_RECORDS.md +++ b/DEVELOPMENT_DECISION_RECORDS.md @@ -16,7 +16,7 @@ tests. Expect to include some code cleanup as part of all PRs. ## Follow-Naming-Conventions Use established terminology from GTFS, NeTEx or the existing OTP code. Make sure the code is easy -to read and understand. [Follow naming conventions](CODE_CONVENTIONS.md#naming-conventions) . +to read and understand. [Follow naming conventions](doc/dev/decisionrecords/NamingConventions.md#naming-conventions) . ## Write-Code-Documentation - Use JavaDoc @@ -32,7 +32,7 @@ notes on `private` members and as inline comments. **See also** - [Developers-Guide > Code comments](doc/user/Developers-Guide.md#code-comments). - - [Codestyle > Javadoc Guidlines](doc/dev/decisionrecords/Codestyle.md#javadoc-guidlines) - JavaDoc checklist + - [Codestyle > Javadoc Guidelines](doc/dev/decisionrecords/Codestyle.md#javadoc-guidlines) - JavaDoc checklist ## Document-Config-and-APIs diff --git a/application/pom.xml b/application/pom.xml new file mode 100644 index 00000000000..4a228829c70 --- /dev/null +++ b/application/pom.xml @@ -0,0 +1,518 @@ + + + 4.0.0 + + org.opentripplanner + otp-root + 2.7.0-SNAPSHOT + + otp + OpenTripPlanner - Application + + + + net.sf.trove4j + trove4j + + + + org.slf4j + slf4j-api + + + + org.slf4j + jul-to-slf4j + ${slf4j.version} + + + + ch.qos.logback + logback-classic + ${logback.version} + + + + net.logstash.logback + logstash-logback-encoder + 8.0 + + + + + com.google.dagger + dagger + ${google.dagger.version} + + + + + + org.geotools + gt-coverage + + + org.geotools + gt-geotiff + + + org.geotools + gt-api + + + org.geotools + gt-geojson-core + + + + + org.apache.lucene + lucene-core + ${lucene.version} + + + org.apache.lucene + lucene-queryparser + ${lucene.version} + + + org.apache.lucene + lucene-suggest + ${lucene.version} + + + + io.micrometer + micrometer-registry-prometheus + ${micrometer.version} + + + io.micrometer + micrometer-registry-influx + ${micrometer.version} + test + + + + + + edu.ucar + netcdf4 + ${netcdf4.version} + + + + org.entur + netex-java-model + ${netex-java-model.version} + + + + + org.entur + siri-java-model + ${siri-java-model.version} + + + + + org.entur + siri-protobuf-mapper + 1.0.3 + + + + org.mobilitydata + gbfs-java-model + 1.0.7 + + + + + org.junit.jupiter + junit-jupiter-api + ${junit.version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit.version} + test + + + com.google.truth + truth + 1.4.4 + test + + + com.tngtech.archunit + archunit + 1.3.0 + test + + + org.mockito + mockito-core + 5.13.0 + test + + + io.github.origin-energy + java-snapshot-testing-junit5 + 2.3.0 + test + + + + + com.conveyal + kryo-tools + 1.6.0 + + + + de.javakaffee + kryo-serializers + 0.45 + + + + com.google.guava + guava + + + + org.glassfish.jersey.core + jersey-server + ${jersey.version} + + + + org.glassfish.jersey.containers + jersey-container-grizzly2-http + ${jersey.version} + + + + org.glassfish.jersey.media + jersey-media-json-jackson + ${jersey.version} + + + + org.glassfish.jersey.inject + jersey-hk2 + ${jersey.version} + + + + + org.glassfish.jaxb + jaxb-runtime + ${jaxb-runtime.version} + + + + + com.fasterxml.jackson.core + jackson-core + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jdk8 + ${jackson.version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson.version} + + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson.version} + + + + + + + com.google.cloud + google-cloud-storage + + + + + com.google.cloud + google-cloud-pubsub + + + + + com.google.protobuf + protobuf-java + + + + + org.onebusaway + onebusaway-gtfs + 3.2.4 + + + + org.processing + core + 2.2.1 + + + + net.java.dev.jets3t + jets3t + 0.9.4 + + + + org.openstreetmap.osmosis + osmosis-osm-binary + 0.48.3 + + + + com.beust + jcommander + 1.82 + + + com.graphql-java + graphql-java + 22.3 + + + com.graphql-java + graphql-java-extended-scalars + 22.0 + + + org.apache.httpcomponents.client5 + httpclient5 + 5.4 + + + commons-cli + commons-cli + 1.5.0 + test + + + net.sourceforge.javacsv + javacsv + 2.0 + + + org.eclipse.paho + org.eclipse.paho.client.mqttv3 + 1.2.5 + + + io.github.ci-cmg + mapbox-vector-tile + 4.0.6 + + + net.objecthunter + exp4j + 0.4.8 + + + com.azure + azure-core + 1.46.0 + + + com.azure + azure-messaging-servicebus + 7.15.0 + + + com.azure + azure-identity + 1.11.2 + compile + + + ch.poole + OpeningHoursParser + 0.28.2 + + + + + org.apache.commons + commons-compress + 1.27.1 + test + + + + + + + + src/main/resources + true + + + src/ext/resources + true + + + src/client + client + false + + + + + src/test/resources + + + src/ext-test/resources + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.6.0 + + + build-helper-generate-sources + generate-sources + + add-source + + + + src/main/java + src/ext/java + + + + + build-helper-generate-test-sources + generate-test-sources + + add-test-source + + + + src/test/java + src/ext-test/java + + + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.6.0 + + + package + + shade + + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + true + shaded + false + + + + + + + org.opentripplanner.standalone.OTPMain + + Java Advanced Imaging Image I/O + Tools + + 1.1 + Sun Microsystems, Inc. + com.sun.media.imageio + 1.1 + Sun Microsystems, Inc. + com.sun.media.imageio + + + + + + + + + + diff --git a/src/client/META-INF/MANIFEST.MF b/application/src/client/META-INF/MANIFEST.MF similarity index 100% rename from src/client/META-INF/MANIFEST.MF rename to application/src/client/META-INF/MANIFEST.MF diff --git a/src/client/WEB-INF/web_client.xml b/application/src/client/WEB-INF/web_client.xml similarity index 100% rename from src/client/WEB-INF/web_client.xml rename to application/src/client/WEB-INF/web_client.xml diff --git a/src/client/classic-debug/i18n/babel.cfg b/application/src/client/classic-debug/i18n/babel.cfg similarity index 100% rename from src/client/classic-debug/i18n/babel.cfg rename to application/src/client/classic-debug/i18n/babel.cfg diff --git a/src/client/classic-debug/i18n/ca_ES.po b/application/src/client/classic-debug/i18n/ca_ES.po similarity index 100% rename from src/client/classic-debug/i18n/ca_ES.po rename to application/src/client/classic-debug/i18n/ca_ES.po diff --git a/src/client/classic-debug/i18n/de.po b/application/src/client/classic-debug/i18n/de.po similarity index 100% rename from src/client/classic-debug/i18n/de.po rename to application/src/client/classic-debug/i18n/de.po diff --git a/src/client/classic-debug/i18n/en.po b/application/src/client/classic-debug/i18n/en.po similarity index 100% rename from src/client/classic-debug/i18n/en.po rename to application/src/client/classic-debug/i18n/en.po diff --git a/src/client/classic-debug/i18n/es.po b/application/src/client/classic-debug/i18n/es.po similarity index 100% rename from src/client/classic-debug/i18n/es.po rename to application/src/client/classic-debug/i18n/es.po diff --git a/src/client/classic-debug/i18n/fr.po b/application/src/client/classic-debug/i18n/fr.po similarity index 100% rename from src/client/classic-debug/i18n/fr.po rename to application/src/client/classic-debug/i18n/fr.po diff --git a/src/client/classic-debug/i18n/hu.po b/application/src/client/classic-debug/i18n/hu.po similarity index 100% rename from src/client/classic-debug/i18n/hu.po rename to application/src/client/classic-debug/i18n/hu.po diff --git a/src/client/classic-debug/i18n/it.po b/application/src/client/classic-debug/i18n/it.po similarity index 100% rename from src/client/classic-debug/i18n/it.po rename to application/src/client/classic-debug/i18n/it.po diff --git a/src/client/classic-debug/i18n/messages.pot b/application/src/client/classic-debug/i18n/messages.pot similarity index 100% rename from src/client/classic-debug/i18n/messages.pot rename to application/src/client/classic-debug/i18n/messages.pot diff --git a/src/client/classic-debug/i18n/no.po b/application/src/client/classic-debug/i18n/no.po similarity index 100% rename from src/client/classic-debug/i18n/no.po rename to application/src/client/classic-debug/i18n/no.po diff --git a/src/client/classic-debug/i18n/pl.po b/application/src/client/classic-debug/i18n/pl.po similarity index 100% rename from src/client/classic-debug/i18n/pl.po rename to application/src/client/classic-debug/i18n/pl.po diff --git a/src/client/classic-debug/i18n/pt.po b/application/src/client/classic-debug/i18n/pt.po similarity index 100% rename from src/client/classic-debug/i18n/pt.po rename to application/src/client/classic-debug/i18n/pt.po diff --git a/src/client/classic-debug/i18n/sl.po b/application/src/client/classic-debug/i18n/sl.po similarity index 100% rename from src/client/classic-debug/i18n/sl.po rename to application/src/client/classic-debug/i18n/sl.po diff --git a/src/client/classic-debug/images/agency_logo.png b/application/src/client/classic-debug/images/agency_logo.png similarity index 100% rename from src/client/classic-debug/images/agency_logo.png rename to application/src/client/classic-debug/images/agency_logo.png diff --git a/src/client/classic-debug/images/alert.png b/application/src/client/classic-debug/images/alert.png similarity index 100% rename from src/client/classic-debug/images/alert.png rename to application/src/client/classic-debug/images/alert.png diff --git a/src/client/classic-debug/images/bicycle_green.png b/application/src/client/classic-debug/images/bicycle_green.png similarity index 100% rename from src/client/classic-debug/images/bicycle_green.png rename to application/src/client/classic-debug/images/bicycle_green.png diff --git a/src/client/classic-debug/images/bicycle_green_small.png b/application/src/client/classic-debug/images/bicycle_green_small.png similarity index 100% rename from src/client/classic-debug/images/bicycle_green_small.png rename to application/src/client/classic-debug/images/bicycle_green_small.png diff --git a/src/client/classic-debug/images/bicycle_red.png b/application/src/client/classic-debug/images/bicycle_red.png similarity index 100% rename from src/client/classic-debug/images/bicycle_red.png rename to application/src/client/classic-debug/images/bicycle_red.png diff --git a/src/client/classic-debug/images/bicycle_red_small.png b/application/src/client/classic-debug/images/bicycle_red_small.png similarity index 100% rename from src/client/classic-debug/images/bicycle_red_small.png rename to application/src/client/classic-debug/images/bicycle_red_small.png diff --git a/src/client/classic-debug/images/directions/circle_clockwise.png b/application/src/client/classic-debug/images/directions/circle_clockwise.png similarity index 100% rename from src/client/classic-debug/images/directions/circle_clockwise.png rename to application/src/client/classic-debug/images/directions/circle_clockwise.png diff --git a/src/client/classic-debug/images/directions/circle_counterclockwise.png b/application/src/client/classic-debug/images/directions/circle_counterclockwise.png similarity index 100% rename from src/client/classic-debug/images/directions/circle_counterclockwise.png rename to application/src/client/classic-debug/images/directions/circle_counterclockwise.png diff --git a/src/client/classic-debug/images/directions/clear.png b/application/src/client/classic-debug/images/directions/clear.png similarity index 100% rename from src/client/classic-debug/images/directions/clear.png rename to application/src/client/classic-debug/images/directions/clear.png diff --git a/src/client/classic-debug/images/directions/continue.png b/application/src/client/classic-debug/images/directions/continue.png similarity index 100% rename from src/client/classic-debug/images/directions/continue.png rename to application/src/client/classic-debug/images/directions/continue.png diff --git a/src/client/classic-debug/images/directions/depart.png b/application/src/client/classic-debug/images/directions/depart.png similarity index 100% rename from src/client/classic-debug/images/directions/depart.png rename to application/src/client/classic-debug/images/directions/depart.png diff --git a/src/client/classic-debug/images/directions/direction_icons.svg b/application/src/client/classic-debug/images/directions/direction_icons.svg similarity index 100% rename from src/client/classic-debug/images/directions/direction_icons.svg rename to application/src/client/classic-debug/images/directions/direction_icons.svg diff --git a/src/client/classic-debug/images/directions/elevator.png b/application/src/client/classic-debug/images/directions/elevator.png similarity index 100% rename from src/client/classic-debug/images/directions/elevator.png rename to application/src/client/classic-debug/images/directions/elevator.png diff --git a/src/client/classic-debug/images/directions/enter_station.png b/application/src/client/classic-debug/images/directions/enter_station.png similarity index 100% rename from src/client/classic-debug/images/directions/enter_station.png rename to application/src/client/classic-debug/images/directions/enter_station.png diff --git a/src/client/classic-debug/images/directions/exit_left.png b/application/src/client/classic-debug/images/directions/exit_left.png similarity index 100% rename from src/client/classic-debug/images/directions/exit_left.png rename to application/src/client/classic-debug/images/directions/exit_left.png diff --git a/src/client/classic-debug/images/directions/exit_right.png b/application/src/client/classic-debug/images/directions/exit_right.png similarity index 100% rename from src/client/classic-debug/images/directions/exit_right.png rename to application/src/client/classic-debug/images/directions/exit_right.png diff --git a/src/client/classic-debug/images/directions/exit_station.png b/application/src/client/classic-debug/images/directions/exit_station.png similarity index 100% rename from src/client/classic-debug/images/directions/exit_station.png rename to application/src/client/classic-debug/images/directions/exit_station.png diff --git a/src/client/classic-debug/images/directions/follow_signs.png b/application/src/client/classic-debug/images/directions/follow_signs.png similarity index 100% rename from src/client/classic-debug/images/directions/follow_signs.png rename to application/src/client/classic-debug/images/directions/follow_signs.png diff --git a/src/client/classic-debug/images/directions/hard_left.png b/application/src/client/classic-debug/images/directions/hard_left.png similarity index 100% rename from src/client/classic-debug/images/directions/hard_left.png rename to application/src/client/classic-debug/images/directions/hard_left.png diff --git a/src/client/classic-debug/images/directions/hard_right.png b/application/src/client/classic-debug/images/directions/hard_right.png similarity index 100% rename from src/client/classic-debug/images/directions/hard_right.png rename to application/src/client/classic-debug/images/directions/hard_right.png diff --git a/src/client/classic-debug/images/directions/left.png b/application/src/client/classic-debug/images/directions/left.png similarity index 100% rename from src/client/classic-debug/images/directions/left.png rename to application/src/client/classic-debug/images/directions/left.png diff --git a/src/client/classic-debug/images/directions/merge.png b/application/src/client/classic-debug/images/directions/merge.png similarity index 100% rename from src/client/classic-debug/images/directions/merge.png rename to application/src/client/classic-debug/images/directions/merge.png diff --git a/src/client/classic-debug/images/directions/right.png b/application/src/client/classic-debug/images/directions/right.png similarity index 100% rename from src/client/classic-debug/images/directions/right.png rename to application/src/client/classic-debug/images/directions/right.png diff --git a/src/client/classic-debug/images/directions/slightly_left.png b/application/src/client/classic-debug/images/directions/slightly_left.png similarity index 100% rename from src/client/classic-debug/images/directions/slightly_left.png rename to application/src/client/classic-debug/images/directions/slightly_left.png diff --git a/src/client/classic-debug/images/directions/slightly_right.png b/application/src/client/classic-debug/images/directions/slightly_right.png similarity index 100% rename from src/client/classic-debug/images/directions/slightly_right.png rename to application/src/client/classic-debug/images/directions/slightly_right.png diff --git a/src/client/classic-debug/images/directions/turn_left.png b/application/src/client/classic-debug/images/directions/turn_left.png similarity index 100% rename from src/client/classic-debug/images/directions/turn_left.png rename to application/src/client/classic-debug/images/directions/turn_left.png diff --git a/src/client/classic-debug/images/directions/turn_right.png b/application/src/client/classic-debug/images/directions/turn_right.png similarity index 100% rename from src/client/classic-debug/images/directions/turn_right.png rename to application/src/client/classic-debug/images/directions/turn_right.png diff --git a/src/client/classic-debug/images/directions/uturn_left.png b/application/src/client/classic-debug/images/directions/uturn_left.png similarity index 100% rename from src/client/classic-debug/images/directions/uturn_left.png rename to application/src/client/classic-debug/images/directions/uturn_left.png diff --git a/src/client/classic-debug/images/directions/uturn_right.png b/application/src/client/classic-debug/images/directions/uturn_right.png similarity index 100% rename from src/client/classic-debug/images/directions/uturn_right.png rename to application/src/client/classic-debug/images/directions/uturn_right.png diff --git a/src/client/classic-debug/images/flag_marker_green.png b/application/src/client/classic-debug/images/flag_marker_green.png similarity index 100% rename from src/client/classic-debug/images/flag_marker_green.png rename to application/src/client/classic-debug/images/flag_marker_green.png diff --git a/src/client/classic-debug/images/flag_marker_red.png b/application/src/client/classic-debug/images/flag_marker_red.png similarity index 100% rename from src/client/classic-debug/images/flag_marker_red.png rename to application/src/client/classic-debug/images/flag_marker_red.png diff --git a/src/client/classic-debug/images/gear.svg b/application/src/client/classic-debug/images/gear.svg similarity index 100% rename from src/client/classic-debug/images/gear.svg rename to application/src/client/classic-debug/images/gear.svg diff --git a/src/client/classic-debug/images/language_icon.png b/application/src/client/classic-debug/images/language_icon.png similarity index 100% rename from src/client/classic-debug/images/language_icon.png rename to application/src/client/classic-debug/images/language_icon.png diff --git a/src/client/classic-debug/images/language_icon.svg b/application/src/client/classic-debug/images/language_icon.svg similarity index 100% rename from src/client/classic-debug/images/language_icon.svg rename to application/src/client/classic-debug/images/language_icon.svg diff --git a/src/client/classic-debug/images/marker-0pct.png b/application/src/client/classic-debug/images/marker-0pct.png similarity index 100% rename from src/client/classic-debug/images/marker-0pct.png rename to application/src/client/classic-debug/images/marker-0pct.png diff --git a/src/client/classic-debug/images/marker-100pct.png b/application/src/client/classic-debug/images/marker-100pct.png similarity index 100% rename from src/client/classic-debug/images/marker-100pct.png rename to application/src/client/classic-debug/images/marker-100pct.png diff --git a/src/client/classic-debug/images/marker-25pct.png b/application/src/client/classic-debug/images/marker-25pct.png similarity index 100% rename from src/client/classic-debug/images/marker-25pct.png rename to application/src/client/classic-debug/images/marker-25pct.png diff --git a/src/client/classic-debug/images/marker-50pct.png b/application/src/client/classic-debug/images/marker-50pct.png similarity index 100% rename from src/client/classic-debug/images/marker-50pct.png rename to application/src/client/classic-debug/images/marker-50pct.png diff --git a/src/client/classic-debug/images/marker-75pct.png b/application/src/client/classic-debug/images/marker-75pct.png similarity index 100% rename from src/client/classic-debug/images/marker-75pct.png rename to application/src/client/classic-debug/images/marker-75pct.png diff --git a/src/client/classic-debug/images/marker-bike-green-shadowed.png b/application/src/client/classic-debug/images/marker-bike-green-shadowed.png similarity index 100% rename from src/client/classic-debug/images/marker-bike-green-shadowed.png rename to application/src/client/classic-debug/images/marker-bike-green-shadowed.png diff --git a/src/client/classic-debug/images/marker-bike-green.png b/application/src/client/classic-debug/images/marker-bike-green.png similarity index 100% rename from src/client/classic-debug/images/marker-bike-green.png rename to application/src/client/classic-debug/images/marker-bike-green.png diff --git a/src/client/classic-debug/images/marker-bike-red-shadowed.png b/application/src/client/classic-debug/images/marker-bike-red-shadowed.png similarity index 100% rename from src/client/classic-debug/images/marker-bike-red-shadowed.png rename to application/src/client/classic-debug/images/marker-bike-red-shadowed.png diff --git a/src/client/classic-debug/images/marker-bike-red.png b/application/src/client/classic-debug/images/marker-bike-red.png similarity index 100% rename from src/client/classic-debug/images/marker-bike-red.png rename to application/src/client/classic-debug/images/marker-bike-red.png diff --git a/src/client/classic-debug/images/marker-bike-shadow.png b/application/src/client/classic-debug/images/marker-bike-shadow.png similarity index 100% rename from src/client/classic-debug/images/marker-bike-shadow.png rename to application/src/client/classic-debug/images/marker-bike-shadow.png diff --git a/src/client/classic-debug/images/marker-blue-med.png b/application/src/client/classic-debug/images/marker-blue-med.png similarity index 100% rename from src/client/classic-debug/images/marker-blue-med.png rename to application/src/client/classic-debug/images/marker-blue-med.png diff --git a/src/client/classic-debug/images/marker-blue-nub.png b/application/src/client/classic-debug/images/marker-blue-nub.png similarity index 100% rename from src/client/classic-debug/images/marker-blue-nub.png rename to application/src/client/classic-debug/images/marker-blue-nub.png diff --git a/src/client/classic-debug/images/marker-blue-sm.png b/application/src/client/classic-debug/images/marker-blue-sm.png similarity index 100% rename from src/client/classic-debug/images/marker-blue-sm.png rename to application/src/client/classic-debug/images/marker-blue-sm.png diff --git a/src/client/classic-debug/images/marker-flag-end-shadowed.png b/application/src/client/classic-debug/images/marker-flag-end-shadowed.png similarity index 100% rename from src/client/classic-debug/images/marker-flag-end-shadowed.png rename to application/src/client/classic-debug/images/marker-flag-end-shadowed.png diff --git a/src/client/classic-debug/images/marker-flag-end.png b/application/src/client/classic-debug/images/marker-flag-end.png similarity index 100% rename from src/client/classic-debug/images/marker-flag-end.png rename to application/src/client/classic-debug/images/marker-flag-end.png diff --git a/src/client/classic-debug/images/marker-flag-shadow.png b/application/src/client/classic-debug/images/marker-flag-shadow.png similarity index 100% rename from src/client/classic-debug/images/marker-flag-shadow.png rename to application/src/client/classic-debug/images/marker-flag-shadow.png diff --git a/src/client/classic-debug/images/marker-flag-start-shadowed.png b/application/src/client/classic-debug/images/marker-flag-start-shadowed.png similarity index 100% rename from src/client/classic-debug/images/marker-flag-start-shadowed.png rename to application/src/client/classic-debug/images/marker-flag-start-shadowed.png diff --git a/src/client/classic-debug/images/marker-flag-start.png b/application/src/client/classic-debug/images/marker-flag-start.png similarity index 100% rename from src/client/classic-debug/images/marker-flag-start.png rename to application/src/client/classic-debug/images/marker-flag-start.png diff --git a/src/client/classic-debug/images/marker-med-0pct.png b/application/src/client/classic-debug/images/marker-med-0pct.png similarity index 100% rename from src/client/classic-debug/images/marker-med-0pct.png rename to application/src/client/classic-debug/images/marker-med-0pct.png diff --git a/src/client/classic-debug/images/marker-med-100pct.png b/application/src/client/classic-debug/images/marker-med-100pct.png similarity index 100% rename from src/client/classic-debug/images/marker-med-100pct.png rename to application/src/client/classic-debug/images/marker-med-100pct.png diff --git a/src/client/classic-debug/images/marker-med-25pct.png b/application/src/client/classic-debug/images/marker-med-25pct.png similarity index 100% rename from src/client/classic-debug/images/marker-med-25pct.png rename to application/src/client/classic-debug/images/marker-med-25pct.png diff --git a/src/client/classic-debug/images/marker-med-50pct.png b/application/src/client/classic-debug/images/marker-med-50pct.png similarity index 100% rename from src/client/classic-debug/images/marker-med-50pct.png rename to application/src/client/classic-debug/images/marker-med-50pct.png diff --git a/src/client/classic-debug/images/marker-med-75pct.png b/application/src/client/classic-debug/images/marker-med-75pct.png similarity index 100% rename from src/client/classic-debug/images/marker-med-75pct.png rename to application/src/client/classic-debug/images/marker-med-75pct.png diff --git a/src/client/classic-debug/images/marker-sm-0pct.png b/application/src/client/classic-debug/images/marker-sm-0pct.png similarity index 100% rename from src/client/classic-debug/images/marker-sm-0pct.png rename to application/src/client/classic-debug/images/marker-sm-0pct.png diff --git a/src/client/classic-debug/images/marker-sm-100pct.png b/application/src/client/classic-debug/images/marker-sm-100pct.png similarity index 100% rename from src/client/classic-debug/images/marker-sm-100pct.png rename to application/src/client/classic-debug/images/marker-sm-100pct.png diff --git a/src/client/classic-debug/images/marker-sm-25pct.png b/application/src/client/classic-debug/images/marker-sm-25pct.png similarity index 100% rename from src/client/classic-debug/images/marker-sm-25pct.png rename to application/src/client/classic-debug/images/marker-sm-25pct.png diff --git a/src/client/classic-debug/images/marker-sm-50pct.png b/application/src/client/classic-debug/images/marker-sm-50pct.png similarity index 100% rename from src/client/classic-debug/images/marker-sm-50pct.png rename to application/src/client/classic-debug/images/marker-sm-50pct.png diff --git a/src/client/classic-debug/images/marker-sm-75pct.png b/application/src/client/classic-debug/images/marker-sm-75pct.png similarity index 100% rename from src/client/classic-debug/images/marker-sm-75pct.png rename to application/src/client/classic-debug/images/marker-sm-75pct.png diff --git a/src/client/classic-debug/images/mode/airplane.png b/application/src/client/classic-debug/images/mode/airplane.png similarity index 100% rename from src/client/classic-debug/images/mode/airplane.png rename to application/src/client/classic-debug/images/mode/airplane.png diff --git a/src/client/classic-debug/images/mode/arrow-left.png b/application/src/client/classic-debug/images/mode/arrow-left.png similarity index 100% rename from src/client/classic-debug/images/mode/arrow-left.png rename to application/src/client/classic-debug/images/mode/arrow-left.png diff --git a/src/client/classic-debug/images/mode/arrow.png b/application/src/client/classic-debug/images/mode/arrow.png similarity index 100% rename from src/client/classic-debug/images/mode/arrow.png rename to application/src/client/classic-debug/images/mode/arrow.png diff --git a/src/client/classic-debug/images/mode/bicycle.png b/application/src/client/classic-debug/images/mode/bicycle.png similarity index 100% rename from src/client/classic-debug/images/mode/bicycle.png rename to application/src/client/classic-debug/images/mode/bicycle.png diff --git a/src/client/classic-debug/images/mode/bicycle_darkbg.png b/application/src/client/classic-debug/images/mode/bicycle_darkbg.png similarity index 100% rename from src/client/classic-debug/images/mode/bicycle_darkbg.png rename to application/src/client/classic-debug/images/mode/bicycle_darkbg.png diff --git a/src/client/classic-debug/images/mode/bus.png b/application/src/client/classic-debug/images/mode/bus.png similarity index 100% rename from src/client/classic-debug/images/mode/bus.png rename to application/src/client/classic-debug/images/mode/bus.png diff --git a/src/client/classic-debug/images/mode/bus_darkbg.png b/application/src/client/classic-debug/images/mode/bus_darkbg.png similarity index 100% rename from src/client/classic-debug/images/mode/bus_darkbg.png rename to application/src/client/classic-debug/images/mode/bus_darkbg.png diff --git a/src/client/classic-debug/images/mode/cable_car.png b/application/src/client/classic-debug/images/mode/cable_car.png similarity index 100% rename from src/client/classic-debug/images/mode/cable_car.png rename to application/src/client/classic-debug/images/mode/cable_car.png diff --git a/src/client/classic-debug/images/mode/car.png b/application/src/client/classic-debug/images/mode/car.png similarity index 100% rename from src/client/classic-debug/images/mode/car.png rename to application/src/client/classic-debug/images/mode/car.png diff --git a/src/client/classic-debug/images/mode/car_darkbg.png b/application/src/client/classic-debug/images/mode/car_darkbg.png similarity index 100% rename from src/client/classic-debug/images/mode/car_darkbg.png rename to application/src/client/classic-debug/images/mode/car_darkbg.png diff --git a/src/client/classic-debug/images/mode/carpool.png b/application/src/client/classic-debug/images/mode/carpool.png similarity index 100% rename from src/client/classic-debug/images/mode/carpool.png rename to application/src/client/classic-debug/images/mode/carpool.png diff --git a/src/client/classic-debug/images/mode/carpool_darkbg.png b/application/src/client/classic-debug/images/mode/carpool_darkbg.png similarity index 100% rename from src/client/classic-debug/images/mode/carpool_darkbg.png rename to application/src/client/classic-debug/images/mode/carpool_darkbg.png diff --git a/src/client/classic-debug/images/mode/coach.png b/application/src/client/classic-debug/images/mode/coach.png similarity index 100% rename from src/client/classic-debug/images/mode/coach.png rename to application/src/client/classic-debug/images/mode/coach.png diff --git a/src/client/classic-debug/images/mode/ferry.png b/application/src/client/classic-debug/images/mode/ferry.png similarity index 100% rename from src/client/classic-debug/images/mode/ferry.png rename to application/src/client/classic-debug/images/mode/ferry.png diff --git a/src/client/classic-debug/images/mode/ferry_darkbg.png b/application/src/client/classic-debug/images/mode/ferry_darkbg.png similarity index 100% rename from src/client/classic-debug/images/mode/ferry_darkbg.png rename to application/src/client/classic-debug/images/mode/ferry_darkbg.png diff --git a/src/client/classic-debug/images/mode/funicular.png b/application/src/client/classic-debug/images/mode/funicular.png similarity index 100% rename from src/client/classic-debug/images/mode/funicular.png rename to application/src/client/classic-debug/images/mode/funicular.png diff --git a/src/client/classic-debug/images/mode/gondola.png b/application/src/client/classic-debug/images/mode/gondola.png similarity index 100% rename from src/client/classic-debug/images/mode/gondola.png rename to application/src/client/classic-debug/images/mode/gondola.png diff --git a/src/client/classic-debug/images/mode/gondola_darkbg.png b/application/src/client/classic-debug/images/mode/gondola_darkbg.png similarity index 100% rename from src/client/classic-debug/images/mode/gondola_darkbg.png rename to application/src/client/classic-debug/images/mode/gondola_darkbg.png diff --git a/src/client/classic-debug/images/mode/mode_bubble.psd b/application/src/client/classic-debug/images/mode/mode_bubble.psd similarity index 100% rename from src/client/classic-debug/images/mode/mode_bubble.psd rename to application/src/client/classic-debug/images/mode/mode_bubble.psd diff --git a/src/client/classic-debug/images/mode/mode_bubble_ne.png b/application/src/client/classic-debug/images/mode/mode_bubble_ne.png similarity index 100% rename from src/client/classic-debug/images/mode/mode_bubble_ne.png rename to application/src/client/classic-debug/images/mode/mode_bubble_ne.png diff --git a/src/client/classic-debug/images/mode/mode_bubble_ne_highlight.png b/application/src/client/classic-debug/images/mode/mode_bubble_ne_highlight.png similarity index 100% rename from src/client/classic-debug/images/mode/mode_bubble_ne_highlight.png rename to application/src/client/classic-debug/images/mode/mode_bubble_ne_highlight.png diff --git a/src/client/classic-debug/images/mode/mode_bubble_nw.png b/application/src/client/classic-debug/images/mode/mode_bubble_nw.png similarity index 100% rename from src/client/classic-debug/images/mode/mode_bubble_nw.png rename to application/src/client/classic-debug/images/mode/mode_bubble_nw.png diff --git a/src/client/classic-debug/images/mode/mode_bubble_nw_highlight.png b/application/src/client/classic-debug/images/mode/mode_bubble_nw_highlight.png similarity index 100% rename from src/client/classic-debug/images/mode/mode_bubble_nw_highlight.png rename to application/src/client/classic-debug/images/mode/mode_bubble_nw_highlight.png diff --git a/src/client/classic-debug/images/mode/mode_bubble_se.png b/application/src/client/classic-debug/images/mode/mode_bubble_se.png similarity index 100% rename from src/client/classic-debug/images/mode/mode_bubble_se.png rename to application/src/client/classic-debug/images/mode/mode_bubble_se.png diff --git a/src/client/classic-debug/images/mode/mode_bubble_se_highlight.png b/application/src/client/classic-debug/images/mode/mode_bubble_se_highlight.png similarity index 100% rename from src/client/classic-debug/images/mode/mode_bubble_se_highlight.png rename to application/src/client/classic-debug/images/mode/mode_bubble_se_highlight.png diff --git a/src/client/classic-debug/images/mode/mode_bubble_sw.png b/application/src/client/classic-debug/images/mode/mode_bubble_sw.png similarity index 100% rename from src/client/classic-debug/images/mode/mode_bubble_sw.png rename to application/src/client/classic-debug/images/mode/mode_bubble_sw.png diff --git a/src/client/classic-debug/images/mode/mode_bubble_sw_highlight.png b/application/src/client/classic-debug/images/mode/mode_bubble_sw_highlight.png similarity index 100% rename from src/client/classic-debug/images/mode/mode_bubble_sw_highlight.png rename to application/src/client/classic-debug/images/mode/mode_bubble_sw_highlight.png diff --git a/src/client/classic-debug/images/mode/monorail.png b/application/src/client/classic-debug/images/mode/monorail.png similarity index 100% rename from src/client/classic-debug/images/mode/monorail.png rename to application/src/client/classic-debug/images/mode/monorail.png diff --git a/src/client/classic-debug/images/mode/rail.png b/application/src/client/classic-debug/images/mode/rail.png similarity index 100% rename from src/client/classic-debug/images/mode/rail.png rename to application/src/client/classic-debug/images/mode/rail.png diff --git a/src/client/classic-debug/images/mode/rail_darkbg.png b/application/src/client/classic-debug/images/mode/rail_darkbg.png similarity index 100% rename from src/client/classic-debug/images/mode/rail_darkbg.png rename to application/src/client/classic-debug/images/mode/rail_darkbg.png diff --git a/src/client/classic-debug/images/mode/scooter.png b/application/src/client/classic-debug/images/mode/scooter.png similarity index 100% rename from src/client/classic-debug/images/mode/scooter.png rename to application/src/client/classic-debug/images/mode/scooter.png diff --git a/src/client/classic-debug/images/mode/subway.png b/application/src/client/classic-debug/images/mode/subway.png similarity index 100% rename from src/client/classic-debug/images/mode/subway.png rename to application/src/client/classic-debug/images/mode/subway.png diff --git a/src/client/classic-debug/images/mode/subway_darkbg.png b/application/src/client/classic-debug/images/mode/subway_darkbg.png similarity index 100% rename from src/client/classic-debug/images/mode/subway_darkbg.png rename to application/src/client/classic-debug/images/mode/subway_darkbg.png diff --git a/src/client/classic-debug/images/mode/taxi.png b/application/src/client/classic-debug/images/mode/taxi.png similarity index 100% rename from src/client/classic-debug/images/mode/taxi.png rename to application/src/client/classic-debug/images/mode/taxi.png diff --git a/src/client/classic-debug/images/mode/tram.png b/application/src/client/classic-debug/images/mode/tram.png similarity index 100% rename from src/client/classic-debug/images/mode/tram.png rename to application/src/client/classic-debug/images/mode/tram.png diff --git a/src/client/classic-debug/images/mode/tram_darkbg.png b/application/src/client/classic-debug/images/mode/tram_darkbg.png similarity index 100% rename from src/client/classic-debug/images/mode/tram_darkbg.png rename to application/src/client/classic-debug/images/mode/tram_darkbg.png diff --git a/src/client/classic-debug/images/mode/trolleybus.png b/application/src/client/classic-debug/images/mode/trolleybus.png similarity index 100% rename from src/client/classic-debug/images/mode/trolleybus.png rename to application/src/client/classic-debug/images/mode/trolleybus.png diff --git a/src/client/classic-debug/images/mode/walk.png b/application/src/client/classic-debug/images/mode/walk.png similarity index 100% rename from src/client/classic-debug/images/mode/walk.png rename to application/src/client/classic-debug/images/mode/walk.png diff --git a/src/client/classic-debug/images/mode/walk_darkbg.png b/application/src/client/classic-debug/images/mode/walk_darkbg.png similarity index 100% rename from src/client/classic-debug/images/mode/walk_darkbg.png rename to application/src/client/classic-debug/images/mode/walk_darkbg.png diff --git a/src/client/classic-debug/images/openplans-logo-20x20.png b/application/src/client/classic-debug/images/openplans-logo-20x20.png similarity index 100% rename from src/client/classic-debug/images/openplans-logo-20x20.png rename to application/src/client/classic-debug/images/openplans-logo-20x20.png diff --git a/src/client/classic-debug/images/openplans-logo-40x40.png b/application/src/client/classic-debug/images/openplans-logo-40x40.png similarity index 100% rename from src/client/classic-debug/images/openplans-logo-40x40.png rename to application/src/client/classic-debug/images/openplans-logo-40x40.png diff --git a/src/client/classic-debug/images/openplans-logo-gray.gif b/application/src/client/classic-debug/images/openplans-logo-gray.gif similarity index 100% rename from src/client/classic-debug/images/openplans-logo-gray.gif rename to application/src/client/classic-debug/images/openplans-logo-gray.gif diff --git a/src/client/classic-debug/images/otp_logo_40px.png b/application/src/client/classic-debug/images/otp_logo_40px.png similarity index 100% rename from src/client/classic-debug/images/otp_logo_40px.png rename to application/src/client/classic-debug/images/otp_logo_40px.png diff --git a/src/client/classic-debug/images/otp_logo_darkbg_40px.png b/application/src/client/classic-debug/images/otp_logo_darkbg_40px.png similarity index 100% rename from src/client/classic-debug/images/otp_logo_darkbg_40px.png rename to application/src/client/classic-debug/images/otp_logo_darkbg_40px.png diff --git a/src/client/classic-debug/images/reverse.png b/application/src/client/classic-debug/images/reverse.png similarity index 100% rename from src/client/classic-debug/images/reverse.png rename to application/src/client/classic-debug/images/reverse.png diff --git a/src/client/classic-debug/images/shadow.png b/application/src/client/classic-debug/images/shadow.png similarity index 100% rename from src/client/classic-debug/images/shadow.png rename to application/src/client/classic-debug/images/shadow.png diff --git a/src/client/classic-debug/images/spinner.gif b/application/src/client/classic-debug/images/spinner.gif similarity index 100% rename from src/client/classic-debug/images/spinner.gif rename to application/src/client/classic-debug/images/spinner.gif diff --git a/src/client/classic-debug/images/stop20.png b/application/src/client/classic-debug/images/stop20.png similarity index 100% rename from src/client/classic-debug/images/stop20.png rename to application/src/client/classic-debug/images/stop20.png diff --git a/src/client/classic-debug/images/widget-trip-stop-first.png b/application/src/client/classic-debug/images/widget-trip-stop-first.png similarity index 100% rename from src/client/classic-debug/images/widget-trip-stop-first.png rename to application/src/client/classic-debug/images/widget-trip-stop-first.png diff --git a/src/client/classic-debug/images/widget-trip-stop-last.png b/application/src/client/classic-debug/images/widget-trip-stop-last.png similarity index 100% rename from src/client/classic-debug/images/widget-trip-stop-last.png rename to application/src/client/classic-debug/images/widget-trip-stop-last.png diff --git a/src/client/classic-debug/images/widget-trip-stop-middle.png b/application/src/client/classic-debug/images/widget-trip-stop-middle.png similarity index 100% rename from src/client/classic-debug/images/widget-trip-stop-middle.png rename to application/src/client/classic-debug/images/widget-trip-stop-middle.png diff --git a/src/client/classic-debug/index.html b/application/src/client/classic-debug/index.html similarity index 100% rename from src/client/classic-debug/index.html rename to application/src/client/classic-debug/index.html diff --git a/src/client/classic-debug/js/lib/ICanHaz.js b/application/src/client/classic-debug/js/lib/ICanHaz.js similarity index 100% rename from src/client/classic-debug/js/lib/ICanHaz.js rename to application/src/client/classic-debug/js/lib/ICanHaz.js diff --git a/src/client/classic-debug/js/lib/backbone-min.js b/application/src/client/classic-debug/js/lib/backbone-min.js similarity index 100% rename from src/client/classic-debug/js/lib/backbone-min.js rename to application/src/client/classic-debug/js/lib/backbone-min.js diff --git a/src/client/classic-debug/js/lib/backbone.js b/application/src/client/classic-debug/js/lib/backbone.js similarity index 100% rename from src/client/classic-debug/js/lib/backbone.js rename to application/src/client/classic-debug/js/lib/backbone.js diff --git a/src/client/classic-debug/js/lib/i18next-1.7.3.min.js b/application/src/client/classic-debug/js/lib/i18next-1.7.3.min.js similarity index 100% rename from src/client/classic-debug/js/lib/i18next-1.7.3.min.js rename to application/src/client/classic-debug/js/lib/i18next-1.7.3.min.js diff --git a/src/client/classic-debug/js/lib/jquery-ui/addons/jquery-ui-timepicker.css b/application/src/client/classic-debug/js/lib/jquery-ui/addons/jquery-ui-timepicker.css similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/addons/jquery-ui-timepicker.css rename to application/src/client/classic-debug/js/lib/jquery-ui/addons/jquery-ui-timepicker.css diff --git a/src/client/classic-debug/js/lib/jquery-ui/addons/jquery-ui-timepicker.js b/application/src/client/classic-debug/js/lib/jquery-ui/addons/jquery-ui-timepicker.js similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/addons/jquery-ui-timepicker.js rename to application/src/client/classic-debug/js/lib/jquery-ui/addons/jquery-ui-timepicker.js diff --git a/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png b/application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png rename to application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png diff --git a/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png b/application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png rename to application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png diff --git a/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png b/application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png rename to application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png diff --git a/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png b/application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png rename to application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png diff --git a/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png b/application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png rename to application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png diff --git a/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png b/application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png rename to application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png diff --git a/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png b/application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png rename to application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png diff --git a/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png rename to application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png diff --git a/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-icons_222222_256x240.png b/application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-icons_222222_256x240.png similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-icons_222222_256x240.png rename to application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-icons_222222_256x240.png diff --git a/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-icons_2e83ff_256x240.png b/application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-icons_2e83ff_256x240.png similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-icons_2e83ff_256x240.png rename to application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-icons_2e83ff_256x240.png diff --git a/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-icons_454545_256x240.png b/application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-icons_454545_256x240.png similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-icons_454545_256x240.png rename to application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-icons_454545_256x240.png diff --git a/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-icons_888888_256x240.png b/application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-icons_888888_256x240.png similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-icons_888888_256x240.png rename to application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-icons_888888_256x240.png diff --git a/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-icons_cd0a0a_256x240.png b/application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-icons_cd0a0a_256x240.png similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-icons_cd0a0a_256x240.png rename to application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/images/ui-icons_cd0a0a_256x240.png diff --git a/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/jquery-ui-1.9.1.custom.css b/application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/jquery-ui-1.9.1.custom.css similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/css/smoothness/jquery-ui-1.9.1.custom.css rename to application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/jquery-ui-1.9.1.custom.css diff --git a/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/jquery-ui-1.9.1.custom.min.css b/application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/jquery-ui-1.9.1.custom.min.css similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/css/smoothness/jquery-ui-1.9.1.custom.min.css rename to application/src/client/classic-debug/js/lib/jquery-ui/css/smoothness/jquery-ui-1.9.1.custom.min.css diff --git a/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-ca.js b/application/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-ca.js similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-ca.js rename to application/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-ca.js diff --git a/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-de.js b/application/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-de.js similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-de.js rename to application/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-de.js diff --git a/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-es.js b/application/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-es.js similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-es.js rename to application/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-es.js diff --git a/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-fr.js b/application/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-fr.js similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-fr.js rename to application/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-fr.js diff --git a/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-hu.js b/application/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-hu.js similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-hu.js rename to application/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-hu.js diff --git a/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-it.js b/application/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-it.js similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-it.js rename to application/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-it.js diff --git a/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-no.js b/application/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-no.js similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-no.js rename to application/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-no.js diff --git a/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-pl.js b/application/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-pl.js similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-pl.js rename to application/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-pl.js diff --git a/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-pt.js b/application/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-pt.js similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-pt.js rename to application/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-pt.js diff --git a/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-sl.js b/application/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-sl.js similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-sl.js rename to application/src/client/classic-debug/js/lib/jquery-ui/i18n/jquery.ui.datepicker-sl.js diff --git a/src/client/classic-debug/js/lib/jquery-ui/js/jquery-1.8.2.js b/application/src/client/classic-debug/js/lib/jquery-ui/js/jquery-1.8.2.js similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/js/jquery-1.8.2.js rename to application/src/client/classic-debug/js/lib/jquery-ui/js/jquery-1.8.2.js diff --git a/src/client/classic-debug/js/lib/jquery-ui/js/jquery-ui-1.9.1.custom.js b/application/src/client/classic-debug/js/lib/jquery-ui/js/jquery-ui-1.9.1.custom.js similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/js/jquery-ui-1.9.1.custom.js rename to application/src/client/classic-debug/js/lib/jquery-ui/js/jquery-ui-1.9.1.custom.js diff --git a/src/client/classic-debug/js/lib/jquery-ui/js/jquery-ui-1.9.1.custom.min.js b/application/src/client/classic-debug/js/lib/jquery-ui/js/jquery-ui-1.9.1.custom.min.js similarity index 100% rename from src/client/classic-debug/js/lib/jquery-ui/js/jquery-ui-1.9.1.custom.min.js rename to application/src/client/classic-debug/js/lib/jquery-ui/js/jquery-ui-1.9.1.custom.min.js diff --git a/src/client/classic-debug/js/otp/config.js b/application/src/client/classic-debug/js/otp/config.js similarity index 100% rename from src/client/classic-debug/js/otp/config.js rename to application/src/client/classic-debug/js/otp/config.js diff --git a/src/client/classic-debug/js/otp/core/ContextMenu.js b/application/src/client/classic-debug/js/otp/core/ContextMenu.js similarity index 100% rename from src/client/classic-debug/js/otp/core/ContextMenu.js rename to application/src/client/classic-debug/js/otp/core/ContextMenu.js diff --git a/src/client/classic-debug/js/otp/core/Geocoder.js b/application/src/client/classic-debug/js/otp/core/Geocoder.js similarity index 100% rename from src/client/classic-debug/js/otp/core/Geocoder.js rename to application/src/client/classic-debug/js/otp/core/Geocoder.js diff --git a/src/client/classic-debug/js/otp/core/GeocoderBag.js b/application/src/client/classic-debug/js/otp/core/GeocoderBag.js similarity index 100% rename from src/client/classic-debug/js/otp/core/GeocoderBag.js rename to application/src/client/classic-debug/js/otp/core/GeocoderBag.js diff --git a/src/client/classic-debug/js/otp/core/GeocoderBuiltin.js b/application/src/client/classic-debug/js/otp/core/GeocoderBuiltin.js similarity index 100% rename from src/client/classic-debug/js/otp/core/GeocoderBuiltin.js rename to application/src/client/classic-debug/js/otp/core/GeocoderBuiltin.js diff --git a/src/client/classic-debug/js/otp/core/IndexApi.js b/application/src/client/classic-debug/js/otp/core/IndexApi.js similarity index 100% rename from src/client/classic-debug/js/otp/core/IndexApi.js rename to application/src/client/classic-debug/js/otp/core/IndexApi.js diff --git a/src/client/classic-debug/js/otp/core/Map.js b/application/src/client/classic-debug/js/otp/core/Map.js similarity index 100% rename from src/client/classic-debug/js/otp/core/Map.js rename to application/src/client/classic-debug/js/otp/core/Map.js diff --git a/src/client/classic-debug/js/otp/core/MapContextMenu.js b/application/src/client/classic-debug/js/otp/core/MapContextMenu.js similarity index 100% rename from src/client/classic-debug/js/otp/core/MapContextMenu.js rename to application/src/client/classic-debug/js/otp/core/MapContextMenu.js diff --git a/src/client/classic-debug/js/otp/core/PopupMenu.js b/application/src/client/classic-debug/js/otp/core/PopupMenu.js similarity index 100% rename from src/client/classic-debug/js/otp/core/PopupMenu.js rename to application/src/client/classic-debug/js/otp/core/PopupMenu.js diff --git a/src/client/classic-debug/js/otp/core/QueryLogger.js b/application/src/client/classic-debug/js/otp/core/QueryLogger.js similarity index 100% rename from src/client/classic-debug/js/otp/core/QueryLogger.js rename to application/src/client/classic-debug/js/otp/core/QueryLogger.js diff --git a/src/client/classic-debug/js/otp/core/SOLRGeocoder.js b/application/src/client/classic-debug/js/otp/core/SOLRGeocoder.js similarity index 100% rename from src/client/classic-debug/js/otp/core/SOLRGeocoder.js rename to application/src/client/classic-debug/js/otp/core/SOLRGeocoder.js diff --git a/src/client/classic-debug/js/otp/core/TransitIndex.js b/application/src/client/classic-debug/js/otp/core/TransitIndex.js similarity index 100% rename from src/client/classic-debug/js/otp/core/TransitIndex.js rename to application/src/client/classic-debug/js/otp/core/TransitIndex.js diff --git a/src/client/classic-debug/js/otp/core/TripPlan.js b/application/src/client/classic-debug/js/otp/core/TripPlan.js similarity index 100% rename from src/client/classic-debug/js/otp/core/TripPlan.js rename to application/src/client/classic-debug/js/otp/core/TripPlan.js diff --git a/src/client/classic-debug/js/otp/core/Webapp.js b/application/src/client/classic-debug/js/otp/core/Webapp.js similarity index 100% rename from src/client/classic-debug/js/otp/core/Webapp.js rename to application/src/client/classic-debug/js/otp/core/Webapp.js diff --git a/src/client/classic-debug/js/otp/core/WidgetManagerMenu.js b/application/src/client/classic-debug/js/otp/core/WidgetManagerMenu.js similarity index 100% rename from src/client/classic-debug/js/otp/core/WidgetManagerMenu.js rename to application/src/client/classic-debug/js/otp/core/WidgetManagerMenu.js diff --git a/src/client/classic-debug/js/otp/debug.js b/application/src/client/classic-debug/js/otp/debug.js similarity index 100% rename from src/client/classic-debug/js/otp/debug.js rename to application/src/client/classic-debug/js/otp/debug.js diff --git a/src/client/classic-debug/js/otp/layers/AreaStopsLayer.js b/application/src/client/classic-debug/js/otp/layers/AreaStopsLayer.js similarity index 100% rename from src/client/classic-debug/js/otp/layers/AreaStopsLayer.js rename to application/src/client/classic-debug/js/otp/layers/AreaStopsLayer.js diff --git a/src/client/classic-debug/js/otp/layers/GeofencingZonesLayer.js b/application/src/client/classic-debug/js/otp/layers/GeofencingZonesLayer.js similarity index 100% rename from src/client/classic-debug/js/otp/layers/GeofencingZonesLayer.js rename to application/src/client/classic-debug/js/otp/layers/GeofencingZonesLayer.js diff --git a/src/client/classic-debug/js/otp/layers/StopsLayer.js b/application/src/client/classic-debug/js/otp/layers/StopsLayer.js similarity index 100% rename from src/client/classic-debug/js/otp/layers/StopsLayer.js rename to application/src/client/classic-debug/js/otp/layers/StopsLayer.js diff --git a/src/client/classic-debug/js/otp/layers/layers-templates.html b/application/src/client/classic-debug/js/otp/layers/layers-templates.html similarity index 100% rename from src/client/classic-debug/js/otp/layers/layers-templates.html rename to application/src/client/classic-debug/js/otp/layers/layers-templates.html diff --git a/src/client/classic-debug/js/otp/locale/Catalan.js b/application/src/client/classic-debug/js/otp/locale/Catalan.js similarity index 100% rename from src/client/classic-debug/js/otp/locale/Catalan.js rename to application/src/client/classic-debug/js/otp/locale/Catalan.js diff --git a/src/client/classic-debug/js/otp/locale/English.js b/application/src/client/classic-debug/js/otp/locale/English.js similarity index 100% rename from src/client/classic-debug/js/otp/locale/English.js rename to application/src/client/classic-debug/js/otp/locale/English.js diff --git a/src/client/classic-debug/js/otp/locale/French.js b/application/src/client/classic-debug/js/otp/locale/French.js similarity index 100% rename from src/client/classic-debug/js/otp/locale/French.js rename to application/src/client/classic-debug/js/otp/locale/French.js diff --git a/src/client/classic-debug/js/otp/locale/German.js b/application/src/client/classic-debug/js/otp/locale/German.js similarity index 100% rename from src/client/classic-debug/js/otp/locale/German.js rename to application/src/client/classic-debug/js/otp/locale/German.js diff --git a/src/client/classic-debug/js/otp/locale/Hungarian.js b/application/src/client/classic-debug/js/otp/locale/Hungarian.js similarity index 100% rename from src/client/classic-debug/js/otp/locale/Hungarian.js rename to application/src/client/classic-debug/js/otp/locale/Hungarian.js diff --git a/src/client/classic-debug/js/otp/locale/Italian.js b/application/src/client/classic-debug/js/otp/locale/Italian.js similarity index 100% rename from src/client/classic-debug/js/otp/locale/Italian.js rename to application/src/client/classic-debug/js/otp/locale/Italian.js diff --git a/src/client/classic-debug/js/otp/locale/Norwegian.js b/application/src/client/classic-debug/js/otp/locale/Norwegian.js similarity index 100% rename from src/client/classic-debug/js/otp/locale/Norwegian.js rename to application/src/client/classic-debug/js/otp/locale/Norwegian.js diff --git a/src/client/classic-debug/js/otp/locale/Polish.js b/application/src/client/classic-debug/js/otp/locale/Polish.js similarity index 100% rename from src/client/classic-debug/js/otp/locale/Polish.js rename to application/src/client/classic-debug/js/otp/locale/Polish.js diff --git a/src/client/classic-debug/js/otp/locale/Portuguese.js b/application/src/client/classic-debug/js/otp/locale/Portuguese.js similarity index 100% rename from src/client/classic-debug/js/otp/locale/Portuguese.js rename to application/src/client/classic-debug/js/otp/locale/Portuguese.js diff --git a/src/client/classic-debug/js/otp/locale/Slovenian.js b/application/src/client/classic-debug/js/otp/locale/Slovenian.js similarity index 100% rename from src/client/classic-debug/js/otp/locale/Slovenian.js rename to application/src/client/classic-debug/js/otp/locale/Slovenian.js diff --git a/src/client/classic-debug/js/otp/locale/Spanish.js b/application/src/client/classic-debug/js/otp/locale/Spanish.js similarity index 100% rename from src/client/classic-debug/js/otp/locale/Spanish.js rename to application/src/client/classic-debug/js/otp/locale/Spanish.js diff --git a/src/client/classic-debug/js/otp/locale/ca_ES.json b/application/src/client/classic-debug/js/otp/locale/ca_ES.json similarity index 100% rename from src/client/classic-debug/js/otp/locale/ca_ES.json rename to application/src/client/classic-debug/js/otp/locale/ca_ES.json diff --git a/src/client/classic-debug/js/otp/locale/de.json b/application/src/client/classic-debug/js/otp/locale/de.json similarity index 100% rename from src/client/classic-debug/js/otp/locale/de.json rename to application/src/client/classic-debug/js/otp/locale/de.json diff --git a/src/client/classic-debug/js/otp/locale/en.json b/application/src/client/classic-debug/js/otp/locale/en.json similarity index 100% rename from src/client/classic-debug/js/otp/locale/en.json rename to application/src/client/classic-debug/js/otp/locale/en.json diff --git a/src/client/classic-debug/js/otp/locale/es.json b/application/src/client/classic-debug/js/otp/locale/es.json similarity index 100% rename from src/client/classic-debug/js/otp/locale/es.json rename to application/src/client/classic-debug/js/otp/locale/es.json diff --git a/src/client/classic-debug/js/otp/locale/fr.json b/application/src/client/classic-debug/js/otp/locale/fr.json similarity index 100% rename from src/client/classic-debug/js/otp/locale/fr.json rename to application/src/client/classic-debug/js/otp/locale/fr.json diff --git a/src/client/classic-debug/js/otp/locale/hu.json b/application/src/client/classic-debug/js/otp/locale/hu.json similarity index 100% rename from src/client/classic-debug/js/otp/locale/hu.json rename to application/src/client/classic-debug/js/otp/locale/hu.json diff --git a/src/client/classic-debug/js/otp/locale/it.json b/application/src/client/classic-debug/js/otp/locale/it.json similarity index 100% rename from src/client/classic-debug/js/otp/locale/it.json rename to application/src/client/classic-debug/js/otp/locale/it.json diff --git a/src/client/classic-debug/js/otp/locale/no.json b/application/src/client/classic-debug/js/otp/locale/no.json similarity index 100% rename from src/client/classic-debug/js/otp/locale/no.json rename to application/src/client/classic-debug/js/otp/locale/no.json diff --git a/src/client/classic-debug/js/otp/locale/pl.json b/application/src/client/classic-debug/js/otp/locale/pl.json similarity index 100% rename from src/client/classic-debug/js/otp/locale/pl.json rename to application/src/client/classic-debug/js/otp/locale/pl.json diff --git a/src/client/classic-debug/js/otp/locale/pt.json b/application/src/client/classic-debug/js/otp/locale/pt.json similarity index 100% rename from src/client/classic-debug/js/otp/locale/pt.json rename to application/src/client/classic-debug/js/otp/locale/pt.json diff --git a/src/client/classic-debug/js/otp/locale/sl.json b/application/src/client/classic-debug/js/otp/locale/sl.json similarity index 100% rename from src/client/classic-debug/js/otp/locale/sl.json rename to application/src/client/classic-debug/js/otp/locale/sl.json diff --git a/src/client/classic-debug/js/otp/modules/Module.js b/application/src/client/classic-debug/js/otp/modules/Module.js similarity index 100% rename from src/client/classic-debug/js/otp/modules/Module.js rename to application/src/client/classic-debug/js/otp/modules/Module.js diff --git a/src/client/classic-debug/js/otp/modules/bikeshare/BikeShareModule.js b/application/src/client/classic-debug/js/otp/modules/bikeshare/BikeShareModule.js similarity index 100% rename from src/client/classic-debug/js/otp/modules/bikeshare/BikeShareModule.js rename to application/src/client/classic-debug/js/otp/modules/bikeshare/BikeShareModule.js diff --git a/src/client/classic-debug/js/otp/modules/bikeshare/BikeStationsWidget.js b/application/src/client/classic-debug/js/otp/modules/bikeshare/BikeStationsWidget.js similarity index 100% rename from src/client/classic-debug/js/otp/modules/bikeshare/BikeStationsWidget.js rename to application/src/client/classic-debug/js/otp/modules/bikeshare/BikeStationsWidget.js diff --git a/src/client/classic-debug/js/otp/modules/bikeshare/bikeshare-style.css b/application/src/client/classic-debug/js/otp/modules/bikeshare/bikeshare-style.css similarity index 100% rename from src/client/classic-debug/js/otp/modules/bikeshare/bikeshare-style.css rename to application/src/client/classic-debug/js/otp/modules/bikeshare/bikeshare-style.css diff --git a/src/client/classic-debug/js/otp/modules/multimodal/MultimodalPlannerModule.js b/application/src/client/classic-debug/js/otp/modules/multimodal/MultimodalPlannerModule.js similarity index 100% rename from src/client/classic-debug/js/otp/modules/multimodal/MultimodalPlannerModule.js rename to application/src/client/classic-debug/js/otp/modules/multimodal/MultimodalPlannerModule.js diff --git a/src/client/classic-debug/js/otp/modules/multimodal/multimodal-style.css b/application/src/client/classic-debug/js/otp/modules/multimodal/multimodal-style.css similarity index 100% rename from src/client/classic-debug/js/otp/modules/multimodal/multimodal-style.css rename to application/src/client/classic-debug/js/otp/modules/multimodal/multimodal-style.css diff --git a/src/client/classic-debug/js/otp/modules/planner/IconFactory.js b/application/src/client/classic-debug/js/otp/modules/planner/IconFactory.js similarity index 100% rename from src/client/classic-debug/js/otp/modules/planner/IconFactory.js rename to application/src/client/classic-debug/js/otp/modules/planner/IconFactory.js diff --git a/src/client/classic-debug/js/otp/modules/planner/ItinerariesWidget.js b/application/src/client/classic-debug/js/otp/modules/planner/ItinerariesWidget.js similarity index 100% rename from src/client/classic-debug/js/otp/modules/planner/ItinerariesWidget.js rename to application/src/client/classic-debug/js/otp/modules/planner/ItinerariesWidget.js diff --git a/src/client/classic-debug/js/otp/modules/planner/Itinerary.js b/application/src/client/classic-debug/js/otp/modules/planner/Itinerary.js similarity index 100% rename from src/client/classic-debug/js/otp/modules/planner/Itinerary.js rename to application/src/client/classic-debug/js/otp/modules/planner/Itinerary.js diff --git a/src/client/classic-debug/js/otp/modules/planner/PlannerModule.js b/application/src/client/classic-debug/js/otp/modules/planner/PlannerModule.js similarity index 100% rename from src/client/classic-debug/js/otp/modules/planner/PlannerModule.js rename to application/src/client/classic-debug/js/otp/modules/planner/PlannerModule.js diff --git a/src/client/classic-debug/js/otp/modules/planner/TripPlan.js b/application/src/client/classic-debug/js/otp/modules/planner/TripPlan.js similarity index 100% rename from src/client/classic-debug/js/otp/modules/planner/TripPlan.js rename to application/src/client/classic-debug/js/otp/modules/planner/TripPlan.js diff --git a/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble.psd b/application/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble.psd similarity index 100% rename from src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble.psd rename to application/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble.psd diff --git a/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_ne.png b/application/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_ne.png similarity index 100% rename from src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_ne.png rename to application/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_ne.png diff --git a/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_ne_highlight.png b/application/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_ne_highlight.png similarity index 100% rename from src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_ne_highlight.png rename to application/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_ne_highlight.png diff --git a/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_nw.png b/application/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_nw.png similarity index 100% rename from src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_nw.png rename to application/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_nw.png diff --git a/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_nw_highlight.png b/application/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_nw_highlight.png similarity index 100% rename from src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_nw_highlight.png rename to application/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_nw_highlight.png diff --git a/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_se.png b/application/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_se.png similarity index 100% rename from src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_se.png rename to application/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_se.png diff --git a/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_se_highlight.png b/application/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_se_highlight.png similarity index 100% rename from src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_se_highlight.png rename to application/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_se_highlight.png diff --git a/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_sw.png b/application/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_sw.png similarity index 100% rename from src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_sw.png rename to application/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_sw.png diff --git a/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_sw_highlight.png b/application/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_sw_highlight.png similarity index 100% rename from src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_sw_highlight.png rename to application/src/client/classic-debug/js/otp/modules/planner/images/mode/mode_bubble_sw_highlight.png diff --git a/src/client/classic-debug/js/otp/modules/planner/images/user_icon.png b/application/src/client/classic-debug/js/otp/modules/planner/images/user_icon.png similarity index 100% rename from src/client/classic-debug/js/otp/modules/planner/images/user_icon.png rename to application/src/client/classic-debug/js/otp/modules/planner/images/user_icon.png diff --git a/src/client/classic-debug/js/otp/modules/planner/planner-style.css b/application/src/client/classic-debug/js/otp/modules/planner/planner-style.css similarity index 100% rename from src/client/classic-debug/js/otp/modules/planner/planner-style.css rename to application/src/client/classic-debug/js/otp/modules/planner/planner-style.css diff --git a/src/client/classic-debug/js/otp/modules/planner/planner-templates.html b/application/src/client/classic-debug/js/otp/modules/planner/planner-templates.html similarity index 100% rename from src/client/classic-debug/js/otp/modules/planner/planner-templates.html rename to application/src/client/classic-debug/js/otp/modules/planner/planner-templates.html diff --git a/src/client/classic-debug/js/otp/otp.js b/application/src/client/classic-debug/js/otp/otp.js similarity index 100% rename from src/client/classic-debug/js/otp/otp.js rename to application/src/client/classic-debug/js/otp/otp.js diff --git a/src/client/classic-debug/js/otp/templates.js b/application/src/client/classic-debug/js/otp/templates.js similarity index 100% rename from src/client/classic-debug/js/otp/templates.js rename to application/src/client/classic-debug/js/otp/templates.js diff --git a/src/client/classic-debug/js/otp/util/DataStorage.js b/application/src/client/classic-debug/js/otp/util/DataStorage.js similarity index 100% rename from src/client/classic-debug/js/otp/util/DataStorage.js rename to application/src/client/classic-debug/js/otp/util/DataStorage.js diff --git a/src/client/classic-debug/js/otp/util/Geo.js b/application/src/client/classic-debug/js/otp/util/Geo.js similarity index 100% rename from src/client/classic-debug/js/otp/util/Geo.js rename to application/src/client/classic-debug/js/otp/util/Geo.js diff --git a/src/client/classic-debug/js/otp/util/Imperial.js b/application/src/client/classic-debug/js/otp/util/Imperial.js similarity index 100% rename from src/client/classic-debug/js/otp/util/Imperial.js rename to application/src/client/classic-debug/js/otp/util/Imperial.js diff --git a/src/client/classic-debug/js/otp/util/Itin.js b/application/src/client/classic-debug/js/otp/util/Itin.js similarity index 100% rename from src/client/classic-debug/js/otp/util/Itin.js rename to application/src/client/classic-debug/js/otp/util/Itin.js diff --git a/src/client/classic-debug/js/otp/util/Logger.js b/application/src/client/classic-debug/js/otp/util/Logger.js similarity index 100% rename from src/client/classic-debug/js/otp/util/Logger.js rename to application/src/client/classic-debug/js/otp/util/Logger.js diff --git a/src/client/classic-debug/js/otp/util/Text.js b/application/src/client/classic-debug/js/otp/util/Text.js similarity index 100% rename from src/client/classic-debug/js/otp/util/Text.js rename to application/src/client/classic-debug/js/otp/util/Text.js diff --git a/src/client/classic-debug/js/otp/util/Time.js b/application/src/client/classic-debug/js/otp/util/Time.js similarity index 100% rename from src/client/classic-debug/js/otp/util/Time.js rename to application/src/client/classic-debug/js/otp/util/Time.js diff --git a/src/client/classic-debug/js/otp/widgets/Dialogs.js b/application/src/client/classic-debug/js/otp/widgets/Dialogs.js similarity index 100% rename from src/client/classic-debug/js/otp/widgets/Dialogs.js rename to application/src/client/classic-debug/js/otp/widgets/Dialogs.js diff --git a/src/client/classic-debug/js/otp/widgets/InfoWidget.js b/application/src/client/classic-debug/js/otp/widgets/InfoWidget.js similarity index 100% rename from src/client/classic-debug/js/otp/widgets/InfoWidget.js rename to application/src/client/classic-debug/js/otp/widgets/InfoWidget.js diff --git a/src/client/classic-debug/js/otp/widgets/Widget.js b/application/src/client/classic-debug/js/otp/widgets/Widget.js similarity index 100% rename from src/client/classic-debug/js/otp/widgets/Widget.js rename to application/src/client/classic-debug/js/otp/widgets/Widget.js diff --git a/src/client/classic-debug/js/otp/widgets/WidgetManager.js b/application/src/client/classic-debug/js/otp/widgets/WidgetManager.js similarity index 100% rename from src/client/classic-debug/js/otp/widgets/WidgetManager.js rename to application/src/client/classic-debug/js/otp/widgets/WidgetManager.js diff --git a/src/client/classic-debug/js/otp/widgets/transit/RouteBasedWidget.js b/application/src/client/classic-debug/js/otp/widgets/transit/RouteBasedWidget.js similarity index 100% rename from src/client/classic-debug/js/otp/widgets/transit/RouteBasedWidget.js rename to application/src/client/classic-debug/js/otp/widgets/transit/RouteBasedWidget.js diff --git a/src/client/classic-debug/js/otp/widgets/transit/StopFinderWidget.js b/application/src/client/classic-debug/js/otp/widgets/transit/StopFinderWidget.js similarity index 100% rename from src/client/classic-debug/js/otp/widgets/transit/StopFinderWidget.js rename to application/src/client/classic-debug/js/otp/widgets/transit/StopFinderWidget.js diff --git a/src/client/classic-debug/js/otp/widgets/transit/StopViewerWidget.js b/application/src/client/classic-debug/js/otp/widgets/transit/StopViewerWidget.js similarity index 100% rename from src/client/classic-debug/js/otp/widgets/transit/StopViewerWidget.js rename to application/src/client/classic-debug/js/otp/widgets/transit/StopViewerWidget.js diff --git a/src/client/classic-debug/js/otp/widgets/transit/TripViewerWidget.js b/application/src/client/classic-debug/js/otp/widgets/transit/TripViewerWidget.js similarity index 100% rename from src/client/classic-debug/js/otp/widgets/transit/TripViewerWidget.js rename to application/src/client/classic-debug/js/otp/widgets/transit/TripViewerWidget.js diff --git a/src/client/classic-debug/js/otp/widgets/transit/widgets-transit-style.css b/application/src/client/classic-debug/js/otp/widgets/transit/widgets-transit-style.css similarity index 100% rename from src/client/classic-debug/js/otp/widgets/transit/widgets-transit-style.css rename to application/src/client/classic-debug/js/otp/widgets/transit/widgets-transit-style.css diff --git a/src/client/classic-debug/js/otp/widgets/transit/widgets-transit-templates.html b/application/src/client/classic-debug/js/otp/widgets/transit/widgets-transit-templates.html similarity index 100% rename from src/client/classic-debug/js/otp/widgets/transit/widgets-transit-templates.html rename to application/src/client/classic-debug/js/otp/widgets/transit/widgets-transit-templates.html diff --git a/src/client/classic-debug/js/otp/widgets/tripoptions/BikeTrianglePanel.js b/application/src/client/classic-debug/js/otp/widgets/tripoptions/BikeTrianglePanel.js similarity index 100% rename from src/client/classic-debug/js/otp/widgets/tripoptions/BikeTrianglePanel.js rename to application/src/client/classic-debug/js/otp/widgets/tripoptions/BikeTrianglePanel.js diff --git a/src/client/classic-debug/js/otp/widgets/tripoptions/RoutesSelectorWidget.js b/application/src/client/classic-debug/js/otp/widgets/tripoptions/RoutesSelectorWidget.js similarity index 100% rename from src/client/classic-debug/js/otp/widgets/tripoptions/RoutesSelectorWidget.js rename to application/src/client/classic-debug/js/otp/widgets/tripoptions/RoutesSelectorWidget.js diff --git a/src/client/classic-debug/js/otp/widgets/tripoptions/TripOptionsWidget.js b/application/src/client/classic-debug/js/otp/widgets/tripoptions/TripOptionsWidget.js similarity index 100% rename from src/client/classic-debug/js/otp/widgets/tripoptions/TripOptionsWidget.js rename to application/src/client/classic-debug/js/otp/widgets/tripoptions/TripOptionsWidget.js diff --git a/src/client/classic-debug/js/otp/widgets/tripoptions/tripoptions-style.css b/application/src/client/classic-debug/js/otp/widgets/tripoptions/tripoptions-style.css similarity index 100% rename from src/client/classic-debug/js/otp/widgets/tripoptions/tripoptions-style.css rename to application/src/client/classic-debug/js/otp/widgets/tripoptions/tripoptions-style.css diff --git a/src/client/classic-debug/js/otp/widgets/tripoptions/tripoptions-templates.html b/application/src/client/classic-debug/js/otp/widgets/tripoptions/tripoptions-templates.html similarity index 100% rename from src/client/classic-debug/js/otp/widgets/tripoptions/tripoptions-templates.html rename to application/src/client/classic-debug/js/otp/widgets/tripoptions/tripoptions-templates.html diff --git a/src/client/classic-debug/js/otp/widgets/widget-style.css b/application/src/client/classic-debug/js/otp/widgets/widget-style.css similarity index 100% rename from src/client/classic-debug/js/otp/widgets/widget-style.css rename to application/src/client/classic-debug/js/otp/widgets/widget-style.css diff --git a/src/client/classic-debug/js/otp/widgets/widget-templates.html b/application/src/client/classic-debug/js/otp/widgets/widget-templates.html similarity index 100% rename from src/client/classic-debug/js/otp/widgets/widget-templates.html rename to application/src/client/classic-debug/js/otp/widgets/widget-templates.html diff --git a/src/client/classic-debug/style.css b/application/src/client/classic-debug/style.css similarity index 100% rename from src/client/classic-debug/style.css rename to application/src/client/classic-debug/style.css diff --git a/src/client/graphiql/index.html b/application/src/client/graphiql/index.html similarity index 100% rename from src/client/graphiql/index.html rename to application/src/client/graphiql/index.html diff --git a/src/client/index.html b/application/src/client/index.html similarity index 67% rename from src/client/index.html rename to application/src/client/index.html index 5b969aed83e..d662eb5cb42 100644 --- a/src/client/index.html +++ b/application/src/client/index.html @@ -5,8 +5,8 @@ OTP Debug Client - - + +
diff --git a/src/client/legacygraphql/graphiql/index.html b/application/src/client/legacygraphql/graphiql/index.html similarity index 100% rename from src/client/legacygraphql/graphiql/index.html rename to application/src/client/legacygraphql/graphiql/index.html diff --git a/src/ext-test/java/org/opentripplanner/ext/SandboxExtensionResourceTest.java b/application/src/ext-test/java/org/opentripplanner/ext/SandboxExtensionResourceTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/SandboxExtensionResourceTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/SandboxExtensionResourceTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/accessibilityscore/DecorateWithAccessibilityScoreTest.java b/application/src/ext-test/java/org/opentripplanner/ext/accessibilityscore/DecorateWithAccessibilityScoreTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/accessibilityscore/DecorateWithAccessibilityScoreTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/accessibilityscore/DecorateWithAccessibilityScoreTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/datastore/gs/GsDataSourceRepositoryTest.java b/application/src/ext-test/java/org/opentripplanner/ext/datastore/gs/GsDataSourceRepositoryTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/datastore/gs/GsDataSourceRepositoryTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/datastore/gs/GsDataSourceRepositoryTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/datastore/gs/GsHelperTest.java b/application/src/ext-test/java/org/opentripplanner/ext/datastore/gs/GsHelperTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/datastore/gs/GsHelperTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/datastore/gs/GsHelperTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/datastore/gs/GsIntegrationTest.java b/application/src/ext-test/java/org/opentripplanner/ext/datastore/gs/GsIntegrationTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/datastore/gs/GsIntegrationTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/datastore/gs/GsIntegrationTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/emissions/Co2EmissionsDataReaderTest.java b/application/src/ext-test/java/org/opentripplanner/ext/emissions/Co2EmissionsDataReaderTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/emissions/Co2EmissionsDataReaderTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/emissions/Co2EmissionsDataReaderTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/emissions/EmissionsModuleTest.java b/application/src/ext-test/java/org/opentripplanner/ext/emissions/EmissionsModuleTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/emissions/EmissionsModuleTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/emissions/EmissionsModuleTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/emissions/EmissionsTest.java b/application/src/ext-test/java/org/opentripplanner/ext/emissions/EmissionsTest.java similarity index 87% rename from src/ext-test/java/org/opentripplanner/ext/emissions/EmissionsTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/emissions/EmissionsTest.java index ff8a65ab494..51bf5f344f6 100644 --- a/src/ext-test/java/org/opentripplanner/ext/emissions/EmissionsTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/emissions/EmissionsTest.java @@ -2,6 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; +import static org.opentripplanner.model.plan.Itinerary.createScheduledTransitItinerary; import static org.opentripplanner.transit.model._data.TransitModelForTest.id; import java.time.OffsetDateTime; @@ -63,42 +64,48 @@ static void SetUp() { @Test void testGetEmissionsForItinerary() { - Itinerary i = new Itinerary(List.of(createTransitLeg(ROUTE_WITH_EMISSIONS))); + Itinerary i = createScheduledTransitItinerary(List.of(createTransitLeg(ROUTE_WITH_EMISSIONS))); decorateWithEmission.decorate(i); assertEquals(new Grams(2223.902), i.getEmissionsPerPerson().getCo2()); } @Test void testGetEmissionsForCarRoute() { - Itinerary i = new Itinerary(List.of(STREET_LEG)); + Itinerary i = createScheduledTransitItinerary(List.of(STREET_LEG)); decorateWithEmission.decorate(i); assertEquals(new Grams(28.0864), i.getEmissionsPerPerson().getCo2()); } @Test void testNoEmissionsForFeedWithoutEmissionsConfigured() { - Itinerary i = new Itinerary(List.of(createTransitLeg(ROUTE_WITHOUT_EMISSIONS_CONFIGURED))); + Itinerary i = createScheduledTransitItinerary( + List.of(createTransitLeg(ROUTE_WITHOUT_EMISSIONS_CONFIGURED)) + ); decorateWithEmission.decorate(i); assertNull(i.getEmissionsPerPerson()); } @Test void testZeroEmissionsForItineraryWithZeroEmissions() { - Itinerary i = new Itinerary(List.of(createTransitLeg(ROUTE_WITH_ZERO_EMISSIONS))); + Itinerary i = createScheduledTransitItinerary( + List.of(createTransitLeg(ROUTE_WITH_ZERO_EMISSIONS)) + ); decorateWithEmission.decorate(i); assertEquals(new Grams(0.0), i.getEmissionsPerPerson().getCo2()); } @Test void testGetEmissionsForCombinedRoute() { - Itinerary i = new Itinerary(List.of(createTransitLeg(ROUTE_WITH_EMISSIONS), STREET_LEG)); + Itinerary i = createScheduledTransitItinerary( + List.of(createTransitLeg(ROUTE_WITH_EMISSIONS), STREET_LEG) + ); decorateWithEmission.decorate(i); assertEquals(new Grams(2251.9884), i.getEmissionsPerPerson().getCo2()); } @Test void testNoEmissionsForCombinedRouteWithoutTransitEmissions() { - Itinerary i = new Itinerary( + Itinerary i = createScheduledTransitItinerary( List.of(createTransitLeg(ROUTE_WITHOUT_EMISSIONS_CONFIGURED), STREET_LEG) ); decorateWithEmission.decorate(i); diff --git a/application/src/ext-test/java/org/opentripplanner/ext/fares/FareRuleSetTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/FareRuleSetTest.java new file mode 100644 index 00000000000..13d4f713634 --- /dev/null +++ b/application/src/ext-test/java/org/opentripplanner/ext/fares/FareRuleSetTest.java @@ -0,0 +1,222 @@ +package org.opentripplanner.ext.fares; + +import static org.junit.jupiter.api.Assertions.*; + +import java.time.Duration; +import java.util.HashSet; +import java.util.Set; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.opentripplanner.ext.fares.model.FareAttribute; +import org.opentripplanner.ext.fares.model.FareRuleSet; +import org.opentripplanner.transit.model.basic.Money; +import org.opentripplanner.transit.model.framework.FeedScopedId; + +class FareRuleSetTest { + + private FareRuleSet fareRuleSet; + static final Money TWO_FIFTY = Money.usDollars(2.50f); + + @BeforeEach + void setUp() { + FeedScopedId id = new FeedScopedId("feed", "fare1"); + FareAttribute fareAttribute = FareAttribute + .of(id) + .setPrice(TWO_FIFTY) + .setPaymentMethod(1) + .setTransfers(1) + .setTransferDuration(7200) + .build(); + fareRuleSet = new FareRuleSet(fareAttribute); + } + + @Test + void testHasNoRules() { + assertFalse(fareRuleSet.hasRules()); + } + + @Test + void testAddOriginDestination() { + fareRuleSet.addOriginDestination("A", "B"); + assertTrue(fareRuleSet.hasRules()); + } + + @Test + void testAddRouteOriginDestination() { + fareRuleSet.addRouteOriginDestination("Route1", "A", "B"); + assertTrue(fareRuleSet.hasRules()); + assertEquals(1, fareRuleSet.getRouteOriginDestinations().size()); + } + + @Test + void testAddContains() { + fareRuleSet.addContains("Zone1"); + assertTrue(fareRuleSet.hasRules()); + assertEquals(1, fareRuleSet.getContains().size()); + } + + @Test + void testAddRoute() { + FeedScopedId routeId = new FeedScopedId("feed", "route1"); + fareRuleSet.addRoute(routeId); + assertTrue(fareRuleSet.hasRules()); + assertEquals(1, fareRuleSet.getRoutes().size()); + } + + @Test + void testMatchesWithNoRules() { + var routes = Set.of(new FeedScopedId("feed", "route1")); + var trips = Set.of(new FeedScopedId("feed", "trip1")); + var zones = Set.of("zone1"); + assertTrue( + fareRuleSet.matches("A", "B", Set.of(), Set.of(), Set.of(), 0, Duration.ZERO, Duration.ZERO) + ); + assertTrue( + fareRuleSet.matches( + "A", + "B", + zones, + routes, + trips, + 0, + Duration.ofMinutes(100), + Duration.ofMinutes(100) + ) + ); + } + + @Test + void testMatchesWithOriginDestination() { + fareRuleSet.addOriginDestination("A", "B"); + assertTrue( + fareRuleSet.matches("A", "B", Set.of(), Set.of(), Set.of(), 0, Duration.ZERO, Duration.ZERO) + ); + assertFalse( + fareRuleSet.matches("B", "C", Set.of(), Set.of(), Set.of(), 0, Duration.ZERO, Duration.ZERO) + ); + } + + @Test + void testMatchesWithContains() { + Set zones = new HashSet<>(); + zones.add("Zone1"); + zones.add("Zone2"); + fareRuleSet.addContains("Zone1"); + fareRuleSet.addContains("Zone2"); + assertTrue( + fareRuleSet.matches("A", "B", zones, Set.of(), Set.of(), 0, Duration.ZERO, Duration.ZERO) + ); + assertFalse( + fareRuleSet.matches("A", "B", Set.of(), Set.of(), Set.of(), 0, Duration.ZERO, Duration.ZERO) + ); + } + + @Test + void testMatchesWithRoutes() { + Set routes = new HashSet<>(); + FeedScopedId routeId = new FeedScopedId("feed", "route1"); + FeedScopedId otherRouteId = new FeedScopedId("feed", "route2"); + routes.add(routeId); + fareRuleSet.addRoute(routeId); + assertTrue( + fareRuleSet.matches("A", "B", Set.of(), routes, Set.of(), 0, Duration.ZERO, Duration.ZERO) + ); + assertFalse( + fareRuleSet.matches( + "A", + "B", + Set.of(), + Set.of(otherRouteId), + Set.of(), + 0, + Duration.ZERO, + Duration.ZERO + ) + ); + } + + @Test + void testMatchesWithTransfers() { + assertTrue( + fareRuleSet.matches("A", "B", Set.of(), Set.of(), Set.of(), 1, Duration.ZERO, Duration.ZERO) + ); + assertFalse( + fareRuleSet.matches("A", "B", Set.of(), Set.of(), Set.of(), 2, Duration.ZERO, Duration.ZERO) + ); + } + + @Test + void testMatchesWithTransferDuration() { + assertTrue( + fareRuleSet.matches( + "A", + "B", + Set.of(), + Set.of(), + Set.of(), + 0, + Duration.ofSeconds(7000), + Duration.ZERO + ) + ); + assertFalse( + fareRuleSet.matches( + "A", + "B", + Set.of(), + Set.of(), + Set.of(), + 0, + Duration.ofSeconds(8000), + Duration.ZERO + ) + ); + } + + @Test + void testMatchesWithJourneyDuration() { + FareAttribute journeyFare = FareAttribute + .of(new FeedScopedId("feed", "journey")) + .setPrice(Money.usDollars(3.00f)) + .setPaymentMethod(1) + .setJourneyDuration(7200) + .build(); + FareRuleSet journeyRuleSet = new FareRuleSet(journeyFare); + + assertTrue( + journeyRuleSet.matches( + "A", + "B", + Set.of(), + Set.of(), + Set.of(), + 0, + Duration.ZERO, + Duration.ofSeconds(7000) + ) + ); + assertFalse( + journeyRuleSet.matches( + "A", + "B", + Set.of(), + Set.of(), + Set.of(), + 0, + Duration.ZERO, + Duration.ofSeconds(8000) + ) + ); + } + + @Test + void testAgencyMethods() { + assertFalse(fareRuleSet.hasAgencyDefined()); + assertNull(fareRuleSet.getAgency()); + + FeedScopedId agencyId = new FeedScopedId("feed", "agency1"); + fareRuleSet.setAgency(agencyId); + assertTrue(fareRuleSet.hasAgencyDefined()); + assertEquals(agencyId, fareRuleSet.getAgency()); + } +} diff --git a/src/ext-test/java/org/opentripplanner/ext/fares/FaresConfigurationTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/FaresConfigurationTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/fares/FaresConfigurationTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/fares/FaresConfigurationTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/fares/FaresFilterTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/FaresFilterTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/fares/FaresFilterTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/fares/FaresFilterTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/fares/impl/AtlantaFareServiceTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/AtlantaFareServiceTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/fares/impl/AtlantaFareServiceTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/fares/impl/AtlantaFareServiceTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/fares/impl/CombinedInterlinedLegsFareServiceTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/CombinedInterlinedLegsFareServiceTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/fares/impl/CombinedInterlinedLegsFareServiceTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/fares/impl/CombinedInterlinedLegsFareServiceTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/fares/impl/DefaultFareServiceTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/DefaultFareServiceTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/fares/impl/DefaultFareServiceTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/fares/impl/DefaultFareServiceTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/fares/impl/FareModelForTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/FareModelForTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/fares/impl/FareModelForTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/fares/impl/FareModelForTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/fares/impl/FaresIntegrationTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/FaresIntegrationTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/fares/impl/FaresIntegrationTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/fares/impl/FaresIntegrationTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/fares/impl/GtfsFaresV2ServiceTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/GtfsFaresV2ServiceTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/fares/impl/GtfsFaresV2ServiceTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/fares/impl/GtfsFaresV2ServiceTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/fares/impl/HSLFareServiceTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/HSLFareServiceTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/fares/impl/HSLFareServiceTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/fares/impl/HSLFareServiceTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/fares/impl/HighestFareInFreeTransferWindowFareServiceTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/HighestFareInFreeTransferWindowFareServiceTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/fares/impl/HighestFareInFreeTransferWindowFareServiceTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/fares/impl/HighestFareInFreeTransferWindowFareServiceTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/fares/impl/OrcaFareServiceTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/OrcaFareServiceTest.java similarity index 99% rename from src/ext-test/java/org/opentripplanner/ext/fares/impl/OrcaFareServiceTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/fares/impl/OrcaFareServiceTest.java index e7a2610b42f..63ed44131fd 100644 --- a/src/ext-test/java/org/opentripplanner/ext/fares/impl/OrcaFareServiceTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/OrcaFareServiceTest.java @@ -79,7 +79,7 @@ public static void setUpClass() { * types. */ private static void calculateFare(List legs, FareType fareType, Money expectedPrice) { - var itinerary = new Itinerary(legs); + var itinerary = Itinerary.createScheduledTransitItinerary(legs); var itineraryFares = orcaFareService.calculateFares(itinerary); assertEquals( expectedPrice, diff --git a/src/ext-test/java/org/opentripplanner/ext/fares/model/FareProductTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/model/FareProductTest.java similarity index 97% rename from src/ext-test/java/org/opentripplanner/ext/fares/model/FareProductTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/fares/model/FareProductTest.java index 089bac64c11..65f10db6f85 100644 --- a/src/ext-test/java/org/opentripplanner/ext/fares/model/FareProductTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/fares/model/FareProductTest.java @@ -6,7 +6,6 @@ import java.time.OffsetDateTime; import java.time.ZonedDateTime; import java.util.stream.Stream; -import javax.annotation.Nonnull; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; @@ -57,7 +56,6 @@ void instanceId(FareProduct fareProduct, ZonedDateTime startTime, String expecte assertEquals(expectedInstanceId, instanceId); } - @Nonnull private static FareProduct fareProduct(Duration duration, RiderCategory cat, FareMedium medium) { return new FareProduct( new FeedScopedId("fares", "daypass"), diff --git a/src/ext-test/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapperTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapperTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapperTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapperTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTest.java similarity index 99% rename from src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTest.java index c88439a9e3f..56d66081e35 100644 --- a/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTest.java @@ -13,7 +13,6 @@ import java.time.ZonedDateTime; import java.util.List; import java.util.Map; -import javax.annotation.Nonnull; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -216,7 +215,6 @@ private Itinerary getItinerary(GenericLocation from, GenericLocation to, int ind return itineraries.get(index); } - @Nonnull private static List getItineraries( GenericLocation from, GenericLocation to, diff --git a/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTestData.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTestData.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTestData.java rename to application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTestData.java diff --git a/src/ext-test/java/org/opentripplanner/ext/flex/FlexPathDurationsTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexPathDurationsTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/flex/FlexPathDurationsTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/flex/FlexPathDurationsTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/flex/FlexStopTimesForTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexStopTimesForTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/flex/FlexStopTimesForTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/flex/FlexStopTimesForTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/flex/GtfsFlexTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/GtfsFlexTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/flex/GtfsFlexTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/flex/GtfsFlexTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/flex/flexpathcalculator/FlexPathTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/flexpathcalculator/FlexPathTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/flex/flexpathcalculator/FlexPathTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/flex/flexpathcalculator/FlexPathTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/flex/flexpathcalculator/ScheduledFlexPathCalculatorTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/flexpathcalculator/ScheduledFlexPathCalculatorTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/flex/flexpathcalculator/ScheduledFlexPathCalculatorTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/flex/flexpathcalculator/ScheduledFlexPathCalculatorTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/flex/flexpathcalculator/TimePenaltyCalculatorTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/flexpathcalculator/TimePenaltyCalculatorTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/flex/flexpathcalculator/TimePenaltyCalculatorTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/flex/flexpathcalculator/TimePenaltyCalculatorTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/flex/template/BoardAlight.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/template/BoardAlight.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/flex/template/BoardAlight.java rename to application/src/ext-test/java/org/opentripplanner/ext/flex/template/BoardAlight.java diff --git a/src/ext-test/java/org/opentripplanner/ext/flex/template/FlexTemplateFactoryTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/template/FlexTemplateFactoryTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/flex/template/FlexTemplateFactoryTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/flex/template/FlexTemplateFactoryTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/flex/trip/FlexTripsMapperTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/FlexTripsMapperTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/flex/trip/FlexTripsMapperTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/flex/trip/FlexTripsMapperTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTripTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTripTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTripTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTripTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/flex/trip/UnscheduledDrivingDurationTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/UnscheduledDrivingDurationTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/flex/trip/UnscheduledDrivingDurationTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/flex/trip/UnscheduledDrivingDurationTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/flex/trip/UnscheduledTripTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/UnscheduledTripTest.java similarity index 99% rename from src/ext-test/java/org/opentripplanner/ext/flex/trip/UnscheduledTripTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/flex/trip/UnscheduledTripTest.java index 8bc9d7c8919..6280095b6be 100644 --- a/src/ext-test/java/org/opentripplanner/ext/flex/trip/UnscheduledTripTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/UnscheduledTripTest.java @@ -16,7 +16,6 @@ import java.util.List; import java.util.Objects; import java.util.stream.Stream; -import javax.annotation.Nonnull; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; diff --git a/src/ext-test/java/org/opentripplanner/ext/geocoder/EnglishNgramAnalyzerTest.java b/application/src/ext-test/java/org/opentripplanner/ext/geocoder/EnglishNgramAnalyzerTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/geocoder/EnglishNgramAnalyzerTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/geocoder/EnglishNgramAnalyzerTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/geocoder/LuceneIndexTest.java b/application/src/ext-test/java/org/opentripplanner/ext/geocoder/LuceneIndexTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/geocoder/LuceneIndexTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/geocoder/LuceneIndexTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/geocoder/StopClusterMapperTest.java b/application/src/ext-test/java/org/opentripplanner/ext/geocoder/StopClusterMapperTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/geocoder/StopClusterMapperTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/geocoder/StopClusterMapperTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/mapping/TransmodelMappingUtilTest.java b/application/src/ext-test/java/org/opentripplanner/ext/mapping/TransmodelMappingUtilTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/mapping/TransmodelMappingUtilTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/mapping/TransmodelMappingUtilTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/realtimeresolver/RealtimeResolverTest.java b/application/src/ext-test/java/org/opentripplanner/ext/realtimeresolver/RealtimeResolverTest.java similarity index 98% rename from src/ext-test/java/org/opentripplanner/ext/realtimeresolver/RealtimeResolverTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/realtimeresolver/RealtimeResolverTest.java index 21d5a7f1696..e5b842a474a 100644 --- a/src/ext-test/java/org/opentripplanner/ext/realtimeresolver/RealtimeResolverTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/realtimeresolver/RealtimeResolverTest.java @@ -129,9 +129,12 @@ void testPopulateLegsWithRealtimeKeepStaySeated() { private static TripPattern delay(TripPattern pattern1, int seconds) { var originalTimeTable = pattern1.getScheduledTimetable(); - var delayedTimetable = new Timetable(pattern1); var delayedTripTimes = delay(originalTimeTable.getTripTimes(0), seconds); - delayedTimetable.addTripTimes(delayedTripTimes); + var delayedTimetable = Timetable + .of() + .withTripPattern(pattern1) + .addTripTimes(delayedTripTimes) + .build(); return pattern1.copy().withScheduledTimeTable(delayedTimetable).build(); } diff --git a/src/ext-test/java/org/opentripplanner/ext/restapi/mapping/EnumMapperTest.java b/application/src/ext-test/java/org/opentripplanner/ext/restapi/mapping/EnumMapperTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/restapi/mapping/EnumMapperTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/restapi/mapping/EnumMapperTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/restapi/model/ApiTravelOptionsMakerTest.java b/application/src/ext-test/java/org/opentripplanner/ext/restapi/model/ApiTravelOptionsMakerTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/restapi/model/ApiTravelOptionsMakerTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/restapi/model/ApiTravelOptionsMakerTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/restapi/model/ApiWalkStepTest.java b/application/src/ext-test/java/org/opentripplanner/ext/restapi/model/ApiWalkStepTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/restapi/model/ApiWalkStepTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/restapi/model/ApiWalkStepTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/restapi/parameter/ApiRequestModeTest.java b/application/src/ext-test/java/org/opentripplanner/ext/restapi/parameter/ApiRequestModeTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/restapi/parameter/ApiRequestModeTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/restapi/parameter/ApiRequestModeTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/restapi/parameter/QualifiedModeSetTest.java b/application/src/ext-test/java/org/opentripplanner/ext/restapi/parameter/QualifiedModeSetTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/restapi/parameter/QualifiedModeSetTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/restapi/parameter/QualifiedModeSetTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/restapi/parameter/QualifiedModeTest.java b/application/src/ext-test/java/org/opentripplanner/ext/restapi/parameter/QualifiedModeTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/restapi/parameter/QualifiedModeTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/restapi/parameter/QualifiedModeTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/ridehailing/DecorateWithRideHailingTest.java b/application/src/ext-test/java/org/opentripplanner/ext/ridehailing/DecorateWithRideHailingTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/ridehailing/DecorateWithRideHailingTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/ridehailing/DecorateWithRideHailingTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/ridehailing/FailingRideHailingService.java b/application/src/ext-test/java/org/opentripplanner/ext/ridehailing/FailingRideHailingService.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/ridehailing/FailingRideHailingService.java rename to application/src/ext-test/java/org/opentripplanner/ext/ridehailing/FailingRideHailingService.java diff --git a/src/ext-test/java/org/opentripplanner/ext/ridehailing/RideHailingAccessAdapterTest.java b/application/src/ext-test/java/org/opentripplanner/ext/ridehailing/RideHailingAccessAdapterTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/ridehailing/RideHailingAccessAdapterTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/ridehailing/RideHailingAccessAdapterTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/ridehailing/RideHailingAccessShifterTest.java b/application/src/ext-test/java/org/opentripplanner/ext/ridehailing/RideHailingAccessShifterTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/ridehailing/RideHailingAccessShifterTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/ridehailing/RideHailingAccessShifterTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/ridehailing/TestRideHailingService.java b/application/src/ext-test/java/org/opentripplanner/ext/ridehailing/TestRideHailingService.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/ridehailing/TestRideHailingService.java rename to application/src/ext-test/java/org/opentripplanner/ext/ridehailing/TestRideHailingService.java diff --git a/src/ext-test/java/org/opentripplanner/ext/ridehailing/configure/RideHailingServicesModuleTest.java b/application/src/ext-test/java/org/opentripplanner/ext/ridehailing/configure/RideHailingServicesModuleTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/ridehailing/configure/RideHailingServicesModuleTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/ridehailing/configure/RideHailingServicesModuleTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/ridehailing/service/uber/UberServiceTest.java b/application/src/ext-test/java/org/opentripplanner/ext/ridehailing/service/uber/UberServiceTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/ridehailing/service/uber/UberServiceTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/ridehailing/service/uber/UberServiceTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/smoovebikerental/SmooveBikeRentalDataSourceTest.java b/application/src/ext-test/java/org/opentripplanner/ext/smoovebikerental/SmooveBikeRentalDataSourceTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/smoovebikerental/SmooveBikeRentalDataSourceTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/smoovebikerental/SmooveBikeRentalDataSourceTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNamesTest.java b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNamesTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNamesTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNamesTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModuleTest.java b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModuleTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModuleTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModuleTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationParserTest.java b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationParserTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationParserTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationParserTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/TestStopConsolidationModel.java b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/TestStopConsolidationModel.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/stopconsolidation/TestStopConsolidationModel.java rename to application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/TestStopConsolidationModel.java diff --git a/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationRepositoryTest.java b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationRepositoryTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationRepositoryTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationRepositoryTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationServiceTest.java b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationServiceTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationServiceTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationServiceTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/vectortiles/VectorTilesConfigDocTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/VectorTilesConfigDocTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/vectortiles/VectorTilesConfigDocTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/vectortiles/VectorTilesConfigDocTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/vectortiles/VectorTilesResourceTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/VectorTilesResourceTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/vectortiles/VectorTilesResourceTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/vectortiles/VectorTilesResourceTest.java diff --git a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/LayerFiltersTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/LayerFiltersTest.java new file mode 100644 index 00000000000..f12d43b62cf --- /dev/null +++ b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/LayerFiltersTest.java @@ -0,0 +1,42 @@ +package org.opentripplanner.ext.vectortiles.layers; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.time.LocalDate; +import java.util.List; +import org.junit.jupiter.api.Test; +import org.opentripplanner.transit.model._data.PatternTestModel; +import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model.network.TripPattern; +import org.opentripplanner.transit.model.site.RegularStop; + +class LayerFiltersTest { + + private static final RegularStop STOP = TransitModelForTest.of().stop("1").build(); + private static final LocalDate DATE = LocalDate.of(2024, 9, 5); + private static final TripPattern PATTERN = PatternTestModel.pattern(); + + @Test + void includeStopWithinServiceWeek() { + var predicate = LayerFilters.buildCurrentServiceWeekPredicate( + s -> List.of(PATTERN), + trip -> List.of(DATE), + () -> DATE + ); + + assertTrue(predicate.test(STOP)); + } + + @Test + void excludeOutsideServiceWeek() { + var inThreeWeeks = DATE.plusDays(21); + var predicate = LayerFilters.buildCurrentServiceWeekPredicate( + s -> List.of(PATTERN), + trip -> List.of(inThreeWeeks), + () -> DATE + ); + + assertFalse(predicate.test(STOP)); + } +} diff --git a/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/TestTransitService.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/TestTransitService.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/TestTransitService.java rename to application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/TestTransitService.java diff --git a/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopPropertyMapperTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopPropertyMapperTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopPropertyMapperTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopPropertyMapperTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopsLayerBuilderTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopsLayerBuilderTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopsLayerBuilderTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopsLayerBuilderTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stations/DigitransitStationPropertyMapperTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stations/DigitransitStationPropertyMapperTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stations/DigitransitStationPropertyMapperTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stations/DigitransitStationPropertyMapperTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/RealtimeStopsLayerTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/RealtimeStopsLayerTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/RealtimeStopsLayerTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/RealtimeStopsLayerTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingGroupsLayerTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingGroupsLayerTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingGroupsLayerTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingGroupsLayerTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingsLayerTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingsLayerTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingsLayerTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingsLayerTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/VehicleRentalLayerTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/VehicleRentalLayerTest.java similarity index 99% rename from src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/VehicleRentalLayerTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/VehicleRentalLayerTest.java index 984d4927041..45a4ab30744 100644 --- a/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/VehicleRentalLayerTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/VehicleRentalLayerTest.java @@ -8,7 +8,6 @@ import java.util.HashMap; import java.util.Locale; import java.util.Map; -import javax.annotation.Nonnull; import org.junit.jupiter.api.Test; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.framework.i18n.TranslatedString; @@ -114,7 +113,6 @@ public void realtimeStation() { assertEquals(3, map.get("spacesAvailable")); } - @Nonnull private static RentalVehicleType vehicleType(RentalFormFactor formFactor) { return new RentalVehicleType( new FeedScopedId("1", formFactor.name()), diff --git a/src/ext-test/java/org/opentripplanner/ext/vehicleparking/bikeep/BikeepUpdaterTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vehicleparking/bikeep/BikeepUpdaterTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/vehicleparking/bikeep/BikeepUpdaterTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/vehicleparking/bikeep/BikeepUpdaterTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/vehicleparking/bikely/BikelyUpdaterTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vehicleparking/bikely/BikelyUpdaterTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/vehicleparking/bikely/BikelyUpdaterTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/vehicleparking/bikely/BikelyUpdaterTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkUpdaterTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkUpdaterTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkUpdaterTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkUpdaterTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/vehicleparking/parkapi/ParkAPIUpdaterTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vehicleparking/parkapi/ParkAPIUpdaterTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/vehicleparking/parkapi/ParkAPIUpdaterTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/vehicleparking/parkapi/ParkAPIUpdaterTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/vehicleparking/sirifm/SiriFmUpdaterTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vehicleparking/sirifm/SiriFmUpdaterTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/vehicleparking/sirifm/SiriFmUpdaterTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/vehicleparking/sirifm/SiriFmUpdaterTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/vehiclerentalservicedirectory/generatedoc/VehicleRentalServiceDirectoryConfigDocTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vehiclerentalservicedirectory/generatedoc/VehicleRentalServiceDirectoryConfigDocTest.java similarity index 100% rename from src/ext-test/java/org/opentripplanner/ext/vehiclerentalservicedirectory/generatedoc/VehicleRentalServiceDirectoryConfigDocTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/vehiclerentalservicedirectory/generatedoc/VehicleRentalServiceDirectoryConfigDocTest.java diff --git a/src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-invalid-test-gtfs/emissions.txt b/application/src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-invalid-test-gtfs/emissions.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-invalid-test-gtfs/emissions.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-invalid-test-gtfs/emissions.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-invalid-test-gtfs/feed_info.txt b/application/src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-invalid-test-gtfs/feed_info.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-invalid-test-gtfs/feed_info.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-invalid-test-gtfs/feed_info.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-missing-test-gtfs.zip b/application/src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-missing-test-gtfs.zip similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-missing-test-gtfs.zip rename to application/src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-missing-test-gtfs.zip diff --git a/src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-missing-test-gtfs/feed_info.txt b/application/src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-missing-test-gtfs/feed_info.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-missing-test-gtfs/feed_info.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-missing-test-gtfs/feed_info.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-test-gtfs.zip b/application/src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-test-gtfs.zip similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-test-gtfs.zip rename to application/src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-test-gtfs.zip diff --git a/src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-test-gtfs/emissions.txt b/application/src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-test-gtfs/emissions.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-test-gtfs/emissions.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-test-gtfs/emissions.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-test-gtfs/feed_info.txt b/application/src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-test-gtfs/feed_info.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-test-gtfs/feed_info.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/emissions/emissions-test-gtfs/feed_info.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/agency.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/agency.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/agency.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/agency.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/booking_rules.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/booking_rules.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/booking_rules.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/booking_rules.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/calendar.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/calendar.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/calendar.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/calendar.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/calendar_attributes.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/calendar_attributes.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/calendar_attributes.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/calendar_attributes.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/calendar_dates.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/calendar_dates.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/calendar_dates.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/calendar_dates.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/feed_info.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/feed_info.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/feed_info.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/feed_info.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/location_groups.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/location_groups.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/location_groups.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/location_groups.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/locations.geojson b/application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/locations.geojson similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/locations.geojson rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/locations.geojson diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/routes.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/routes.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/routes.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/routes.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/shapes.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/shapes.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/shapes.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/shapes.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/stop_times.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/stop_times.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/stop_times.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/stop_times.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/stops.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/stops.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/stops.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/stops.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/trips.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/trips.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/trips.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/aspen-flex-on-demand.gtfs/trips.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/cobb-county.filtered.osm.pbf b/application/src/ext-test/resources/org/opentripplanner/ext/flex/cobb-county.filtered.osm.pbf similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/cobb-county.filtered.osm.pbf rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/cobb-county.filtered.osm.pbf diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-bus-30-only.gtfs.zip b/application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-bus-30-only.gtfs.zip similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-bus-30-only.gtfs.zip rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-bus-30-only.gtfs.zip diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/agency.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/agency.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/agency.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/agency.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/booking_rules.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/booking_rules.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/booking_rules.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/booking_rules.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/calendar.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/calendar.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/calendar.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/calendar.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/fare_attributes.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/fare_attributes.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/fare_attributes.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/fare_attributes.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/fare_rules.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/fare_rules.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/fare_rules.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/fare_rules.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/feed_info.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/feed_info.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/feed_info.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/feed_info.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/location_groups.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/location_groups.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/location_groups.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/location_groups.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/locations.geojson b/application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/locations.geojson similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/locations.geojson rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/locations.geojson diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/routes.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/routes.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/routes.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/routes.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/shapes.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/shapes.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/shapes.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/shapes.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/stop_times.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/stop_times.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/stop_times.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/stop_times.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/stops.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/stops.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/stops.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/stops.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/trips.txt b/application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/trips.txt similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/trips.txt rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/cobblinc-scheduled-deviated-flex.gtfs/trips.txt diff --git a/src/ext-test/resources/org/opentripplanner/ext/flex/marta-bus-856-only.gtfs.zip b/application/src/ext-test/resources/org/opentripplanner/ext/flex/marta-bus-856-only.gtfs.zip similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/flex/marta-bus-856-only.gtfs.zip rename to application/src/ext-test/resources/org/opentripplanner/ext/flex/marta-bus-856-only.gtfs.zip diff --git a/src/ext-test/resources/org/opentripplanner/ext/stopconsolidation/consolidated-stops.csv b/application/src/ext-test/resources/org/opentripplanner/ext/stopconsolidation/consolidated-stops.csv similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/stopconsolidation/consolidated-stops.csv rename to application/src/ext-test/resources/org/opentripplanner/ext/stopconsolidation/consolidated-stops.csv diff --git a/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/bikeep/bikeep.json b/application/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/bikeep/bikeep.json similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/vehicleparking/bikeep/bikeep.json rename to application/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/bikeep/bikeep.json diff --git a/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/bikely/bikely.json b/application/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/bikely/bikely.json similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/vehicleparking/bikely/bikely.json rename to application/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/bikely/bikely.json diff --git a/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/hslpark/facilities.json b/application/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/hslpark/facilities.json similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/vehicleparking/hslpark/facilities.json rename to application/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/hslpark/facilities.json diff --git a/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/hslpark/hubs.json b/application/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/hslpark/hubs.json similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/vehicleparking/hslpark/hubs.json rename to application/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/hslpark/hubs.json diff --git a/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/hslpark/utilizations.json b/application/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/hslpark/utilizations.json similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/vehicleparking/hslpark/utilizations.json rename to application/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/hslpark/utilizations.json diff --git a/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/parkapi/herrenberg.json b/application/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/parkapi/herrenberg.json similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/vehicleparking/parkapi/herrenberg.json rename to application/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/parkapi/herrenberg.json diff --git a/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/parkapi/parkapi-reutlingen.json b/application/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/parkapi/parkapi-reutlingen.json similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/vehicleparking/parkapi/parkapi-reutlingen.json rename to application/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/parkapi/parkapi-reutlingen.json diff --git a/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/sirifm/siri-fm.xml b/application/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/sirifm/siri-fm.xml similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/vehicleparking/sirifm/siri-fm.xml rename to application/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/sirifm/siri-fm.xml diff --git a/src/ext-test/resources/org/opentripplanner/ext/vehiclerentalservicedirectory/generatedoc/router-config.json b/application/src/ext-test/resources/org/opentripplanner/ext/vehiclerentalservicedirectory/generatedoc/router-config.json similarity index 100% rename from src/ext-test/resources/org/opentripplanner/ext/vehiclerentalservicedirectory/generatedoc/router-config.json rename to application/src/ext-test/resources/org/opentripplanner/ext/vehiclerentalservicedirectory/generatedoc/router-config.json diff --git a/src/ext-test/resources/ridehailing/uber-arrival-estimates.json b/application/src/ext-test/resources/ridehailing/uber-arrival-estimates.json similarity index 100% rename from src/ext-test/resources/ridehailing/uber-arrival-estimates.json rename to application/src/ext-test/resources/ridehailing/uber-arrival-estimates.json diff --git a/src/ext-test/resources/ridehailing/uber-price-estimates.json b/application/src/ext-test/resources/ridehailing/uber-price-estimates.json similarity index 100% rename from src/ext-test/resources/ridehailing/uber-price-estimates.json rename to application/src/ext-test/resources/ridehailing/uber-price-estimates.json diff --git a/src/ext-test/resources/smoovebikerental/smoove.json b/application/src/ext-test/resources/smoovebikerental/smoove.json similarity index 100% rename from src/ext-test/resources/smoovebikerental/smoove.json rename to application/src/ext-test/resources/smoovebikerental/smoove.json diff --git a/src/ext-test/resources/test.txt b/application/src/ext-test/resources/test.txt similarity index 100% rename from src/ext-test/resources/test.txt rename to application/src/ext-test/resources/test.txt diff --git a/src/ext/java/org/opentripplanner/ext/accessibilityscore/DecorateWithAccessibilityScore.java b/application/src/ext/java/org/opentripplanner/ext/accessibilityscore/DecorateWithAccessibilityScore.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/accessibilityscore/DecorateWithAccessibilityScore.java rename to application/src/ext/java/org/opentripplanner/ext/accessibilityscore/DecorateWithAccessibilityScore.java diff --git a/src/ext/java/org/opentripplanner/ext/actuator/ActuatorAPI.java b/application/src/ext/java/org/opentripplanner/ext/actuator/ActuatorAPI.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/actuator/ActuatorAPI.java rename to application/src/ext/java/org/opentripplanner/ext/actuator/ActuatorAPI.java diff --git a/src/ext/java/org/opentripplanner/ext/actuator/MicrometerGraphQLInstrumentation.java b/application/src/ext/java/org/opentripplanner/ext/actuator/MicrometerGraphQLInstrumentation.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/actuator/MicrometerGraphQLInstrumentation.java rename to application/src/ext/java/org/opentripplanner/ext/actuator/MicrometerGraphQLInstrumentation.java diff --git a/src/ext/java/org/opentripplanner/ext/dataoverlay/DataOverlayStreetEdgeCostExtension.java b/application/src/ext/java/org/opentripplanner/ext/dataoverlay/DataOverlayStreetEdgeCostExtension.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/dataoverlay/DataOverlayStreetEdgeCostExtension.java rename to application/src/ext/java/org/opentripplanner/ext/dataoverlay/DataOverlayStreetEdgeCostExtension.java diff --git a/src/ext/java/org/opentripplanner/ext/dataoverlay/EdgeGenQuality.java b/application/src/ext/java/org/opentripplanner/ext/dataoverlay/EdgeGenQuality.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/dataoverlay/EdgeGenQuality.java rename to application/src/ext/java/org/opentripplanner/ext/dataoverlay/EdgeGenQuality.java diff --git a/src/ext/java/org/opentripplanner/ext/dataoverlay/EdgeUpdaterModule.java b/application/src/ext/java/org/opentripplanner/ext/dataoverlay/EdgeUpdaterModule.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/dataoverlay/EdgeUpdaterModule.java rename to application/src/ext/java/org/opentripplanner/ext/dataoverlay/EdgeUpdaterModule.java diff --git a/src/ext/java/org/opentripplanner/ext/dataoverlay/GenericDataFile.java b/application/src/ext/java/org/opentripplanner/ext/dataoverlay/GenericDataFile.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/dataoverlay/GenericDataFile.java rename to application/src/ext/java/org/opentripplanner/ext/dataoverlay/GenericDataFile.java diff --git a/src/ext/java/org/opentripplanner/ext/dataoverlay/GenericEdgeUpdater.java b/application/src/ext/java/org/opentripplanner/ext/dataoverlay/GenericEdgeUpdater.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/dataoverlay/GenericEdgeUpdater.java rename to application/src/ext/java/org/opentripplanner/ext/dataoverlay/GenericEdgeUpdater.java diff --git a/src/ext/java/org/opentripplanner/ext/dataoverlay/api/DataOverlayParameters.java b/application/src/ext/java/org/opentripplanner/ext/dataoverlay/api/DataOverlayParameters.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/dataoverlay/api/DataOverlayParameters.java rename to application/src/ext/java/org/opentripplanner/ext/dataoverlay/api/DataOverlayParameters.java diff --git a/src/ext/java/org/opentripplanner/ext/dataoverlay/api/DataOverlayParametersBuilder.java b/application/src/ext/java/org/opentripplanner/ext/dataoverlay/api/DataOverlayParametersBuilder.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/dataoverlay/api/DataOverlayParametersBuilder.java rename to application/src/ext/java/org/opentripplanner/ext/dataoverlay/api/DataOverlayParametersBuilder.java diff --git a/src/ext/java/org/opentripplanner/ext/dataoverlay/api/Parameter.java b/application/src/ext/java/org/opentripplanner/ext/dataoverlay/api/Parameter.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/dataoverlay/api/Parameter.java rename to application/src/ext/java/org/opentripplanner/ext/dataoverlay/api/Parameter.java diff --git a/src/ext/java/org/opentripplanner/ext/dataoverlay/api/ParameterName.java b/application/src/ext/java/org/opentripplanner/ext/dataoverlay/api/ParameterName.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/dataoverlay/api/ParameterName.java rename to application/src/ext/java/org/opentripplanner/ext/dataoverlay/api/ParameterName.java diff --git a/src/ext/java/org/opentripplanner/ext/dataoverlay/api/ParameterType.java b/application/src/ext/java/org/opentripplanner/ext/dataoverlay/api/ParameterType.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/dataoverlay/api/ParameterType.java rename to application/src/ext/java/org/opentripplanner/ext/dataoverlay/api/ParameterType.java diff --git a/src/ext/java/org/opentripplanner/ext/dataoverlay/configuration/DataOverlayConfig.java b/application/src/ext/java/org/opentripplanner/ext/dataoverlay/configuration/DataOverlayConfig.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/dataoverlay/configuration/DataOverlayConfig.java rename to application/src/ext/java/org/opentripplanner/ext/dataoverlay/configuration/DataOverlayConfig.java diff --git a/src/ext/java/org/opentripplanner/ext/dataoverlay/configuration/DataOverlayParameterBindings.java b/application/src/ext/java/org/opentripplanner/ext/dataoverlay/configuration/DataOverlayParameterBindings.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/dataoverlay/configuration/DataOverlayParameterBindings.java rename to application/src/ext/java/org/opentripplanner/ext/dataoverlay/configuration/DataOverlayParameterBindings.java diff --git a/src/ext/java/org/opentripplanner/ext/dataoverlay/configuration/IndexVariable.java b/application/src/ext/java/org/opentripplanner/ext/dataoverlay/configuration/IndexVariable.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/dataoverlay/configuration/IndexVariable.java rename to application/src/ext/java/org/opentripplanner/ext/dataoverlay/configuration/IndexVariable.java diff --git a/src/ext/java/org/opentripplanner/ext/dataoverlay/configuration/ParameterBinding.java b/application/src/ext/java/org/opentripplanner/ext/dataoverlay/configuration/ParameterBinding.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/dataoverlay/configuration/ParameterBinding.java rename to application/src/ext/java/org/opentripplanner/ext/dataoverlay/configuration/ParameterBinding.java diff --git a/src/ext/java/org/opentripplanner/ext/dataoverlay/configuration/TimeUnit.java b/application/src/ext/java/org/opentripplanner/ext/dataoverlay/configuration/TimeUnit.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/dataoverlay/configuration/TimeUnit.java rename to application/src/ext/java/org/opentripplanner/ext/dataoverlay/configuration/TimeUnit.java diff --git a/src/ext/java/org/opentripplanner/ext/dataoverlay/configure/DataOverlayFactory.java b/application/src/ext/java/org/opentripplanner/ext/dataoverlay/configure/DataOverlayFactory.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/dataoverlay/configure/DataOverlayFactory.java rename to application/src/ext/java/org/opentripplanner/ext/dataoverlay/configure/DataOverlayFactory.java diff --git a/src/ext/java/org/opentripplanner/ext/dataoverlay/routing/DataOverlayContext.java b/application/src/ext/java/org/opentripplanner/ext/dataoverlay/routing/DataOverlayContext.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/dataoverlay/routing/DataOverlayContext.java rename to application/src/ext/java/org/opentripplanner/ext/dataoverlay/routing/DataOverlayContext.java diff --git a/src/ext/java/org/opentripplanner/ext/dataoverlay/routing/Parameter.java b/application/src/ext/java/org/opentripplanner/ext/dataoverlay/routing/Parameter.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/dataoverlay/routing/Parameter.java rename to application/src/ext/java/org/opentripplanner/ext/dataoverlay/routing/Parameter.java diff --git a/src/ext/java/org/opentripplanner/ext/datastore/gs/AbstractGsDataSource.java b/application/src/ext/java/org/opentripplanner/ext/datastore/gs/AbstractGsDataSource.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/datastore/gs/AbstractGsDataSource.java rename to application/src/ext/java/org/opentripplanner/ext/datastore/gs/AbstractGsDataSource.java diff --git a/src/ext/java/org/opentripplanner/ext/datastore/gs/GsDataSourceModule.java b/application/src/ext/java/org/opentripplanner/ext/datastore/gs/GsDataSourceModule.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/datastore/gs/GsDataSourceModule.java rename to application/src/ext/java/org/opentripplanner/ext/datastore/gs/GsDataSourceModule.java diff --git a/src/ext/java/org/opentripplanner/ext/datastore/gs/GsDataSourceRepository.java b/application/src/ext/java/org/opentripplanner/ext/datastore/gs/GsDataSourceRepository.java similarity index 94% rename from src/ext/java/org/opentripplanner/ext/datastore/gs/GsDataSourceRepository.java rename to application/src/ext/java/org/opentripplanner/ext/datastore/gs/GsDataSourceRepository.java index ee7e4614ee7..f049beef0b8 100644 --- a/src/ext/java/org/opentripplanner/ext/datastore/gs/GsDataSourceRepository.java +++ b/application/src/ext/java/org/opentripplanner/ext/datastore/gs/GsDataSourceRepository.java @@ -9,7 +9,6 @@ import java.io.IOException; import java.net.URI; import java.util.Collections; -import javax.annotation.Nonnull; import org.opentripplanner.datastore.api.CompositeDataSource; import org.opentripplanner.datastore.api.DataSource; import org.opentripplanner.datastore.api.FileType; @@ -39,7 +38,7 @@ public void open() { } @Override - public DataSource findSource(@Nonnull URI uri, @Nonnull FileType type) { + public DataSource findSource(URI uri, FileType type) { if (skipUri(uri)) { return null; } @@ -48,7 +47,7 @@ public DataSource findSource(@Nonnull URI uri, @Nonnull FileType type) { } @Override - public CompositeDataSource findCompositeSource(@Nonnull URI uri, @Nonnull FileType type) { + public CompositeDataSource findCompositeSource(URI uri, FileType type) { if (skipUri(uri)) { return null; } diff --git a/src/ext/java/org/opentripplanner/ext/datastore/gs/GsDirectoryDataSource.java b/application/src/ext/java/org/opentripplanner/ext/datastore/gs/GsDirectoryDataSource.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/datastore/gs/GsDirectoryDataSource.java rename to application/src/ext/java/org/opentripplanner/ext/datastore/gs/GsDirectoryDataSource.java diff --git a/src/ext/java/org/opentripplanner/ext/datastore/gs/GsFileDataSource.java b/application/src/ext/java/org/opentripplanner/ext/datastore/gs/GsFileDataSource.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/datastore/gs/GsFileDataSource.java rename to application/src/ext/java/org/opentripplanner/ext/datastore/gs/GsFileDataSource.java diff --git a/src/ext/java/org/opentripplanner/ext/datastore/gs/GsHelper.java b/application/src/ext/java/org/opentripplanner/ext/datastore/gs/GsHelper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/datastore/gs/GsHelper.java rename to application/src/ext/java/org/opentripplanner/ext/datastore/gs/GsHelper.java diff --git a/src/ext/java/org/opentripplanner/ext/datastore/gs/GsOutFileDataSource.java b/application/src/ext/java/org/opentripplanner/ext/datastore/gs/GsOutFileDataSource.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/datastore/gs/GsOutFileDataSource.java rename to application/src/ext/java/org/opentripplanner/ext/datastore/gs/GsOutFileDataSource.java diff --git a/src/ext/java/org/opentripplanner/ext/datastore/gs/package-info.java b/application/src/ext/java/org/opentripplanner/ext/datastore/gs/package-info.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/datastore/gs/package-info.java rename to application/src/ext/java/org/opentripplanner/ext/datastore/gs/package-info.java diff --git a/src/ext/java/org/opentripplanner/ext/emissions/Co2EmissionsDataReader.java b/application/src/ext/java/org/opentripplanner/ext/emissions/Co2EmissionsDataReader.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/emissions/Co2EmissionsDataReader.java rename to application/src/ext/java/org/opentripplanner/ext/emissions/Co2EmissionsDataReader.java diff --git a/src/ext/java/org/opentripplanner/ext/emissions/DecorateWithEmission.java b/application/src/ext/java/org/opentripplanner/ext/emissions/DecorateWithEmission.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/emissions/DecorateWithEmission.java rename to application/src/ext/java/org/opentripplanner/ext/emissions/DecorateWithEmission.java diff --git a/src/ext/java/org/opentripplanner/ext/emissions/DefaultEmissionsService.java b/application/src/ext/java/org/opentripplanner/ext/emissions/DefaultEmissionsService.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/emissions/DefaultEmissionsService.java rename to application/src/ext/java/org/opentripplanner/ext/emissions/DefaultEmissionsService.java diff --git a/src/ext/java/org/opentripplanner/ext/emissions/EmissionsConfig.java b/application/src/ext/java/org/opentripplanner/ext/emissions/EmissionsConfig.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/emissions/EmissionsConfig.java rename to application/src/ext/java/org/opentripplanner/ext/emissions/EmissionsConfig.java diff --git a/src/ext/java/org/opentripplanner/ext/emissions/EmissionsDataModel.java b/application/src/ext/java/org/opentripplanner/ext/emissions/EmissionsDataModel.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/emissions/EmissionsDataModel.java rename to application/src/ext/java/org/opentripplanner/ext/emissions/EmissionsDataModel.java diff --git a/src/ext/java/org/opentripplanner/ext/emissions/EmissionsModule.java b/application/src/ext/java/org/opentripplanner/ext/emissions/EmissionsModule.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/emissions/EmissionsModule.java rename to application/src/ext/java/org/opentripplanner/ext/emissions/EmissionsModule.java diff --git a/src/ext/java/org/opentripplanner/ext/emissions/EmissionsService.java b/application/src/ext/java/org/opentripplanner/ext/emissions/EmissionsService.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/emissions/EmissionsService.java rename to application/src/ext/java/org/opentripplanner/ext/emissions/EmissionsService.java diff --git a/src/ext/java/org/opentripplanner/ext/emissions/EmissionsServiceModule.java b/application/src/ext/java/org/opentripplanner/ext/emissions/EmissionsServiceModule.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/emissions/EmissionsServiceModule.java rename to application/src/ext/java/org/opentripplanner/ext/emissions/EmissionsServiceModule.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/DecorateWithFare.java b/application/src/ext/java/org/opentripplanner/ext/fares/DecorateWithFare.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/DecorateWithFare.java rename to application/src/ext/java/org/opentripplanner/ext/fares/DecorateWithFare.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/FaresConfiguration.java b/application/src/ext/java/org/opentripplanner/ext/fares/FaresConfiguration.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/FaresConfiguration.java rename to application/src/ext/java/org/opentripplanner/ext/fares/FaresConfiguration.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/FaresToItineraryMapper.java b/application/src/ext/java/org/opentripplanner/ext/fares/FaresToItineraryMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/FaresToItineraryMapper.java rename to application/src/ext/java/org/opentripplanner/ext/fares/FaresToItineraryMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/impl/AtlantaFareService.java b/application/src/ext/java/org/opentripplanner/ext/fares/impl/AtlantaFareService.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/impl/AtlantaFareService.java rename to application/src/ext/java/org/opentripplanner/ext/fares/impl/AtlantaFareService.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/impl/AtlantaFareServiceFactory.java b/application/src/ext/java/org/opentripplanner/ext/fares/impl/AtlantaFareServiceFactory.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/impl/AtlantaFareServiceFactory.java rename to application/src/ext/java/org/opentripplanner/ext/fares/impl/AtlantaFareServiceFactory.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/impl/CombineInterlinedLegsFactory.java b/application/src/ext/java/org/opentripplanner/ext/fares/impl/CombineInterlinedLegsFactory.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/impl/CombineInterlinedLegsFactory.java rename to application/src/ext/java/org/opentripplanner/ext/fares/impl/CombineInterlinedLegsFactory.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/impl/CombinedInterlinedLegsFareService.java b/application/src/ext/java/org/opentripplanner/ext/fares/impl/CombinedInterlinedLegsFareService.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/impl/CombinedInterlinedLegsFareService.java rename to application/src/ext/java/org/opentripplanner/ext/fares/impl/CombinedInterlinedLegsFareService.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/impl/CombinedInterlinedTransitLeg.java b/application/src/ext/java/org/opentripplanner/ext/fares/impl/CombinedInterlinedTransitLeg.java similarity index 98% rename from src/ext/java/org/opentripplanner/ext/fares/impl/CombinedInterlinedTransitLeg.java rename to application/src/ext/java/org/opentripplanner/ext/fares/impl/CombinedInterlinedTransitLeg.java index 9d10b87bbd6..ce838480186 100644 --- a/src/ext/java/org/opentripplanner/ext/fares/impl/CombinedInterlinedTransitLeg.java +++ b/application/src/ext/java/org/opentripplanner/ext/fares/impl/CombinedInterlinedTransitLeg.java @@ -5,7 +5,6 @@ import java.time.ZonedDateTime; import java.util.List; import java.util.Set; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.LineString; import org.opentripplanner.framework.collection.ListUtils; import org.opentripplanner.model.fare.FareProductUse; @@ -39,19 +38,16 @@ public Agency getAgency() { return first.getAgency(); } - @Nonnull @Override public TransitMode getMode() { return first.getMode(); } - @Nonnull @Override public Route getRoute() { return first.getRoute(); } - @Nonnull @Override public Trip getTrip() { return first.getTrip(); diff --git a/src/ext/java/org/opentripplanner/ext/fares/impl/DefaultFareService.java b/application/src/ext/java/org/opentripplanner/ext/fares/impl/DefaultFareService.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/impl/DefaultFareService.java rename to application/src/ext/java/org/opentripplanner/ext/fares/impl/DefaultFareService.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/impl/DefaultFareServiceFactory.java b/application/src/ext/java/org/opentripplanner/ext/fares/impl/DefaultFareServiceFactory.java similarity index 98% rename from src/ext/java/org/opentripplanner/ext/fares/impl/DefaultFareServiceFactory.java rename to application/src/ext/java/org/opentripplanner/ext/fares/impl/DefaultFareServiceFactory.java index ee4c87924ea..d7a3a0425ec 100644 --- a/src/ext/java/org/opentripplanner/ext/fares/impl/DefaultFareServiceFactory.java +++ b/application/src/ext/java/org/opentripplanner/ext/fares/impl/DefaultFareServiceFactory.java @@ -92,7 +92,7 @@ protected void fillFareRules( FareRuleSet fareRule = fareRuleSet.get(id); if (fareRule == null) { // Should never happen by design - LOG.error("Inexistant fare ID in fare rule: " + id); + LOG.error("Nonexistent fare ID in fare rule: " + id); continue; } String contains = rule.getContainsId(); diff --git a/src/ext/java/org/opentripplanner/ext/fares/impl/GtfsFaresService.java b/application/src/ext/java/org/opentripplanner/ext/fares/impl/GtfsFaresService.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/impl/GtfsFaresService.java rename to application/src/ext/java/org/opentripplanner/ext/fares/impl/GtfsFaresService.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/impl/GtfsFaresV2Service.java b/application/src/ext/java/org/opentripplanner/ext/fares/impl/GtfsFaresV2Service.java similarity index 98% rename from src/ext/java/org/opentripplanner/ext/fares/impl/GtfsFaresV2Service.java rename to application/src/ext/java/org/opentripplanner/ext/fares/impl/GtfsFaresV2Service.java index 6aad14179b4..5bff64f05e0 100644 --- a/src/ext/java/org/opentripplanner/ext/fares/impl/GtfsFaresV2Service.java +++ b/application/src/ext/java/org/opentripplanner/ext/fares/impl/GtfsFaresV2Service.java @@ -13,7 +13,6 @@ import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import org.opentripplanner.ext.fares.model.FareDistance; import org.opentripplanner.ext.fares.model.FareLegRule; import org.opentripplanner.ext.fares.model.FareTransferRule; @@ -210,7 +209,7 @@ private boolean transferRuleMatchesNextLeg( .orElse(false); } - private Optional getFareLegRuleByGroupId(@Nonnull FeedScopedId groupId) { + private Optional getFareLegRuleByGroupId(FeedScopedId groupId) { return legRules.stream().filter(lr -> groupId.equals(lr.legGroupId())).findAny(); } diff --git a/src/ext/java/org/opentripplanner/ext/fares/impl/HSLFareService.java b/application/src/ext/java/org/opentripplanner/ext/fares/impl/HSLFareService.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/impl/HSLFareService.java rename to application/src/ext/java/org/opentripplanner/ext/fares/impl/HSLFareService.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/impl/HSLFareServiceFactory.java b/application/src/ext/java/org/opentripplanner/ext/fares/impl/HSLFareServiceFactory.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/impl/HSLFareServiceFactory.java rename to application/src/ext/java/org/opentripplanner/ext/fares/impl/HSLFareServiceFactory.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/impl/HighestFareInFreeTransferWindowFareService.java b/application/src/ext/java/org/opentripplanner/ext/fares/impl/HighestFareInFreeTransferWindowFareService.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/impl/HighestFareInFreeTransferWindowFareService.java rename to application/src/ext/java/org/opentripplanner/ext/fares/impl/HighestFareInFreeTransferWindowFareService.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/impl/HighestFareInFreeTransferWindowFareServiceFactory.java b/application/src/ext/java/org/opentripplanner/ext/fares/impl/HighestFareInFreeTransferWindowFareServiceFactory.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/impl/HighestFareInFreeTransferWindowFareServiceFactory.java rename to application/src/ext/java/org/opentripplanner/ext/fares/impl/HighestFareInFreeTransferWindowFareServiceFactory.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/impl/NoopFareServiceFactory.java b/application/src/ext/java/org/opentripplanner/ext/fares/impl/NoopFareServiceFactory.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/impl/NoopFareServiceFactory.java rename to application/src/ext/java/org/opentripplanner/ext/fares/impl/NoopFareServiceFactory.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/impl/OrcaFareFactory.java b/application/src/ext/java/org/opentripplanner/ext/fares/impl/OrcaFareFactory.java similarity index 88% rename from src/ext/java/org/opentripplanner/ext/fares/impl/OrcaFareFactory.java rename to application/src/ext/java/org/opentripplanner/ext/fares/impl/OrcaFareFactory.java index 34a03c1fc06..d48cad48450 100644 --- a/src/ext/java/org/opentripplanner/ext/fares/impl/OrcaFareFactory.java +++ b/application/src/ext/java/org/opentripplanner/ext/fares/impl/OrcaFareFactory.java @@ -24,6 +24,8 @@ public FareService makeFareService() { @Override public void processGtfs(FareRulesData fareRuleService, OtpTransitService transitService) { fillFareRules(fareRuleService.fareAttributes(), fareRuleService.fareRules(), regularFareRules); + // ORCA agencies don't rely on fare attributes without rules, so let's remove them. + regularFareRules.entrySet().removeIf(entry -> !entry.getValue().hasRules()); } /** diff --git a/src/ext/java/org/opentripplanner/ext/fares/impl/OrcaFareService.java b/application/src/ext/java/org/opentripplanner/ext/fares/impl/OrcaFareService.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/impl/OrcaFareService.java rename to application/src/ext/java/org/opentripplanner/ext/fares/impl/OrcaFareService.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/impl/OrcaFaresData.java b/application/src/ext/java/org/opentripplanner/ext/fares/impl/OrcaFaresData.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/impl/OrcaFaresData.java rename to application/src/ext/java/org/opentripplanner/ext/fares/impl/OrcaFaresData.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/model/Distance.java b/application/src/ext/java/org/opentripplanner/ext/fares/model/Distance.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/model/Distance.java rename to application/src/ext/java/org/opentripplanner/ext/fares/model/Distance.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/model/FareAttribute.java b/application/src/ext/java/org/opentripplanner/ext/fares/model/FareAttribute.java similarity index 96% rename from src/ext/java/org/opentripplanner/ext/fares/model/FareAttribute.java rename to application/src/ext/java/org/opentripplanner/ext/fares/model/FareAttribute.java index 2c93fb016fa..39a6c0bd1d0 100644 --- a/src/ext/java/org/opentripplanner/ext/fares/model/FareAttribute.java +++ b/application/src/ext/java/org/opentripplanner/ext/fares/model/FareAttribute.java @@ -2,7 +2,6 @@ package org.opentripplanner.ext.fares.model; import java.util.Objects; -import javax.annotation.Nonnull; import org.opentripplanner.transit.model.basic.Money; import org.opentripplanner.transit.model.framework.AbstractTransitEntity; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -77,7 +76,7 @@ public Integer getJourneyDuration() { } @Override - public boolean sameAs(@Nonnull FareAttribute other) { + public boolean sameAs(FareAttribute other) { return ( getId().equals(other.getId()) && getPrice().equals(other.getPrice()) && @@ -88,7 +87,6 @@ public boolean sameAs(@Nonnull FareAttribute other) { ); } - @Nonnull @Override public FareAttributeBuilder copy() { return new FareAttributeBuilder(this); diff --git a/src/ext/java/org/opentripplanner/ext/fares/model/FareAttributeBuilder.java b/application/src/ext/java/org/opentripplanner/ext/fares/model/FareAttributeBuilder.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/model/FareAttributeBuilder.java rename to application/src/ext/java/org/opentripplanner/ext/fares/model/FareAttributeBuilder.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/model/FareDistance.java b/application/src/ext/java/org/opentripplanner/ext/fares/model/FareDistance.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/model/FareDistance.java rename to application/src/ext/java/org/opentripplanner/ext/fares/model/FareDistance.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/model/FareLegRule.java b/application/src/ext/java/org/opentripplanner/ext/fares/model/FareLegRule.java similarity index 90% rename from src/ext/java/org/opentripplanner/ext/fares/model/FareLegRule.java rename to application/src/ext/java/org/opentripplanner/ext/fares/model/FareLegRule.java index 28ef5dcab6c..984dcb0291a 100644 --- a/src/ext/java/org/opentripplanner/ext/fares/model/FareLegRule.java +++ b/application/src/ext/java/org/opentripplanner/ext/fares/model/FareLegRule.java @@ -3,19 +3,18 @@ import java.util.Collection; import java.util.List; import java.util.Objects; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.model.fare.FareProduct; import org.opentripplanner.transit.model.framework.FeedScopedId; public record FareLegRule( - @Nonnull FeedScopedId id, + FeedScopedId id, @Nullable FeedScopedId legGroupId, @Nullable String networkId, @Nullable String fromAreaId, @Nullable String toAreaId, @Nullable FareDistance fareDistance, - @Nonnull Collection fareProducts + Collection fareProducts ) { public FareLegRule { Objects.requireNonNull(id); diff --git a/src/ext/java/org/opentripplanner/ext/fares/model/FareLegRuleBuilder.java b/application/src/ext/java/org/opentripplanner/ext/fares/model/FareLegRuleBuilder.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/model/FareLegRuleBuilder.java rename to application/src/ext/java/org/opentripplanner/ext/fares/model/FareLegRuleBuilder.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/model/FareRule.java b/application/src/ext/java/org/opentripplanner/ext/fares/model/FareRule.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/model/FareRule.java rename to application/src/ext/java/org/opentripplanner/ext/fares/model/FareRule.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/model/FareRuleSet.java b/application/src/ext/java/org/opentripplanner/ext/fares/model/FareRuleSet.java similarity index 77% rename from src/ext/java/org/opentripplanner/ext/fares/model/FareRuleSet.java rename to application/src/ext/java/org/opentripplanner/ext/fares/model/FareRuleSet.java index 30119631216..b8fbb0f1fe9 100644 --- a/src/ext/java/org/opentripplanner/ext/fares/model/FareRuleSet.java +++ b/application/src/ext/java/org/opentripplanner/ext/fares/model/FareRuleSet.java @@ -40,6 +40,19 @@ public Set getRouteOriginDestinations() { return routeOriginDestinations; } + /** + * Determine whether the FareRuleSet has any rules added. + * @return True if any rules have been added. + */ + public boolean hasRules() { + return ( + !routes.isEmpty() || + !originDestinations.isEmpty() || + !routeOriginDestinations.isEmpty() || + !contains.isEmpty() + ); + } + public void addContains(String containsId) { contains.add(containsId); } @@ -60,6 +73,19 @@ public FareAttribute getFareAttribute() { return fareAttribute; } + /** + * Determines whether the FareRuleSet matches against a set of itinerary parameters + * based on the added rules and fare attribute + * @param startZone Origin zone + * @param endZone End zone + * @param zonesVisited A set containing the names of zones visited on the fare + * @param routesVisited A set containing the route IDs visited + * @param tripsVisited [Not implemented] A set containing the trip IDs visited + * @param transfersUsed Number of transfers already used + * @param tripTime Time from beginning of first leg to beginning of current leg to be evaluated + * @param journeyTime Total journey time from beginning of first leg to end of current leg + * @return True if this FareAttribute should apply to this leg + */ public boolean matches( String startZone, String endZone, diff --git a/src/ext/java/org/opentripplanner/ext/fares/model/FareRulesData.java b/application/src/ext/java/org/opentripplanner/ext/fares/model/FareRulesData.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/model/FareRulesData.java rename to application/src/ext/java/org/opentripplanner/ext/fares/model/FareRulesData.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/model/FareTransferRule.java b/application/src/ext/java/org/opentripplanner/ext/fares/model/FareTransferRule.java similarity index 81% rename from src/ext/java/org/opentripplanner/ext/fares/model/FareTransferRule.java rename to application/src/ext/java/org/opentripplanner/ext/fares/model/FareTransferRule.java index d3b2020771f..87917bc819c 100644 --- a/src/ext/java/org/opentripplanner/ext/fares/model/FareTransferRule.java +++ b/application/src/ext/java/org/opentripplanner/ext/fares/model/FareTransferRule.java @@ -2,18 +2,17 @@ import java.time.Duration; import java.util.Collection; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.model.fare.FareProduct; import org.opentripplanner.transit.model.framework.FeedScopedId; public record FareTransferRule( - @Nonnull FeedScopedId id, + FeedScopedId id, @Nullable FeedScopedId fromLegGroup, @Nullable FeedScopedId toLegGroup, int transferCount, @Nullable Duration timeLimit, - @Nonnull Collection fareProducts + Collection fareProducts ) { public String feedId() { return id.getFeedId(); diff --git a/src/ext/java/org/opentripplanner/ext/fares/model/FareTransferType.java b/application/src/ext/java/org/opentripplanner/ext/fares/model/FareTransferType.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/model/FareTransferType.java rename to application/src/ext/java/org/opentripplanner/ext/fares/model/FareTransferType.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/model/LegProducts.java b/application/src/ext/java/org/opentripplanner/ext/fares/model/LegProducts.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/model/LegProducts.java rename to application/src/ext/java/org/opentripplanner/ext/fares/model/LegProducts.java diff --git a/src/ext/java/org/opentripplanner/ext/fares/model/RouteOriginDestination.java b/application/src/ext/java/org/opentripplanner/ext/fares/model/RouteOriginDestination.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/fares/model/RouteOriginDestination.java rename to application/src/ext/java/org/opentripplanner/ext/fares/model/RouteOriginDestination.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapper.java b/application/src/ext/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapper.java similarity index 98% rename from src/ext/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapper.java rename to application/src/ext/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapper.java index 612fb7a1d29..8b969c99344 100644 --- a/src/ext/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapper.java +++ b/application/src/ext/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapper.java @@ -4,7 +4,6 @@ import com.google.common.collect.ImmutableMultimap; import jakarta.inject.Inject; import java.util.stream.Stream; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.Point; import org.opentripplanner.framework.geometry.GeometryUtils; import org.opentripplanner.framework.logging.ProgressTracker; @@ -77,7 +76,6 @@ public void buildGraph() { LOG.info(progress.completeMessage()); } - @Nonnull private static Stream matchingVerticesForStop( StreetIndex streetIndex, AreaStop areaStop diff --git a/src/ext/java/org/opentripplanner/ext/flex/Flex.svg b/application/src/ext/java/org/opentripplanner/ext/flex/Flex.svg similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/Flex.svg rename to application/src/ext/java/org/opentripplanner/ext/flex/Flex.svg diff --git a/src/ext/java/org/opentripplanner/ext/flex/FlexAccessEgress.java b/application/src/ext/java/org/opentripplanner/ext/flex/FlexAccessEgress.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/FlexAccessEgress.java rename to application/src/ext/java/org/opentripplanner/ext/flex/FlexAccessEgress.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/FlexIndex.java b/application/src/ext/java/org/opentripplanner/ext/flex/FlexIndex.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/FlexIndex.java rename to application/src/ext/java/org/opentripplanner/ext/flex/FlexIndex.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/FlexParameters.java b/application/src/ext/java/org/opentripplanner/ext/flex/FlexParameters.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/FlexParameters.java rename to application/src/ext/java/org/opentripplanner/ext/flex/FlexParameters.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/FlexPathDurations.java b/application/src/ext/java/org/opentripplanner/ext/flex/FlexPathDurations.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/FlexPathDurations.java rename to application/src/ext/java/org/opentripplanner/ext/flex/FlexPathDurations.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/FlexRouter.java b/application/src/ext/java/org/opentripplanner/ext/flex/FlexRouter.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/FlexRouter.java rename to application/src/ext/java/org/opentripplanner/ext/flex/FlexRouter.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/FlexTripsMapper.java b/application/src/ext/java/org/opentripplanner/ext/flex/FlexTripsMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/FlexTripsMapper.java rename to application/src/ext/java/org/opentripplanner/ext/flex/FlexTripsMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/FlexibleTransitLeg.java b/application/src/ext/java/org/opentripplanner/ext/flex/FlexibleTransitLeg.java similarity index 99% rename from src/ext/java/org/opentripplanner/ext/flex/FlexibleTransitLeg.java rename to application/src/ext/java/org/opentripplanner/ext/flex/FlexibleTransitLeg.java index 0544a46da72..24f996ca5fe 100644 --- a/src/ext/java/org/opentripplanner/ext/flex/FlexibleTransitLeg.java +++ b/application/src/ext/java/org/opentripplanner/ext/flex/FlexibleTransitLeg.java @@ -6,7 +6,6 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.LineString; import org.opentripplanner.ext.flex.edgetype.FlexTripEdge; import org.opentripplanner.framework.i18n.I18NString; @@ -96,7 +95,6 @@ public LegTime end() { } @Override - @Nonnull public TransitMode getMode() { return getTrip().getMode(); } diff --git a/src/ext/java/org/opentripplanner/ext/flex/README.md b/application/src/ext/java/org/opentripplanner/ext/flex/README.md similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/README.md rename to application/src/ext/java/org/opentripplanner/ext/flex/README.md diff --git a/src/ext/java/org/opentripplanner/ext/flex/edgetype/FlexTripEdge.java b/application/src/ext/java/org/opentripplanner/ext/flex/edgetype/FlexTripEdge.java similarity index 98% rename from src/ext/java/org/opentripplanner/ext/flex/edgetype/FlexTripEdge.java rename to application/src/ext/java/org/opentripplanner/ext/flex/edgetype/FlexTripEdge.java index 40201295d7b..70b0fcdcb3c 100644 --- a/src/ext/java/org/opentripplanner/ext/flex/edgetype/FlexTripEdge.java +++ b/application/src/ext/java/org/opentripplanner/ext/flex/edgetype/FlexTripEdge.java @@ -2,7 +2,6 @@ import java.time.LocalDate; import java.util.Objects; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.LineString; import org.opentripplanner.ext.flex.flexpathcalculator.FlexPath; import org.opentripplanner.ext.flex.trip.FlexTrip; @@ -92,7 +91,6 @@ public double getDistanceMeters() { } @Override - @Nonnull public State[] traverse(State s0) { StateEditor editor = s0.edit(this); editor.setBackMode(TraverseMode.FLEX); diff --git a/src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/DirectFlexPathCalculator.java b/application/src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/DirectFlexPathCalculator.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/DirectFlexPathCalculator.java rename to application/src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/DirectFlexPathCalculator.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/FlexPath.java b/application/src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/FlexPath.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/FlexPath.java rename to application/src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/FlexPath.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/FlexPathCalculator.java b/application/src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/FlexPathCalculator.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/FlexPathCalculator.java rename to application/src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/FlexPathCalculator.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/ScheduledFlexPathCalculator.java b/application/src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/ScheduledFlexPathCalculator.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/ScheduledFlexPathCalculator.java rename to application/src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/ScheduledFlexPathCalculator.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/StreetFlexPathCalculator.java b/application/src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/StreetFlexPathCalculator.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/StreetFlexPathCalculator.java rename to application/src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/StreetFlexPathCalculator.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/TimePenaltyCalculator.java b/application/src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/TimePenaltyCalculator.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/TimePenaltyCalculator.java rename to application/src/ext/java/org/opentripplanner/ext/flex/flexpathcalculator/TimePenaltyCalculator.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/template/AbstractFlexTemplate.java b/application/src/ext/java/org/opentripplanner/ext/flex/template/AbstractFlexTemplate.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/template/AbstractFlexTemplate.java rename to application/src/ext/java/org/opentripplanner/ext/flex/template/AbstractFlexTemplate.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/template/ClosestTrip.java b/application/src/ext/java/org/opentripplanner/ext/flex/template/ClosestTrip.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/template/ClosestTrip.java rename to application/src/ext/java/org/opentripplanner/ext/flex/template/ClosestTrip.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/template/DirectFlexPath.java b/application/src/ext/java/org/opentripplanner/ext/flex/template/DirectFlexPath.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/template/DirectFlexPath.java rename to application/src/ext/java/org/opentripplanner/ext/flex/template/DirectFlexPath.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/template/FlexAccessEgressCallbackAdapter.java b/application/src/ext/java/org/opentripplanner/ext/flex/template/FlexAccessEgressCallbackAdapter.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/template/FlexAccessEgressCallbackAdapter.java rename to application/src/ext/java/org/opentripplanner/ext/flex/template/FlexAccessEgressCallbackAdapter.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/template/FlexAccessFactory.java b/application/src/ext/java/org/opentripplanner/ext/flex/template/FlexAccessFactory.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/template/FlexAccessFactory.java rename to application/src/ext/java/org/opentripplanner/ext/flex/template/FlexAccessFactory.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/template/FlexAccessTemplate.java b/application/src/ext/java/org/opentripplanner/ext/flex/template/FlexAccessTemplate.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/template/FlexAccessTemplate.java rename to application/src/ext/java/org/opentripplanner/ext/flex/template/FlexAccessTemplate.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/template/FlexDirectPathFactory.java b/application/src/ext/java/org/opentripplanner/ext/flex/template/FlexDirectPathFactory.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/template/FlexDirectPathFactory.java rename to application/src/ext/java/org/opentripplanner/ext/flex/template/FlexDirectPathFactory.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/template/FlexEgressFactory.java b/application/src/ext/java/org/opentripplanner/ext/flex/template/FlexEgressFactory.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/template/FlexEgressFactory.java rename to application/src/ext/java/org/opentripplanner/ext/flex/template/FlexEgressFactory.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/template/FlexEgressTemplate.java b/application/src/ext/java/org/opentripplanner/ext/flex/template/FlexEgressTemplate.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/template/FlexEgressTemplate.java rename to application/src/ext/java/org/opentripplanner/ext/flex/template/FlexEgressTemplate.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/template/FlexServiceDate.java b/application/src/ext/java/org/opentripplanner/ext/flex/template/FlexServiceDate.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/template/FlexServiceDate.java rename to application/src/ext/java/org/opentripplanner/ext/flex/template/FlexServiceDate.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/template/FlexTemplateFactory.java b/application/src/ext/java/org/opentripplanner/ext/flex/template/FlexTemplateFactory.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/template/FlexTemplateFactory.java rename to application/src/ext/java/org/opentripplanner/ext/flex/template/FlexTemplateFactory.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/trip/FlexTrip.java b/application/src/ext/java/org/opentripplanner/ext/flex/trip/FlexTrip.java similarity index 98% rename from src/ext/java/org/opentripplanner/ext/flex/trip/FlexTrip.java rename to application/src/ext/java/org/opentripplanner/ext/flex/trip/FlexTrip.java index 8fdb1b8fd5c..caceab676ce 100644 --- a/src/ext/java/org/opentripplanner/ext/flex/trip/FlexTrip.java +++ b/application/src/ext/java/org/opentripplanner/ext/flex/trip/FlexTrip.java @@ -3,7 +3,6 @@ import java.util.List; import java.util.Objects; import java.util.Set; -import javax.annotation.Nonnull; import org.opentripplanner.ext.flex.flexpathcalculator.FlexPathCalculator; import org.opentripplanner.model.PickDrop; import org.opentripplanner.model.StopTime; @@ -140,7 +139,7 @@ public abstract FlexPathCalculator decorateFlexPathCalculator( ); @Override - public boolean sameAs(@Nonnull T other) { + public boolean sameAs(T other) { return getId().equals(other.getId()) && Objects.equals(trip, other.getTrip()); } } diff --git a/src/ext/java/org/opentripplanner/ext/flex/trip/FlexTripBuilder.java b/application/src/ext/java/org/opentripplanner/ext/flex/trip/FlexTripBuilder.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/trip/FlexTripBuilder.java rename to application/src/ext/java/org/opentripplanner/ext/flex/trip/FlexTripBuilder.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTrip.java b/application/src/ext/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTrip.java similarity index 98% rename from src/ext/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTrip.java rename to application/src/ext/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTrip.java index 5ea0cb9fb91..c8484532b68 100644 --- a/src/ext/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTrip.java +++ b/application/src/ext/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTrip.java @@ -9,7 +9,6 @@ import java.util.Set; import java.util.function.Predicate; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import org.opentripplanner.ext.flex.flexpathcalculator.FlexPathCalculator; import org.opentripplanner.ext.flex.flexpathcalculator.ScheduledFlexPathCalculator; import org.opentripplanner.model.PickDrop; @@ -152,7 +151,7 @@ public boolean isAlightingPossible(StopLocation toStop) { } @Override - public boolean sameAs(@Nonnull ScheduledDeviatedTrip other) { + public boolean sameAs(ScheduledDeviatedTrip other) { return ( super.sameAs(other) && Arrays.equals(stopTimes, other.stopTimes) && @@ -161,7 +160,6 @@ public boolean sameAs(@Nonnull ScheduledDeviatedTrip other) { ); } - @Nonnull @Override public TransitBuilder copy() { return new ScheduledDeviatedTripBuilder(this); diff --git a/src/ext/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTripBuilder.java b/application/src/ext/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTripBuilder.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTripBuilder.java rename to application/src/ext/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTripBuilder.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/trip/StopTimeWindow.java b/application/src/ext/java/org/opentripplanner/ext/flex/trip/StopTimeWindow.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/trip/StopTimeWindow.java rename to application/src/ext/java/org/opentripplanner/ext/flex/trip/StopTimeWindow.java diff --git a/src/ext/java/org/opentripplanner/ext/flex/trip/UnscheduledTrip.java b/application/src/ext/java/org/opentripplanner/ext/flex/trip/UnscheduledTrip.java similarity index 98% rename from src/ext/java/org/opentripplanner/ext/flex/trip/UnscheduledTrip.java rename to application/src/ext/java/org/opentripplanner/ext/flex/trip/UnscheduledTrip.java index 20a77bb94ed..30c79ac0d1a 100644 --- a/src/ext/java/org/opentripplanner/ext/flex/trip/UnscheduledTrip.java +++ b/application/src/ext/java/org/opentripplanner/ext/flex/trip/UnscheduledTrip.java @@ -10,7 +10,6 @@ import java.util.Set; import java.util.function.Predicate; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import org.opentripplanner.ext.flex.flexpathcalculator.FlexPathCalculator; import org.opentripplanner.ext.flex.flexpathcalculator.TimePenaltyCalculator; import org.opentripplanner.framework.lang.DoubleUtils; @@ -197,7 +196,7 @@ public boolean isAlightingPossible(StopLocation stop) { } @Override - public boolean sameAs(@Nonnull UnscheduledTrip other) { + public boolean sameAs(UnscheduledTrip other) { return ( super.sameAs(other) && Arrays.equals(stopTimes, other.stopTimes) && @@ -206,7 +205,6 @@ public boolean sameAs(@Nonnull UnscheduledTrip other) { ); } - @Nonnull @Override public TransitBuilder copy() { return new UnscheduledTripBuilder(this); diff --git a/src/ext/java/org/opentripplanner/ext/flex/trip/UnscheduledTripBuilder.java b/application/src/ext/java/org/opentripplanner/ext/flex/trip/UnscheduledTripBuilder.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/flex/trip/UnscheduledTripBuilder.java rename to application/src/ext/java/org/opentripplanner/ext/flex/trip/UnscheduledTripBuilder.java diff --git a/src/ext/java/org/opentripplanner/ext/geocoder/EnglishNGramAnalyzer.java b/application/src/ext/java/org/opentripplanner/ext/geocoder/EnglishNGramAnalyzer.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/geocoder/EnglishNGramAnalyzer.java rename to application/src/ext/java/org/opentripplanner/ext/geocoder/EnglishNGramAnalyzer.java diff --git a/src/ext/java/org/opentripplanner/ext/geocoder/GeocoderResource.java b/application/src/ext/java/org/opentripplanner/ext/geocoder/GeocoderResource.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/geocoder/GeocoderResource.java rename to application/src/ext/java/org/opentripplanner/ext/geocoder/GeocoderResource.java diff --git a/src/ext/java/org/opentripplanner/ext/geocoder/LuceneIndex.java b/application/src/ext/java/org/opentripplanner/ext/geocoder/LuceneIndex.java similarity index 97% rename from src/ext/java/org/opentripplanner/ext/geocoder/LuceneIndex.java rename to application/src/ext/java/org/opentripplanner/ext/geocoder/LuceneIndex.java index 71b80ac58a6..764c40d3f86 100644 --- a/src/ext/java/org/opentripplanner/ext/geocoder/LuceneIndex.java +++ b/application/src/ext/java/org/opentripplanner/ext/geocoder/LuceneIndex.java @@ -18,7 +18,7 @@ import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.codecs.Codec; import org.apache.lucene.codecs.PostingsFormat; -import org.apache.lucene.codecs.lucene99.Lucene99Codec; +import org.apache.lucene.codecs.lucene912.Lucene912Codec; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field.Store; import org.apache.lucene.document.StoredField; @@ -34,7 +34,7 @@ import org.apache.lucene.search.FuzzyQuery; import org.apache.lucene.search.PrefixQuery; import org.apache.lucene.search.TermQuery; -import org.apache.lucene.search.suggest.document.Completion99PostingsFormat; +import org.apache.lucene.search.suggest.document.Completion912PostingsFormat; import org.apache.lucene.search.suggest.document.CompletionAnalyzer; import org.apache.lucene.search.suggest.document.ContextQuery; import org.apache.lucene.search.suggest.document.ContextSuggestField; @@ -200,8 +200,8 @@ private StopCluster toStopCluster(Document document) { static IndexWriterConfig iwcWithSuggestField(Analyzer analyzer, final Set suggestFields) { IndexWriterConfig iwc = new IndexWriterConfig(analyzer); - Codec filterCodec = new Lucene99Codec() { - final PostingsFormat postingsFormat = new Completion99PostingsFormat(); + Codec filterCodec = new Lucene912Codec() { + final PostingsFormat postingsFormat = new Completion912PostingsFormat(); @Override public PostingsFormat getPostingsFormatForField(String field) { diff --git a/src/ext/java/org/opentripplanner/ext/geocoder/LuceneStopCluster.java b/application/src/ext/java/org/opentripplanner/ext/geocoder/LuceneStopCluster.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/geocoder/LuceneStopCluster.java rename to application/src/ext/java/org/opentripplanner/ext/geocoder/LuceneStopCluster.java diff --git a/src/ext/java/org/opentripplanner/ext/geocoder/StopCluster.java b/application/src/ext/java/org/opentripplanner/ext/geocoder/StopCluster.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/geocoder/StopCluster.java rename to application/src/ext/java/org/opentripplanner/ext/geocoder/StopCluster.java diff --git a/src/ext/java/org/opentripplanner/ext/geocoder/StopClusterMapper.java b/application/src/ext/java/org/opentripplanner/ext/geocoder/StopClusterMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/geocoder/StopClusterMapper.java rename to application/src/ext/java/org/opentripplanner/ext/geocoder/StopClusterMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/geocoder/configure/GeocoderModule.java b/application/src/ext/java/org/opentripplanner/ext/geocoder/configure/GeocoderModule.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/geocoder/configure/GeocoderModule.java rename to application/src/ext/java/org/opentripplanner/ext/geocoder/configure/GeocoderModule.java diff --git a/src/ext/java/org/opentripplanner/ext/interactivelauncher/InteractiveOtpMain.java b/application/src/ext/java/org/opentripplanner/ext/interactivelauncher/InteractiveOtpMain.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/interactivelauncher/InteractiveOtpMain.java rename to application/src/ext/java/org/opentripplanner/ext/interactivelauncher/InteractiveOtpMain.java diff --git a/src/ext/java/org/opentripplanner/ext/interactivelauncher/Model.java b/application/src/ext/java/org/opentripplanner/ext/interactivelauncher/Model.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/interactivelauncher/Model.java rename to application/src/ext/java/org/opentripplanner/ext/interactivelauncher/Model.java diff --git a/src/ext/java/org/opentripplanner/ext/interactivelauncher/api/LauncherRequestDecorator.java b/application/src/ext/java/org/opentripplanner/ext/interactivelauncher/api/LauncherRequestDecorator.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/interactivelauncher/api/LauncherRequestDecorator.java rename to application/src/ext/java/org/opentripplanner/ext/interactivelauncher/api/LauncherRequestDecorator.java diff --git a/src/ext/java/org/opentripplanner/ext/interactivelauncher/configuration/InteractiveLauncherModule.java b/application/src/ext/java/org/opentripplanner/ext/interactivelauncher/configuration/InteractiveLauncherModule.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/interactivelauncher/configuration/InteractiveLauncherModule.java rename to application/src/ext/java/org/opentripplanner/ext/interactivelauncher/configuration/InteractiveLauncherModule.java diff --git a/src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/OtpDebugController.java b/application/src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/OtpDebugController.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/OtpDebugController.java rename to application/src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/OtpDebugController.java diff --git a/src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/logging/DebugLoggers.java b/application/src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/logging/DebugLoggers.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/logging/DebugLoggers.java rename to application/src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/logging/DebugLoggers.java diff --git a/src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/logging/DebugLoggingSupport.java b/application/src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/logging/DebugLoggingSupport.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/logging/DebugLoggingSupport.java rename to application/src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/logging/DebugLoggingSupport.java diff --git a/src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/logging/LogModel.java b/application/src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/logging/LogModel.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/logging/LogModel.java rename to application/src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/logging/LogModel.java diff --git a/src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/logging/LogView.java b/application/src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/logging/LogView.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/logging/LogView.java rename to application/src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/logging/LogView.java diff --git a/src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/raptor/RaptorDebugModel.java b/application/src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/raptor/RaptorDebugModel.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/raptor/RaptorDebugModel.java rename to application/src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/raptor/RaptorDebugModel.java diff --git a/src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/raptor/RaptorDebugView.java b/application/src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/raptor/RaptorDebugView.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/raptor/RaptorDebugView.java rename to application/src/ext/java/org/opentripplanner/ext/interactivelauncher/debug/raptor/RaptorDebugView.java diff --git a/src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/DataSourceRootView.java b/application/src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/DataSourceRootView.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/DataSourceRootView.java rename to application/src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/DataSourceRootView.java diff --git a/src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/DataSourcesView.java b/application/src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/DataSourcesView.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/DataSourcesView.java rename to application/src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/DataSourcesView.java diff --git a/src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/MainView.java b/application/src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/MainView.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/MainView.java rename to application/src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/MainView.java diff --git a/src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/OptionsView.java b/application/src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/OptionsView.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/OptionsView.java rename to application/src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/OptionsView.java diff --git a/src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/StartOtpButtonView.java b/application/src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/StartOtpButtonView.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/StartOtpButtonView.java rename to application/src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/StartOtpButtonView.java diff --git a/src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/StartupModel.java b/application/src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/StartupModel.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/StartupModel.java rename to application/src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/StartupModel.java diff --git a/src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/StatusBar.java b/application/src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/StatusBar.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/StatusBar.java rename to application/src/ext/java/org/opentripplanner/ext/interactivelauncher/startup/StatusBar.java diff --git a/src/ext/java/org/opentripplanner/ext/interactivelauncher/support/SearchForOtpConfig.java b/application/src/ext/java/org/opentripplanner/ext/interactivelauncher/support/SearchForOtpConfig.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/interactivelauncher/support/SearchForOtpConfig.java rename to application/src/ext/java/org/opentripplanner/ext/interactivelauncher/support/SearchForOtpConfig.java diff --git a/src/ext/java/org/opentripplanner/ext/interactivelauncher/support/ViewUtils.java b/application/src/ext/java/org/opentripplanner/ext/interactivelauncher/support/ViewUtils.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/interactivelauncher/support/ViewUtils.java rename to application/src/ext/java/org/opentripplanner/ext/interactivelauncher/support/ViewUtils.java diff --git a/src/ext/java/org/opentripplanner/ext/parkAndRideApi/ParkAndRideResource.java b/application/src/ext/java/org/opentripplanner/ext/parkAndRideApi/ParkAndRideResource.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/parkAndRideApi/ParkAndRideResource.java rename to application/src/ext/java/org/opentripplanner/ext/parkAndRideApi/ParkAndRideResource.java diff --git a/src/ext/java/org/opentripplanner/ext/realtimeresolver/RealtimeResolver.java b/application/src/ext/java/org/opentripplanner/ext/realtimeresolver/RealtimeResolver.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/realtimeresolver/RealtimeResolver.java rename to application/src/ext/java/org/opentripplanner/ext/realtimeresolver/RealtimeResolver.java diff --git a/src/ext/java/org/opentripplanner/ext/reportapi/model/CachedValue.java b/application/src/ext/java/org/opentripplanner/ext/reportapi/model/CachedValue.java similarity index 87% rename from src/ext/java/org/opentripplanner/ext/reportapi/model/CachedValue.java rename to application/src/ext/java/org/opentripplanner/ext/reportapi/model/CachedValue.java index 6a7dac61b23..acf5758fa66 100644 --- a/src/ext/java/org/opentripplanner/ext/reportapi/model/CachedValue.java +++ b/application/src/ext/java/org/opentripplanner/ext/reportapi/model/CachedValue.java @@ -3,7 +3,6 @@ import java.time.Duration; import java.time.Instant; import java.util.function.Supplier; -import javax.annotation.Nonnull; /** * The purpose of this class is to be a generic container for caching expensive computations. @@ -16,7 +15,7 @@ public class CachedValue { private T value; private Instant timeout; - public CachedValue(@Nonnull Duration cacheInterval) { + public CachedValue(Duration cacheInterval) { this.value = null; this.cacheInterval = cacheInterval; this.timeout = calculateTimeout(); @@ -27,7 +26,7 @@ public CachedValue(@Nonnull Duration cacheInterval) { *

* Otherwise, recompute and return it. */ - public T get(@Nonnull Supplier supplier) { + public T get(Supplier supplier) { synchronized (this) { if (hasExpired()) { this.value = supplier.get(); diff --git a/src/ext/java/org/opentripplanner/ext/reportapi/model/CsvReportBuilder.java b/application/src/ext/java/org/opentripplanner/ext/reportapi/model/CsvReportBuilder.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/reportapi/model/CsvReportBuilder.java rename to application/src/ext/java/org/opentripplanner/ext/reportapi/model/CsvReportBuilder.java diff --git a/src/ext/java/org/opentripplanner/ext/reportapi/model/GraphReportBuilder.java b/application/src/ext/java/org/opentripplanner/ext/reportapi/model/GraphReportBuilder.java similarity index 97% rename from src/ext/java/org/opentripplanner/ext/reportapi/model/GraphReportBuilder.java rename to application/src/ext/java/org/opentripplanner/ext/reportapi/model/GraphReportBuilder.java index 57d0872b9bd..7f819c70792 100644 --- a/src/ext/java/org/opentripplanner/ext/reportapi/model/GraphReportBuilder.java +++ b/application/src/ext/java/org/opentripplanner/ext/reportapi/model/GraphReportBuilder.java @@ -4,7 +4,6 @@ import java.util.HashMap; import java.util.Map; import java.util.function.Function; -import javax.annotation.Nonnull; import org.opentripplanner.standalone.api.OtpServerRequestContext; public class GraphReportBuilder { @@ -50,13 +49,11 @@ public static GraphStats build(OtpServerRequestContext context) { ); } - @Nonnull private static String firstLetterToLowerCase(Object instance) { var className = instance.getClass().getSimpleName(); return Character.toLowerCase(className.charAt(0)) + className.substring(1); } - @Nonnull private static TypeStats countValues(Collection input, Function classify) { Map result = new HashMap<>(); input.forEach(item -> { diff --git a/src/ext/java/org/opentripplanner/ext/reportapi/model/TransfersReport.java b/application/src/ext/java/org/opentripplanner/ext/reportapi/model/TransfersReport.java similarity index 99% rename from src/ext/java/org/opentripplanner/ext/reportapi/model/TransfersReport.java rename to application/src/ext/java/org/opentripplanner/ext/reportapi/model/TransfersReport.java index 2cfe1b19c1c..e53cd6c3c58 100644 --- a/src/ext/java/org/opentripplanner/ext/reportapi/model/TransfersReport.java +++ b/application/src/ext/java/org/opentripplanner/ext/reportapi/model/TransfersReport.java @@ -4,7 +4,6 @@ import java.util.List; import java.util.Optional; -import javax.annotation.Nonnull; import org.opentripplanner.framework.geometry.SphericalDistanceLibrary; import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.i18n.I18NString; @@ -196,7 +195,6 @@ private TxPoint pointInfo(TransferPoint p, boolean boarding) { return r; } - @Nonnull private static String getName(Operator operator) { return Optional.ofNullable(operator).map(o -> o.getId().getId()).orElse(""); } diff --git a/src/ext/java/org/opentripplanner/ext/reportapi/model/TransitGroupPriorityReport.java b/application/src/ext/java/org/opentripplanner/ext/reportapi/model/TransitGroupPriorityReport.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/reportapi/model/TransitGroupPriorityReport.java rename to application/src/ext/java/org/opentripplanner/ext/reportapi/model/TransitGroupPriorityReport.java diff --git a/src/ext/java/org/opentripplanner/ext/reportapi/resource/ReportResource.java b/application/src/ext/java/org/opentripplanner/ext/reportapi/resource/ReportResource.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/reportapi/resource/ReportResource.java rename to application/src/ext/java/org/opentripplanner/ext/reportapi/resource/ReportResource.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/AbsoluteDirectionMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/AbsoluteDirectionMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/AbsoluteDirectionMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/AbsoluteDirectionMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/AgencyMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/AgencyMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/AgencyMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/AgencyMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/AlertMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/AlertMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/AlertMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/AlertMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/BikeAccessMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/BikeAccessMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/BikeAccessMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/BikeAccessMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/BookingInfoMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/BookingInfoMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/BookingInfoMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/BookingInfoMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/BookingMethodMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/BookingMethodMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/BookingMethodMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/BookingMethodMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/BookingTimeMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/BookingTimeMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/BookingTimeMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/BookingTimeMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/ContactInfoMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/ContactInfoMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/ContactInfoMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/ContactInfoMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/DirectionMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/DirectionMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/DirectionMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/DirectionMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/ElevationMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/ElevationMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/ElevationMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/ElevationMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/FareMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/FareMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/FareMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/FareMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/FeedInfoMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/FeedInfoMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/FeedInfoMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/FeedInfoMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/FeedScopedIdMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/FeedScopedIdMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/FeedScopedIdMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/FeedScopedIdMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/ItineraryMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/ItineraryMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/ItineraryMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/ItineraryMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/LegMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/LegMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/LegMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/LegMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/LegacyVehicleRoutingOptimizeType.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/LegacyVehicleRoutingOptimizeType.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/LegacyVehicleRoutingOptimizeType.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/LegacyVehicleRoutingOptimizeType.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/LocalDateMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/LocalDateMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/LocalDateMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/LocalDateMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/ModeMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/ModeMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/ModeMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/ModeMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/PlaceMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/PlaceMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/PlaceMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/PlaceMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/RelativeDirectionMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/RelativeDirectionMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/RelativeDirectionMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/RelativeDirectionMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/RouteMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/RouteMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/RouteMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/RouteMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/RouteTypeMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/RouteTypeMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/RouteTypeMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/RouteTypeMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/StopMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/StopMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/StopMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/StopMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/StopTimesInPatternMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/StopTimesInPatternMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/StopTimesInPatternMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/StopTimesInPatternMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/SystemNoticeMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/SystemNoticeMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/SystemNoticeMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/SystemNoticeMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/TransferMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/TransferMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/TransferMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/TransferMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/TripMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/TripMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/TripMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/TripMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/TripPatternMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/TripPatternMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/TripPatternMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/TripPatternMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/TripPlanMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/TripPlanMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/TripPlanMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/TripPlanMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/TripSearchMetadataMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/TripSearchMetadataMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/TripSearchMetadataMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/TripSearchMetadataMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/TripTimeMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/TripTimeMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/TripTimeMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/TripTimeMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/VehicleRentalStationMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/VehicleRentalStationMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/VehicleRentalStationMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/VehicleRentalStationMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/VertexTypeMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/VertexTypeMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/VertexTypeMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/VertexTypeMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/WalkStepMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/WalkStepMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/WalkStepMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/WalkStepMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/mapping/WheelchairAccessibilityMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/WheelchairAccessibilityMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/mapping/WheelchairAccessibilityMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/mapping/WheelchairAccessibilityMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiAbsoluteDirection.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiAbsoluteDirection.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiAbsoluteDirection.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiAbsoluteDirection.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiAgency.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiAgency.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiAgency.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiAgency.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiAlert.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiAlert.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiAlert.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiAlert.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiBookingInfo.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiBookingInfo.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiBookingInfo.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiBookingInfo.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiBookingTime.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiBookingTime.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiBookingTime.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiBookingTime.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiContactInfo.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiContactInfo.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiContactInfo.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiContactInfo.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiCurrency.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiCurrency.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiCurrency.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiCurrency.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiFareComponent.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiFareComponent.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiFareComponent.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiFareComponent.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiFareProduct.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiFareProduct.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiFareProduct.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiFareProduct.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiFareQualifier.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiFareQualifier.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiFareQualifier.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiFareQualifier.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiFeedInfo.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiFeedInfo.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiFeedInfo.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiFeedInfo.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiItinerary.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiItinerary.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiItinerary.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiItinerary.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiItineraryFares.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiItineraryFares.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiItineraryFares.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiItineraryFares.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiLeg.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiLeg.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiLeg.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiLeg.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiLegProducts.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiLegProducts.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiLegProducts.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiLegProducts.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiMoney.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiMoney.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiMoney.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiMoney.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiPatternDetail.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiPatternDetail.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiPatternDetail.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiPatternDetail.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiPatternShort.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiPatternShort.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiPatternShort.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiPatternShort.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiPlace.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiPlace.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiPlace.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiPlace.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiRealTimeState.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiRealTimeState.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiRealTimeState.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiRealTimeState.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiRelativeDirection.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiRelativeDirection.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiRelativeDirection.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiRelativeDirection.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiRoute.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiRoute.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiRoute.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiRoute.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiRouteShort.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiRouteShort.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiRouteShort.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiRouteShort.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiRouterInfo.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiRouterInfo.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiRouterInfo.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiRouterInfo.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiRouterList.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiRouterList.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiRouterList.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiRouterList.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiStop.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiStop.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiStop.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiStop.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiStopShort.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiStopShort.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiStopShort.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiStopShort.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiStopTimesInPattern.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiStopTimesInPattern.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiStopTimesInPattern.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiStopTimesInPattern.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiSystemNotice.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiSystemNotice.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiSystemNotice.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiSystemNotice.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTransfer.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTransfer.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiTransfer.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTransfer.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTravelOption.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTravelOption.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiTravelOption.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTravelOption.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTravelOptionsMaker.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTravelOptionsMaker.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiTravelOptionsMaker.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTravelOptionsMaker.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTrip.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTrip.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiTrip.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTrip.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTripPlan.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTripPlan.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiTripPlan.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTripPlan.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTripSearchMetadata.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTripSearchMetadata.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiTripSearchMetadata.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTripSearchMetadata.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTripShort.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTripShort.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiTripShort.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTripShort.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTripTimeShort.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTripTimeShort.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiTripTimeShort.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiTripTimeShort.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiVehicleParkingSpaces.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiVehicleParkingSpaces.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiVehicleParkingSpaces.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiVehicleParkingSpaces.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiVehicleParkingWithEntrance.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiVehicleParkingWithEntrance.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiVehicleParkingWithEntrance.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiVehicleParkingWithEntrance.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiVehicleRentalStation.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiVehicleRentalStation.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiVehicleRentalStation.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiVehicleRentalStation.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiVehicleRentalStationList.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiVehicleRentalStationList.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiVehicleRentalStationList.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiVehicleRentalStationList.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiVertexType.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiVertexType.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiVertexType.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiVertexType.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ApiWalkStep.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiWalkStep.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ApiWalkStep.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiWalkStep.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/ElevationMetadata.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ElevationMetadata.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/ElevationMetadata.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/ElevationMetadata.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/model/TripPlannerResponse.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/TripPlannerResponse.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/model/TripPlannerResponse.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/model/TripPlannerResponse.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/resources/BikeRental.java b/application/src/ext/java/org/opentripplanner/ext/restapi/resources/BikeRental.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/resources/BikeRental.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/resources/BikeRental.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/resources/IndexAPI.java b/application/src/ext/java/org/opentripplanner/ext/restapi/resources/IndexAPI.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/resources/IndexAPI.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/resources/IndexAPI.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/resources/PlannerResource.java b/application/src/ext/java/org/opentripplanner/ext/restapi/resources/PlannerResource.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/resources/PlannerResource.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/resources/PlannerResource.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/resources/RequestToPreferencesMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/resources/RequestToPreferencesMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/resources/RequestToPreferencesMapper.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/resources/RequestToPreferencesMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/resources/Routers.java b/application/src/ext/java/org/opentripplanner/ext/restapi/resources/Routers.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/resources/Routers.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/resources/Routers.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/resources/RoutingResource.java b/application/src/ext/java/org/opentripplanner/ext/restapi/resources/RoutingResource.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/resources/RoutingResource.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/resources/RoutingResource.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/resources/ValidateParameters.java b/application/src/ext/java/org/opentripplanner/ext/restapi/resources/ValidateParameters.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/resources/ValidateParameters.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/resources/ValidateParameters.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/resources/package-info.java b/application/src/ext/java/org/opentripplanner/ext/restapi/resources/package-info.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/resources/package-info.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/resources/package-info.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/serialization/FeedScopedIdDeserializer.java b/application/src/ext/java/org/opentripplanner/ext/restapi/serialization/FeedScopedIdDeserializer.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/serialization/FeedScopedIdDeserializer.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/serialization/FeedScopedIdDeserializer.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/serialization/FeedScopedIdKeyDeserializer.java b/application/src/ext/java/org/opentripplanner/ext/restapi/serialization/FeedScopedIdKeyDeserializer.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/serialization/FeedScopedIdKeyDeserializer.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/serialization/FeedScopedIdKeyDeserializer.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/serialization/FeedScopedIdSerializer.java b/application/src/ext/java/org/opentripplanner/ext/restapi/serialization/FeedScopedIdSerializer.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/serialization/FeedScopedIdSerializer.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/serialization/FeedScopedIdSerializer.java diff --git a/src/ext/java/org/opentripplanner/ext/restapi/serialization/JSONObjectMapperProvider.java b/application/src/ext/java/org/opentripplanner/ext/restapi/serialization/JSONObjectMapperProvider.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/restapi/serialization/JSONObjectMapperProvider.java rename to application/src/ext/java/org/opentripplanner/ext/restapi/serialization/JSONObjectMapperProvider.java diff --git a/src/ext/java/org/opentripplanner/ext/ridehailing/CachingRideHailingService.java b/application/src/ext/java/org/opentripplanner/ext/ridehailing/CachingRideHailingService.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/ridehailing/CachingRideHailingService.java rename to application/src/ext/java/org/opentripplanner/ext/ridehailing/CachingRideHailingService.java diff --git a/src/ext/java/org/opentripplanner/ext/ridehailing/DecorateWithRideHailing.java b/application/src/ext/java/org/opentripplanner/ext/ridehailing/DecorateWithRideHailing.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/ridehailing/DecorateWithRideHailing.java rename to application/src/ext/java/org/opentripplanner/ext/ridehailing/DecorateWithRideHailing.java diff --git a/src/ext/java/org/opentripplanner/ext/ridehailing/RideHailingAccessAdapter.java b/application/src/ext/java/org/opentripplanner/ext/ridehailing/RideHailingAccessAdapter.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/ridehailing/RideHailingAccessAdapter.java rename to application/src/ext/java/org/opentripplanner/ext/ridehailing/RideHailingAccessAdapter.java diff --git a/src/ext/java/org/opentripplanner/ext/ridehailing/RideHailingAccessShifter.java b/application/src/ext/java/org/opentripplanner/ext/ridehailing/RideHailingAccessShifter.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/ridehailing/RideHailingAccessShifter.java rename to application/src/ext/java/org/opentripplanner/ext/ridehailing/RideHailingAccessShifter.java diff --git a/src/ext/java/org/opentripplanner/ext/ridehailing/RideHailingService.java b/application/src/ext/java/org/opentripplanner/ext/ridehailing/RideHailingService.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/ridehailing/RideHailingService.java rename to application/src/ext/java/org/opentripplanner/ext/ridehailing/RideHailingService.java diff --git a/src/ext/java/org/opentripplanner/ext/ridehailing/RideHailingServiceParameters.java b/application/src/ext/java/org/opentripplanner/ext/ridehailing/RideHailingServiceParameters.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/ridehailing/RideHailingServiceParameters.java rename to application/src/ext/java/org/opentripplanner/ext/ridehailing/RideHailingServiceParameters.java diff --git a/src/ext/java/org/opentripplanner/ext/ridehailing/configure/RideHailingServicesModule.java b/application/src/ext/java/org/opentripplanner/ext/ridehailing/configure/RideHailingServicesModule.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/ridehailing/configure/RideHailingServicesModule.java rename to application/src/ext/java/org/opentripplanner/ext/ridehailing/configure/RideHailingServicesModule.java diff --git a/src/ext/java/org/opentripplanner/ext/ridehailing/model/ArrivalTime.java b/application/src/ext/java/org/opentripplanner/ext/ridehailing/model/ArrivalTime.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/ridehailing/model/ArrivalTime.java rename to application/src/ext/java/org/opentripplanner/ext/ridehailing/model/ArrivalTime.java diff --git a/src/ext/java/org/opentripplanner/ext/ridehailing/model/Ride.java b/application/src/ext/java/org/opentripplanner/ext/ridehailing/model/Ride.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/ridehailing/model/Ride.java rename to application/src/ext/java/org/opentripplanner/ext/ridehailing/model/Ride.java diff --git a/src/ext/java/org/opentripplanner/ext/ridehailing/model/RideEstimate.java b/application/src/ext/java/org/opentripplanner/ext/ridehailing/model/RideEstimate.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/ridehailing/model/RideEstimate.java rename to application/src/ext/java/org/opentripplanner/ext/ridehailing/model/RideEstimate.java diff --git a/src/ext/java/org/opentripplanner/ext/ridehailing/model/RideEstimateRequest.java b/application/src/ext/java/org/opentripplanner/ext/ridehailing/model/RideEstimateRequest.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/ridehailing/model/RideEstimateRequest.java rename to application/src/ext/java/org/opentripplanner/ext/ridehailing/model/RideEstimateRequest.java diff --git a/src/ext/java/org/opentripplanner/ext/ridehailing/model/RideHailingLeg.java b/application/src/ext/java/org/opentripplanner/ext/ridehailing/model/RideHailingLeg.java similarity index 95% rename from src/ext/java/org/opentripplanner/ext/ridehailing/model/RideHailingLeg.java rename to application/src/ext/java/org/opentripplanner/ext/ridehailing/model/RideHailingLeg.java index 91a7a1fbf6f..94587333c4e 100644 --- a/src/ext/java/org/opentripplanner/ext/ridehailing/model/RideHailingLeg.java +++ b/application/src/ext/java/org/opentripplanner/ext/ridehailing/model/RideHailingLeg.java @@ -1,6 +1,5 @@ package org.opentripplanner.ext.ridehailing.model; -import javax.annotation.Nonnull; import org.opentripplanner.model.plan.StreetLeg; import org.opentripplanner.model.plan.StreetLegBuilder; @@ -27,7 +26,6 @@ public RideHailingProvider provider() { return provider; } - @Nonnull public RideEstimate rideEstimate() { return estimate; } diff --git a/src/ext/java/org/opentripplanner/ext/ridehailing/model/RideHailingProvider.java b/application/src/ext/java/org/opentripplanner/ext/ridehailing/model/RideHailingProvider.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/ridehailing/model/RideHailingProvider.java rename to application/src/ext/java/org/opentripplanner/ext/ridehailing/model/RideHailingProvider.java diff --git a/src/ext/java/org/opentripplanner/ext/ridehailing/service/oauth/CachedOAuthToken.java b/application/src/ext/java/org/opentripplanner/ext/ridehailing/service/oauth/CachedOAuthToken.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/ridehailing/service/oauth/CachedOAuthToken.java rename to application/src/ext/java/org/opentripplanner/ext/ridehailing/service/oauth/CachedOAuthToken.java diff --git a/src/ext/java/org/opentripplanner/ext/ridehailing/service/oauth/CachingOAuthService.java b/application/src/ext/java/org/opentripplanner/ext/ridehailing/service/oauth/CachingOAuthService.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/ridehailing/service/oauth/CachingOAuthService.java rename to application/src/ext/java/org/opentripplanner/ext/ridehailing/service/oauth/CachingOAuthService.java diff --git a/src/ext/java/org/opentripplanner/ext/ridehailing/service/oauth/ClientCredentialsRequest.java b/application/src/ext/java/org/opentripplanner/ext/ridehailing/service/oauth/ClientCredentialsRequest.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/ridehailing/service/oauth/ClientCredentialsRequest.java rename to application/src/ext/java/org/opentripplanner/ext/ridehailing/service/oauth/ClientCredentialsRequest.java diff --git a/src/ext/java/org/opentripplanner/ext/ridehailing/service/oauth/OAuthService.java b/application/src/ext/java/org/opentripplanner/ext/ridehailing/service/oauth/OAuthService.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/ridehailing/service/oauth/OAuthService.java rename to application/src/ext/java/org/opentripplanner/ext/ridehailing/service/oauth/OAuthService.java diff --git a/src/ext/java/org/opentripplanner/ext/ridehailing/service/oauth/UrlEncodedOAuthService.java b/application/src/ext/java/org/opentripplanner/ext/ridehailing/service/oauth/UrlEncodedOAuthService.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/ridehailing/service/oauth/UrlEncodedOAuthService.java rename to application/src/ext/java/org/opentripplanner/ext/ridehailing/service/oauth/UrlEncodedOAuthService.java diff --git a/src/ext/java/org/opentripplanner/ext/ridehailing/service/uber/UberArrivalEstimateResponse.java b/application/src/ext/java/org/opentripplanner/ext/ridehailing/service/uber/UberArrivalEstimateResponse.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/ridehailing/service/uber/UberArrivalEstimateResponse.java rename to application/src/ext/java/org/opentripplanner/ext/ridehailing/service/uber/UberArrivalEstimateResponse.java diff --git a/src/ext/java/org/opentripplanner/ext/ridehailing/service/uber/UberService.java b/application/src/ext/java/org/opentripplanner/ext/ridehailing/service/uber/UberService.java similarity index 99% rename from src/ext/java/org/opentripplanner/ext/ridehailing/service/uber/UberService.java rename to application/src/ext/java/org/opentripplanner/ext/ridehailing/service/uber/UberService.java index 9b276fc053e..d5ab1e8c5fa 100644 --- a/src/ext/java/org/opentripplanner/ext/ridehailing/service/uber/UberService.java +++ b/application/src/ext/java/org/opentripplanner/ext/ridehailing/service/uber/UberService.java @@ -13,7 +13,6 @@ import java.util.Currency; import java.util.List; import java.util.Map; -import javax.annotation.Nonnull; import org.opentripplanner.ext.ridehailing.CachingRideHailingService; import org.opentripplanner.ext.ridehailing.RideHailingServiceParameters; import org.opentripplanner.ext.ridehailing.model.ArrivalTime; @@ -191,7 +190,6 @@ private boolean filterRides(Ride a, boolean wheelchairAccessible) { } } - @Nonnull private Map headers() throws IOException { return Map.ofEntries( entry(AUTHORIZATION, "Bearer %s".formatted(oauthService.getToken())), diff --git a/src/ext/java/org/opentripplanner/ext/ridehailing/service/uber/UberTripTimeEstimateResponse.java b/application/src/ext/java/org/opentripplanner/ext/ridehailing/service/uber/UberTripTimeEstimateResponse.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/ridehailing/service/uber/UberTripTimeEstimateResponse.java rename to application/src/ext/java/org/opentripplanner/ext/ridehailing/service/uber/UberTripTimeEstimateResponse.java diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/azure/AbstractAzureSiriUpdater.java b/application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/AbstractAzureSiriUpdater.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/siri/updater/azure/AbstractAzureSiriUpdater.java rename to application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/AbstractAzureSiriUpdater.java diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/azure/AuthenticationType.java b/application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/AuthenticationType.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/siri/updater/azure/AuthenticationType.java rename to application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/AuthenticationType.java diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureETUpdater.java b/application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureETUpdater.java similarity index 98% rename from src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureETUpdater.java rename to application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureETUpdater.java index 009bc3a7f0e..a2fe5b71f36 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureETUpdater.java +++ b/application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureETUpdater.java @@ -15,7 +15,7 @@ import java.util.function.Consumer; import javax.xml.stream.XMLStreamException; import org.apache.hc.core5.net.URIBuilder; -import org.opentripplanner.ext.siri.SiriTimetableSnapshotSource; +import org.opentripplanner.updater.siri.SiriTimetableSnapshotSource; import org.opentripplanner.updater.spi.ResultLogger; import org.opentripplanner.updater.spi.UpdateResult; import org.opentripplanner.updater.trip.UpdateIncrementality; diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureETUpdaterParameters.java b/application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureETUpdaterParameters.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureETUpdaterParameters.java rename to application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureETUpdaterParameters.java diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureInitializationException.java b/application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureInitializationException.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureInitializationException.java rename to application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureInitializationException.java diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureSXUpdater.java b/application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureSXUpdater.java similarity index 98% rename from src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureSXUpdater.java rename to application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureSXUpdater.java index bcd2c500c40..b6a9f014c81 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureSXUpdater.java +++ b/application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureSXUpdater.java @@ -15,11 +15,11 @@ import java.util.function.Consumer; import javax.xml.stream.XMLStreamException; import org.apache.hc.core5.net.URIBuilder; -import org.opentripplanner.ext.siri.SiriAlertsUpdateHandler; import org.opentripplanner.routing.impl.TransitAlertServiceImpl; import org.opentripplanner.routing.services.TransitAlertService; import org.opentripplanner.transit.service.TransitModel; import org.opentripplanner.updater.alert.TransitAlertProvider; +import org.opentripplanner.updater.siri.SiriAlertsUpdateHandler; import org.rutebanken.siri20.util.SiriXml; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureSXUpdaterParameters.java b/application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureSXUpdaterParameters.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureSXUpdaterParameters.java rename to application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureSXUpdaterParameters.java diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureUpdaterParameters.java b/application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureUpdaterParameters.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureUpdaterParameters.java rename to application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureUpdaterParameters.java diff --git a/src/ext/java/org/opentripplanner/ext/smoovebikerental/SmooveBikeRentalDataSource.java b/application/src/ext/java/org/opentripplanner/ext/smoovebikerental/SmooveBikeRentalDataSource.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/smoovebikerental/SmooveBikeRentalDataSource.java rename to application/src/ext/java/org/opentripplanner/ext/smoovebikerental/SmooveBikeRentalDataSource.java diff --git a/src/ext/java/org/opentripplanner/ext/smoovebikerental/SmooveBikeRentalDataSourceParameters.java b/application/src/ext/java/org/opentripplanner/ext/smoovebikerental/SmooveBikeRentalDataSourceParameters.java similarity index 96% rename from src/ext/java/org/opentripplanner/ext/smoovebikerental/SmooveBikeRentalDataSourceParameters.java rename to application/src/ext/java/org/opentripplanner/ext/smoovebikerental/SmooveBikeRentalDataSourceParameters.java index ca0f5497601..5aa834554c7 100644 --- a/src/ext/java/org/opentripplanner/ext/smoovebikerental/SmooveBikeRentalDataSourceParameters.java +++ b/application/src/ext/java/org/opentripplanner/ext/smoovebikerental/SmooveBikeRentalDataSourceParameters.java @@ -1,6 +1,5 @@ package org.opentripplanner.ext.smoovebikerental; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.updater.spi.HttpHeaders; import org.opentripplanner.updater.vehicle_rental.VehicleRentalSourceType; @@ -26,7 +25,6 @@ public String getNetwork(String defaultValue) { return network == null || network.isEmpty() ? defaultValue : network; } - @Nonnull @Override public VehicleRentalSourceType sourceType() { return VehicleRentalSourceType.SMOOVE; diff --git a/src/ext/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNames.java b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNames.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNames.java rename to application/src/ext/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNames.java diff --git a/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModule.java b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModule.java similarity index 98% rename from src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModule.java rename to application/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModule.java index 100941d88d4..7f5cf431a4c 100644 --- a/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModule.java +++ b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModule.java @@ -4,7 +4,6 @@ import java.util.Collection; import java.util.List; import java.util.Objects; -import javax.annotation.Nonnull; import org.opentripplanner.datastore.api.DataSource; import org.opentripplanner.ext.stopconsolidation.internal.DefaultStopConsolidationService; import org.opentripplanner.ext.stopconsolidation.model.ConsolidatedStopGroup; @@ -62,7 +61,6 @@ public void buildGraph() { }); } - @Nonnull private TripPattern modifyStopsInPattern( TripPattern pattern, List replacements diff --git a/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationParser.java b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationParser.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationParser.java rename to application/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationParser.java diff --git a/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationRepository.java b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationRepository.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationRepository.java rename to application/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationRepository.java diff --git a/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationService.java b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationService.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationService.java rename to application/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationService.java diff --git a/src/ext/java/org/opentripplanner/ext/stopconsolidation/configure/StopConsolidationRepositoryModule.java b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/configure/StopConsolidationRepositoryModule.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/stopconsolidation/configure/StopConsolidationRepositoryModule.java rename to application/src/ext/java/org/opentripplanner/ext/stopconsolidation/configure/StopConsolidationRepositoryModule.java diff --git a/src/ext/java/org/opentripplanner/ext/stopconsolidation/configure/StopConsolidationServiceModule.java b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/configure/StopConsolidationServiceModule.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/stopconsolidation/configure/StopConsolidationServiceModule.java rename to application/src/ext/java/org/opentripplanner/ext/stopconsolidation/configure/StopConsolidationServiceModule.java diff --git a/src/ext/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationRepository.java b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationRepository.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationRepository.java rename to application/src/ext/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationRepository.java diff --git a/src/ext/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationService.java b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationService.java similarity index 98% rename from src/ext/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationService.java rename to application/src/ext/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationService.java index 9f31e366be5..53a0f8ed827 100644 --- a/src/ext/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationService.java +++ b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationService.java @@ -4,7 +4,6 @@ import java.util.Objects; import java.util.Optional; import java.util.stream.Stream; -import javax.annotation.Nonnull; import org.opentripplanner.ext.stopconsolidation.StopConsolidationRepository; import org.opentripplanner.ext.stopconsolidation.StopConsolidationService; import org.opentripplanner.ext.stopconsolidation.model.ConsolidatedStopGroup; @@ -86,7 +85,6 @@ public StopLocation agencySpecificStop(StopLocation stop, Agency agency) { } } - @Nonnull private Optional findAgencySpecificStop(StopLocation stop, Agency agency) { return repo .groups() diff --git a/src/ext/java/org/opentripplanner/ext/stopconsolidation/model/ConsolidatedStopGroup.java b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/model/ConsolidatedStopGroup.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/stopconsolidation/model/ConsolidatedStopGroup.java rename to application/src/ext/java/org/opentripplanner/ext/stopconsolidation/model/ConsolidatedStopGroup.java diff --git a/src/ext/java/org/opentripplanner/ext/stopconsolidation/model/ConsolidatedStopLeg.java b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/model/ConsolidatedStopLeg.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/stopconsolidation/model/ConsolidatedStopLeg.java rename to application/src/ext/java/org/opentripplanner/ext/stopconsolidation/model/ConsolidatedStopLeg.java diff --git a/src/ext/java/org/opentripplanner/ext/stopconsolidation/model/StopReplacement.java b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/model/StopReplacement.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/stopconsolidation/model/StopReplacement.java rename to application/src/ext/java/org/opentripplanner/ext/stopconsolidation/model/StopReplacement.java diff --git a/src/ext/java/org/opentripplanner/ext/transferanalyzer/DirectTransferAnalyzer.java b/application/src/ext/java/org/opentripplanner/ext/transferanalyzer/DirectTransferAnalyzer.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/transferanalyzer/DirectTransferAnalyzer.java rename to application/src/ext/java/org/opentripplanner/ext/transferanalyzer/DirectTransferAnalyzer.java diff --git a/src/ext/java/org/opentripplanner/ext/transferanalyzer/annotations/TransferCouldNotBeRouted.java b/application/src/ext/java/org/opentripplanner/ext/transferanalyzer/annotations/TransferCouldNotBeRouted.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/transferanalyzer/annotations/TransferCouldNotBeRouted.java rename to application/src/ext/java/org/opentripplanner/ext/transferanalyzer/annotations/TransferCouldNotBeRouted.java diff --git a/src/ext/java/org/opentripplanner/ext/transferanalyzer/annotations/TransferRoutingDistanceTooLong.java b/application/src/ext/java/org/opentripplanner/ext/transferanalyzer/annotations/TransferRoutingDistanceTooLong.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/transferanalyzer/annotations/TransferRoutingDistanceTooLong.java rename to application/src/ext/java/org/opentripplanner/ext/transferanalyzer/annotations/TransferRoutingDistanceTooLong.java diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/VectorTilesResource.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/VectorTilesResource.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vectortiles/VectorTilesResource.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/VectorTilesResource.java diff --git a/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/LayerFilters.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/LayerFilters.java new file mode 100644 index 00000000000..7d63bbe5398 --- /dev/null +++ b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/LayerFilters.java @@ -0,0 +1,73 @@ +package org.opentripplanner.ext.vectortiles.layers; + +import java.time.DayOfWeek; +import java.time.LocalDate; +import java.time.temporal.TemporalAdjusters; +import java.util.Collection; +import java.util.List; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.function.Supplier; +import org.opentripplanner.apis.gtfs.model.LocalDateRange; +import org.opentripplanner.transit.model.network.TripPattern; +import org.opentripplanner.transit.model.site.RegularStop; +import org.opentripplanner.transit.model.timetable.Trip; +import org.opentripplanner.transit.service.PatternByServiceDatesFilter; +import org.opentripplanner.transit.service.TransitService; + +/** + * Predicates for filtering elements of vector tile layers. Currently only contains predicates + * for {@link RegularStop}. Once more types need to be filtered, this may need some refactoring. + */ +public class LayerFilters { + + /** + * No filter is applied: all stops are included in the result. + */ + public static final Predicate NO_FILTER = x -> true; + + /** + * Returns a predicate which only includes stop which are visited by a pattern that is in the current + * "service week", which lasts from Sunday to Sunday. + */ + public static Predicate buildCurrentServiceWeekPredicate( + Function> getPatternsForStop, + Function> getServiceDatesForTrip, + Supplier nowSupplier + ) { + var serviceDate = nowSupplier.get(); + var lastSunday = serviceDate.with(TemporalAdjusters.previousOrSame(DayOfWeek.SUNDAY)); + var nextSundayPlusOne = serviceDate.with(TemporalAdjusters.next(DayOfWeek.SUNDAY)).plusDays(1); + + var filter = new PatternByServiceDatesFilter( + // reminder, the end of the date range is exclusive so it's the next Sunday plus one day + new LocalDateRange(lastSunday, nextSundayPlusOne), + // not used + route -> List.of(), + getServiceDatesForTrip + ); + + return regularStop -> { + var patterns = getPatternsForStop.apply(regularStop); + var patternsInCurrentWeek = filter.filterPatterns(patterns); + return !patternsInCurrentWeek.isEmpty(); + }; + } + + public static Predicate forType(FilterType type, TransitService transitService) { + return switch (type) { + case NONE -> NO_FILTER; + case SUNDAY_TO_SUNDAY_SERVICE_WEEK -> buildCurrentServiceWeekPredicate( + transitService::getPatternsForStop, + trip -> + transitService.getCalendarService().getServiceDatesForServiceId(trip.getServiceId()), + () -> LocalDate.now(transitService.getTimeZone()) + ); + }; + } + + public enum FilterType { + NONE, + SUNDAY_TO_SUNDAY_SERVICE_WEEK, + } +} diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopPropertyMapper.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopPropertyMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopPropertyMapper.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopPropertyMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopsLayerBuilder.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopsLayerBuilder.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopsLayerBuilder.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopsLayerBuilder.java diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stations/DigitransitStationPropertyMapper.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stations/DigitransitStationPropertyMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/stations/DigitransitStationPropertyMapper.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stations/DigitransitStationPropertyMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stations/StationsLayerBuilder.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stations/StationsLayerBuilder.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/stations/StationsLayerBuilder.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stations/StationsLayerBuilder.java diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/DigitransitRealtimeStopPropertyMapper.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/DigitransitRealtimeStopPropertyMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/DigitransitRealtimeStopPropertyMapper.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/DigitransitRealtimeStopPropertyMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/DigitransitStopPropertyMapper.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/DigitransitStopPropertyMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/DigitransitStopPropertyMapper.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/DigitransitStopPropertyMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerBuilder.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerBuilder.java similarity index 77% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerBuilder.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerBuilder.java index aa664497728..141157f8f3e 100644 --- a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerBuilder.java +++ b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerBuilder.java @@ -5,24 +5,20 @@ import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.function.BiFunction; -import java.util.stream.Collectors; +import java.util.function.Predicate; import org.locationtech.jts.geom.Envelope; import org.locationtech.jts.geom.Geometry; -import org.opentripplanner.apis.support.mapping.PropertyMapper; import org.opentripplanner.ext.vectortiles.VectorTilesResource; +import org.opentripplanner.ext.vectortiles.layers.LayerFilters; import org.opentripplanner.inspector.vector.LayerBuilder; import org.opentripplanner.inspector.vector.LayerParameters; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.service.TransitService; -public class StopsLayerBuilder extends LayerBuilder { +public class StopsLayerBuilder extends LayerBuilder { - static Map>> mappers = Map.of( - MapperType.Digitransit, - DigitransitStopPropertyMapper::create - ); private final TransitService transitService; + private final Predicate filter; public StopsLayerBuilder( TransitService transitService, @@ -30,7 +26,7 @@ public StopsLayerBuilder( Locale locale ) { super( - (PropertyMapper) Map + Map .ofEntries( entry(MapperType.Digitransit, new DigitransitStopPropertyMapper(transitService, locale)), entry( @@ -43,12 +39,14 @@ public StopsLayerBuilder( layerParameters.expansionFactor() ); this.transitService = transitService; + this.filter = LayerFilters.forType(layerParameters.filterType(), transitService); } protected List getGeometries(Envelope query) { return transitService .findRegularStops(query) .stream() + .filter(filter) .map(stop -> { Geometry point = stop.getGeometry(); @@ -56,7 +54,7 @@ protected List getGeometries(Envelope query) { return point; }) - .collect(Collectors.toList()); + .toList(); } enum MapperType { diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/DigitransitVehicleParkingGroupPropertyMapper.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/DigitransitVehicleParkingGroupPropertyMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/DigitransitVehicleParkingGroupPropertyMapper.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/DigitransitVehicleParkingGroupPropertyMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/DigitransitVehicleParkingPropertyMapper.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/DigitransitVehicleParkingPropertyMapper.java similarity index 97% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/DigitransitVehicleParkingPropertyMapper.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/DigitransitVehicleParkingPropertyMapper.java index 892d4907395..951552e1fdc 100644 --- a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/DigitransitVehicleParkingPropertyMapper.java +++ b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/DigitransitVehicleParkingPropertyMapper.java @@ -4,7 +4,6 @@ import java.util.Collection; import java.util.List; import java.util.Locale; -import javax.annotation.Nonnull; import org.opentripplanner.apis.support.mapping.PropertyMapper; import org.opentripplanner.framework.i18n.I18NStringMapper; import org.opentripplanner.inspector.vector.KeyValue; @@ -27,7 +26,6 @@ protected Collection map(VehicleParking vehicleParking) { return basicMapping(vehicleParking); } - @Nonnull protected ArrayList basicMapping(VehicleParking vehicleParking) { return new ArrayList<>( List.of( diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/StadtnaviVehicleParkingPropertyMapper.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/StadtnaviVehicleParkingPropertyMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/StadtnaviVehicleParkingPropertyMapper.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/StadtnaviVehicleParkingPropertyMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingAndGroup.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingAndGroup.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingAndGroup.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingAndGroup.java diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingGroupsLayerBuilder.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingGroupsLayerBuilder.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingGroupsLayerBuilder.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingGroupsLayerBuilder.java diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingsLayerBuilder.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingsLayerBuilder.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingsLayerBuilder.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingsLayerBuilder.java diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/VehicleRentalLayerBuilder.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/VehicleRentalLayerBuilder.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/VehicleRentalLayerBuilder.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/VehicleRentalLayerBuilder.java diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/VehicleRentalPlacesLayerBuilder.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/VehicleRentalPlacesLayerBuilder.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/VehicleRentalPlacesLayerBuilder.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/VehicleRentalPlacesLayerBuilder.java diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/VehicleRentalStationsLayerBuilder.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/VehicleRentalStationsLayerBuilder.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/VehicleRentalStationsLayerBuilder.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/VehicleRentalStationsLayerBuilder.java diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/VehicleRentalVehiclesLayerBuilder.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/VehicleRentalVehiclesLayerBuilder.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/VehicleRentalVehiclesLayerBuilder.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/VehicleRentalVehiclesLayerBuilder.java diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/DigitransitRealtimeVehicleRentalStationPropertyMapper.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/DigitransitRealtimeVehicleRentalStationPropertyMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/DigitransitRealtimeVehicleRentalStationPropertyMapper.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/DigitransitRealtimeVehicleRentalStationPropertyMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/DigitransitRentalVehiclePropertyMapper.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/DigitransitRentalVehiclePropertyMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/DigitransitRentalVehiclePropertyMapper.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/DigitransitRentalVehiclePropertyMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/DigitransitVehicleRentalPropertyMapper.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/DigitransitVehicleRentalPropertyMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/DigitransitVehicleRentalPropertyMapper.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/DigitransitVehicleRentalPropertyMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/DigitransitVehicleRentalStationPropertyMapper.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/DigitransitVehicleRentalStationPropertyMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/DigitransitVehicleRentalStationPropertyMapper.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/vehiclerental/mapper/DigitransitVehicleRentalStationPropertyMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/vehicleparking/bikeep/BikeepUpdater.java b/application/src/ext/java/org/opentripplanner/ext/vehicleparking/bikeep/BikeepUpdater.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vehicleparking/bikeep/BikeepUpdater.java rename to application/src/ext/java/org/opentripplanner/ext/vehicleparking/bikeep/BikeepUpdater.java diff --git a/src/ext/java/org/opentripplanner/ext/vehicleparking/bikeep/BikeepUpdaterParameters.java b/application/src/ext/java/org/opentripplanner/ext/vehicleparking/bikeep/BikeepUpdaterParameters.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vehicleparking/bikeep/BikeepUpdaterParameters.java rename to application/src/ext/java/org/opentripplanner/ext/vehicleparking/bikeep/BikeepUpdaterParameters.java diff --git a/src/ext/java/org/opentripplanner/ext/vehicleparking/bikely/BikelyUpdater.java b/application/src/ext/java/org/opentripplanner/ext/vehicleparking/bikely/BikelyUpdater.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vehicleparking/bikely/BikelyUpdater.java rename to application/src/ext/java/org/opentripplanner/ext/vehicleparking/bikely/BikelyUpdater.java diff --git a/src/ext/java/org/opentripplanner/ext/vehicleparking/bikely/BikelyUpdaterParameters.java b/application/src/ext/java/org/opentripplanner/ext/vehicleparking/bikely/BikelyUpdaterParameters.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vehicleparking/bikely/BikelyUpdaterParameters.java rename to application/src/ext/java/org/opentripplanner/ext/vehicleparking/bikely/BikelyUpdaterParameters.java diff --git a/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslFacilitiesDownloader.java b/application/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslFacilitiesDownloader.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslFacilitiesDownloader.java rename to application/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslFacilitiesDownloader.java diff --git a/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslHubToVehicleParkingGroupMapper.java b/application/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslHubToVehicleParkingGroupMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslHubToVehicleParkingGroupMapper.java rename to application/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslHubToVehicleParkingGroupMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslHubsDownloader.java b/application/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslHubsDownloader.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslHubsDownloader.java rename to application/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslHubsDownloader.java diff --git a/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkPatch.java b/application/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkPatch.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkPatch.java rename to application/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkPatch.java diff --git a/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkToVehicleParkingMapper.java b/application/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkToVehicleParkingMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkToVehicleParkingMapper.java rename to application/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkToVehicleParkingMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkUpdater.java b/application/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkUpdater.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkUpdater.java rename to application/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkUpdater.java diff --git a/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkUpdaterParameters.java b/application/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkUpdaterParameters.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkUpdaterParameters.java rename to application/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkUpdaterParameters.java diff --git a/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkUtilizationToPatchMapper.java b/application/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkUtilizationToPatchMapper.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkUtilizationToPatchMapper.java rename to application/src/ext/java/org/opentripplanner/ext/vehicleparking/hslpark/HslParkUtilizationToPatchMapper.java diff --git a/src/ext/java/org/opentripplanner/ext/vehicleparking/parkapi/BicycleParkAPIUpdater.java b/application/src/ext/java/org/opentripplanner/ext/vehicleparking/parkapi/BicycleParkAPIUpdater.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vehicleparking/parkapi/BicycleParkAPIUpdater.java rename to application/src/ext/java/org/opentripplanner/ext/vehicleparking/parkapi/BicycleParkAPIUpdater.java diff --git a/src/ext/java/org/opentripplanner/ext/vehicleparking/parkapi/CarParkAPIUpdater.java b/application/src/ext/java/org/opentripplanner/ext/vehicleparking/parkapi/CarParkAPIUpdater.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vehicleparking/parkapi/CarParkAPIUpdater.java rename to application/src/ext/java/org/opentripplanner/ext/vehicleparking/parkapi/CarParkAPIUpdater.java diff --git a/src/ext/java/org/opentripplanner/ext/vehicleparking/parkapi/ParkAPIUpdater.java b/application/src/ext/java/org/opentripplanner/ext/vehicleparking/parkapi/ParkAPIUpdater.java similarity index 97% rename from src/ext/java/org/opentripplanner/ext/vehicleparking/parkapi/ParkAPIUpdater.java rename to application/src/ext/java/org/opentripplanner/ext/vehicleparking/parkapi/ParkAPIUpdater.java index c6f775e588f..59a19b1cce7 100644 --- a/src/ext/java/org/opentripplanner/ext/vehicleparking/parkapi/ParkAPIUpdater.java +++ b/application/src/ext/java/org/opentripplanner/ext/vehicleparking/parkapi/ParkAPIUpdater.java @@ -15,7 +15,7 @@ import org.opentripplanner.framework.tostring.ToStringBuilder; import org.opentripplanner.model.calendar.openinghours.OHCalendar; import org.opentripplanner.model.calendar.openinghours.OpeningHoursCalendarService; -import org.opentripplanner.openstreetmap.OSMOpeningHoursParser; +import org.opentripplanner.osm.OsmOpeningHoursParser; import org.opentripplanner.routing.vehicle_parking.VehicleParking; import org.opentripplanner.routing.vehicle_parking.VehicleParkingSpaces; import org.opentripplanner.routing.vehicle_parking.VehicleParkingState; @@ -36,7 +36,7 @@ abstract class ParkAPIUpdater extends GenericJsonDataSource { private final String feedId; private final Collection staticTags; - private final OSMOpeningHoursParser osmOpeningHoursParser; + private final OsmOpeningHoursParser osmOpeningHoursParser; private final String url; public ParkAPIUpdater( @@ -47,7 +47,7 @@ public ParkAPIUpdater( this.feedId = parameters.feedId(); this.staticTags = parameters.tags(); this.osmOpeningHoursParser = - new OSMOpeningHoursParser(openingHoursCalendarService, parameters.timeZone()); + new OsmOpeningHoursParser(openingHoursCalendarService, parameters.timeZone()); this.url = parameters.url(); } diff --git a/src/ext/java/org/opentripplanner/ext/vehicleparking/parkapi/ParkAPIUpdaterParameters.java b/application/src/ext/java/org/opentripplanner/ext/vehicleparking/parkapi/ParkAPIUpdaterParameters.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vehicleparking/parkapi/ParkAPIUpdaterParameters.java rename to application/src/ext/java/org/opentripplanner/ext/vehicleparking/parkapi/ParkAPIUpdaterParameters.java diff --git a/src/ext/java/org/opentripplanner/ext/vehicleparking/sirifm/SiriFmDatasource.java b/application/src/ext/java/org/opentripplanner/ext/vehicleparking/sirifm/SiriFmDatasource.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vehicleparking/sirifm/SiriFmDatasource.java rename to application/src/ext/java/org/opentripplanner/ext/vehicleparking/sirifm/SiriFmDatasource.java diff --git a/src/ext/java/org/opentripplanner/ext/vehicleparking/sirifm/SiriFmUpdaterParameters.java b/application/src/ext/java/org/opentripplanner/ext/vehicleparking/sirifm/SiriFmUpdaterParameters.java similarity index 92% rename from src/ext/java/org/opentripplanner/ext/vehicleparking/sirifm/SiriFmUpdaterParameters.java rename to application/src/ext/java/org/opentripplanner/ext/vehicleparking/sirifm/SiriFmUpdaterParameters.java index 5afdffb7067..daecb2b2bb9 100644 --- a/src/ext/java/org/opentripplanner/ext/vehicleparking/sirifm/SiriFmUpdaterParameters.java +++ b/application/src/ext/java/org/opentripplanner/ext/vehicleparking/sirifm/SiriFmUpdaterParameters.java @@ -5,14 +5,13 @@ import java.net.URI; import java.time.Duration; -import org.opentripplanner.ext.vehicleparking.noi.NoiUpdater; import org.opentripplanner.updater.spi.HttpHeaders; import org.opentripplanner.updater.vehicle_parking.VehicleParkingSourceType; import org.opentripplanner.updater.vehicle_parking.VehicleParkingUpdaterParameters; /** * Class that extends {@link VehicleParkingUpdaterParameters} with parameters required by {@link - * NoiUpdater}. + * SiriFmDatasource}. */ public record SiriFmUpdaterParameters( String configRef, diff --git a/src/ext/java/org/opentripplanner/ext/vehiclerentalservicedirectory/VehicleRentalParameters.java b/application/src/ext/java/org/opentripplanner/ext/vehiclerentalservicedirectory/VehicleRentalParameters.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vehiclerentalservicedirectory/VehicleRentalParameters.java rename to application/src/ext/java/org/opentripplanner/ext/vehiclerentalservicedirectory/VehicleRentalParameters.java diff --git a/src/ext/java/org/opentripplanner/ext/vehiclerentalservicedirectory/VehicleRentalServiceDirectoryFetcher.java b/application/src/ext/java/org/opentripplanner/ext/vehiclerentalservicedirectory/VehicleRentalServiceDirectoryFetcher.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vehiclerentalservicedirectory/VehicleRentalServiceDirectoryFetcher.java rename to application/src/ext/java/org/opentripplanner/ext/vehiclerentalservicedirectory/VehicleRentalServiceDirectoryFetcher.java diff --git a/src/ext/java/org/opentripplanner/ext/vehiclerentalservicedirectory/api/NetworkParameters.java b/application/src/ext/java/org/opentripplanner/ext/vehiclerentalservicedirectory/api/NetworkParameters.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vehiclerentalservicedirectory/api/NetworkParameters.java rename to application/src/ext/java/org/opentripplanner/ext/vehiclerentalservicedirectory/api/NetworkParameters.java diff --git a/src/ext/java/org/opentripplanner/ext/vehiclerentalservicedirectory/api/VehicleRentalServiceDirectoryFetcherParameters.java b/application/src/ext/java/org/opentripplanner/ext/vehiclerentalservicedirectory/api/VehicleRentalServiceDirectoryFetcherParameters.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vehiclerentalservicedirectory/api/VehicleRentalServiceDirectoryFetcherParameters.java rename to application/src/ext/java/org/opentripplanner/ext/vehiclerentalservicedirectory/api/VehicleRentalServiceDirectoryFetcherParameters.java diff --git a/src/ext/resources/org/opentripplanner/ext/vectortiles/router-config.json b/application/src/ext/resources/org/opentripplanner/ext/vectortiles/router-config.json similarity index 100% rename from src/ext/resources/org/opentripplanner/ext/vectortiles/router-config.json rename to application/src/ext/resources/org/opentripplanner/ext/vectortiles/router-config.json diff --git a/src/main/java/META-INF/MANIFEST.MF b/application/src/main/java/META-INF/MANIFEST.MF similarity index 100% rename from src/main/java/META-INF/MANIFEST.MF rename to application/src/main/java/META-INF/MANIFEST.MF diff --git a/src/main/java/com/jhlabs/awt/ShapeStroke.java b/application/src/main/java/com/jhlabs/awt/ShapeStroke.java similarity index 100% rename from src/main/java/com/jhlabs/awt/ShapeStroke.java rename to application/src/main/java/com/jhlabs/awt/ShapeStroke.java diff --git a/src/main/java/com/jhlabs/awt/TextStroke.java b/application/src/main/java/com/jhlabs/awt/TextStroke.java similarity index 100% rename from src/main/java/com/jhlabs/awt/TextStroke.java rename to application/src/main/java/com/jhlabs/awt/TextStroke.java diff --git a/src/main/java/org/opentripplanner/api/common/LocationStringParser.java b/application/src/main/java/org/opentripplanner/api/common/LocationStringParser.java similarity index 100% rename from src/main/java/org/opentripplanner/api/common/LocationStringParser.java rename to application/src/main/java/org/opentripplanner/api/common/LocationStringParser.java diff --git a/src/main/java/org/opentripplanner/api/common/Message.java b/application/src/main/java/org/opentripplanner/api/common/Message.java similarity index 100% rename from src/main/java/org/opentripplanner/api/common/Message.java rename to application/src/main/java/org/opentripplanner/api/common/Message.java diff --git a/src/main/java/org/opentripplanner/api/common/OTPExceptionMapper.java b/application/src/main/java/org/opentripplanner/api/common/OTPExceptionMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/api/common/OTPExceptionMapper.java rename to application/src/main/java/org/opentripplanner/api/common/OTPExceptionMapper.java diff --git a/src/main/java/org/opentripplanner/api/error/PlannerError.java b/application/src/main/java/org/opentripplanner/api/error/PlannerError.java similarity index 100% rename from src/main/java/org/opentripplanner/api/error/PlannerError.java rename to application/src/main/java/org/opentripplanner/api/error/PlannerError.java diff --git a/src/main/java/org/opentripplanner/api/model/serverinfo/ApiConfigInfo.java b/application/src/main/java/org/opentripplanner/api/model/serverinfo/ApiConfigInfo.java similarity index 100% rename from src/main/java/org/opentripplanner/api/model/serverinfo/ApiConfigInfo.java rename to application/src/main/java/org/opentripplanner/api/model/serverinfo/ApiConfigInfo.java diff --git a/src/main/java/org/opentripplanner/api/model/serverinfo/ApiProjectVersion.java b/application/src/main/java/org/opentripplanner/api/model/serverinfo/ApiProjectVersion.java similarity index 100% rename from src/main/java/org/opentripplanner/api/model/serverinfo/ApiProjectVersion.java rename to application/src/main/java/org/opentripplanner/api/model/serverinfo/ApiProjectVersion.java diff --git a/src/main/java/org/opentripplanner/api/model/serverinfo/ApiServerInfo.java b/application/src/main/java/org/opentripplanner/api/model/serverinfo/ApiServerInfo.java similarity index 100% rename from src/main/java/org/opentripplanner/api/model/serverinfo/ApiServerInfo.java rename to application/src/main/java/org/opentripplanner/api/model/serverinfo/ApiServerInfo.java diff --git a/src/main/java/org/opentripplanner/api/model/serverinfo/ApiVersionControlInfo.java b/application/src/main/java/org/opentripplanner/api/model/serverinfo/ApiVersionControlInfo.java similarity index 100% rename from src/main/java/org/opentripplanner/api/model/serverinfo/ApiVersionControlInfo.java rename to application/src/main/java/org/opentripplanner/api/model/serverinfo/ApiVersionControlInfo.java diff --git a/src/main/java/org/opentripplanner/api/parameter/ApiRequestMode.java b/application/src/main/java/org/opentripplanner/api/parameter/ApiRequestMode.java similarity index 100% rename from src/main/java/org/opentripplanner/api/parameter/ApiRequestMode.java rename to application/src/main/java/org/opentripplanner/api/parameter/ApiRequestMode.java diff --git a/src/main/java/org/opentripplanner/api/parameter/MIMEImageFormat.java b/application/src/main/java/org/opentripplanner/api/parameter/MIMEImageFormat.java similarity index 100% rename from src/main/java/org/opentripplanner/api/parameter/MIMEImageFormat.java rename to application/src/main/java/org/opentripplanner/api/parameter/MIMEImageFormat.java diff --git a/src/main/java/org/opentripplanner/api/parameter/QualifiedMode.java b/application/src/main/java/org/opentripplanner/api/parameter/QualifiedMode.java similarity index 100% rename from src/main/java/org/opentripplanner/api/parameter/QualifiedMode.java rename to application/src/main/java/org/opentripplanner/api/parameter/QualifiedMode.java diff --git a/src/main/java/org/opentripplanner/api/parameter/QualifiedModeSet.java b/application/src/main/java/org/opentripplanner/api/parameter/QualifiedModeSet.java similarity index 100% rename from src/main/java/org/opentripplanner/api/parameter/QualifiedModeSet.java rename to application/src/main/java/org/opentripplanner/api/parameter/QualifiedModeSet.java diff --git a/src/main/java/org/opentripplanner/api/parameter/Qualifier.java b/application/src/main/java/org/opentripplanner/api/parameter/Qualifier.java similarity index 100% rename from src/main/java/org/opentripplanner/api/parameter/Qualifier.java rename to application/src/main/java/org/opentripplanner/api/parameter/Qualifier.java diff --git a/src/main/java/org/opentripplanner/api/parameter/package-info.java b/application/src/main/java/org/opentripplanner/api/parameter/package-info.java similarity index 100% rename from src/main/java/org/opentripplanner/api/parameter/package-info.java rename to application/src/main/java/org/opentripplanner/api/parameter/package-info.java diff --git a/src/main/java/org/opentripplanner/api/resource/DebugOutput.java b/application/src/main/java/org/opentripplanner/api/resource/DebugOutput.java similarity index 100% rename from src/main/java/org/opentripplanner/api/resource/DebugOutput.java rename to application/src/main/java/org/opentripplanner/api/resource/DebugOutput.java diff --git a/src/main/java/org/opentripplanner/api/resource/GraphInspectorTileResource.java b/application/src/main/java/org/opentripplanner/api/resource/GraphInspectorTileResource.java similarity index 100% rename from src/main/java/org/opentripplanner/api/resource/GraphInspectorTileResource.java rename to application/src/main/java/org/opentripplanner/api/resource/GraphInspectorTileResource.java diff --git a/src/main/java/org/opentripplanner/api/resource/InspectorLayersList.java b/application/src/main/java/org/opentripplanner/api/resource/InspectorLayersList.java similarity index 100% rename from src/main/java/org/opentripplanner/api/resource/InspectorLayersList.java rename to application/src/main/java/org/opentripplanner/api/resource/InspectorLayersList.java diff --git a/src/main/java/org/opentripplanner/api/resource/ServerInfo.java b/application/src/main/java/org/opentripplanner/api/resource/ServerInfo.java similarity index 100% rename from src/main/java/org/opentripplanner/api/resource/ServerInfo.java rename to application/src/main/java/org/opentripplanner/api/resource/ServerInfo.java diff --git a/src/main/java/org/opentripplanner/api/resource/TransitTimingOutput.java b/application/src/main/java/org/opentripplanner/api/resource/TransitTimingOutput.java similarity index 100% rename from src/main/java/org/opentripplanner/api/resource/TransitTimingOutput.java rename to application/src/main/java/org/opentripplanner/api/resource/TransitTimingOutput.java diff --git a/src/main/java/org/opentripplanner/api/resource/UpdaterStatusResource.java b/application/src/main/java/org/opentripplanner/api/resource/UpdaterStatusResource.java similarity index 100% rename from src/main/java/org/opentripplanner/api/resource/UpdaterStatusResource.java rename to application/src/main/java/org/opentripplanner/api/resource/UpdaterStatusResource.java diff --git a/src/main/java/org/opentripplanner/api/resource/WebMercatorTile.java b/application/src/main/java/org/opentripplanner/api/resource/WebMercatorTile.java similarity index 100% rename from src/main/java/org/opentripplanner/api/resource/WebMercatorTile.java rename to application/src/main/java/org/opentripplanner/api/resource/WebMercatorTile.java diff --git a/src/main/java/org/opentripplanner/apis/APIEndpoints.java b/application/src/main/java/org/opentripplanner/apis/APIEndpoints.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/APIEndpoints.java rename to application/src/main/java/org/opentripplanner/apis/APIEndpoints.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/GraphQLRequestContext.java b/application/src/main/java/org/opentripplanner/apis/gtfs/GraphQLRequestContext.java similarity index 97% rename from src/main/java/org/opentripplanner/apis/gtfs/GraphQLRequestContext.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/GraphQLRequestContext.java index dfc3e2d75f8..192cbb26aa9 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/GraphQLRequestContext.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/GraphQLRequestContext.java @@ -1,6 +1,5 @@ package org.opentripplanner.apis.gtfs; -import javax.annotation.Nonnull; import org.opentripplanner.routing.api.RoutingService; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.fares.FareService; @@ -38,7 +37,6 @@ public static GraphQLRequestContext ofServerContext(OtpServerRequestContext cont * Returns a clone of the default route request. The clone is necessary because one HTTP * request can lead to several GraphQL queries, for example through batch or alias queries. */ - @Nonnull @Override public RouteRequest defaultRouteRequest() { return defaultRouteRequest.clone(); diff --git a/src/main/java/org/opentripplanner/apis/gtfs/GraphQLScalars.java b/application/src/main/java/org/opentripplanner/apis/gtfs/GraphQLScalars.java similarity index 96% rename from src/main/java/org/opentripplanner/apis/gtfs/GraphQLScalars.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/GraphQLScalars.java index 8ec3172db52..25953652365 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/GraphQLScalars.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/GraphQLScalars.java @@ -16,7 +16,6 @@ import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.util.Optional; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.Geometry; import org.opentripplanner.framework.graphql.scalar.DateScalarFactory; import org.opentripplanner.framework.graphql.scalar.DurationScalarFactory; @@ -65,8 +64,7 @@ public String parseLiteral(Object input) { .coercing( new Coercing() { @Override - public String serialize(@Nonnull Object dataFetcherResult) - throws CoercingSerializeException { + public String serialize(Object dataFetcherResult) throws CoercingSerializeException { if (dataFetcherResult instanceof ZonedDateTime zdt) { return zdt.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME); } else if (dataFetcherResult instanceof OffsetDateTime odt) { @@ -123,8 +121,7 @@ public OffsetDateTime parseLiteral(Object input) throws CoercingParseLiteralExce private static final String VALIDATION_ERROR_MESSAGE = "Not a valid WGS84 coordinate value"; @Override - public Double serialize(@Nonnull Object dataFetcherResult) - throws CoercingSerializeException { + public Double serialize(Object dataFetcherResult) throws CoercingSerializeException { if (dataFetcherResult instanceof Double doubleValue) { return doubleValue; } else if (dataFetcherResult instanceof Float floatValue) { @@ -188,8 +185,7 @@ private static Optional validateCoordinate(double coordinate) { "Cost cannot be negative or greater than %d".formatted(MAX_COST); @Override - public Integer serialize(@Nonnull Object dataFetcherResult) - throws CoercingSerializeException { + public Integer serialize(Object dataFetcherResult) throws CoercingSerializeException { if (dataFetcherResult instanceof Integer intValue) { return intValue; } else if (dataFetcherResult instanceof Cost costValue) { @@ -358,8 +354,7 @@ public Grams parseLiteral(Object input) throws CoercingParseLiteralException { "Value is under 0 or greater than 1."; @Override - public Double serialize(@Nonnull Object dataFetcherResult) - throws CoercingSerializeException { + public Double serialize(Object dataFetcherResult) throws CoercingSerializeException { var validationException = new CoercingSerializeException(VALIDATION_ERROR_MESSAGE); if (dataFetcherResult instanceof Double doubleValue) { return validateRatio(doubleValue).orElseThrow(() -> validationException); @@ -425,8 +420,7 @@ private static Optional validateRatio(double ratio) { "Reluctance needs to be between %s and %s".formatted(MIN_Reluctance, MAX_Reluctance); @Override - public Double serialize(@Nonnull Object dataFetcherResult) - throws CoercingSerializeException { + public Double serialize(Object dataFetcherResult) throws CoercingSerializeException { if (dataFetcherResult instanceof Double doubleValue) { return doubleValue; } else if (dataFetcherResult instanceof Float floatValue) { diff --git a/src/main/java/org/opentripplanner/apis/gtfs/GraphQLUtils.java b/application/src/main/java/org/opentripplanner/apis/gtfs/GraphQLUtils.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/GraphQLUtils.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/GraphQLUtils.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/GtfsGraphQLAPI.java b/application/src/main/java/org/opentripplanner/apis/gtfs/GtfsGraphQLAPI.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/GtfsGraphQLAPI.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/GtfsGraphQLAPI.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/GtfsGraphQLIndex.java b/application/src/main/java/org/opentripplanner/apis/gtfs/GtfsGraphQLIndex.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/GtfsGraphQLIndex.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/GtfsGraphQLIndex.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/IntrospectionTypeWiring.java b/application/src/main/java/org/opentripplanner/apis/gtfs/IntrospectionTypeWiring.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/IntrospectionTypeWiring.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/IntrospectionTypeWiring.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/AgencyImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/AgencyImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/AgencyImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/AgencyImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/AlertEntityTypeResolver.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/AlertEntityTypeResolver.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/AlertEntityTypeResolver.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/AlertEntityTypeResolver.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/AlertImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/AlertImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/AlertImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/AlertImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/BikeParkImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/BikeParkImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/BikeParkImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/BikeParkImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/BikeRentalStationImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/BikeRentalStationImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/BikeRentalStationImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/BikeRentalStationImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/BookingInfoImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/BookingInfoImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/BookingInfoImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/BookingInfoImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/BookingTimeImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/BookingTimeImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/BookingTimeImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/BookingTimeImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/CarParkImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/CarParkImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/CarParkImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/CarParkImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/ContactInfoImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/ContactInfoImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/ContactInfoImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/ContactInfoImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/CoordinatesImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/CoordinatesImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/CoordinatesImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/CoordinatesImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/CurrencyImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/CurrencyImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/CurrencyImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/CurrencyImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/DefaultFareProductImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/DefaultFareProductImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/DefaultFareProductImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/DefaultFareProductImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/DepartureRowImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/DepartureRowImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/DepartureRowImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/DepartureRowImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/FareProductTypeResolver.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/FareProductTypeResolver.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/FareProductTypeResolver.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/FareProductTypeResolver.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/FareProductUseImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/FareProductUseImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/FareProductUseImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/FareProductUseImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/FeedImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/FeedImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/FeedImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/FeedImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/GeometryImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/GeometryImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/GeometryImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/GeometryImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/ItineraryImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/ItineraryImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/ItineraryImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/ItineraryImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/LegImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/LegImpl.java similarity index 94% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/LegImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/LegImpl.java index 2fd9220cae5..22f9cc3f764 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/LegImpl.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/LegImpl.java @@ -10,6 +10,7 @@ import org.opentripplanner.apis.gtfs.generated.GraphQLDataFetchers; import org.opentripplanner.apis.gtfs.generated.GraphQLTypes; import org.opentripplanner.apis.gtfs.mapping.NumberMapper; +import org.opentripplanner.apis.gtfs.mapping.RealtimeStateMapper; import org.opentripplanner.ext.restapi.mapping.LocalDateMapper; import org.opentripplanner.ext.ridehailing.model.RideEstimate; import org.opentripplanner.ext.ridehailing.model.RideHailingLeg; @@ -23,6 +24,7 @@ import org.opentripplanner.model.plan.StreetLeg; import org.opentripplanner.model.plan.TransitLeg; import org.opentripplanner.model.plan.WalkStep; +import org.opentripplanner.model.plan.legreference.LegReferenceSerializer; import org.opentripplanner.routing.alertpatch.TransitAlert; import org.opentripplanner.routing.alternativelegs.AlternativeLegs; import org.opentripplanner.routing.alternativelegs.AlternativeLegsFilter; @@ -189,10 +191,12 @@ public DataFetcher realTime() { return environment -> getSource(environment).getRealTime(); } - // TODO @Override - public DataFetcher realtimeState() { - return environment -> null; + public DataFetcher realtimeState() { + return environment -> { + var state = getSource(environment).getRealTimeState(); + return RealtimeStateMapper.map(state); + }; } @Override @@ -333,4 +337,15 @@ private DataFetcher> nextOrPreviousLegs(boolean includeDepartBefor public DataFetcher accessibilityScore() { return environment -> NumberMapper.toDouble(getSource(environment).accessibilityScore()); } + + @Override + public DataFetcher id() { + return environment -> { + var ref = getSource(environment).getLegReference(); + if (ref == null) { + return null; + } + return LegReferenceSerializer.encode(ref); + }; + } } diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/MoneyImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/MoneyImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/MoneyImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/MoneyImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/NodeTypeResolver.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/NodeTypeResolver.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/NodeTypeResolver.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/NodeTypeResolver.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/OpeningHoursImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/OpeningHoursImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/OpeningHoursImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/OpeningHoursImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/PatternImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/PatternImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/PatternImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/PatternImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/PlaceImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/PlaceImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/PlaceImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/PlaceImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/PlaceInterfaceTypeResolver.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/PlaceInterfaceTypeResolver.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/PlaceInterfaceTypeResolver.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/PlaceInterfaceTypeResolver.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/PlanConnectionImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/PlanConnectionImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/PlanConnectionImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/PlanConnectionImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/PlanImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/PlanImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/PlanImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/PlanImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/QueryTypeImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/QueryTypeImpl.java similarity index 97% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/QueryTypeImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/QueryTypeImpl.java index 0e70c13074b..95984ba6dd0 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/QueryTypeImpl.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/QueryTypeImpl.java @@ -27,12 +27,12 @@ import org.locationtech.jts.geom.Envelope; import org.opentripplanner.apis.gtfs.GraphQLRequestContext; import org.opentripplanner.apis.gtfs.GraphQLUtils; -import org.opentripplanner.apis.gtfs.PatternByServiceDatesFilter; import org.opentripplanner.apis.gtfs.generated.GraphQLDataFetchers; import org.opentripplanner.apis.gtfs.generated.GraphQLTypes; import org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLQueryTypeStopsByRadiusArgs; import org.opentripplanner.apis.gtfs.mapping.routerequest.LegacyRouteRequestMapper; import org.opentripplanner.apis.gtfs.mapping.routerequest.RouteRequestMapper; +import org.opentripplanner.apis.gtfs.support.filter.PatternByDateFilterUtil; import org.opentripplanner.apis.gtfs.support.time.LocalDateRangeUtil; import org.opentripplanner.ext.fares.impl.DefaultFareService; import org.opentripplanner.ext.fares.impl.GtfsFaresService; @@ -42,6 +42,9 @@ import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.gtfs.mapping.DirectionMapper; import org.opentripplanner.model.TripTimeOnDate; +import org.opentripplanner.model.plan.Leg; +import org.opentripplanner.model.plan.legreference.LegReference; +import org.opentripplanner.model.plan.legreference.LegReferenceSerializer; import org.opentripplanner.routing.alertpatch.EntitySelector; import org.opentripplanner.routing.alertpatch.TransitAlert; import org.opentripplanner.routing.api.request.RouteRequest; @@ -362,6 +365,20 @@ public DataFetcher> nearest() { }; } + @Override + public DataFetcher leg() { + return environment -> { + TransitService transitService = getTransitService(environment); + var args = new GraphQLTypes.GraphQLQueryTypeLegArgs(environment.getArguments()); + String id = args.getGraphQLId(); + LegReference ref = LegReferenceSerializer.decode(id); + if (ref == null) { + return null; + } + return ref.getLeg(transitService); + }; + } + @Override public DataFetcher node() { return environment -> { @@ -615,8 +632,11 @@ public DataFetcher> routes() { } if (LocalDateRangeUtil.hasServiceDateFilter(args.getGraphQLServiceDates())) { - var filter = new PatternByServiceDatesFilter(args.getGraphQLServiceDates(), transitService); - routeStream = filter.filterRoutes(routeStream).stream(); + var filter = PatternByDateFilterUtil.ofGraphQL( + args.getGraphQLServiceDates(), + transitService + ); + routeStream = filter.filterRoutes(routeStream.toList()).stream(); } return routeStream.toList(); }; diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RentalVehicleImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RentalVehicleImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RentalVehicleImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RentalVehicleImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RentalVehicleTypeImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RentalVehicleTypeImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RentalVehicleTypeImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RentalVehicleTypeImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RideHailingEstimateImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RideHailingEstimateImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RideHailingEstimateImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RideHailingEstimateImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RouteImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RouteImpl.java similarity index 97% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RouteImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RouteImpl.java index a3f557951f0..ae6acb0a297 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RouteImpl.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RouteImpl.java @@ -9,12 +9,12 @@ import java.util.stream.Collectors; import org.opentripplanner.apis.gtfs.GraphQLRequestContext; import org.opentripplanner.apis.gtfs.GraphQLUtils; -import org.opentripplanner.apis.gtfs.PatternByServiceDatesFilter; import org.opentripplanner.apis.gtfs.generated.GraphQLDataFetchers; import org.opentripplanner.apis.gtfs.generated.GraphQLTypes; import org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLBikesAllowed; import org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLTransitMode; import org.opentripplanner.apis.gtfs.mapping.BikesAllowedMapper; +import org.opentripplanner.apis.gtfs.support.filter.PatternByDateFilterUtil; import org.opentripplanner.apis.gtfs.support.time.LocalDateRangeUtil; import org.opentripplanner.routing.alertpatch.EntitySelector; import org.opentripplanner.routing.alertpatch.TransitAlert; @@ -183,7 +183,10 @@ public DataFetcher> patterns() { var args = new GraphQLTypes.GraphQLRoutePatternsArgs(environment.getArguments()); if (LocalDateRangeUtil.hasServiceDateFilter(args.getGraphQLServiceDates())) { - var filter = new PatternByServiceDatesFilter(args.getGraphQLServiceDates(), transitService); + var filter = PatternByDateFilterUtil.ofGraphQL( + args.getGraphQLServiceDates(), + transitService + ); return filter.filterPatterns(patterns); } else { return patterns; diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RouteTypeImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RouteTypeImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RouteTypeImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RouteTypeImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RoutingErrorImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RoutingErrorImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RoutingErrorImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/RoutingErrorImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopGeometriesImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopGeometriesImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopGeometriesImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopGeometriesImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopImpl.java similarity index 96% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopImpl.java index 0730d2fbc91..8d9c11bb7d4 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopImpl.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopImpl.java @@ -18,6 +18,8 @@ import org.opentripplanner.apis.gtfs.GraphQLUtils; import org.opentripplanner.apis.gtfs.generated.GraphQLDataFetchers; import org.opentripplanner.apis.gtfs.generated.GraphQLTypes; +import org.opentripplanner.apis.gtfs.support.filter.PatternByDateFilterUtil; +import org.opentripplanner.apis.gtfs.support.time.LocalDateRangeUtil; import org.opentripplanner.framework.time.ServiceDateUtils; import org.opentripplanner.model.StopTimesInPattern; import org.opentripplanner.model.TripTimeOnDate; @@ -243,7 +245,19 @@ public DataFetcher platformCode() { @Override public DataFetcher> routes() { - return this::getRoutes; + return env -> { + var args = new GraphQLTypes.GraphQLStopRoutesArgs(env.getArguments()); + var routes = getRoutes(env); + if (LocalDateRangeUtil.hasServiceDateFilter(args.getGraphQLServiceDates())) { + var filter = PatternByDateFilterUtil.ofGraphQL( + args.getGraphQLServiceDates(), + getTransitService(env) + ); + return filter.filterRoutes(routes); + } else { + return routes; + } + }; } @Override @@ -264,7 +278,7 @@ public DataFetcher> stopTimesForPattern() { return null; } - if (transitService.hasRealtimeAddedTripPatterns()) { + if (transitService.hasNewTripPatternsForModifiedTrips()) { return getTripTimeOnDatesForPatternAtStopIncludingTripsWithSkippedStops( pattern, stop, @@ -548,7 +562,7 @@ private Stream getRealtimeAddedPatternsAsStream( ) { return originalPattern .scheduledTripsAsStream() - .map(trip -> transitService.getRealtimeAddedTripPattern(trip.getId(), date)) + .map(trip -> transitService.getNewTripPatternForModifiedTrip(trip.getId(), date)) .filter(tripPattern -> tripPattern != null && tripPattern.isModifiedFromTripPatternWithEqualStops(originalPattern) ); diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopOnRouteImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopOnRouteImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopOnRouteImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopOnRouteImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopOnTripImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopOnTripImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopOnTripImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopOnTripImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopRelationshipImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopRelationshipImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopRelationshipImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StopRelationshipImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StoptimeImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StoptimeImpl.java similarity index 91% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StoptimeImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StoptimeImpl.java index faf59ef9d6e..bc14d15fbf2 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StoptimeImpl.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StoptimeImpl.java @@ -3,10 +3,11 @@ import graphql.schema.DataFetcher; import graphql.schema.DataFetchingEnvironment; import org.opentripplanner.apis.gtfs.generated.GraphQLDataFetchers; +import org.opentripplanner.apis.gtfs.generated.GraphQLTypes; +import org.opentripplanner.apis.gtfs.mapping.RealtimeStateMapper; import org.opentripplanner.framework.graphql.GraphQLUtils; import org.opentripplanner.model.StopTime; import org.opentripplanner.model.TripTimeOnDate; -import org.opentripplanner.transit.model.timetable.RealTimeState; import org.opentripplanner.transit.model.timetable.Trip; public class StoptimeImpl implements GraphQLDataFetchers.GraphQLStoptime { @@ -67,11 +68,11 @@ public DataFetcher realtimeDeparture() { } @Override - public DataFetcher realtimeState() { + public DataFetcher realtimeState() { return environment -> getSource(environment).isCanceledEffectively() - ? RealTimeState.CANCELED.name() - : getSource(environment).getRealTimeState().name(); + ? GraphQLTypes.GraphQLRealtimeState.CANCELED + : RealtimeStateMapper.map(getSource(environment).getRealTimeState()); } @Override diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StoptimesInPatternImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StoptimesInPatternImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StoptimesInPatternImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StoptimesInPatternImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/SystemNoticeImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/SystemNoticeImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/SystemNoticeImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/SystemNoticeImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/TicketTypeImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/TicketTypeImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/TicketTypeImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/TicketTypeImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/TranslatedStringImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/TranslatedStringImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/TranslatedStringImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/TranslatedStringImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/TripImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/TripImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/TripImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/TripImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/TripOccupancyImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/TripOccupancyImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/TripOccupancyImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/TripOccupancyImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/UnknownImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/UnknownImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/UnknownImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/UnknownImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/VehicleParkingImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/VehicleParkingImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/VehicleParkingImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/VehicleParkingImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/VehiclePositionImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/VehiclePositionImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/VehiclePositionImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/VehiclePositionImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/VehicleRentalNetworkImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/VehicleRentalNetworkImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/VehicleRentalNetworkImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/VehicleRentalNetworkImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/VehicleRentalStationImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/VehicleRentalStationImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/VehicleRentalStationImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/VehicleRentalStationImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/debugOutputImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/debugOutputImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/debugOutputImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/debugOutputImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/elevationProfileComponentImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/elevationProfileComponentImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/elevationProfileComponentImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/elevationProfileComponentImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/placeAtDistanceImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/placeAtDistanceImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/placeAtDistanceImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/placeAtDistanceImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/serviceTimeRangeImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/serviceTimeRangeImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/serviceTimeRangeImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/serviceTimeRangeImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/stepImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/stepImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/stepImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/stepImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/stopAtDistanceImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/stopAtDistanceImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/datafetchers/stopAtDistanceImpl.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/stopAtDistanceImpl.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLDataFetchers.java b/application/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLDataFetchers.java similarity index 99% rename from src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLDataFetchers.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLDataFetchers.java index d501d2e5cea..235b1d2bb14 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLDataFetchers.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLDataFetchers.java @@ -18,6 +18,7 @@ import org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLBikesAllowed; import org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLInputField; import org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLOccupancyStatus; +import org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLRealtimeState; import org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLRelativeDirection; import org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLRoutingErrorCode; import org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLTransitMode; @@ -482,6 +483,8 @@ public interface GraphQLLeg { public DataFetcher headsign(); + public DataFetcher id(); + public DataFetcher interlineWithPreviousLeg(); public DataFetcher intermediatePlace(); @@ -504,7 +507,7 @@ public interface GraphQLLeg { public DataFetcher realTime(); - public DataFetcher realtimeState(); + public DataFetcher realtimeState(); public DataFetcher rentedBike(); @@ -781,6 +784,8 @@ public interface GraphQLQueryType { public DataFetcher fuzzyTrip(); + public DataFetcher leg(); + public DataFetcher> nearest(); public DataFetcher node(); @@ -1080,7 +1085,7 @@ public interface GraphQLStoptime { public DataFetcher realtimeDeparture(); - public DataFetcher realtimeState(); + public DataFetcher realtimeState(); public DataFetcher scheduledArrival(); diff --git a/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLTypes.java b/application/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLTypes.java similarity index 99% rename from src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLTypes.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLTypes.java index 412a8831149..369adde95ec 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLTypes.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLTypes.java @@ -2495,6 +2495,25 @@ public void setGraphQLTime(Integer time) { } } + public static class GraphQLQueryTypeLegArgs { + + private String id; + + public GraphQLQueryTypeLegArgs(Map args) { + if (args != null) { + this.id = (String) args.get("id"); + } + } + + public String getGraphQLId() { + return this.id; + } + + public void setGraphQLId(String id) { + this.id = id; + } + } + public static class GraphQLQueryTypeNearestArgs { private String after; @@ -4294,6 +4313,26 @@ public void setGraphQLLanguage(String language) { } } + public static class GraphQLStopRoutesArgs { + + private GraphQLLocalDateRangeInput serviceDates; + + public GraphQLStopRoutesArgs(Map args) { + if (args != null) { + this.serviceDates = + new GraphQLLocalDateRangeInput((Map) args.get("serviceDates")); + } + } + + public GraphQLLocalDateRangeInput getGraphQLServiceDates() { + return this.serviceDates; + } + + public void setGraphQLServiceDates(GraphQLLocalDateRangeInput serviceDates) { + this.serviceDates = serviceDates; + } + } + public static class GraphQLStopStopTimesForPatternArgs { private String id; diff --git a/src/main/java/org/opentripplanner/apis/gtfs/generated/README.md b/application/src/main/java/org/opentripplanner/apis/gtfs/generated/README.md similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/generated/README.md rename to application/src/main/java/org/opentripplanner/apis/gtfs/generated/README.md diff --git a/src/main/java/org/opentripplanner/apis/gtfs/generated/graphql-codegen.yml b/application/src/main/java/org/opentripplanner/apis/gtfs/generated/graphql-codegen.yml similarity index 98% rename from src/main/java/org/opentripplanner/apis/gtfs/generated/graphql-codegen.yml rename to application/src/main/java/org/opentripplanner/apis/gtfs/generated/graphql-codegen.yml index 29490a28b78..2a7f2a95ba0 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/generated/graphql-codegen.yml +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/generated/graphql-codegen.yml @@ -84,7 +84,7 @@ config: PlanConnection: graphql.execution.DataFetcherResult PlanEdge: graphql.relay.DefaultEdge#DefaultEdge PlanPageInfo: org.opentripplanner.apis.gtfs.model.PlanPageInfo#PlanPageInfo - RealtimeState: String + RealtimeState: org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLRealtimeState#GraphQLRealtimeState RelativeDirection: org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLRelativeDirection#GraphQLRelativeDirection Route: org.opentripplanner.transit.model.network.Route#Route RoutingError: org.opentripplanner.routing.api.response.RoutingError#RoutingError diff --git a/src/main/java/org/opentripplanner/apis/gtfs/generated/package.json b/application/src/main/java/org/opentripplanner/apis/gtfs/generated/package.json similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/generated/package.json rename to application/src/main/java/org/opentripplanner/apis/gtfs/generated/package.json diff --git a/src/main/java/org/opentripplanner/apis/gtfs/generated/yarn.lock b/application/src/main/java/org/opentripplanner/apis/gtfs/generated/yarn.lock similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/generated/yarn.lock rename to application/src/main/java/org/opentripplanner/apis/gtfs/generated/yarn.lock diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/AlertCauseMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/AlertCauseMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/AlertCauseMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/AlertCauseMapper.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/AlertEffectMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/AlertEffectMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/AlertEffectMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/AlertEffectMapper.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/BikesAllowedMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/BikesAllowedMapper.java similarity index 78% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/BikesAllowedMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/BikesAllowedMapper.java index cd04601d599..79f55f1e50a 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/mapping/BikesAllowedMapper.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/BikesAllowedMapper.java @@ -1,13 +1,11 @@ package org.opentripplanner.apis.gtfs.mapping; -import javax.annotation.Nonnull; import org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLBikesAllowed; import org.opentripplanner.transit.model.network.BikeAccess; public class BikesAllowedMapper { - @Nonnull - public static GraphQLBikesAllowed map(@Nonnull BikeAccess bikesAllowed) { + public static GraphQLBikesAllowed map(BikeAccess bikesAllowed) { return switch (bikesAllowed) { case UNKNOWN -> GraphQLBikesAllowed.NO_INFORMATION; case ALLOWED -> GraphQLBikesAllowed.ALLOWED; diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/DirectionMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/DirectionMapper.java similarity index 97% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/DirectionMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/DirectionMapper.java index 1deb6e3bb0e..69a78b05f55 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/mapping/DirectionMapper.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/DirectionMapper.java @@ -1,6 +1,5 @@ package org.opentripplanner.apis.gtfs.mapping; -import javax.annotation.Nonnull; import org.opentripplanner.apis.gtfs.generated.GraphQLTypes; import org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLAbsoluteDirection; import org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLRelativeDirection; @@ -9,7 +8,6 @@ public final class DirectionMapper { - @Nonnull public static GraphQLAbsoluteDirection map(AbsoluteDirection dir) { return switch (dir) { case NORTH -> GraphQLAbsoluteDirection.NORTH; @@ -23,7 +21,6 @@ public static GraphQLAbsoluteDirection map(AbsoluteDirection dir) { }; } - @Nonnull public static GraphQLRelativeDirection map(RelativeDirection relativeDirection) { return switch (relativeDirection) { case DEPART -> GraphQLRelativeDirection.DEPART; diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/NumberMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/NumberMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/NumberMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/NumberMapper.java diff --git a/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/RealtimeStateMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/RealtimeStateMapper.java new file mode 100644 index 00000000000..6bd46466546 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/RealtimeStateMapper.java @@ -0,0 +1,22 @@ +package org.opentripplanner.apis.gtfs.mapping; + +import javax.annotation.Nullable; +import org.opentripplanner.apis.gtfs.generated.GraphQLTypes; +import org.opentripplanner.transit.model.timetable.RealTimeState; + +/** + * Maps from the internal model to the API one. + */ +public class RealtimeStateMapper { + + public static GraphQLTypes.GraphQLRealtimeState map(@Nullable RealTimeState state) { + if (state == null) return null; + return switch (state) { + case SCHEDULED -> GraphQLTypes.GraphQLRealtimeState.SCHEDULED; + case UPDATED -> GraphQLTypes.GraphQLRealtimeState.UPDATED; + case CANCELED, DELETED -> GraphQLTypes.GraphQLRealtimeState.CANCELED; + case ADDED -> GraphQLTypes.GraphQLRealtimeState.ADDED; + case MODIFIED -> GraphQLTypes.GraphQLRealtimeState.MODIFIED; + }; + } +} diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/SeverityMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/SeverityMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/SeverityMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/SeverityMapper.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/StreetNoteMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/StreetNoteMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/StreetNoteMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/StreetNoteMapper.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/TransitModeMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/TransitModeMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/TransitModeMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/TransitModeMapper.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/AccessModeMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/AccessModeMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/AccessModeMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/AccessModeMapper.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/ArgumentUtils.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/ArgumentUtils.java similarity index 98% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/ArgumentUtils.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/ArgumentUtils.java index b04affeaaf2..8541bd1c3c5 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/ArgumentUtils.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/ArgumentUtils.java @@ -7,7 +7,6 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.apis.gtfs.generated.GraphQLTypes; @@ -63,7 +62,6 @@ static Map getParking(DataFetchingEnvironment environment, Strin *

* TODO this ugliness can be removed when the bug gets fixed */ - @Nonnull static Collection> getParkingFilters( DataFetchingEnvironment environment, String type @@ -83,7 +81,6 @@ static Collection> getParkingFilters( *

* TODO this ugliness can be removed when the bug gets fixed */ - @Nonnull static Collection> getParkingPreferred( DataFetchingEnvironment environment, String type @@ -103,7 +100,6 @@ static Set parseSelectFilters(Collection> filters) { return parseFilters(filters, "select"); } - @Nonnull private static Set parseFilters(Collection> filters, String key) { return filters .stream() diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/BicyclePreferencesMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/BicyclePreferencesMapper.java similarity index 98% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/BicyclePreferencesMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/BicyclePreferencesMapper.java index 7205757a569..cd4d508282e 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/BicyclePreferencesMapper.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/BicyclePreferencesMapper.java @@ -60,7 +60,7 @@ private static void setBicycleWalkPreferences( var mountTime = args.getGraphQLMountDismountTime(); if (mountTime != null) { preferences.withMountDismountTime( - DurationUtils.requireNonNegativeShort(mountTime, "bicycle mount dismount time") + DurationUtils.requireNonNegativeMax30minutes(mountTime, "bicycle mount dismount time") ); } var cost = args.getGraphQLCost(); diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/CarPreferencesMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/CarPreferencesMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/CarPreferencesMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/CarPreferencesMapper.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/DirectModeMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/DirectModeMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/DirectModeMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/DirectModeMapper.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/EgressModeMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/EgressModeMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/EgressModeMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/EgressModeMapper.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/ItineraryFilterDebugProfileMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/ItineraryFilterDebugProfileMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/ItineraryFilterDebugProfileMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/ItineraryFilterDebugProfileMapper.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapper.java similarity index 99% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapper.java index 050127d9a27..696ce9c45b5 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapper.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapper.java @@ -12,7 +12,6 @@ import java.util.Map; import java.util.function.Consumer; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import org.opentripplanner.api.common.LocationStringParser; import org.opentripplanner.api.parameter.QualifiedMode; import org.opentripplanner.api.parameter.QualifiedModeSet; @@ -35,7 +34,6 @@ public class LegacyRouteRequestMapper { - @Nonnull public static RouteRequest toRouteRequest( DataFetchingEnvironment environment, GraphQLRequestContext context diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/ModePreferencesMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/ModePreferencesMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/ModePreferencesMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/ModePreferencesMapper.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/OptimizationTypeMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/OptimizationTypeMapper.java similarity index 94% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/OptimizationTypeMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/OptimizationTypeMapper.java index dc17891f9d2..6e848ce7f66 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/OptimizationTypeMapper.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/OptimizationTypeMapper.java @@ -1,12 +1,10 @@ package org.opentripplanner.apis.gtfs.mapping.routerequest; -import javax.annotation.Nonnull; import org.opentripplanner.apis.gtfs.generated.GraphQLTypes; import org.opentripplanner.routing.core.VehicleRoutingOptimizeType; public final class OptimizationTypeMapper { - @Nonnull public static VehicleRoutingOptimizeType map(GraphQLTypes.GraphQLOptimizeType optimizeType) { return switch (optimizeType) { case QUICK -> VehicleRoutingOptimizeType.SHORTEST_DURATION; diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapper.java similarity index 98% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapper.java index ada358d98b3..22834b200f6 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapper.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapper.java @@ -9,7 +9,6 @@ import graphql.schema.DataFetchingEnvironment; import java.time.Instant; -import javax.annotation.Nonnull; import org.opentripplanner.apis.gtfs.GraphQLRequestContext; import org.opentripplanner.apis.gtfs.generated.GraphQLTypes; import org.opentripplanner.framework.graphql.GraphQLUtils; @@ -22,7 +21,6 @@ public class RouteRequestMapper { - @Nonnull public static RouteRequest toRouteRequest( DataFetchingEnvironment environment, GraphQLRequestContext context @@ -43,7 +41,7 @@ public static RouteRequest toRouteRequest( request.setLocale(GraphQLUtils.getLocale(environment, args.getGraphQLLocale())); if (args.getGraphQLSearchWindow() != null) { request.setSearchWindow( - DurationUtils.requireNonNegativeLong(args.getGraphQLSearchWindow(), "searchWindow") + DurationUtils.requireNonNegativeMax2days(args.getGraphQLSearchWindow(), "searchWindow") ); } diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/ScooterPreferencesMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/ScooterPreferencesMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/ScooterPreferencesMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/ScooterPreferencesMapper.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/TransferModeMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/TransferModeMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/TransferModeMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/TransferModeMapper.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/TransitPreferencesMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/TransitPreferencesMapper.java similarity index 94% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/TransitPreferencesMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/TransitPreferencesMapper.java index d119c9bb8af..f9ef3d2af55 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/TransitPreferencesMapper.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/TransitPreferencesMapper.java @@ -47,7 +47,7 @@ static void setTransitPreferences( var slack = board.getGraphQLSlack(); if (slack != null) { transitPreferences.withDefaultBoardSlackSec( - (int) DurationUtils.requireNonNegativeMedium(slack, "board slack").toSeconds() + (int) DurationUtils.requireNonNegativeMax2hours(slack, "board slack").toSeconds() ); } var waitReluctance = board.getGraphQLWaitReluctance(); @@ -60,7 +60,7 @@ static void setTransitPreferences( var slack = alight.getGraphQLSlack(); if (slack != null) { transitPreferences.withDefaultAlightSlackSec( - (int) DurationUtils.requireNonNegativeMedium(slack, "alight slack").toSeconds() + (int) DurationUtils.requireNonNegativeMax2hours(slack, "alight slack").toSeconds() ); } } @@ -73,7 +73,7 @@ static void setTransitPreferences( var slack = transfer.getGraphQLSlack(); if (slack != null) { transferPreferences.withSlack( - DurationUtils.requireNonNegativeMedium(slack, "transfer slack") + DurationUtils.requireNonNegativeMax2hours(slack, "transfer slack") ); } var maxTransfers = transfer.getGraphQLMaximumTransfers(); diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/VehicleOptimizationTypeMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/VehicleOptimizationTypeMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/VehicleOptimizationTypeMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/VehicleOptimizationTypeMapper.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/WalkPreferencesMapper.java b/application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/WalkPreferencesMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/WalkPreferencesMapper.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/WalkPreferencesMapper.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/model/FeedPublisher.java b/application/src/main/java/org/opentripplanner/apis/gtfs/model/FeedPublisher.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/model/FeedPublisher.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/model/FeedPublisher.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/model/LocalDateRange.java b/application/src/main/java/org/opentripplanner/apis/gtfs/model/LocalDateRange.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/model/LocalDateRange.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/model/LocalDateRange.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/model/PlanPageInfo.java b/application/src/main/java/org/opentripplanner/apis/gtfs/model/PlanPageInfo.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/model/PlanPageInfo.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/model/PlanPageInfo.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/model/RideHailingProvider.java b/application/src/main/java/org/opentripplanner/apis/gtfs/model/RideHailingProvider.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/model/RideHailingProvider.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/model/RideHailingProvider.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/model/RouteTypeModel.java b/application/src/main/java/org/opentripplanner/apis/gtfs/model/RouteTypeModel.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/model/RouteTypeModel.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/model/RouteTypeModel.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/model/StopOnRouteModel.java b/application/src/main/java/org/opentripplanner/apis/gtfs/model/StopOnRouteModel.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/model/StopOnRouteModel.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/model/StopOnRouteModel.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/model/StopOnTripModel.java b/application/src/main/java/org/opentripplanner/apis/gtfs/model/StopOnTripModel.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/model/StopOnTripModel.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/model/StopOnTripModel.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/model/StopPosition.java b/application/src/main/java/org/opentripplanner/apis/gtfs/model/StopPosition.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/model/StopPosition.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/model/StopPosition.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/model/TripOccupancy.java b/application/src/main/java/org/opentripplanner/apis/gtfs/model/TripOccupancy.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/model/TripOccupancy.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/model/TripOccupancy.java diff --git a/src/main/java/org/opentripplanner/apis/gtfs/model/UnknownModel.java b/application/src/main/java/org/opentripplanner/apis/gtfs/model/UnknownModel.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/model/UnknownModel.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/model/UnknownModel.java diff --git a/application/src/main/java/org/opentripplanner/apis/gtfs/support/filter/PatternByDateFilterUtil.java b/application/src/main/java/org/opentripplanner/apis/gtfs/support/filter/PatternByDateFilterUtil.java new file mode 100644 index 00000000000..f3c0d6d0352 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/support/filter/PatternByDateFilterUtil.java @@ -0,0 +1,23 @@ +package org.opentripplanner.apis.gtfs.support.filter; + +import org.opentripplanner.apis.gtfs.generated.GraphQLTypes; +import org.opentripplanner.apis.gtfs.model.LocalDateRange; +import org.opentripplanner.transit.service.PatternByServiceDatesFilter; +import org.opentripplanner.transit.service.TransitService; + +/** + * Utility methods for instantiating a {@link PatternByServiceDatesFilter}. + */ +public class PatternByDateFilterUtil { + + public static PatternByServiceDatesFilter ofGraphQL( + GraphQLTypes.GraphQLLocalDateRangeInput range, + TransitService transitService + ) { + return new PatternByServiceDatesFilter( + new LocalDateRange(range.getGraphQLStart(), range.getGraphQLEnd()), + transitService::getPatternsForRoute, + trip -> transitService.getCalendarService().getServiceDatesForServiceId(trip.getServiceId()) + ); + } +} diff --git a/src/main/java/org/opentripplanner/apis/gtfs/support/time/LocalDateRangeUtil.java b/application/src/main/java/org/opentripplanner/apis/gtfs/support/time/LocalDateRangeUtil.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/support/time/LocalDateRangeUtil.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/support/time/LocalDateRangeUtil.java diff --git a/src/main/java/org/opentripplanner/apis/support/SemanticHash.java b/application/src/main/java/org/opentripplanner/apis/support/SemanticHash.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/support/SemanticHash.java rename to application/src/main/java/org/opentripplanner/apis/support/SemanticHash.java diff --git a/src/main/java/org/opentripplanner/apis/support/TileJson.java b/application/src/main/java/org/opentripplanner/apis/support/TileJson.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/support/TileJson.java rename to application/src/main/java/org/opentripplanner/apis/support/TileJson.java diff --git a/src/main/java/org/opentripplanner/apis/support/graphql/LoggingDataFetcherExceptionHandler.java b/application/src/main/java/org/opentripplanner/apis/support/graphql/LoggingDataFetcherExceptionHandler.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/support/graphql/LoggingDataFetcherExceptionHandler.java rename to application/src/main/java/org/opentripplanner/apis/support/graphql/LoggingDataFetcherExceptionHandler.java diff --git a/src/main/java/org/opentripplanner/apis/support/mapping/PlannerErrorMapper.java b/application/src/main/java/org/opentripplanner/apis/support/mapping/PlannerErrorMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/support/mapping/PlannerErrorMapper.java rename to application/src/main/java/org/opentripplanner/apis/support/mapping/PlannerErrorMapper.java diff --git a/src/main/java/org/opentripplanner/apis/support/mapping/PropertyMapper.java b/application/src/main/java/org/opentripplanner/apis/support/mapping/PropertyMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/support/mapping/PropertyMapper.java rename to application/src/main/java/org/opentripplanner/apis/support/mapping/PropertyMapper.java diff --git a/src/main/java/org/opentripplanner/apis/support/mapping/StreetNoteMapper.java b/application/src/main/java/org/opentripplanner/apis/support/mapping/StreetNoteMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/support/mapping/StreetNoteMapper.java rename to application/src/main/java/org/opentripplanner/apis/support/mapping/StreetNoteMapper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/MaxFieldsInResultInstrumentation.java b/application/src/main/java/org/opentripplanner/apis/transmodel/MaxFieldsInResultInstrumentation.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/MaxFieldsInResultInstrumentation.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/MaxFieldsInResultInstrumentation.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/ResponseTooLargeException.java b/application/src/main/java/org/opentripplanner/apis/transmodel/ResponseTooLargeException.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/ResponseTooLargeException.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/ResponseTooLargeException.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/TransmodelAPI.java b/application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelAPI.java similarity index 97% rename from src/main/java/org/opentripplanner/apis/transmodel/TransmodelAPI.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelAPI.java index 4ce7c1561bb..fa8601096dc 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/TransmodelAPI.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelAPI.java @@ -20,7 +20,6 @@ import java.util.Map; import java.util.stream.Collectors; import org.opentripplanner.apis.transmodel.mapping.TransitIdMapper; -import org.opentripplanner.apis.transmodel.support.GqlUtil; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.standalone.api.OtpServerRequestContext; import org.opentripplanner.transit.service.TransitModel; @@ -75,8 +74,7 @@ public static void setUp( } tracingHeaderTags = config.tracingHeaderTags(); maxNumberOfResultFields = config.maxNumberOfResultFields(); - GqlUtil gqlUtil = new GqlUtil(transitModel.getTimeZone()); - schema = TransmodelGraphQLSchema.create(defaultRouteRequest, gqlUtil); + schema = TransmodelGraphQLSchema.create(defaultRouteRequest, transitModel.getTimeZone()); } @POST diff --git a/src/main/java/org/opentripplanner/apis/transmodel/TransmodelAPIParameters.java b/application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelAPIParameters.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/TransmodelAPIParameters.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelAPIParameters.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraph.java b/application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraph.java similarity index 96% rename from src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraph.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraph.java index 79e767b1fea..f4241fcbc61 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraph.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraph.java @@ -25,6 +25,7 @@ import org.opentripplanner.framework.concurrent.OtpRequestThreadFactory; import org.opentripplanner.framework.lang.ObjectUtils; import org.opentripplanner.standalone.api.OtpServerRequestContext; +import org.opentripplanner.transit.model.framework.EntityNotFoundException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -72,7 +73,7 @@ Response executeGraphQL( return ExecutionResultMapper.timeoutResponse(); } catch (ResponseTooLargeException rtle) { return ExecutionResultMapper.tooLargeResponse(rtle.getMessage()); - } catch (CoercingParseValueException | UnknownOperationException e) { + } catch (EntityNotFoundException | CoercingParseValueException | UnknownOperationException e) { return ExecutionResultMapper.badRequestResponse(e.getMessage()); } catch (Exception systemError) { LOG.error(systemError.getMessage(), systemError); diff --git a/src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLPlanner.java b/application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLPlanner.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLPlanner.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLPlanner.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLSchema.java b/application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLSchema.java similarity index 94% rename from src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLSchema.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLSchema.java index 9ad43606420..5a9fa4cfb59 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLSchema.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLSchema.java @@ -7,6 +7,7 @@ import static org.opentripplanner.apis.transmodel.model.EnumTypes.FILTER_PLACE_TYPE_ENUM; import static org.opentripplanner.apis.transmodel.model.EnumTypes.MULTI_MODAL_MODE; import static org.opentripplanner.apis.transmodel.model.EnumTypes.TRANSPORT_MODE; +import static org.opentripplanner.apis.transmodel.model.scalars.DateTimeScalarFactory.createMillisecondsSinceEpochAsDateTimeStringScalar; import static org.opentripplanner.model.projectinfo.OtpProjectInfo.projectInfo; import graphql.Scalars; @@ -24,8 +25,10 @@ import graphql.schema.GraphQLNonNull; import graphql.schema.GraphQLObjectType; import graphql.schema.GraphQLOutputType; +import graphql.schema.GraphQLScalarType; import graphql.schema.GraphQLSchema; import java.time.LocalDate; +import java.time.ZoneId; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -58,6 +61,8 @@ import org.opentripplanner.apis.transmodel.model.framework.ServerInfoType; import org.opentripplanner.apis.transmodel.model.framework.StreetModeDurationInputType; import org.opentripplanner.apis.transmodel.model.framework.SystemNoticeType; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelDirectives; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelScalars; import org.opentripplanner.apis.transmodel.model.framework.ValidityPeriodType; import org.opentripplanner.apis.transmodel.model.network.DestinationDisplayType; import org.opentripplanner.apis.transmodel.model.network.GroupOfLinesType; @@ -74,10 +79,10 @@ import org.opentripplanner.apis.transmodel.model.plan.TripPatternType; import org.opentripplanner.apis.transmodel.model.plan.TripQuery; import org.opentripplanner.apis.transmodel.model.plan.TripType; -import org.opentripplanner.apis.transmodel.model.plan.ViaLocationInputType; -import org.opentripplanner.apis.transmodel.model.plan.ViaSegmentInputType; -import org.opentripplanner.apis.transmodel.model.plan.ViaTripQuery; -import org.opentripplanner.apis.transmodel.model.plan.ViaTripType; +import org.opentripplanner.apis.transmodel.model.plan.legacyvia.ViaLocationInputType; +import org.opentripplanner.apis.transmodel.model.plan.legacyvia.ViaSegmentInputType; +import org.opentripplanner.apis.transmodel.model.plan.legacyvia.ViaTripQuery; +import org.opentripplanner.apis.transmodel.model.plan.legacyvia.ViaTripType; import org.opentripplanner.apis.transmodel.model.siri.et.EstimatedCallType; import org.opentripplanner.apis.transmodel.model.siri.sx.AffectsType; import org.opentripplanner.apis.transmodel.model.siri.sx.PtSituationElementType; @@ -128,59 +133,37 @@ public class TransmodelGraphQLSchema { private final DefaultRouteRequestType routing; - private final GqlUtil gqlUtil; + private final ZoneId timeZoneId; private final Relay relay = new Relay(); - private TransmodelGraphQLSchema(RouteRequest defaultRequest, GqlUtil gqlUtil) { - this.gqlUtil = gqlUtil; + private TransmodelGraphQLSchema(RouteRequest defaultRequest, ZoneId timeZoneId) { + this.timeZoneId = timeZoneId; this.routing = new DefaultRouteRequestType(defaultRequest); } - public static GraphQLSchema create(RouteRequest defaultRequest, GqlUtil gqlUtil) { - return new TransmodelGraphQLSchema(defaultRequest, gqlUtil).create(); + public static GraphQLSchema create(RouteRequest defaultRequest, ZoneId timeZoneId) { + return new TransmodelGraphQLSchema(defaultRequest, timeZoneId).create(); } - // private BookingArrangement getBookingArrangementForTripTimeShort(TripTimeShort tripTimeShort) { - // Trip trip = index.tripForId.get(tripTimeShort.tripId); - // if (trip == null) { - // return null; - // } - // TripPattern tripPattern = index.patternForTrip.get(trip); - // if (tripPattern == null || tripPattern.stopPattern == null) { - // return null; - // } - // return tripPattern.stopPattern.bookingArrangements[tripTimeShort.stopIndex]; - // } - @SuppressWarnings("unchecked") private GraphQLSchema create() { - /* - multilingualStringType, validityPeriodType, infoLinkType, bookingArrangementType, systemNoticeType, - linkGeometryType, serverInfoType, authorityType, operatorType, noticeType - - - - */ - // Framework + GraphQLScalarType dateTimeScalar = createMillisecondsSinceEpochAsDateTimeStringScalar( + timeZoneId + ); GraphQLOutputType multilingualStringType = MultilingualStringType.create(); - GraphQLObjectType validityPeriodType = ValidityPeriodType.create(gqlUtil); + GraphQLObjectType validityPeriodType = ValidityPeriodType.create(dateTimeScalar); GraphQLObjectType infoLinkType = InfoLinkType.create(); - GraphQLOutputType bookingArrangementType = BookingArrangementType.create(gqlUtil); + GraphQLOutputType bookingArrangementType = BookingArrangementType.create(); GraphQLOutputType systemNoticeType = SystemNoticeType.create(); GraphQLOutputType linkGeometryType = PointsOnLinkType.create(); GraphQLOutputType serverInfoType = ServerInfoType.create(); GraphQLOutputType authorityType = AuthorityType.create( LineType.REF, - PtSituationElementType.REF, - gqlUtil - ); - GraphQLOutputType operatorType = OperatorType.create( - LineType.REF, - ServiceJourneyType.REF, - gqlUtil + PtSituationElementType.REF ); + GraphQLOutputType operatorType = OperatorType.create(LineType.REF, ServiceJourneyType.REF); GraphQLOutputType brandingType = BrandingType.create(); GraphQLOutputType noticeType = NoticeType.create(); GraphQLOutputType rentalVehicleTypeType = RentalVehicleTypeType.create(); @@ -200,7 +183,7 @@ private GraphQLSchema create() { tariffZoneType, EstimatedCallType.REF, PtSituationElementType.REF, - gqlUtil + dateTimeScalar ); GraphQLOutputType quayType = QuayType.create( placeInterface, @@ -210,7 +193,7 @@ private GraphQLSchema create() { EstimatedCallType.REF, PtSituationElementType.REF, tariffZoneType, - gqlUtil + dateTimeScalar ); GraphQLOutputType stopToStopGeometryType = StopToStopGeometryType.create( @@ -245,8 +228,7 @@ private GraphQLSchema create() { stopPlaceType, lineType, ServiceJourneyType.REF, - DatedServiceJourneyType.REF, - gqlUtil + DatedServiceJourneyType.REF ); // Timetable @@ -260,7 +242,7 @@ private GraphQLSchema create() { validityPeriodType, infoLinkType, affectsType, - gqlUtil, + dateTimeScalar, relay ); GraphQLOutputType journeyPatternType = JourneyPatternType.create( @@ -270,8 +252,7 @@ private GraphQLSchema create() { lineType, ServiceJourneyType.REF, stopToStopGeometryType, - ptSituationElementType, - gqlUtil + ptSituationElementType ); GraphQLOutputType estimatedCallType = EstimatedCallType.create( bookingArrangementType, @@ -281,7 +262,7 @@ private GraphQLSchema create() { ptSituationElementType, ServiceJourneyType.REF, DatedServiceJourneyType.REF, - gqlUtil + dateTimeScalar ); GraphQLOutputType serviceJourneyType = ServiceJourneyType.create( @@ -294,16 +275,14 @@ private GraphQLSchema create() { ptSituationElementType, journeyPatternType, estimatedCallType, - TimetabledPassingTimeType.REF, - gqlUtil + TimetabledPassingTimeType.REF ); GraphQLOutputType datedServiceJourneyType = DatedServiceJourneyType.create( serviceJourneyType, journeyPatternType, estimatedCallType, - quayType, - gqlUtil + quayType ); GraphQLOutputType timetabledPassingTime = TimetabledPassingTimeType.create( @@ -311,12 +290,11 @@ private GraphQLSchema create() { noticeType, quayType, destinationDisplayType, - serviceJourneyType, - gqlUtil + serviceJourneyType ); GraphQLObjectType tripPatternTimePenaltyType = TripPatternTimePenaltyType.create(); - GraphQLObjectType tripMetadataType = TripMetadataType.create(gqlUtil); + GraphQLObjectType tripMetadataType = TripMetadataType.create(dateTimeScalar); GraphQLObjectType placeType = PlanPlaceType.create( bikeRentalStationType, rentalVehicleType, @@ -339,13 +317,13 @@ private GraphQLSchema create() { placeType, pathGuidanceType, elevationStepType, - gqlUtil + dateTimeScalar ); GraphQLObjectType tripPatternType = TripPatternType.create( systemNoticeType, legType, tripPatternTimePenaltyType, - gqlUtil + dateTimeScalar ); GraphQLObjectType routingErrorType = RoutingErrorType.create(); @@ -354,22 +332,22 @@ private GraphQLSchema create() { tripPatternType, tripMetadataType, routingErrorType, - gqlUtil + dateTimeScalar ); - GraphQLInputObjectType durationPerStreetModeInput = StreetModeDurationInputType.create(gqlUtil); - GraphQLInputObjectType penaltyForStreetMode = PenaltyForStreetModeType.create(gqlUtil); + GraphQLInputObjectType durationPerStreetModeInput = StreetModeDurationInputType.create(); + GraphQLInputObjectType penaltyForStreetMode = PenaltyForStreetModeType.create(); GraphQLFieldDefinition tripQuery = TripQuery.create( routing, tripType, durationPerStreetModeInput, penaltyForStreetMode, - gqlUtil + dateTimeScalar ); GraphQLOutputType viaTripType = ViaTripType.create(tripPatternType, routingErrorType); - GraphQLInputObjectType viaLocationInputType = ViaLocationInputType.create(gqlUtil); + GraphQLInputObjectType viaLocationInputType = ViaLocationInputType.create(); GraphQLInputObjectType viaSegmentInputType = ViaSegmentInputType.create(); GraphQLFieldDefinition viaTripQuery = ViaTripQuery.create( @@ -377,7 +355,7 @@ private GraphQLSchema create() { viaTripType, viaLocationInputType, viaSegmentInputType, - gqlUtil + dateTimeScalar ); GraphQLInputObjectType inputPlaceIds = GraphQLInputObjectType @@ -435,7 +413,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("stopPlace") .description("Get a single stopPlace based on its id)") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(stopPlaceType) .argument( GraphQLArgument @@ -457,7 +435,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("stopPlaces") .description("Get all stopPlaces") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(new GraphQLNonNull(new GraphQLList(stopPlaceType))) .argument( GraphQLArgument @@ -492,7 +470,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("stopPlacesByBbox") .description("Get all stop places within the specified bounding box") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(new GraphQLNonNull(new GraphQLList(stopPlaceType))) .argument( GraphQLArgument @@ -573,7 +551,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("quay") .description("Get a single quay based on its id)") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(quayType) .argument( GraphQLArgument @@ -594,7 +572,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("quays") .description("Get all quays") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(new GraphQLNonNull(new GraphQLList(quayType))) .argument( GraphQLArgument @@ -639,7 +617,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("quaysByBbox") .description("Get all quays within the specified bounding box") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(new GraphQLNonNull(new GraphQLList(quayType))) .argument( GraphQLArgument @@ -722,7 +700,7 @@ private GraphQLSchema create() { "limits for the input parameters, but the query will timeout and return if the parameters " + "are too high." ) - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type( relay.connectionType( "quayAtDistance", @@ -808,7 +786,7 @@ private GraphQLSchema create() { .description( "Get all places (quays, stop places, car parks etc. with coordinates) within the specified radius from a location. The returned type has two fields place and distance. The search is done by walking so the distance is according to the network of walkables." ) - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type( relay.connectionType( "placeAtDistance", @@ -1008,7 +986,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("authority") .description("Get an authority by ID") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(authorityType) .argument( GraphQLArgument @@ -1029,7 +1007,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("authorities") .description("Get all authorities") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(new GraphQLNonNull(new GraphQLList(authorityType))) .dataFetcher(environment -> { return new ArrayList<>(GqlUtil.getTransitService(environment).getAgencies()); @@ -1041,7 +1019,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("operator") .description("Get a operator by ID") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(operatorType) .argument( GraphQLArgument @@ -1062,7 +1040,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("operators") .description("Get all operators") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(new GraphQLNonNull(new GraphQLList(operatorType))) .dataFetcher(environment -> { return new ArrayList<>(GqlUtil.getTransitService(environment).getAllOperators()); @@ -1074,7 +1052,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("line") .description("Get a single line based on its id") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(lineType) .argument( GraphQLArgument @@ -1099,7 +1077,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("lines") .description("Get all lines") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(new GraphQLNonNull(new GraphQLList(lineType))) .argument( GraphQLArgument @@ -1252,7 +1230,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("serviceJourney") .description("Get a single service journey based on its id") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(serviceJourneyType) .argument( GraphQLArgument @@ -1273,7 +1251,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("serviceJourneys") .description("Get all service journeys") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(new GraphQLNonNull(new GraphQLList(serviceJourneyType))) .argument( GraphQLArgument @@ -1296,7 +1274,7 @@ private GraphQLSchema create() { .newArgument() .name("activeDates") .description("Set of ids of active dates to fetch serviceJourneys for.") - .type(new GraphQLList(gqlUtil.dateScalar)) + .type(new GraphQLList(TransmodelScalars.DATE_SCALAR)) .build() ) .argument( @@ -1350,7 +1328,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("bikeRentalStations") .description("Get all bike rental stations") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .argument( GraphQLArgument .newArgument() @@ -1379,7 +1357,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("bikeRentalStation") .description("Get all bike rental stations") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(bikeRentalStationType) .argument( GraphQLArgument @@ -1406,7 +1384,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("bikeRentalStationsByBbox") .description("Get all bike rental stations within the specified bounding box.") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(new GraphQLNonNull(new GraphQLList(bikeRentalStationType))) .argument( GraphQLArgument.newArgument().name("minimumLatitude").type(Scalars.GraphQLFloat).build() @@ -1445,7 +1423,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("bikePark") .description("Get a single bike park based on its id") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(bikeParkType) .argument( GraphQLArgument @@ -1470,7 +1448,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("bikeParks") .description("Get all bike parks") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(new GraphQLNonNull(new GraphQLList(bikeParkType))) .dataFetcher(environment -> GqlUtil @@ -1485,7 +1463,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("routingParameters") .description("Get default routing parameters.") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(this.routing.graphQLType) .dataFetcher(environment -> routing.request) .build() @@ -1495,7 +1473,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("situations") .description("Get all active situations.") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(ptSituationElementType)))) .argument( GraphQLArgument @@ -1571,7 +1549,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("situation") .description("Get a single situation based on its situationNumber") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(ptSituationElementType) .argument( GraphQLArgument @@ -1596,8 +1574,8 @@ private GraphQLSchema create() { GraphQLFieldDefinition .newFieldDefinition() .name("leg") - .description("Refetch a single leg based on its id") - .withDirective(gqlUtil.timingData) + .description("Refetch a single transit leg based on its id") + .withDirective(TransmodelDirectives.TIMING_DATA) .type(LegType.REF) .argument( GraphQLArgument @@ -1623,14 +1601,16 @@ private GraphQLSchema create() { GraphQLFieldDefinition .newFieldDefinition() .name("serverInfo") - .description("Get OTP server information") - .withDirective(gqlUtil.timingData) + .description( + "Get OTP deployment information. This is only useful for developers of OTP itself not regular API users." + ) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(new GraphQLNonNull(serverInfoType)) .dataFetcher(e -> projectInfo()) .build() ) .field(DatedServiceJourneyQuery.createGetById(datedServiceJourneyType)) - .field(DatedServiceJourneyQuery.createQuery(datedServiceJourneyType, gqlUtil)) + .field(DatedServiceJourneyQuery.createQuery(datedServiceJourneyType)) .build(); return GraphQLSchema @@ -1639,7 +1619,7 @@ private GraphQLSchema create() { .additionalType(placeInterface) .additionalType(timetabledPassingTime) .additionalType(Relay.pageInfoType) - .additionalDirective(gqlUtil.timingData) + .additionalDirective(TransmodelDirectives.TIMING_DATA) .build(); } diff --git a/src/main/java/org/opentripplanner/apis/transmodel/TransmodelRequestContext.java b/application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelRequestContext.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/TransmodelRequestContext.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelRequestContext.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/FilterMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/FilterMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/FilterMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/FilterMapper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/GenericLocationMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/GenericLocationMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/GenericLocationMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/GenericLocationMapper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/GeometryMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/GeometryMapper.java similarity index 92% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/GeometryMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/GeometryMapper.java index e2bf687e3b8..664da59d522 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/mapping/GeometryMapper.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/GeometryMapper.java @@ -2,7 +2,7 @@ import java.util.ArrayList; import java.util.List; -import org.opentripplanner.apis.transmodel.model.util.EncodedPolylineBeanWithStops; +import org.opentripplanner.apis.transmodel.model.framework.EncodedPolylineBeanWithStops; import org.opentripplanner.framework.geometry.EncodedPolyline; import org.opentripplanner.transit.model.network.TripPattern; diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/OccupancyStatusMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/OccupancyStatusMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/OccupancyStatusMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/OccupancyStatusMapper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/PlaceMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/PlaceMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/PlaceMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/PlaceMapper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/PreferencesMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/PreferencesMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/PreferencesMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/PreferencesMapper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/RequestModesMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/RequestModesMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/RequestModesMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/RequestModesMapper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/SelectRequestMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/SelectRequestMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/SelectRequestMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/SelectRequestMapper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/SeverityMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/SeverityMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/SeverityMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/SeverityMapper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/TransitIdMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/TransitIdMapper.java similarity index 98% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/TransitIdMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/TransitIdMapper.java index 1554a8c9d7c..1231ebd73b6 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/mapping/TransitIdMapper.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/TransitIdMapper.java @@ -4,7 +4,6 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.framework.lang.StringUtils; import org.opentripplanner.transit.model.framework.AbstractTransitEntity; @@ -39,7 +38,6 @@ public static String mapIDToApi(FeedScopedId id) { * Return an empty collection if the collection of ids is null. * If the collection of ids contains null or blank elements, they are ignored. */ - @Nonnull public static List mapIDsToDomainNullSafe(@Nullable Collection ids) { if (ids == null) { return List.of(); diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/TripRequestMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/TripRequestMapper.java similarity index 92% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/TripRequestMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/TripRequestMapper.java index 72cd5fc6260..abb548256a1 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/mapping/TripRequestMapper.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/TripRequestMapper.java @@ -11,12 +11,12 @@ import java.util.Locale; import java.util.Map; import org.opentripplanner.apis.transmodel.TransmodelRequestContext; +import org.opentripplanner.apis.transmodel.model.plan.TripQuery; import org.opentripplanner.apis.transmodel.support.DataFetcherDecorator; import org.opentripplanner.apis.transmodel.support.GqlUtil; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.standalone.api.OtpServerRequestContext; import org.opentripplanner.transit.model.framework.FeedScopedId; -import org.opentripplanner.transit.service.TransitService; public class TripRequestMapper { @@ -40,11 +40,16 @@ public static RouteRequest createRequest(DataFetchingEnvironment environment) { "to", (Map v) -> request.setTo(GenericLocationMapper.toGenericLocation(v)) ); - final TransitService transitService = context.getTransitService(); callWith.argument( "passThroughPoints", (List> v) -> { - request.setPassThroughPoints(PassThroughLocationMapper.toLocations(transitService, v)); + request.setViaLocations(TripViaLocationMapper.toLegacyPassThroughLocations(v)); + } + ); + callWith.argument( + TripQuery.TRIP_VIA_PARAMETER, + (List> v) -> { + request.setViaLocations(TripViaLocationMapper.mapToViaLocations(v)); } ); diff --git a/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/TripViaLocationMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/TripViaLocationMapper.java new file mode 100644 index 00000000000..50845aecef7 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/TripViaLocationMapper.java @@ -0,0 +1,83 @@ +package org.opentripplanner.apis.transmodel.mapping; + +import static java.util.stream.Collectors.toList; + +import java.time.Duration; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import org.opentripplanner.apis.transmodel.model.plan.TripQuery; +import org.opentripplanner.apis.transmodel.model.plan.ViaLocationInputType; +import org.opentripplanner.apis.transmodel.support.OneOfInputValidator; +import org.opentripplanner.routing.api.request.via.PassThroughViaLocation; +import org.opentripplanner.routing.api.request.via.ViaLocation; +import org.opentripplanner.routing.api.request.via.VisitViaLocation; +import org.opentripplanner.transit.model.framework.FeedScopedId; + +class TripViaLocationMapper { + + static List mapToViaLocations(final List> via) { + return via.stream().map(TripViaLocationMapper::mapViaLocation).collect(toList()); + } + + /** + * @deprecated Legacy passThrough, use via instead + */ + @Deprecated + static List toLegacyPassThroughLocations( + final List> passThroughPoints + ) { + return passThroughPoints + .stream() + .map(TripViaLocationMapper::mapLegacyPassThroughViaLocation) + .collect(toList()); + } + + private static ViaLocation mapViaLocation(Map inputMap) { + var fieldName = OneOfInputValidator.validateOneOf( + inputMap, + TripQuery.TRIP_VIA_PARAMETER, + ViaLocationInputType.FIELD_VISIT, + ViaLocationInputType.FIELD_PASS_THROUGH + ); + + Map value = (Map) inputMap.get(fieldName); + + return switch (fieldName) { + case ViaLocationInputType.FIELD_VISIT -> mapVisitViaLocation(value); + case ViaLocationInputType.FIELD_PASS_THROUGH -> mapPassThroughViaLocation(value); + default -> throw new IllegalArgumentException("Unknown field: " + fieldName); + }; + } + + private static VisitViaLocation mapVisitViaLocation(Map inputMap) { + var label = (String) inputMap.get(ViaLocationInputType.FIELD_LABEL); + var minimumWaitTime = (Duration) inputMap.get(ViaLocationInputType.FIELD_MINIMUM_WAIT_TIME); + var stopLocationIds = mapStopLocationIds(inputMap); + return new VisitViaLocation(label, minimumWaitTime, stopLocationIds, List.of()); + } + + private static PassThroughViaLocation mapPassThroughViaLocation(Map inputMap) { + var label = (String) inputMap.get(ViaLocationInputType.FIELD_LABEL); + var stopLocationIds = mapStopLocationIds(inputMap); + return new PassThroughViaLocation(label, stopLocationIds); + } + + private static List mapStopLocationIds(Map map) { + var c = (Collection) map.get(ViaLocationInputType.FIELD_STOP_LOCATION_IDS); + return c.stream().map(TransitIdMapper::mapIDToDomain).toList(); + } + + /** + * @deprecated Legacy passThrough, use via instead + */ + @Deprecated + private static ViaLocation mapLegacyPassThroughViaLocation(Map inputMap) { + final String name = (String) inputMap.get("name"); + final List stopLocationIds = + ((List) inputMap.get("placeIds")).stream() + .map(TransitIdMapper::mapIDToDomain) + .toList(); + return new PassThroughViaLocation(name, stopLocationIds); + } +} diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/ViaLocationMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/ViaLocationDeprecatedMapper.java similarity index 77% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/ViaLocationMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/ViaLocationDeprecatedMapper.java index af39338fb98..9ef77dfc847 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/mapping/ViaLocationMapper.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/ViaLocationDeprecatedMapper.java @@ -5,16 +5,17 @@ import java.time.Duration; import java.util.List; import java.util.Map; -import org.opentripplanner.routing.api.request.ViaLocation; +import org.opentripplanner.routing.api.request.ViaLocationDeprecated; import org.opentripplanner.routing.api.response.RoutingError; import org.opentripplanner.routing.api.response.RoutingErrorCode; import org.opentripplanner.routing.error.RoutingValidationException; -class ViaLocationMapper { +@Deprecated +class ViaLocationDeprecatedMapper { - static ViaLocation mapViaLocation(Map viaLocation) { + static ViaLocationDeprecated mapViaLocation(Map viaLocation) { try { - return new ViaLocation( + return new ViaLocationDeprecated( GenericLocationMapper.toGenericLocation(viaLocation), false, (Duration) viaLocation.get("minSlack"), diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/ViaRequestMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/ViaRequestMapper.java similarity index 92% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/ViaRequestMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/ViaRequestMapper.java index 0781fbe34a6..082b96c1add 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/mapping/ViaRequestMapper.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/ViaRequestMapper.java @@ -9,7 +9,7 @@ import org.opentripplanner.framework.graphql.GraphQLUtils; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.api.request.RouteViaRequest; -import org.opentripplanner.routing.api.request.ViaLocation; +import org.opentripplanner.routing.api.request.ViaLocationDeprecated; import org.opentripplanner.routing.api.request.request.JourneyRequest; import org.opentripplanner.standalone.api.OtpServerRequestContext; @@ -27,7 +27,10 @@ public static RouteViaRequest createRouteViaRequest(DataFetchingEnvironment envi RouteRequest request = serverContext.defaultRouteRequest(); List> viaInput = environment.getArgument("via"); - List vias = viaInput.stream().map(ViaLocationMapper::mapViaLocation).toList(); + List vias = viaInput + .stream() + .map(ViaLocationDeprecatedMapper::mapViaLocation) + .toList(); List requests; if (environment.containsArgument("segments")) { diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/ViaSegmentMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/ViaSegmentMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/ViaSegmentMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/ViaSegmentMapper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/BikePreferencesMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/BikePreferencesMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/BikePreferencesMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/BikePreferencesMapper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/CarPreferencesMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/CarPreferencesMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/CarPreferencesMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/CarPreferencesMapper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/ItineraryFilterPreferencesMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/ItineraryFilterPreferencesMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/ItineraryFilterPreferencesMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/ItineraryFilterPreferencesMapper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/RentalPreferencesMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/RentalPreferencesMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/RentalPreferencesMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/RentalPreferencesMapper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/ScooterPreferencesMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/ScooterPreferencesMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/ScooterPreferencesMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/ScooterPreferencesMapper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/StreetPreferencesMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/StreetPreferencesMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/StreetPreferencesMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/StreetPreferencesMapper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/TransferPreferencesMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/TransferPreferencesMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/TransferPreferencesMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/TransferPreferencesMapper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/TransitPreferencesMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/TransitPreferencesMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/TransitPreferencesMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/TransitPreferencesMapper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/WalkPreferencesMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/WalkPreferencesMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/WalkPreferencesMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/mapping/preferences/WalkPreferencesMapper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/DefaultRouteRequestType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/DefaultRouteRequestType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/DefaultRouteRequestType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/DefaultRouteRequestType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/EnumTypes.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/EnumTypes.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/EnumTypes.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/EnumTypes.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/PlanResponse.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/PlanResponse.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/PlanResponse.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/PlanResponse.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/TransmodelPlaceType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/TransmodelPlaceType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/TransmodelPlaceType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/TransmodelPlaceType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/TransmodelStopPlaceType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/TransmodelStopPlaceType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/TransmodelStopPlaceType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/TransmodelStopPlaceType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/TransmodelTransportSubmode.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/TransmodelTransportSubmode.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/TransmodelTransportSubmode.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/TransmodelTransportSubmode.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/TransportModeSlack.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/TransportModeSlack.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/TransportModeSlack.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/TransportModeSlack.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/TripTimeOnDateHelper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/TripTimeOnDateHelper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/TripTimeOnDateHelper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/TripTimeOnDateHelper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/AuthorityType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/AuthorityType.java similarity index 94% rename from src/main/java/org/opentripplanner/apis/transmodel/model/framework/AuthorityType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/AuthorityType.java index 27d20c8e423..baae947e345 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/AuthorityType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/AuthorityType.java @@ -17,8 +17,7 @@ public class AuthorityType { public static GraphQLObjectType create( GraphQLOutputType lineType, - GraphQLOutputType ptSituationElementType, - GqlUtil gqlUtil + GraphQLOutputType ptSituationElementType ) { return GraphQLObjectType .newObject() @@ -65,7 +64,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("lines") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(new GraphQLNonNull(new GraphQLList(lineType))) .dataFetcher(environment -> getTransitService(environment) @@ -80,7 +79,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("situations") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .description("Get all situations active for the authority.") .type(new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(ptSituationElementType)))) .dataFetcher(environment -> diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/BrandingType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/BrandingType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/framework/BrandingType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/BrandingType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/CoordinateInputType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/CoordinateInputType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/framework/CoordinateInputType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/CoordinateInputType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/util/EncodedPolylineBeanWithStops.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/EncodedPolylineBeanWithStops.java similarity index 80% rename from src/main/java/org/opentripplanner/apis/transmodel/model/util/EncodedPolylineBeanWithStops.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/EncodedPolylineBeanWithStops.java index 92262a17381..23508bf2ef7 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/util/EncodedPolylineBeanWithStops.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/EncodedPolylineBeanWithStops.java @@ -1,4 +1,4 @@ -package org.opentripplanner.apis.transmodel.model.util; +package org.opentripplanner.apis.transmodel.model.framework; import org.opentripplanner.framework.geometry.EncodedPolyline; import org.opentripplanner.transit.model.site.StopLocation; diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/InfoLinkType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/InfoLinkType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/framework/InfoLinkType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/InfoLinkType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/LocationInputType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/LocationInputType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/framework/LocationInputType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/LocationInputType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/MultilingualStringType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/MultilingualStringType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/framework/MultilingualStringType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/MultilingualStringType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/NoticeType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/NoticeType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/framework/NoticeType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/NoticeType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/OperatorType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/OperatorType.java similarity index 94% rename from src/main/java/org/opentripplanner/apis/transmodel/model/framework/OperatorType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/OperatorType.java index d45319b9d9e..8f55bea52ab 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/OperatorType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/OperatorType.java @@ -14,8 +14,7 @@ public class OperatorType { public static GraphQLObjectType create( GraphQLOutputType lineType, - GraphQLOutputType serviceJourneyType, - GqlUtil gqlUtil + GraphQLOutputType serviceJourneyType ) { return GraphQLObjectType .newObject() @@ -48,7 +47,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("lines") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(new GraphQLNonNull(new GraphQLList(lineType))) .dataFetcher(environment -> GqlUtil @@ -64,7 +63,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("serviceJourney") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(new GraphQLNonNull(new GraphQLList(serviceJourneyType))) .dataFetcher(environment -> GqlUtil diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/PassThroughPointInputType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/PassThroughPointInputType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/framework/PassThroughPointInputType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/PassThroughPointInputType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/PenaltyForStreetModeType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/PenaltyForStreetModeType.java similarity index 97% rename from src/main/java/org/opentripplanner/apis/transmodel/model/framework/PenaltyForStreetModeType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/PenaltyForStreetModeType.java index 6d945ae912f..b899ada3599 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/PenaltyForStreetModeType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/PenaltyForStreetModeType.java @@ -47,7 +47,7 @@ public class PenaltyForStreetModeType { private static final String FIELD_TIME_PENALTY = "timePenalty"; private static final String FIELD_COST_FACTOR = "costFactor"; - public static GraphQLInputObjectType create(GqlUtil gqlUtil) { + public static GraphQLInputObjectType create() { return GraphQLInputObjectType .newInputObject() .name("PenaltyForStreetMode") @@ -70,7 +70,7 @@ public static GraphQLInputObjectType create(GqlUtil gqlUtil) { GraphQLInputObjectField .newInputObjectField() .name(FIELD_TIME_PENALTY) - .type(new GraphQLNonNull(gqlUtil.doubleFunctionScalar)) + .type(new GraphQLNonNull(TransmodelScalars.DOUBLE_FUNCTION_SCALAR)) .description( """ Penalty applied to the time for the given list of modes. diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/PointsOnLinkType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/PointsOnLinkType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/framework/PointsOnLinkType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/PointsOnLinkType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/RentalVehicleTypeType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/RentalVehicleTypeType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/framework/RentalVehicleTypeType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/RentalVehicleTypeType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/ServerInfoType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/ServerInfoType.java similarity index 80% rename from src/main/java/org/opentripplanner/apis/transmodel/model/framework/ServerInfoType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/ServerInfoType.java index ae6889ab033..8f679cafda3 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/ServerInfoType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/ServerInfoType.java @@ -9,6 +9,7 @@ import graphql.schema.GraphQLFieldDefinition; import graphql.schema.GraphQLObjectType; import graphql.schema.GraphQLOutputType; +import org.opentripplanner.apis.transmodel.support.GqlUtil; public class ServerInfoType { @@ -16,6 +17,13 @@ public static GraphQLOutputType create() { return GraphQLObjectType .newObject() .name("ServerInfo") + .description( + """ + Information about the deployment. This is only useful to developers of OTP itself. + It is not recommended for regular API consumers to use this type as it has no + stability guarantees. + """ + ) .field( GraphQLFieldDefinition .newFieldDefinition() @@ -99,6 +107,21 @@ public static GraphQLOutputType create() { .dataFetcher(e -> projectInfo().getOtpSerializationVersionId()) .build() ) + .field( + GraphQLFieldDefinition + .newFieldDefinition() + .name("internalTransitModelTimeZone") + .description( + """ + The internal time zone of the transit data. + + Note: The input data can be in several time zones, but OTP internally operates on a single one. + """ + ) + .type(Scalars.GraphQLString) + .dataFetcher(e -> GqlUtil.getTransitService(e).getTimeZone()) + .build() + ) .build(); } } diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/StreetModeDurationInputType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/StreetModeDurationInputType.java similarity index 96% rename from src/main/java/org/opentripplanner/apis/transmodel/model/framework/StreetModeDurationInputType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/StreetModeDurationInputType.java index bf274688617..2fba22c78b7 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/StreetModeDurationInputType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/StreetModeDurationInputType.java @@ -26,7 +26,7 @@ public class StreetModeDurationInputType { private static final String FIELD_STREET_MODE = "streetMode"; private static final String FIELD_DURATION = "duration"; - public static GraphQLInputObjectType create(GqlUtil gqlUtil) { + public static GraphQLInputObjectType create() { return GraphQLInputObjectType .newInputObject() .name("StreetModeDurationInput") @@ -42,7 +42,7 @@ public static GraphQLInputObjectType create(GqlUtil gqlUtil) { GraphQLInputObjectField .newInputObjectField() .name(FIELD_DURATION) - .type(new GraphQLNonNull(gqlUtil.durationScalar)) + .type(new GraphQLNonNull(TransmodelScalars.DURATION_SCALAR)) ) .build(); } diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/SystemNoticeType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/SystemNoticeType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/framework/SystemNoticeType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/SystemNoticeType.java diff --git a/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/TransmodelDirectives.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/TransmodelDirectives.java new file mode 100644 index 00000000000..98ee99a8a64 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/TransmodelDirectives.java @@ -0,0 +1,14 @@ +package org.opentripplanner.apis.transmodel.model.framework; + +import graphql.introspection.Introspection; +import graphql.schema.GraphQLDirective; + +public class TransmodelDirectives { + + public static final GraphQLDirective TIMING_DATA = GraphQLDirective + .newDirective() + .name("timingData") + .description("Add timing data to prometheus, if Actuator API is enabled") + .validLocation(Introspection.DirectiveLocation.FIELD_DEFINITION) + .build(); +} diff --git a/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/TransmodelScalars.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/TransmodelScalars.java new file mode 100644 index 00000000000..404fbd4a5ba --- /dev/null +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/TransmodelScalars.java @@ -0,0 +1,30 @@ +package org.opentripplanner.apis.transmodel.model.framework; + +import graphql.schema.GraphQLObjectType; +import graphql.schema.GraphQLScalarType; +import org.opentripplanner.apis.transmodel.model.scalars.DoubleFunctionFactory; +import org.opentripplanner.apis.transmodel.model.scalars.LocalTimeScalarFactory; +import org.opentripplanner.apis.transmodel.model.scalars.TimeScalarFactory; +import org.opentripplanner.framework.graphql.scalar.DateScalarFactory; +import org.opentripplanner.framework.graphql.scalar.DurationScalarFactory; + +/** + * This class contains all Transmodel custom scalars, except the + * {@link org.opentripplanner.apis.transmodel.support.GqlUtil#dateTimeScalar}. + */ +public class TransmodelScalars { + + public static final GraphQLScalarType DATE_SCALAR; + public static final GraphQLScalarType DOUBLE_FUNCTION_SCALAR; + public static final GraphQLScalarType LOCAL_TIME_SCALAR; + public static final GraphQLObjectType TIME_SCALAR; + public static final GraphQLScalarType DURATION_SCALAR; + + static { + DATE_SCALAR = DateScalarFactory.createTransmodelDateScalar(); + DOUBLE_FUNCTION_SCALAR = DoubleFunctionFactory.createDoubleFunctionScalar(); + LOCAL_TIME_SCALAR = LocalTimeScalarFactory.createLocalTimeScalar(); + TIME_SCALAR = TimeScalarFactory.createSecondsSinceMidnightAsTimeObject(); + DURATION_SCALAR = DurationScalarFactory.createDurationScalar(); + } +} diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/ValidityPeriodType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/ValidityPeriodType.java similarity index 84% rename from src/main/java/org/opentripplanner/apis/transmodel/model/framework/ValidityPeriodType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/ValidityPeriodType.java index 35ea9258322..956c24a60d5 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/framework/ValidityPeriodType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/framework/ValidityPeriodType.java @@ -2,12 +2,12 @@ import graphql.schema.GraphQLFieldDefinition; import graphql.schema.GraphQLObjectType; +import graphql.schema.GraphQLScalarType; import org.opentripplanner.apis.transmodel.model.siri.sx.ValidityPeriod; -import org.opentripplanner.apis.transmodel.support.GqlUtil; public class ValidityPeriodType { - public static GraphQLObjectType create(GqlUtil gqlUtil) { + public static GraphQLObjectType create(GraphQLScalarType dateTimeScalar) { return GraphQLObjectType .newObject() .name("ValidityPeriod") @@ -15,7 +15,7 @@ public static GraphQLObjectType create(GqlUtil gqlUtil) { GraphQLFieldDefinition .newFieldDefinition() .name("startTime") - .type(gqlUtil.dateTimeScalar) + .type(dateTimeScalar) .description("Start of validity period") .dataFetcher(environment -> { ValidityPeriod period = environment.getSource(); @@ -27,7 +27,7 @@ public static GraphQLObjectType create(GqlUtil gqlUtil) { GraphQLFieldDefinition .newFieldDefinition() .name("endTime") - .type(gqlUtil.dateTimeScalar) + .type(dateTimeScalar) .description("End of validity period. Will return 'null' if validity is open-ended.") .dataFetcher(environment -> { ValidityPeriod period = environment.getSource(); diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/network/DestinationDisplayType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/network/DestinationDisplayType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/network/DestinationDisplayType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/network/DestinationDisplayType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/network/GroupOfLinesType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/network/GroupOfLinesType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/network/GroupOfLinesType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/network/GroupOfLinesType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/network/JourneyPatternType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/network/JourneyPatternType.java similarity index 92% rename from src/main/java/org/opentripplanner/apis/transmodel/model/network/JourneyPatternType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/network/JourneyPatternType.java index 0743b02a3c4..4ed3871ff8c 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/network/JourneyPatternType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/network/JourneyPatternType.java @@ -16,6 +16,8 @@ import org.locationtech.jts.geom.LineString; import org.opentripplanner.apis.transmodel.mapping.GeometryMapper; import org.opentripplanner.apis.transmodel.model.EnumTypes; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelDirectives; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelScalars; import org.opentripplanner.apis.transmodel.support.GqlUtil; import org.opentripplanner.framework.geometry.EncodedPolyline; import org.opentripplanner.transit.model.network.TripPattern; @@ -33,8 +35,7 @@ public static GraphQLObjectType create( GraphQLOutputType lineType, GraphQLOutputType serviceJourneyType, GraphQLOutputType stopToStopGeometryType, - GraphQLNamedOutputType ptSituationElementType, - GqlUtil gqlUtil + GraphQLNamedOutputType ptSituationElementType ) { return GraphQLObjectType .newObject() @@ -68,7 +69,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("serviceJourneys") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(serviceJourneyType)))) .dataFetcher(e -> ((TripPattern) e.getSource()).scheduledTripsAsStream().collect(Collectors.toList()) @@ -79,9 +80,11 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("serviceJourneysForDate") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .description("List of service journeys for the journey pattern for a given date") - .argument(GraphQLArgument.newArgument().name("date").type(gqlUtil.dateScalar).build()) + .argument( + GraphQLArgument.newArgument().name("date").type(TransmodelScalars.DATE_SCALAR).build() + ) .type(new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(serviceJourneyType)))) .dataFetcher(environment -> { TIntSet services = GqlUtil diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/network/LineType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/network/LineType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/network/LineType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/network/LineType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/network/PresentationType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/network/PresentationType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/network/PresentationType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/network/PresentationType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/network/StopToStopGeometryType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/network/StopToStopGeometryType.java similarity index 94% rename from src/main/java/org/opentripplanner/apis/transmodel/model/network/StopToStopGeometryType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/network/StopToStopGeometryType.java index 800eda04cb2..98a965e50be 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/network/StopToStopGeometryType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/network/StopToStopGeometryType.java @@ -3,7 +3,7 @@ import graphql.schema.GraphQLFieldDefinition; import graphql.schema.GraphQLObjectType; import graphql.schema.GraphQLOutputType; -import org.opentripplanner.apis.transmodel.model.util.EncodedPolylineBeanWithStops; +import org.opentripplanner.apis.transmodel.model.framework.EncodedPolylineBeanWithStops; public class StopToStopGeometryType { diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/BannedInputType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/BannedInputType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/BannedInputType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/BannedInputType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ElevationProfileStepType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ElevationProfileStepType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/ElevationProfileStepType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ElevationProfileStepType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/FilterInputType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/FilterInputType.java similarity index 94% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/FilterInputType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/FilterInputType.java index ce792ca3790..1e868eadb86 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/FilterInputType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/FilterInputType.java @@ -7,7 +7,7 @@ public class FilterInputType { - static final GraphQLInputObjectType INPUT_TYPE = GraphQLInputObjectType + public static final GraphQLInputObjectType INPUT_TYPE = GraphQLInputObjectType .newInputObject() .name("TripFilterInput") .description( diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ItineraryFiltersInputType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ItineraryFiltersInputType.java similarity index 97% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/ItineraryFiltersInputType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ItineraryFiltersInputType.java index b5d82af5138..7f0d5b10215 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ItineraryFiltersInputType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ItineraryFiltersInputType.java @@ -8,6 +8,7 @@ import java.util.Map; import java.util.function.Consumer; import org.opentripplanner.apis.transmodel.model.EnumTypes; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelScalars; import org.opentripplanner.apis.transmodel.model.scalars.DoubleFunction; import org.opentripplanner.apis.transmodel.support.DataFetcherDecorator; import org.opentripplanner.apis.transmodel.support.GqlUtil; @@ -26,7 +27,7 @@ public class ItineraryFiltersInputType { private static final String GROUP_SIMILARITY_KEEP_N_ITINERARIES = "groupSimilarityKeepNumOfItineraries"; - public static GraphQLInputObjectType create(GqlUtil gqlUtil, ItineraryFilterPreferences dft) { + public static GraphQLInputObjectType create(ItineraryFilterPreferences dft) { return GraphQLInputObjectType .newInputObject() .name("ItineraryFilters") @@ -59,7 +60,7 @@ public static GraphQLInputObjectType create(GqlUtil gqlUtil, ItineraryFilterPref GraphQLInputObjectField .newInputObjectField() .name("costLimitFunction") - .type(new GraphQLNonNull(gqlUtil.doubleFunctionScalar)) + .type(new GraphQLNonNull(TransmodelScalars.DOUBLE_FUNCTION_SCALAR)) .build() ) .field( diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/JourneyWhiteListed.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/JourneyWhiteListed.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/JourneyWhiteListed.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/JourneyWhiteListed.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/LegType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/LegType.java similarity index 95% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/LegType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/LegType.java index 867d08e3933..5bf56f75e4b 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/LegType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/LegType.java @@ -12,6 +12,7 @@ import graphql.schema.GraphQLNonNull; import graphql.schema.GraphQLObjectType; import graphql.schema.GraphQLOutputType; +import graphql.schema.GraphQLScalarType; import graphql.schema.GraphQLType; import graphql.schema.GraphQLTypeReference; import java.util.List; @@ -22,6 +23,8 @@ import org.opentripplanner.apis.transmodel.model.EnumTypes; import org.opentripplanner.apis.transmodel.model.TransmodelTransportSubmode; import org.opentripplanner.apis.transmodel.model.TripTimeOnDateHelper; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelDirectives; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelScalars; import org.opentripplanner.apis.transmodel.support.GqlUtil; import org.opentripplanner.framework.geometry.EncodedPolyline; import org.opentripplanner.model.plan.Leg; @@ -51,7 +54,7 @@ public static GraphQLObjectType create( GraphQLObjectType placeType, GraphQLObjectType pathGuidanceType, GraphQLType elevationStepType, - GqlUtil gqlUtil + GraphQLScalarType dateTimeScalar ) { return GraphQLObjectType .newObject() @@ -63,7 +66,9 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("id") - .description("An identifier for the leg, which can be used to re-fetch the information.") + .description( + "An identifier for the leg, which can be used to re-fetch transit leg information." + ) .type(Scalars.GraphQLID) .dataFetcher(env -> LegReferenceSerializer.encode(leg(env).getLegReference())) .build() @@ -73,7 +78,7 @@ public static GraphQLObjectType create( .newFieldDefinition() .name("aimedStartTime") .description("The aimed date and time this leg starts.") - .type(new GraphQLNonNull(gqlUtil.dateTimeScalar)) + .type(new GraphQLNonNull(dateTimeScalar)) .dataFetcher(env -> // startTime is already adjusted for real-time - need to subtract delay to get aimed time leg(env) @@ -89,7 +94,7 @@ public static GraphQLObjectType create( .newFieldDefinition() .name("expectedStartTime") .description("The expected, real-time adjusted date and time this leg starts.") - .type(new GraphQLNonNull(gqlUtil.dateTimeScalar)) + .type(new GraphQLNonNull(dateTimeScalar)) .dataFetcher(env -> leg(env).getStartTime().toInstant().toEpochMilli()) .build() ) @@ -98,7 +103,7 @@ public static GraphQLObjectType create( .newFieldDefinition() .name("aimedEndTime") .description("The aimed date and time this leg ends.") - .type(new GraphQLNonNull(gqlUtil.dateTimeScalar)) + .type(new GraphQLNonNull(dateTimeScalar)) .dataFetcher(env -> // endTime is already adjusted for real-time - need to subtract delay to get aimed time leg(env) .getEndTime() @@ -113,7 +118,7 @@ public static GraphQLObjectType create( .newFieldDefinition() .name("expectedEndTime") .description("The expected, real-time adjusted date and time this leg ends.") - .type(new GraphQLNonNull(gqlUtil.dateTimeScalar)) + .type(new GraphQLNonNull(dateTimeScalar)) .dataFetcher(env -> leg(env).getEndTime().toInstant().toEpochMilli()) .build() ) @@ -268,7 +273,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("fromEstimatedCall") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .description("EstimatedCall for the quay where the leg originates.") .type(estimatedCallType) .dataFetcher(env -> TripTimeOnDateHelper.getTripTimeOnDateForFromPlace(env.getSource())) @@ -278,7 +283,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("toEstimatedCall") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .description("EstimatedCall for the quay where the leg ends.") .type(estimatedCallType) .dataFetcher(env -> TripTimeOnDateHelper.getTripTimeOnDateForToPlace(env.getSource())) @@ -318,7 +323,7 @@ public static GraphQLObjectType create( .description( "For transit legs, the service date of the trip. For non-transit legs, null." ) - .type(gqlUtil.dateScalar) + .type(TransmodelScalars.DATE_SCALAR) .dataFetcher(environment -> Optional.of((Leg) environment.getSource()).map(Leg::getServiceDate).orElse(null) ) @@ -352,7 +357,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("intermediateEstimatedCalls") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .description( "For ride legs, estimated calls for quays between the Place where the leg originates and the Place where the leg ends. For non-ride legs, empty list." ) @@ -366,7 +371,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("serviceJourneyEstimatedCalls") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .description( "For ride legs, all estimated calls for the service journey. For non-ride legs, empty list." ) diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ModeAndSubModeInputType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ModeAndSubModeInputType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/ModeAndSubModeInputType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ModeAndSubModeInputType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ModeInputType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ModeInputType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/ModeInputType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ModeInputType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/PathGuidanceType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/PathGuidanceType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/PathGuidanceType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/PathGuidanceType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/PlanPlaceType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/PlanPlaceType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/PlanPlaceType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/PlanPlaceType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/RelaxCostType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/RelaxCostType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/RelaxCostType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/RelaxCostType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/RoutingErrorType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/RoutingErrorType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/RoutingErrorType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/RoutingErrorType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/SelectInputType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/SelectInputType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/SelectInputType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/SelectInputType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TriangleFactorsInputType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TriangleFactorsInputType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/TriangleFactorsInputType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TriangleFactorsInputType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripPatternTimePenaltyType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripPatternTimePenaltyType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripPatternTimePenaltyType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripPatternTimePenaltyType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripPatternType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripPatternType.java similarity index 95% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripPatternType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripPatternType.java index c903016b91b..42899beca55 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripPatternType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripPatternType.java @@ -8,7 +8,7 @@ import graphql.schema.GraphQLNonNull; import graphql.schema.GraphQLObjectType; import graphql.schema.GraphQLOutputType; -import org.opentripplanner.apis.transmodel.support.GqlUtil; +import graphql.schema.GraphQLScalarType; import org.opentripplanner.model.plan.Itinerary; public class TripPatternType { @@ -17,7 +17,7 @@ public static GraphQLObjectType create( GraphQLOutputType systemNoticeType, GraphQLObjectType legType, GraphQLObjectType timePenaltyType, - GqlUtil gqlUtil + GraphQLScalarType dateTimeScalar ) { return GraphQLObjectType .newObject() @@ -30,7 +30,7 @@ public static GraphQLObjectType create( .newFieldDefinition() .name("startTime") .description("Time that the trip departs.") - .type(gqlUtil.dateTimeScalar) + .type(dateTimeScalar) .deprecate("Replaced with expectedStartTime") .dataFetcher(env -> itinerary(env).startTime().toInstant().toEpochMilli()) .build() @@ -40,7 +40,7 @@ public static GraphQLObjectType create( .newFieldDefinition() .name("endTime") .description("Time that the trip arrives.") - .type(gqlUtil.dateTimeScalar) + .type(dateTimeScalar) .deprecate("Replaced with expectedEndTime") .dataFetcher(env -> itinerary(env).endTime().toInstant().toEpochMilli()) .build() @@ -50,7 +50,7 @@ public static GraphQLObjectType create( .newFieldDefinition() .name("aimedStartTime") .description("The aimed date and time the trip starts.") - .type(new GraphQLNonNull(gqlUtil.dateTimeScalar)) + .type(new GraphQLNonNull(dateTimeScalar)) .dataFetcher(env -> // startTime is already adjusted for real-time - need to subtract delay to get aimed time itinerary(env) @@ -66,7 +66,7 @@ public static GraphQLObjectType create( .newFieldDefinition() .name("expectedStartTime") .description("The expected, real-time adjusted date and time the trip starts.") - .type(new GraphQLNonNull(gqlUtil.dateTimeScalar)) + .type(new GraphQLNonNull(dateTimeScalar)) .dataFetcher(env -> itinerary(env).startTime().toInstant().toEpochMilli()) .build() ) @@ -75,7 +75,7 @@ public static GraphQLObjectType create( .newFieldDefinition() .name("aimedEndTime") .description("The aimed date and time the trip ends.") - .type(new GraphQLNonNull(gqlUtil.dateTimeScalar)) + .type(new GraphQLNonNull(dateTimeScalar)) .dataFetcher(env -> // endTime is already adjusted for real-time - need to subtract delay to get aimed time itinerary(env) @@ -91,7 +91,7 @@ public static GraphQLObjectType create( .newFieldDefinition() .name("expectedEndTime") .description("The expected, real-time adjusted date and time the trip ends.") - .type(new GraphQLNonNull(gqlUtil.dateTimeScalar)) + .type(new GraphQLNonNull(dateTimeScalar)) .dataFetcher(env -> itinerary(env).endTime().toInstant().toEpochMilli()) .build() ) diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripPlanTimePenaltyDto.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripPlanTimePenaltyDto.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripPlanTimePenaltyDto.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripPlanTimePenaltyDto.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripQuery.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripQuery.java similarity index 96% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripQuery.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripQuery.java index b67b26b90b6..5b1bbd84373 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripQuery.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripQuery.java @@ -11,6 +11,7 @@ import graphql.schema.GraphQLList; import graphql.schema.GraphQLNonNull; import graphql.schema.GraphQLOutputType; +import graphql.schema.GraphQLScalarType; import org.opentripplanner.apis.transmodel.TransmodelGraphQLPlanner; import org.opentripplanner.apis.transmodel.model.DefaultRouteRequestType; import org.opentripplanner.apis.transmodel.model.EnumTypes; @@ -18,7 +19,7 @@ import org.opentripplanner.apis.transmodel.model.framework.LocationInputType; import org.opentripplanner.apis.transmodel.model.framework.PassThroughPointInputType; import org.opentripplanner.apis.transmodel.model.framework.PenaltyForStreetModeType; -import org.opentripplanner.apis.transmodel.support.GqlUtil; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelDirectives; import org.opentripplanner.routing.api.request.preference.RoutingPreferences; import org.opentripplanner.routing.core.VehicleRoutingOptimizeType; @@ -27,13 +28,19 @@ public class TripQuery { public static final String ACCESS_EGRESS_PENALTY = "accessEgressPenalty"; public static final String MAX_ACCESS_EGRESS_DURATION_FOR_MODE = "maxAccessEgressDurationForMode"; public static final String MAX_DIRECT_DURATION_FOR_MODE = "maxDirectDurationForMode"; + public static final String TRIP_VIA_PARAMETER = "via"; + public static final String DOC_VIA = + """ + The list of via locations the journey is required to visit. All locations are + visited in the order they are listed. + """; public static GraphQLFieldDefinition create( DefaultRouteRequestType routing, GraphQLOutputType tripType, GraphQLInputObjectType durationPerStreetModeType, GraphQLInputObjectType penaltyForStreetMode, - GqlUtil gqlUtil + GraphQLScalarType dateTimeScalar ) { RoutingPreferences preferences = routing.request.preferences(); @@ -45,7 +52,7 @@ public static GraphQLFieldDefinition create( "trip patterns describing suggested alternatives for the trip." ) .type(new GraphQLNonNull(tripType)) - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .argument( GraphQLArgument .newArgument() @@ -55,7 +62,7 @@ public static GraphQLFieldDefinition create( "(if `false` or not set) or the latest acceptable time of arriving " + "(`true`). Defaults to now." ) - .type(gqlUtil.dateTimeScalar) + .type(dateTimeScalar) .build() ) .argument( @@ -72,7 +79,7 @@ Normally this is when the search is performed (now), plus a small grace period t restrictions are applied - all journeys are listed. """ ) - .type(gqlUtil.dateTimeScalar) + .type(dateTimeScalar) .build() ) .argument( @@ -173,10 +180,19 @@ Normally this is when the search is performed (now), plus a small grace period t GraphQLArgument .newArgument() .name("passThroughPoints") + .deprecate("Use via instead") .description("The list of points the journey is required to pass through.") .type(new GraphQLList(new GraphQLNonNull(PassThroughPointInputType.INPUT_TYPE))) .build() ) + .argument( + GraphQLArgument + .newArgument() + .name(TRIP_VIA_PARAMETER) + .description(DOC_VIA) + .type(new GraphQLList(new GraphQLNonNull(ViaLocationInputType.VIA_LOCATION_INPUT))) + .build() + ) .argument( GraphQLArgument .newArgument() @@ -572,7 +588,7 @@ Normally this is when the search is performed (now), plus a small grace period t "Configure the itinerary-filter-chain. NOTE! THESE PARAMETERS ARE USED " + "FOR SERVER-SIDE TUNING AND IS AVAILABLE HERE FOR TESTING ONLY." ) - .type(ItineraryFiltersInputType.create(gqlUtil, preferences.itineraryFilter())) + .type(ItineraryFiltersInputType.create(preferences.itineraryFilter())) .build() ) .argument( diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripType.java similarity index 98% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripType.java index 053b261c08e..d214bed983f 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/TripType.java @@ -7,10 +7,10 @@ import graphql.schema.GraphQLList; import graphql.schema.GraphQLNonNull; import graphql.schema.GraphQLObjectType; +import graphql.schema.GraphQLScalarType; import java.util.stream.Collectors; import org.opentripplanner.apis.support.mapping.PlannerErrorMapper; import org.opentripplanner.apis.transmodel.model.PlanResponse; -import org.opentripplanner.apis.transmodel.support.GqlUtil; import org.opentripplanner.framework.graphql.GraphQLUtils; import org.opentripplanner.model.plan.paging.cursor.PageCursor; @@ -21,7 +21,7 @@ public static GraphQLObjectType create( GraphQLObjectType tripPatternType, GraphQLObjectType tripMetadataType, GraphQLObjectType routingErrorType, - GqlUtil gqlUtil + GraphQLScalarType dateTimeScalar ) { return GraphQLObjectType .newObject() @@ -32,7 +32,7 @@ public static GraphQLObjectType create( .newFieldDefinition() .name("dateTime") .description("The time and date of travel") - .type(gqlUtil.dateTimeScalar) + .type(dateTimeScalar) .dataFetcher(env -> ((PlanResponse) env.getSource()).plan.date.toEpochMilli()) .build() ) diff --git a/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ViaLocationInputType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ViaLocationInputType.java new file mode 100644 index 00000000000..a808d934eed --- /dev/null +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ViaLocationInputType.java @@ -0,0 +1,125 @@ +package org.opentripplanner.apis.transmodel.model.plan; + +import static graphql.Directives.OneOfDirective; +import static graphql.Scalars.GraphQLString; + +import graphql.language.StringValue; +import graphql.schema.GraphQLInputObjectType; +import graphql.schema.GraphQLList; +import graphql.schema.GraphQLNonNull; +import java.time.Duration; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelScalars; + +public class ViaLocationInputType { + + /* type constants */ + + private static final String INPUT_VIA_LOCATION = "TripViaLocationInput"; + private static final String INPUT_VISIT_VIA_LOCATION = "TripVisitViaLocationInput"; + private static final String INPUT_PASS_THROUGH_VIA_LOCATION = "TripPassThroughViaLocationInput"; + + private static final String DOC_VISIT_VIA_LOCATION = + """ + A visit-via-location is a physical visit to one of the stop locations or coordinates listed. An + on-board visit does not count, the traveler must alight or board at the given stop for it to to + be accepted. To visit a coordinate, the traveler must walk(bike or drive) to the closest point + in the street network from a stop and back to another stop to join the transit network. + + NOTE! Coordinates are NOT supported yet. + """; + private static final String DOC_PASS_THROUGH_VIA_LOCATION = + """ + One of the listed stop locations must be visited on-board a transit vehicle or the journey must + alight or board at the location. + """; + private static final String DOC_VIA_LOCATION = + """ + A via-location is used to specifying a location as an intermediate place the router must + route through. The via-location is either a pass-through-location or a visit-via-location. + """; + + /* field constants */ + + public static final String FIELD_LABEL = "label"; + public static final String FIELD_MINIMUM_WAIT_TIME = "minimumWaitTime"; + public static final String FIELD_STOP_LOCATION_IDS = "stopLocationIds"; + + // TODO : Add coordinates + //private static final String FIELD_COORDINATES = "coordinates"; + public static final String FIELD_VISIT = "visit"; + public static final String DOC_FIELD_VISIT = + "Board or alight at a stop location or visit a coordinate."; + public static final String FIELD_PASS_THROUGH = "passThrough"; + public static final String DOC_FIELD_PASS_THROUGH = + "Board, alight or pass-through(on-board) at the stop location."; + + private static final String DOC_LABEL = + "The label/name of the location. This is pass-through " + + "information and is not used in routing."; + private static final String DOC_MINIMUM_WAIT_TIME = + """ + The minimum wait time is used to force the trip to stay the given duration at the + via-location before the trip is continued. + """; + private static final String DOC_STOP_LOCATION_IDS = + """ + A list of stop locations. A stop location can be a quay, a stop place, a multimodal + stop place or a group of stop places. It is enough to visit ONE of the locations + listed. + """; + + static final GraphQLInputObjectType VISIT_VIA_LOCATION_INPUT = GraphQLInputObjectType + .newInputObject() + .name(INPUT_VISIT_VIA_LOCATION) + .description(DOC_VISIT_VIA_LOCATION) + .field(b -> b.name(FIELD_LABEL).description(DOC_LABEL).type(GraphQLString)) + .field(b -> + b + .name(FIELD_MINIMUM_WAIT_TIME) + .description(DOC_MINIMUM_WAIT_TIME) + .type(TransmodelScalars.DURATION_SCALAR) + .defaultValueLiteral(StringValue.of(Duration.ZERO.toString())) + ) + .field(b -> + b + .name(FIELD_STOP_LOCATION_IDS) + .description(DOC_STOP_LOCATION_IDS) + .type(gqlListOfNonNullStrings()) + ) + /* + TODO: Add support for coordinates + */ + .build(); + + static final GraphQLInputObjectType PASS_THROUGH_VIA_LOCATION_INPUT = GraphQLInputObjectType + .newInputObject() + .name(INPUT_PASS_THROUGH_VIA_LOCATION) + .description(DOC_PASS_THROUGH_VIA_LOCATION) + .field(b -> b.name(FIELD_LABEL).description(DOC_LABEL).type(GraphQLString)) + .field(b -> + // This is NOT nonNull, because we might add other parameters later, like 'list of line-ids' + b + .name(FIELD_STOP_LOCATION_IDS) + .description(DOC_STOP_LOCATION_IDS) + .type(gqlListOfNonNullStrings()) + ) + .build(); + + public static final GraphQLInputObjectType VIA_LOCATION_INPUT = GraphQLInputObjectType + .newInputObject() + .name(INPUT_VIA_LOCATION) + .description(DOC_VIA_LOCATION) + .withDirective(OneOfDirective) + .field(b -> b.name(FIELD_VISIT).description(DOC_FIELD_VISIT).type(VISIT_VIA_LOCATION_INPUT)) + .field(b -> + b + .name(FIELD_PASS_THROUGH) + .description(DOC_FIELD_PASS_THROUGH) + .type(PASS_THROUGH_VIA_LOCATION_INPUT) + ) + .build(); + + private static GraphQLList gqlListOfNonNullStrings() { + return new GraphQLList(new GraphQLNonNull(GraphQLString)); + } +} diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ViaLocationInputType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/legacyvia/ViaLocationInputType.java similarity index 82% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/ViaLocationInputType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/legacyvia/ViaLocationInputType.java index 6ce02240817..1f26d12e7f7 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ViaLocationInputType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/legacyvia/ViaLocationInputType.java @@ -1,15 +1,15 @@ -package org.opentripplanner.apis.transmodel.model.plan; +package org.opentripplanner.apis.transmodel.model.plan.legacyvia; import graphql.Scalars; import graphql.schema.GraphQLInputObjectField; import graphql.schema.GraphQLInputObjectType; import org.opentripplanner.apis.transmodel.model.framework.CoordinateInputType; -import org.opentripplanner.apis.transmodel.support.GqlUtil; -import org.opentripplanner.routing.api.request.ViaLocation; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelScalars; +import org.opentripplanner.routing.api.request.ViaLocationDeprecated; public class ViaLocationInputType { - public static GraphQLInputObjectType create(GqlUtil gqlUtil) { + public static GraphQLInputObjectType create() { return GraphQLInputObjectType .newInputObject() .name("ViaLocationInput") @@ -57,21 +57,21 @@ public static GraphQLInputObjectType create(GqlUtil gqlUtil) { GraphQLInputObjectField .newInputObjectField() .name("minSlack") - .defaultValue(ViaLocation.DEFAULT_MIN_SLACK) + .defaultValue(ViaLocationDeprecated.DEFAULT_MIN_SLACK) .description( "The minimum time the user wants to stay in the via location before continuing his journey" ) - .type(gqlUtil.durationScalar) + .type(TransmodelScalars.DURATION_SCALAR) ) .field( GraphQLInputObjectField .newInputObjectField() .name("maxSlack") - .defaultValue(ViaLocation.DEFAULT_MAX_SLACK) + .defaultValue(ViaLocationDeprecated.DEFAULT_MAX_SLACK) .description( "The maximum time the user wants to stay in the via location before continuing his journey" ) - .type(gqlUtil.durationScalar) + .type(TransmodelScalars.DURATION_SCALAR) ) .build(); } diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ViaSegmentInputType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/legacyvia/ViaSegmentInputType.java similarity index 95% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/ViaSegmentInputType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/legacyvia/ViaSegmentInputType.java index 0d591a1357a..a2ada7487c3 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ViaSegmentInputType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/legacyvia/ViaSegmentInputType.java @@ -1,10 +1,11 @@ -package org.opentripplanner.apis.transmodel.model.plan; +package org.opentripplanner.apis.transmodel.model.plan.legacyvia; import graphql.schema.GraphQLInputObjectField; import graphql.schema.GraphQLInputObjectType; import graphql.schema.GraphQLList; import graphql.schema.GraphQLNonNull; import org.opentripplanner.apis.transmodel.model.EnumTypes; +import org.opentripplanner.apis.transmodel.model.plan.FilterInputType; public class ViaSegmentInputType { diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ViaTripQuery.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/legacyvia/ViaTripQuery.java similarity index 93% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/ViaTripQuery.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/legacyvia/ViaTripQuery.java index 8641dbc60c2..745470c2220 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ViaTripQuery.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/legacyvia/ViaTripQuery.java @@ -1,4 +1,4 @@ -package org.opentripplanner.apis.transmodel.model.plan; +package org.opentripplanner.apis.transmodel.model.plan.legacyvia; import graphql.Scalars; import graphql.schema.GraphQLArgument; @@ -7,11 +7,13 @@ import graphql.schema.GraphQLList; import graphql.schema.GraphQLNonNull; import graphql.schema.GraphQLOutputType; +import graphql.schema.GraphQLScalarType; import org.opentripplanner.apis.transmodel.TransmodelGraphQLPlanner; import org.opentripplanner.apis.transmodel.model.DefaultRouteRequestType; import org.opentripplanner.apis.transmodel.model.EnumTypes; import org.opentripplanner.apis.transmodel.model.framework.LocationInputType; -import org.opentripplanner.apis.transmodel.support.GqlUtil; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelDirectives; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelScalars; public class ViaTripQuery { @@ -20,7 +22,7 @@ public static GraphQLFieldDefinition create( GraphQLOutputType viaTripType, GraphQLInputObjectType viaLocationInputType, GraphQLInputObjectType viaSegmentInputType, - GqlUtil gqlUtil + GraphQLScalarType dateTimeScalar ) { return GraphQLFieldDefinition .newFieldDefinition() @@ -28,8 +30,9 @@ public static GraphQLFieldDefinition create( .description( "Via trip search. Find trip patterns traveling via one or more intermediate (via) locations." ) + .deprecate("Use the regular trip query with via stop instead.") .type(new GraphQLNonNull(viaTripType)) - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .argument( GraphQLArgument .newArgument() @@ -39,7 +42,7 @@ public static GraphQLFieldDefinition create( "(if arriveBy=false/not set) or the latest acceptable time of arriving " + "(arriveBy=true). Defaults to now" ) - .type(gqlUtil.dateTimeScalar) + .type(dateTimeScalar) .build() ) .argument( @@ -72,7 +75,7 @@ public static GraphQLFieldDefinition create( "The search-window used is returned to the response metadata as `searchWindowUsed` for " + "debugging purposes." ) - .type(new GraphQLNonNull(gqlUtil.durationScalar)) + .type(new GraphQLNonNull(TransmodelScalars.DURATION_SCALAR)) .build() ) .argument( diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ViaTripType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/legacyvia/ViaTripType.java similarity index 98% rename from src/main/java/org/opentripplanner/apis/transmodel/model/plan/ViaTripType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/legacyvia/ViaTripType.java index 8b55222f3b8..740664c02f0 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/plan/ViaTripType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/legacyvia/ViaTripType.java @@ -1,4 +1,4 @@ -package org.opentripplanner.apis.transmodel.model.plan; +package org.opentripplanner.apis.transmodel.model.plan.legacyvia; import graphql.Scalars; import graphql.schema.DataFetchingEnvironment; diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/DateTimeScalarFactory.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/DateTimeScalarFactory.java similarity index 93% rename from src/main/java/org/opentripplanner/apis/transmodel/model/scalars/DateTimeScalarFactory.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/DateTimeScalarFactory.java index 9738a277a41..f539715206e 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/DateTimeScalarFactory.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/DateTimeScalarFactory.java @@ -12,7 +12,6 @@ import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; import java.time.temporal.TemporalAccessor; -import javax.annotation.Nonnull; import org.opentripplanner.framework.time.OffsetDateTimeParser; public final class DateTimeScalarFactory { @@ -41,7 +40,7 @@ public static GraphQLScalarType createMillisecondsSinceEpochAsDateTimeStringScal .coercing( new Coercing<>() { @Override - public String serialize(@Nonnull Object input) { + public String serialize(Object input) { if (input instanceof Long inputAsLong) { return Instant.ofEpochMilli(inputAsLong).atZone(timeZone).format(FORMATTER); } @@ -49,7 +48,7 @@ public String serialize(@Nonnull Object input) { } @Override - public Long parseValue(@Nonnull Object input) { + public Long parseValue(Object input) { Instant instant = null; if (input instanceof CharSequence inputAsCharSequence) { try { @@ -80,7 +79,7 @@ public Long parseValue(@Nonnull Object input) { } @Override - public Long parseLiteral(@Nonnull Object input) { + public Long parseLiteral(Object input) { if (input instanceof StringValue inputAsStringValue) { return parseValue(inputAsStringValue.getValue()); } diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/DoubleFunction.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/DoubleFunction.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/scalars/DoubleFunction.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/DoubleFunction.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/DoubleFunctionFactory.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/DoubleFunctionFactory.java similarity index 84% rename from src/main/java/org/opentripplanner/apis/transmodel/model/scalars/DoubleFunctionFactory.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/DoubleFunctionFactory.java index fd45b001642..5259c0dd9db 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/DoubleFunctionFactory.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/DoubleFunctionFactory.java @@ -10,7 +10,6 @@ import graphql.schema.GraphQLScalarType; import java.util.Locale; import java.util.NoSuchElementException; -import javax.annotation.Nonnull; import org.opentripplanner.routing.api.request.framework.LinearFunctionSerialization; public class DoubleFunctionFactory { @@ -40,9 +39,9 @@ public static GraphQLScalarType createDoubleFunctionScalar() { new Coercing() { @Override public String serialize( - @Nonnull Object dataFetcherResult, - @Nonnull GraphQLContext graphQLContext, - @Nonnull Locale locale + Object dataFetcherResult, + GraphQLContext graphQLContext, + Locale locale ) { var value = (DoubleFunction) dataFetcherResult; return LinearFunctionSerialization.serialize(value.constant(), value.coefficient()); @@ -50,9 +49,9 @@ public String serialize( @Override public DoubleFunction parseValue( - @Nonnull Object input, - @Nonnull GraphQLContext graphQLContext, - @Nonnull Locale locale + Object input, + GraphQLContext graphQLContext, + Locale locale ) throws CoercingParseValueException { try { String text = (String) input; @@ -64,10 +63,10 @@ public DoubleFunction parseValue( @Override public DoubleFunction parseLiteral( - @Nonnull Value input, - @Nonnull CoercedVariables variables, - @Nonnull GraphQLContext graphQLContext, - @Nonnull Locale locale + Value input, + CoercedVariables variables, + GraphQLContext graphQLContext, + Locale locale ) throws CoercingParseLiteralException { if (input instanceof StringValue stringValue) { return parseValue(stringValue.getValue(), graphQLContext, locale); diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/GeoJSONCoordinatesScalar.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/GeoJSONCoordinatesScalar.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/scalars/GeoJSONCoordinatesScalar.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/GeoJSONCoordinatesScalar.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/LocalTimeScalarFactory.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/LocalTimeScalarFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/scalars/LocalTimeScalarFactory.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/LocalTimeScalarFactory.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/TimeScalarFactory.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/TimeScalarFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/scalars/TimeScalarFactory.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/scalars/TimeScalarFactory.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/siri/et/EstimatedCallType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/siri/et/EstimatedCallType.java similarity index 96% rename from src/main/java/org/opentripplanner/apis/transmodel/model/siri/et/EstimatedCallType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/siri/et/EstimatedCallType.java index 3587b3dc0f6..a0a904a0ae0 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/siri/et/EstimatedCallType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/siri/et/EstimatedCallType.java @@ -9,6 +9,7 @@ import graphql.schema.GraphQLNonNull; import graphql.schema.GraphQLObjectType; import graphql.schema.GraphQLOutputType; +import graphql.schema.GraphQLScalarType; import graphql.schema.GraphQLTypeReference; import java.time.Instant; import java.time.LocalDate; @@ -17,6 +18,8 @@ import java.util.Set; import org.opentripplanner.apis.transmodel.mapping.OccupancyStatusMapper; import org.opentripplanner.apis.transmodel.model.EnumTypes; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelDirectives; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelScalars; import org.opentripplanner.apis.transmodel.support.GqlUtil; import org.opentripplanner.model.TripTimeOnDate; import org.opentripplanner.routing.alertpatch.StopCondition; @@ -41,7 +44,7 @@ public static GraphQLObjectType create( GraphQLOutputType ptSituationElementType, GraphQLOutputType serviceJourneyType, GraphQLOutputType datedServiceJourneyType, - GqlUtil gqlUtil + GraphQLScalarType dateTimeScalar ) { return GraphQLObjectType .newObject() @@ -62,7 +65,7 @@ public static GraphQLObjectType create( .newFieldDefinition() .name("aimedArrivalTime") .description("Scheduled time of arrival at quay. Not affected by read time updated") - .type(new GraphQLNonNull(gqlUtil.dateTimeScalar)) + .type(new GraphQLNonNull(dateTimeScalar)) .dataFetcher(environment -> 1000 * ( @@ -76,7 +79,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("expectedArrivalTime") - .type(new GraphQLNonNull(gqlUtil.dateTimeScalar)) + .type(new GraphQLNonNull(dateTimeScalar)) .description( "Expected time of arrival at quay. Updated with real time information if available. Will be null if an actualArrivalTime exists" ) @@ -92,7 +95,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("actualArrivalTime") - .type(gqlUtil.dateTimeScalar) + .type(dateTimeScalar) .description( "Actual time of arrival at quay. Updated from real time information if available." ) @@ -112,7 +115,7 @@ public static GraphQLObjectType create( .newFieldDefinition() .name("aimedDepartureTime") .description("Scheduled time of departure from quay. Not affected by read time updated") - .type(new GraphQLNonNull(gqlUtil.dateTimeScalar)) + .type(new GraphQLNonNull(dateTimeScalar)) .dataFetcher(environment -> 1000 * ( @@ -126,7 +129,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("expectedDepartureTime") - .type(new GraphQLNonNull(gqlUtil.dateTimeScalar)) + .type(new GraphQLNonNull(dateTimeScalar)) .description( "Expected time of departure from quay. Updated with real time information if available. Will be null if an actualDepartureTime exists" ) @@ -143,7 +146,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("actualDepartureTime") - .type(gqlUtil.dateTimeScalar) + .type(dateTimeScalar) .description( "Actual time of departure from quay. Updated with real time information if available." ) @@ -271,7 +274,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("date") - .type(new GraphQLNonNull(gqlUtil.dateScalar)) + .type(new GraphQLNonNull(TransmodelScalars.DATE_SCALAR)) .description("The date the estimated call is valid for.") .dataFetcher(environment -> ((TripTimeOnDate) environment.getSource()).getServiceDay()) .build() @@ -326,7 +329,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("situations") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(ptSituationElementType)))) .description("Get all relevant situations for this EstimatedCall.") .dataFetcher(environment -> diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/siri/sx/AffectsType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/siri/sx/AffectsType.java similarity index 97% rename from src/main/java/org/opentripplanner/apis/transmodel/model/siri/sx/AffectsType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/siri/sx/AffectsType.java index 4aded08e3e8..58bf9d3f958 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/siri/sx/AffectsType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/siri/sx/AffectsType.java @@ -8,6 +8,7 @@ import graphql.schema.GraphQLOutputType; import graphql.schema.GraphQLUnionType; import org.opentripplanner.apis.transmodel.model.EnumTypes; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelScalars; import org.opentripplanner.apis.transmodel.model.stop.StopPlaceType; import org.opentripplanner.apis.transmodel.support.GqlUtil; import org.opentripplanner.routing.alertpatch.EntitySelector; @@ -23,8 +24,7 @@ public static GraphQLOutputType create( GraphQLOutputType stopPlaceType, GraphQLOutputType lineType, GraphQLOutputType serviceJourneyType, - GraphQLOutputType datedServiceJourneyType, - GqlUtil gqlUtil + GraphQLOutputType datedServiceJourneyType ) { GraphQLObjectType affectedStopPlace = GraphQLObjectType .newObject() @@ -96,7 +96,7 @@ public static GraphQLOutputType create( GraphQLFieldDefinition .newFieldDefinition() .name("operatingDay") - .type(gqlUtil.dateScalar) + .type(TransmodelScalars.DATE_SCALAR) .dataFetcher(environment -> environment.getSource().serviceDate()) .build() ) @@ -204,7 +204,7 @@ public static GraphQLOutputType create( GraphQLFieldDefinition .newFieldDefinition() .name("operatingDay") - .type(gqlUtil.dateScalar) + .type(TransmodelScalars.DATE_SCALAR) .dataFetcher(environment -> environment.getSource().serviceDate() ) diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/siri/sx/PtSituationElementType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/siri/sx/PtSituationElementType.java similarity index 99% rename from src/main/java/org/opentripplanner/apis/transmodel/model/siri/sx/PtSituationElementType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/siri/sx/PtSituationElementType.java index 0dc0e74d3b3..1567cd977c9 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/siri/sx/PtSituationElementType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/siri/sx/PtSituationElementType.java @@ -10,6 +10,7 @@ import graphql.schema.GraphQLNonNull; import graphql.schema.GraphQLObjectType; import graphql.schema.GraphQLOutputType; +import graphql.schema.GraphQLScalarType; import graphql.schema.GraphQLTypeReference; import java.time.ZonedDateTime; import java.util.AbstractMap; @@ -41,7 +42,7 @@ public static GraphQLObjectType create( GraphQLObjectType validityPeriodType, GraphQLObjectType infoLinkType, GraphQLOutputType affectsType, - GqlUtil gqlUtil, + GraphQLScalarType dateTimeScalar, Relay relay ) { return GraphQLObjectType @@ -304,7 +305,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("creationTime") - .type(gqlUtil.dateTimeScalar) + .type(dateTimeScalar) .description("Timestamp for when the situation was created.") .dataFetcher(environment -> { final ZonedDateTime creationTime = environment.getSource().creationTime(); @@ -316,7 +317,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("versionedAtTime") - .type(gqlUtil.dateTimeScalar) + .type(dateTimeScalar) .description("Timestamp when the situation element was updated.") .dataFetcher(environment -> { final ZonedDateTime updatedTime = environment.getSource().updatedTime(); diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/siri/sx/ValidityPeriod.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/siri/sx/ValidityPeriod.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/siri/sx/ValidityPeriod.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/siri/sx/ValidityPeriod.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/stop/BikeParkType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/BikeParkType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/stop/BikeParkType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/BikeParkType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/stop/BikeRentalStationType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/BikeRentalStationType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/stop/BikeRentalStationType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/BikeRentalStationType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/stop/MonoOrMultiModalStation.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/MonoOrMultiModalStation.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/stop/MonoOrMultiModalStation.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/MonoOrMultiModalStation.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/stop/PlaceAtDistanceType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/PlaceAtDistanceType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/stop/PlaceAtDistanceType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/PlaceAtDistanceType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/stop/PlaceInterfaceType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/PlaceInterfaceType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/stop/PlaceInterfaceType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/PlaceInterfaceType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/stop/PlaceType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/PlaceType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/stop/PlaceType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/PlaceType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/stop/QuayAtDistanceType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/QuayAtDistanceType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/stop/QuayAtDistanceType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/QuayAtDistanceType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/stop/QuayType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/QuayType.java similarity index 97% rename from src/main/java/org/opentripplanner/apis/transmodel/model/stop/QuayType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/QuayType.java index e146b537c1c..e12775936bd 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/stop/QuayType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/QuayType.java @@ -10,6 +10,7 @@ import graphql.schema.GraphQLNonNull; import graphql.schema.GraphQLObjectType; import graphql.schema.GraphQLOutputType; +import graphql.schema.GraphQLScalarType; import graphql.schema.GraphQLTypeReference; import java.time.Duration; import java.time.Instant; @@ -19,6 +20,7 @@ import java.util.Optional; import org.locationtech.jts.geom.Geometry; import org.opentripplanner.apis.transmodel.model.EnumTypes; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelDirectives; import org.opentripplanner.apis.transmodel.model.plan.JourneyWhiteListed; import org.opentripplanner.apis.transmodel.model.scalars.GeoJSONCoordinatesScalar; import org.opentripplanner.apis.transmodel.support.GqlUtil; @@ -44,7 +46,7 @@ public static GraphQLObjectType create( GraphQLOutputType estimatedCallType, GraphQLOutputType ptSituationElementType, GraphQLOutputType tariffZoneType, - GqlUtil gqlUtil + GraphQLScalarType dateTimeScalar ) { return GraphQLObjectType .newObject() @@ -169,7 +171,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("lines") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .description("List of lines servicing this quay") .type(new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(lineType)))) .dataFetcher(env -> @@ -187,7 +189,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("journeyPatterns") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .description("List of journey patterns servicing this quay") .type(new GraphQLNonNull(new GraphQLList(journeyPatternType))) .dataFetcher(env -> @@ -199,14 +201,14 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("estimatedCalls") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .description("List of visits to this quay as part of vehicle journeys.") .type(new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(estimatedCallType)))) .argument( GraphQLArgument .newArgument() .name("startTime") - .type(gqlUtil.dateTimeScalar) + .type(dateTimeScalar) .description( "DateTime for when to fetch estimated calls from. Default value is current time" ) diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/stop/RentalVehicleType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/RentalVehicleType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/stop/RentalVehicleType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/RentalVehicleType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/stop/StopPlaceType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/StopPlaceType.java similarity index 98% rename from src/main/java/org/opentripplanner/apis/transmodel/model/stop/StopPlaceType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/StopPlaceType.java index 53621ee9b5a..00ac5b0e11b 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/stop/StopPlaceType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/StopPlaceType.java @@ -12,6 +12,7 @@ import graphql.schema.GraphQLNonNull; import graphql.schema.GraphQLObjectType; import graphql.schema.GraphQLOutputType; +import graphql.schema.GraphQLScalarType; import graphql.schema.GraphQLTypeReference; import java.time.Duration; import java.time.Instant; @@ -29,6 +30,7 @@ import org.opentripplanner.apis.transmodel.mapping.TransitIdMapper; import org.opentripplanner.apis.transmodel.model.EnumTypes; import org.opentripplanner.apis.transmodel.model.TransmodelTransportSubmode; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelDirectives; import org.opentripplanner.apis.transmodel.model.plan.JourneyWhiteListed; import org.opentripplanner.apis.transmodel.support.GqlUtil; import org.opentripplanner.framework.graphql.GraphQLUtils; @@ -56,7 +58,7 @@ public static GraphQLObjectType create( GraphQLOutputType tariffZoneType, GraphQLOutputType estimatedCallType, GraphQLOutputType ptSituationElementType, - GqlUtil gqlUtil + GraphQLScalarType dateTimeScalar ) { return GraphQLObjectType .newObject() @@ -227,7 +229,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("quays") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .description("Returns all quays that are children of this stop place") .type(new GraphQLList(quayType)) .argument( @@ -285,14 +287,14 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("estimatedCalls") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .description("List of visits to this stop place as part of vehicle journeys.") .type(new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(estimatedCallType)))) .argument( GraphQLArgument .newArgument() .name("startTime") - .type(gqlUtil.dateTimeScalar) + .type(dateTimeScalar) .description( "DateTime for when to fetch estimated calls from. Default value is current time" ) diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/stop/StopTypeMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/StopTypeMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/stop/StopTypeMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/StopTypeMapper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/stop/TariffZoneType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/TariffZoneType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/stop/TariffZoneType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/TariffZoneType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/BookingArrangementType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/BookingArrangementType.java similarity index 97% rename from src/main/java/org/opentripplanner/apis/transmodel/model/timetable/BookingArrangementType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/BookingArrangementType.java index de0f86b1166..727dc37d99b 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/BookingArrangementType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/BookingArrangementType.java @@ -7,14 +7,14 @@ import graphql.schema.GraphQLObjectType; import graphql.schema.GraphQLOutputType; import org.opentripplanner.apis.transmodel.model.EnumTypes; -import org.opentripplanner.apis.transmodel.support.GqlUtil; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelScalars; import org.opentripplanner.transit.model.organization.ContactInfo; import org.opentripplanner.transit.model.timetable.booking.BookingInfo; import org.opentripplanner.transit.model.timetable.booking.BookingTime; public class BookingArrangementType { - public static GraphQLObjectType create(GqlUtil gqlUtil) { + public static GraphQLObjectType create() { GraphQLOutputType contactType = GraphQLObjectType .newObject() .name("Contact") @@ -82,7 +82,7 @@ public static GraphQLObjectType create(GqlUtil gqlUtil) { .newFieldDefinition() .name("latestBookingTime") .description("Latest time the service can be booked. ISO 8601 timestamp") - .type(gqlUtil.localTimeScalar) + .type(TransmodelScalars.LOCAL_TIME_SCALAR) .dataFetcher(environment -> { final BookingTime latestBookingTime = (bookingInfo(environment)).getLatestBookingTime(); return latestBookingTime == null ? null : latestBookingTime.getTime(); diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/DatedServiceJourneyQuery.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/DatedServiceJourneyQuery.java similarity index 63% rename from src/main/java/org/opentripplanner/apis/transmodel/model/timetable/DatedServiceJourneyQuery.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/DatedServiceJourneyQuery.java index c3c8ba420e4..aef659901e4 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/DatedServiceJourneyQuery.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/DatedServiceJourneyQuery.java @@ -10,13 +10,14 @@ import graphql.schema.GraphQLOutputType; import java.time.LocalDate; import java.util.List; -import java.util.stream.Stream; import org.opentripplanner.apis.transmodel.mapping.TransitIdMapper; import org.opentripplanner.apis.transmodel.model.EnumTypes; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelScalars; import org.opentripplanner.apis.transmodel.support.GqlUtil; +import org.opentripplanner.transit.api.request.TripOnServiceDateRequest; +import org.opentripplanner.transit.api.request.TripOnServiceDateRequestBuilder; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.timetable.TripAlteration; -import org.opentripplanner.transit.model.timetable.TripOnServiceDate; /** * A GraphQL query for retrieving data on DatedServiceJourneys @@ -38,10 +39,7 @@ public static GraphQLFieldDefinition createGetById(GraphQLOutputType datedServic .build(); } - public static GraphQLFieldDefinition createQuery( - GraphQLOutputType datedServiceJourneyType, - GqlUtil gqlUtil - ) { + public static GraphQLFieldDefinition createQuery(GraphQLOutputType datedServiceJourneyType) { return GraphQLFieldDefinition .newFieldDefinition() .name("datedServiceJourneys") @@ -69,7 +67,9 @@ public static GraphQLFieldDefinition createQuery( GraphQLArgument .newArgument() .name("operatingDays") - .type(new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(gqlUtil.dateScalar)))) + .type( + new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(TransmodelScalars.DATE_SCALAR))) + ) ) .argument( GraphQLArgument @@ -93,72 +93,34 @@ public static GraphQLFieldDefinition createQuery( .type(new GraphQLList(new GraphQLNonNull(Scalars.GraphQLString))) ) .dataFetcher(environment -> { - Stream stream = GqlUtil - .getTransitService(environment) - .getAllTripOnServiceDates() - .stream(); - + // The null safety checks are not needed here - they are taken care of by the request + // object, but reuse let's use the mapping method and leave this improvement until all APIs + // are pushing this check into the domain request. + var authorities = mapIDsToDomainNullSafe(environment.getArgument("authorities")); var lines = mapIDsToDomainNullSafe(environment.getArgument("lines")); var serviceJourneys = mapIDsToDomainNullSafe(environment.getArgument("serviceJourneys")); + var replacementFor = mapIDsToDomainNullSafe(environment.getArgument("replacementFor")); var privateCodes = environment.>getArgument("privateCodes"); var operatingDays = environment.>getArgument("operatingDays"); var alterations = environment.>getArgument("alterations"); - var authorities = mapIDsToDomainNullSafe(environment.getArgument("authorities")); - var replacementFor = mapIDsToDomainNullSafe(environment.getArgument("replacementFor")); - if (!lines.isEmpty()) { - stream = - stream.filter(tripOnServiceDate -> - lines.contains(tripOnServiceDate.getTrip().getRoute().getId()) - ); - } + TripOnServiceDateRequestBuilder tripOnServiceDateRequestBuilder = TripOnServiceDateRequest + .of() + .withOperatingDays(operatingDays) + .withAuthorities(authorities) + .withLines(lines) + .withServiceJourneys(serviceJourneys) + .withReplacementFor(replacementFor); - if (!serviceJourneys.isEmpty()) { - stream = - stream.filter(tripOnServiceDate -> - serviceJourneys.contains(tripOnServiceDate.getTrip().getId()) - ); - } + tripOnServiceDateRequestBuilder = + tripOnServiceDateRequestBuilder.withPrivateCodes(privateCodes); - if (privateCodes != null && !privateCodes.isEmpty()) { - stream = - stream.filter(tripOnServiceDate -> - privateCodes.contains(tripOnServiceDate.getTrip().getNetexInternalPlanningCode()) - ); - } + tripOnServiceDateRequestBuilder = + tripOnServiceDateRequestBuilder.withAlterations(alterations); - // At least one operationg day is required - var days = operatingDays.stream().toList(); - - stream = - stream.filter(tripOnServiceDate -> days.contains(tripOnServiceDate.getServiceDate())); - - if (alterations != null && !alterations.isEmpty()) { - stream = - stream.filter(tripOnServiceDate -> - alterations.contains(tripOnServiceDate.getTripAlteration()) - ); - } - - if (!authorities.isEmpty()) { - stream = - stream.filter(tripOnServiceDate -> - authorities.contains(tripOnServiceDate.getTrip().getRoute().getAgency().getId()) - ); - } - - if (!replacementFor.isEmpty()) { - stream = - stream.filter(tripOnServiceDate -> - !tripOnServiceDate.getReplacementFor().isEmpty() && - tripOnServiceDate - .getReplacementFor() - .stream() - .anyMatch(replacement -> replacementFor.contains(replacement.getId())) - ); - } - - return stream.toList(); + return GqlUtil + .getTransitService(environment) + .getTripOnServiceDates(tripOnServiceDateRequestBuilder.build()); }) .build(); } diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/DatedServiceJourneyType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/DatedServiceJourneyType.java similarity index 95% rename from src/main/java/org/opentripplanner/apis/transmodel/model/timetable/DatedServiceJourneyType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/DatedServiceJourneyType.java index faeccf930c6..7fcce88c4ee 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/DatedServiceJourneyType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/DatedServiceJourneyType.java @@ -14,6 +14,8 @@ import java.util.List; import java.util.Optional; import org.opentripplanner.apis.transmodel.model.EnumTypes; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelDirectives; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelScalars; import org.opentripplanner.apis.transmodel.support.GqlUtil; import org.opentripplanner.routing.TripTimeOnDateHelper; import org.opentripplanner.transit.model.network.TripPattern; @@ -33,8 +35,7 @@ public static GraphQLObjectType create( GraphQLOutputType serviceJourneyType, GraphQLOutputType journeyPatternType, GraphQLType estimatedCallType, - GraphQLType quayType, - GqlUtil gqlUtil + GraphQLType quayType ) { return GraphQLObjectType .newObject() @@ -48,7 +49,7 @@ public static GraphQLObjectType create( .description( "The date this service runs. The date used is based on the service date as opposed to calendar date." ) - .type(gqlUtil.dateScalar) + .type(TransmodelScalars.DATE_SCALAR) .dataFetcher(environment -> Optional .of(tripOnServiceDate(environment)) @@ -142,7 +143,7 @@ public static GraphQLObjectType create( .newFieldDefinition() .name("estimatedCalls") .type(new GraphQLList(estimatedCallType)) - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .description( "Returns scheduled passingTimes for this dated service journey, " + "updated with real-time-updates (if available). " diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/InterchangeType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/InterchangeType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/model/timetable/InterchangeType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/InterchangeType.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/ServiceJourneyType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/ServiceJourneyType.java similarity index 96% rename from src/main/java/org/opentripplanner/apis/transmodel/model/timetable/ServiceJourneyType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/ServiceJourneyType.java index c0c96b1e393..e61d0a12edc 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/ServiceJourneyType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/ServiceJourneyType.java @@ -17,6 +17,8 @@ import org.locationtech.jts.geom.LineString; import org.opentripplanner.apis.transmodel.model.EnumTypes; import org.opentripplanner.apis.transmodel.model.TransmodelTransportSubmode; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelDirectives; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelScalars; import org.opentripplanner.apis.transmodel.support.GqlUtil; import org.opentripplanner.framework.geometry.EncodedPolyline; import org.opentripplanner.model.TripTimeOnDate; @@ -41,8 +43,7 @@ public static GraphQLObjectType create( GraphQLOutputType ptSituationElementType, GraphQLOutputType journeyPatternType, GraphQLOutputType estimatedCallType, - GraphQLOutputType timetabledPassingTimeType, - GqlUtil gqlUtil + GraphQLOutputType timetabledPassingTimeType ) { return GraphQLObjectType .newObject() @@ -61,8 +62,8 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("activeDates") - .withDirective(gqlUtil.timingData) - .type(new GraphQLNonNull(new GraphQLList(gqlUtil.dateScalar))) + .withDirective(TransmodelDirectives.TIMING_DATA) + .type(new GraphQLNonNull(new GraphQLList(TransmodelScalars.DATE_SCALAR))) .dataFetcher(environment -> GqlUtil .getTransitService(environment) @@ -235,7 +236,7 @@ public static GraphQLObjectType create( .newFieldDefinition() .name("passingTimes") .type(new GraphQLNonNull(new GraphQLList(timetabledPassingTimeType))) - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .description( "Returns scheduled passing times only - without real-time-updates, for realtime-data use 'estimatedCalls'" ) @@ -254,7 +255,7 @@ public static GraphQLObjectType create( .newFieldDefinition() .name("estimatedCalls") .type(new GraphQLList(estimatedCallType)) - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .description( "Returns scheduled passingTimes for this ServiceJourney for a given date, updated with real-time-updates (if available). " + "NB! This takes a date as argument (default=today) and returns estimatedCalls for that date and should only be used if the date is " + @@ -264,7 +265,7 @@ public static GraphQLObjectType create( GraphQLArgument .newArgument() .name("date") - .type(gqlUtil.dateScalar) + .type(TransmodelScalars.DATE_SCALAR) .description("Date to get estimated calls for. Defaults to today.") .build() ) diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/TimetabledPassingTimeType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/TimetabledPassingTimeType.java similarity index 95% rename from src/main/java/org/opentripplanner/apis/transmodel/model/timetable/TimetabledPassingTimeType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/TimetabledPassingTimeType.java index 9370ed74d93..0f4a40f0750 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/TimetabledPassingTimeType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/TimetabledPassingTimeType.java @@ -8,6 +8,7 @@ import graphql.schema.GraphQLObjectType; import graphql.schema.GraphQLOutputType; import graphql.schema.GraphQLTypeReference; +import org.opentripplanner.apis.transmodel.model.framework.TransmodelScalars; import org.opentripplanner.apis.transmodel.support.GqlUtil; import org.opentripplanner.ext.flex.trip.FlexTrip; import org.opentripplanner.framework.application.OTPFeature; @@ -25,8 +26,7 @@ public static GraphQLObjectType create( GraphQLOutputType noticeType, GraphQLOutputType quayType, GraphQLOutputType destinationDisplayType, - GraphQLOutputType serviceJourneyType, - GqlUtil gqlUtil + GraphQLOutputType serviceJourneyType ) { return GraphQLObjectType .newObject() @@ -44,7 +44,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("arrival") - .type(gqlUtil.timeScalar) + .type(TransmodelScalars.TIME_SCALAR) .description("Scheduled time of arrival at quay") .dataFetcher(environment -> missingValueToNull(((TripTimeOnDate) environment.getSource()).getScheduledArrival()) @@ -55,7 +55,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("departure") - .type(gqlUtil.timeScalar) + .type(TransmodelScalars.TIME_SCALAR) .description("Scheduled time of departure from quay") .dataFetcher(environment -> missingValueToNull(((TripTimeOnDate) environment.getSource()).getScheduledDeparture()) @@ -111,7 +111,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("earliestDepartureTime") - .type(gqlUtil.timeScalar) + .type(TransmodelScalars.TIME_SCALAR) .description( "Earliest possible departure time for a service journey with a service window." ) @@ -131,7 +131,7 @@ public static GraphQLObjectType create( GraphQLFieldDefinition .newFieldDefinition() .name("latestArrivalTime") - .type(gqlUtil.timeScalar) + .type(TransmodelScalars.TIME_SCALAR) .description( "Latest possible (planned) arrival time for a service journey with a service window." ) diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/TripMetadataType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/TripMetadataType.java similarity index 92% rename from src/main/java/org/opentripplanner/apis/transmodel/model/timetable/TripMetadataType.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/TripMetadataType.java index ccdb3a9b39d..fabae563047 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/TripMetadataType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/timetable/TripMetadataType.java @@ -4,14 +4,14 @@ import graphql.schema.GraphQLFieldDefinition; import graphql.schema.GraphQLNonNull; import graphql.schema.GraphQLObjectType; -import org.opentripplanner.apis.transmodel.support.GqlUtil; +import graphql.schema.GraphQLScalarType; import org.opentripplanner.routing.api.response.TripSearchMetadata; public class TripMetadataType { private TripMetadataType() {} - public static GraphQLObjectType create(GqlUtil gqlUtil) { + public static GraphQLObjectType create(GraphQLScalarType dateTimeScalar) { return GraphQLObjectType .newObject() .name("TripSearchData") @@ -43,7 +43,7 @@ public static GraphQLObjectType create(GqlUtil gqlUtil) { "AFTER the current search." ) .deprecate("Use pageCursor instead") - .type(gqlUtil.dateTimeScalar) + .type(dateTimeScalar) .dataFetcher(e -> ((TripSearchMetadata) e.getSource()).nextDateTime.toEpochMilli()) .build() ) @@ -58,7 +58,7 @@ public static GraphQLObjectType create(GqlUtil gqlUtil) { "time-window BEFORE the current search." ) .deprecate("Use pageCursor instead") - .type(gqlUtil.dateTimeScalar) + .type(dateTimeScalar) .dataFetcher(e -> ((TripSearchMetadata) e.getSource()).prevDateTime.toEpochMilli()) .build() ) diff --git a/src/main/java/org/opentripplanner/apis/transmodel/support/AbortOnUnprocessableRequestExecutionStrategy.java b/application/src/main/java/org/opentripplanner/apis/transmodel/support/AbortOnUnprocessableRequestExecutionStrategy.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/support/AbortOnUnprocessableRequestExecutionStrategy.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/support/AbortOnUnprocessableRequestExecutionStrategy.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/support/DataFetcherDecorator.java b/application/src/main/java/org/opentripplanner/apis/transmodel/support/DataFetcherDecorator.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/support/DataFetcherDecorator.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/support/DataFetcherDecorator.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/support/ExecutionResultMapper.java b/application/src/main/java/org/opentripplanner/apis/transmodel/support/ExecutionResultMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/transmodel/support/ExecutionResultMapper.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/support/ExecutionResultMapper.java diff --git a/src/main/java/org/opentripplanner/apis/transmodel/support/GqlUtil.java b/application/src/main/java/org/opentripplanner/apis/transmodel/support/GqlUtil.java similarity index 64% rename from src/main/java/org/opentripplanner/apis/transmodel/support/GqlUtil.java rename to application/src/main/java/org/opentripplanner/apis/transmodel/support/GqlUtil.java index 16083085500..6b9abc75b05 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/support/GqlUtil.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/support/GqlUtil.java @@ -1,27 +1,16 @@ package org.opentripplanner.apis.transmodel.support; import graphql.Scalars; -import graphql.introspection.Introspection.DirectiveLocation; import graphql.schema.DataFetchingEnvironment; -import graphql.schema.GraphQLDirective; import graphql.schema.GraphQLFieldDefinition; import graphql.schema.GraphQLInputObjectField; import graphql.schema.GraphQLList; import graphql.schema.GraphQLNonNull; -import graphql.schema.GraphQLObjectType; -import graphql.schema.GraphQLScalarType; -import java.time.ZoneId; import java.util.List; import java.util.Locale; import org.opentripplanner.apis.transmodel.TransmodelRequestContext; import org.opentripplanner.apis.transmodel.mapping.TransitIdMapper; -import org.opentripplanner.apis.transmodel.model.scalars.DateTimeScalarFactory; -import org.opentripplanner.apis.transmodel.model.scalars.DoubleFunctionFactory; -import org.opentripplanner.apis.transmodel.model.scalars.LocalTimeScalarFactory; -import org.opentripplanner.apis.transmodel.model.scalars.TimeScalarFactory; import org.opentripplanner.framework.graphql.GraphQLUtils; -import org.opentripplanner.framework.graphql.scalar.DateScalarFactory; -import org.opentripplanner.framework.graphql.scalar.DurationScalarFactory; import org.opentripplanner.routing.graphfinder.GraphFinder; import org.opentripplanner.routing.vehicle_parking.VehicleParkingService; import org.opentripplanner.service.vehiclerental.VehicleRentalService; @@ -33,31 +22,8 @@ */ public class GqlUtil { - public final GraphQLScalarType dateTimeScalar; - public final GraphQLScalarType dateScalar; - public final GraphQLScalarType doubleFunctionScalar; - public final GraphQLScalarType localTimeScalar; - public final GraphQLObjectType timeScalar; - public final GraphQLScalarType durationScalar; - public final GraphQLDirective timingData; - - /** private to prevent util class from instantiation */ - public GqlUtil(ZoneId timeZone) { - this.dateTimeScalar = - DateTimeScalarFactory.createMillisecondsSinceEpochAsDateTimeStringScalar(timeZone); - this.dateScalar = DateScalarFactory.createTransmodelDateScalar(); - this.doubleFunctionScalar = DoubleFunctionFactory.createDoubleFunctionScalar(); - this.localTimeScalar = LocalTimeScalarFactory.createLocalTimeScalar(); - this.timeScalar = TimeScalarFactory.createSecondsSinceMidnightAsTimeObject(); - this.durationScalar = DurationScalarFactory.createDurationScalar(); - this.timingData = - GraphQLDirective - .newDirective() - .name("timingData") - .description("Add timing data to prometheus, if Actuator API is enabled") - .validLocation(DirectiveLocation.FIELD_DEFINITION) - .build(); - } + /** private constructor, prevent instantiation of utility class */ + private GqlUtil() {} public static TransitService getTransitService(DataFetchingEnvironment environment) { return ((TransmodelRequestContext) environment.getContext()).getTransitService(); @@ -122,10 +88,6 @@ public static int getPositiveNonNullIntegerArgument( return argumentValue; } - public static List listOfNullSafe(T element) { - return element == null ? List.of() : List.of(element); - } - /** * Helper method to support the deprecated 'lang' argument. */ diff --git a/application/src/main/java/org/opentripplanner/apis/transmodel/support/OneOfInputValidator.java b/application/src/main/java/org/opentripplanner/apis/transmodel/support/OneOfInputValidator.java new file mode 100644 index 00000000000..0ea554d6b23 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/support/OneOfInputValidator.java @@ -0,0 +1,68 @@ +package org.opentripplanner.apis.transmodel.support; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Map; +import java.util.Objects; + +/** + * Validate @oneOf directive, this validation is NOT done by the Java GraphQL library at the + * moment(v22.1). Remove this when enforced by the library. The {@code @oneOf} is an experimental + * feature in this version of the library. This applies to the code-first approach, not the + * schema-first approach. + *

+ * See {@link graphql.Directives#OneOfDirective} + */ +public class OneOfInputValidator { + + /** + * Validate that the {@code parent} {@code map} only has one entry. + * + * @param map The input to validate. + * @param inputTypeName The name of the type annotated with @oneOf. The name is used in + * the error message only, in case the validation fails. + * @param definedFields The name of the fields the @oneOf directive apply to. + * + * @return the field with a value set. + */ + public static String validateOneOf( + Map map, + String inputTypeName, + String... definedFields + ) { + var fieldsInInput = Arrays + .stream(definedFields) + .map(k -> map.containsKey(k) ? k : null) + .filter(Objects::nonNull) + .toList(); + + if (fieldsInInput.isEmpty()) { + throw new IllegalArgumentException( + "No entries in '%s @oneOf'. One of '%s' must be set.".formatted( + inputTypeName, + String.join("', '", definedFields) + ) + ); + } + if (fieldsInInput.size() > 1) { + throw new IllegalArgumentException( + "Only one entry in '%s @oneOf' is allowed. Set: '%s'".formatted( + inputTypeName, + String.join("', '", fieldsInInput) + ) + ); + } + + // This is not done in the "standard" validator, so if this is replaced by another validator + // we should consider adding this validation. + var field = fieldsInInput.getFirst(); + if (map.get(field) instanceof Collection c) { + if (c.isEmpty()) { + throw new IllegalArgumentException( + "'%s' can not be empty in '%s @oneOf'.".formatted(field, inputTypeName) + ); + } + } + return field; + } +} diff --git a/src/main/java/org/opentripplanner/apis/vectortiles/DebugStyleSpec.java b/application/src/main/java/org/opentripplanner/apis/vectortiles/DebugStyleSpec.java similarity index 94% rename from src/main/java/org/opentripplanner/apis/vectortiles/DebugStyleSpec.java rename to application/src/main/java/org/opentripplanner/apis/vectortiles/DebugStyleSpec.java index 21cdfee9ef7..0dde1494f0a 100644 --- a/src/main/java/org/opentripplanner/apis/vectortiles/DebugStyleSpec.java +++ b/application/src/main/java/org/opentripplanner/apis/vectortiles/DebugStyleSpec.java @@ -18,6 +18,7 @@ import org.opentripplanner.street.model.edge.EscalatorEdge; import org.opentripplanner.street.model.edge.PathwayEdge; import org.opentripplanner.street.model.edge.StreetEdge; +import org.opentripplanner.street.model.edge.StreetStationCentroidLink; import org.opentripplanner.street.model.edge.StreetTransitEntranceLink; import org.opentripplanner.street.model.edge.StreetTransitStopLink; import org.opentripplanner.street.model.edge.StreetVehicleParkingLink; @@ -48,6 +49,10 @@ public class DebugStyleSpec { 1.3f, List.of(new ZoomStop(13, 0.5f), new ZoomStop(MAX_ZOOM, 10)) ); + private static final ZoomDependentNumber LINE_OFFSET = new ZoomDependentNumber( + 1.3f, + List.of(new ZoomStop(13, 0.3f), new ZoomStop(MAX_ZOOM, 6)) + ); private static final ZoomDependentNumber CIRCLE_STROKE = new ZoomDependentNumber( 1, List.of(new ZoomStop(15, 0.2f), new ZoomStop(MAX_ZOOM, 3)) @@ -87,6 +92,7 @@ static StyleSpec build( .lineColor(MAGENTA) .edgeFilter(EDGES_TO_DISPLAY) .lineWidth(LINE_WIDTH) + .lineOffset(LINE_OFFSET) .minZoom(6) .maxZoom(MAX_ZOOM) .intiallyHidden(), @@ -109,9 +115,11 @@ static StyleSpec build( StreetTransitEntranceLink.class, BoardingLocationToStopLink.class, StreetVehicleRentalLink.class, - StreetVehicleParkingLink.class + StreetVehicleParkingLink.class, + StreetStationCentroidLink.class ) .lineWidth(LINE_WIDTH) + .lineOffset(LINE_OFFSET) .minZoom(13) .maxZoom(MAX_ZOOM) .intiallyHidden(), diff --git a/src/main/java/org/opentripplanner/apis/vectortiles/GraphInspectorVectorTileResource.java b/application/src/main/java/org/opentripplanner/apis/vectortiles/GraphInspectorVectorTileResource.java similarity index 99% rename from src/main/java/org/opentripplanner/apis/vectortiles/GraphInspectorVectorTileResource.java rename to application/src/main/java/org/opentripplanner/apis/vectortiles/GraphInspectorVectorTileResource.java index f97830232bd..26863157353 100644 --- a/src/main/java/org/opentripplanner/apis/vectortiles/GraphInspectorVectorTileResource.java +++ b/application/src/main/java/org/opentripplanner/apis/vectortiles/GraphInspectorVectorTileResource.java @@ -23,7 +23,6 @@ import java.util.Objects; import java.util.function.Predicate; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import org.glassfish.grizzly.http.server.Request; import org.opentripplanner.apis.support.TileJson; import org.opentripplanner.apis.vectortiles.model.LayerParams; @@ -164,7 +163,6 @@ private String tileJsonUrl(String base, List> layers) ); } - @Nonnull private List feedInfos() { return serverContext .transitService() diff --git a/src/main/java/org/opentripplanner/apis/vectortiles/model/LayerParams.java b/application/src/main/java/org/opentripplanner/apis/vectortiles/model/LayerParams.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/vectortiles/model/LayerParams.java rename to application/src/main/java/org/opentripplanner/apis/vectortiles/model/LayerParams.java diff --git a/src/main/java/org/opentripplanner/apis/vectortiles/model/LayerType.java b/application/src/main/java/org/opentripplanner/apis/vectortiles/model/LayerType.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/vectortiles/model/LayerType.java rename to application/src/main/java/org/opentripplanner/apis/vectortiles/model/LayerType.java diff --git a/src/main/java/org/opentripplanner/apis/vectortiles/model/StyleBuilder.java b/application/src/main/java/org/opentripplanner/apis/vectortiles/model/StyleBuilder.java similarity index 97% rename from src/main/java/org/opentripplanner/apis/vectortiles/model/StyleBuilder.java rename to application/src/main/java/org/opentripplanner/apis/vectortiles/model/StyleBuilder.java index d842b5e6687..14b2fe8b014 100644 --- a/src/main/java/org/opentripplanner/apis/vectortiles/model/StyleBuilder.java +++ b/application/src/main/java/org/opentripplanner/apis/vectortiles/model/StyleBuilder.java @@ -165,6 +165,11 @@ public StyleBuilder lineWidth(ZoomDependentNumber zoomStops) { return this; } + public StyleBuilder lineOffset(ZoomDependentNumber zoomStops) { + paint.put("line-offset", zoomStops.toJson()); + return this; + } + public StyleBuilder fillColor(String color) { paint.put("fill-color", validateColor(color)); return this; diff --git a/src/main/java/org/opentripplanner/apis/vectortiles/model/StyleSpec.java b/application/src/main/java/org/opentripplanner/apis/vectortiles/model/StyleSpec.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/vectortiles/model/StyleSpec.java rename to application/src/main/java/org/opentripplanner/apis/vectortiles/model/StyleSpec.java diff --git a/src/main/java/org/opentripplanner/apis/vectortiles/model/TileSource.java b/application/src/main/java/org/opentripplanner/apis/vectortiles/model/TileSource.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/vectortiles/model/TileSource.java rename to application/src/main/java/org/opentripplanner/apis/vectortiles/model/TileSource.java diff --git a/src/main/java/org/opentripplanner/apis/vectortiles/model/VectorSourceLayer.java b/application/src/main/java/org/opentripplanner/apis/vectortiles/model/VectorSourceLayer.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/vectortiles/model/VectorSourceLayer.java rename to application/src/main/java/org/opentripplanner/apis/vectortiles/model/VectorSourceLayer.java diff --git a/src/main/java/org/opentripplanner/apis/vectortiles/model/ZoomDependentNumber.java b/application/src/main/java/org/opentripplanner/apis/vectortiles/model/ZoomDependentNumber.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/vectortiles/model/ZoomDependentNumber.java rename to application/src/main/java/org/opentripplanner/apis/vectortiles/model/ZoomDependentNumber.java diff --git a/src/main/java/org/opentripplanner/astar/AStar.java b/application/src/main/java/org/opentripplanner/astar/AStar.java similarity index 99% rename from src/main/java/org/opentripplanner/astar/AStar.java rename to application/src/main/java/org/opentripplanner/astar/AStar.java index 1b4c69bfc16..9c14669a159 100644 --- a/src/main/java/org/opentripplanner/astar/AStar.java +++ b/application/src/main/java/org/opentripplanner/astar/AStar.java @@ -7,7 +7,6 @@ import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import org.opentripplanner.astar.model.BinHeap; import org.opentripplanner.astar.model.GraphPath; import org.opentripplanner.astar.model.ShortestPathTree; @@ -63,7 +62,7 @@ public class AStar< Set toVertices, SearchTerminationStrategy terminationStrategy, DominanceFunction dominanceFunction, - @Nonnull Duration timeout, + Duration timeout, Collection initialStates ) { this.heuristic = heuristic; diff --git a/src/main/java/org/opentripplanner/astar/AStarBuilder.java b/application/src/main/java/org/opentripplanner/astar/AStarBuilder.java similarity index 99% rename from src/main/java/org/opentripplanner/astar/AStarBuilder.java rename to application/src/main/java/org/opentripplanner/astar/AStarBuilder.java index a4b0ac32389..349b7185b29 100644 --- a/src/main/java/org/opentripplanner/astar/AStarBuilder.java +++ b/application/src/main/java/org/opentripplanner/astar/AStarBuilder.java @@ -6,7 +6,6 @@ import java.util.List; import java.util.Optional; import java.util.Set; -import javax.annotation.Nonnull; import org.opentripplanner.astar.model.GraphPath; import org.opentripplanner.astar.model.ShortestPathTree; import org.opentripplanner.astar.spi.AStarEdge; @@ -98,7 +97,6 @@ public Builder setDominanceFunction(DominanceFunction dominanceFunction) return builder; } - @Nonnull protected abstract Duration streetRoutingTimeout(); public Builder setOriginBackEdge(Edge originBackEdge) { diff --git a/src/main/java/org/opentripplanner/astar/model/BinHeap.java b/application/src/main/java/org/opentripplanner/astar/model/BinHeap.java similarity index 100% rename from src/main/java/org/opentripplanner/astar/model/BinHeap.java rename to application/src/main/java/org/opentripplanner/astar/model/BinHeap.java diff --git a/src/main/java/org/opentripplanner/astar/model/GraphPath.java b/application/src/main/java/org/opentripplanner/astar/model/GraphPath.java similarity index 100% rename from src/main/java/org/opentripplanner/astar/model/GraphPath.java rename to application/src/main/java/org/opentripplanner/astar/model/GraphPath.java diff --git a/src/main/java/org/opentripplanner/astar/model/ShortestPathTree.java b/application/src/main/java/org/opentripplanner/astar/model/ShortestPathTree.java similarity index 100% rename from src/main/java/org/opentripplanner/astar/model/ShortestPathTree.java rename to application/src/main/java/org/opentripplanner/astar/model/ShortestPathTree.java diff --git a/src/main/java/org/opentripplanner/astar/spi/AStarEdge.java b/application/src/main/java/org/opentripplanner/astar/spi/AStarEdge.java similarity index 98% rename from src/main/java/org/opentripplanner/astar/spi/AStarEdge.java rename to application/src/main/java/org/opentripplanner/astar/spi/AStarEdge.java index 91872021fc1..c4caafb19a9 100644 --- a/src/main/java/org/opentripplanner/astar/spi/AStarEdge.java +++ b/application/src/main/java/org/opentripplanner/astar/spi/AStarEdge.java @@ -1,7 +1,5 @@ package org.opentripplanner.astar.spi; -import javax.annotation.Nonnull; - /** * Represents an edge in the street network. Most edges have a one-to-one mapping to real world * things like street segments or stairs. @@ -43,6 +41,5 @@ public interface AStarEdge< * vehicle is speculatively dropped off and the passenger continues on foot in case * that the destination is inside the zone. */ - @Nonnull State[] traverse(State s0); } diff --git a/src/main/java/org/opentripplanner/astar/spi/AStarRequest.java b/application/src/main/java/org/opentripplanner/astar/spi/AStarRequest.java similarity index 100% rename from src/main/java/org/opentripplanner/astar/spi/AStarRequest.java rename to application/src/main/java/org/opentripplanner/astar/spi/AStarRequest.java diff --git a/src/main/java/org/opentripplanner/astar/spi/AStarState.java b/application/src/main/java/org/opentripplanner/astar/spi/AStarState.java similarity index 100% rename from src/main/java/org/opentripplanner/astar/spi/AStarState.java rename to application/src/main/java/org/opentripplanner/astar/spi/AStarState.java diff --git a/src/main/java/org/opentripplanner/astar/spi/AStarVertex.java b/application/src/main/java/org/opentripplanner/astar/spi/AStarVertex.java similarity index 100% rename from src/main/java/org/opentripplanner/astar/spi/AStarVertex.java rename to application/src/main/java/org/opentripplanner/astar/spi/AStarVertex.java diff --git a/src/main/java/org/opentripplanner/astar/spi/DominanceFunction.java b/application/src/main/java/org/opentripplanner/astar/spi/DominanceFunction.java similarity index 100% rename from src/main/java/org/opentripplanner/astar/spi/DominanceFunction.java rename to application/src/main/java/org/opentripplanner/astar/spi/DominanceFunction.java diff --git a/src/main/java/org/opentripplanner/astar/spi/RemainingWeightHeuristic.java b/application/src/main/java/org/opentripplanner/astar/spi/RemainingWeightHeuristic.java similarity index 100% rename from src/main/java/org/opentripplanner/astar/spi/RemainingWeightHeuristic.java rename to application/src/main/java/org/opentripplanner/astar/spi/RemainingWeightHeuristic.java diff --git a/src/main/java/org/opentripplanner/astar/spi/SearchTerminationStrategy.java b/application/src/main/java/org/opentripplanner/astar/spi/SearchTerminationStrategy.java similarity index 100% rename from src/main/java/org/opentripplanner/astar/spi/SearchTerminationStrategy.java rename to application/src/main/java/org/opentripplanner/astar/spi/SearchTerminationStrategy.java diff --git a/src/main/java/org/opentripplanner/astar/spi/SkipEdgeStrategy.java b/application/src/main/java/org/opentripplanner/astar/spi/SkipEdgeStrategy.java similarity index 100% rename from src/main/java/org/opentripplanner/astar/spi/SkipEdgeStrategy.java rename to application/src/main/java/org/opentripplanner/astar/spi/SkipEdgeStrategy.java diff --git a/src/main/java/org/opentripplanner/astar/spi/TraverseVisitor.java b/application/src/main/java/org/opentripplanner/astar/spi/TraverseVisitor.java similarity index 100% rename from src/main/java/org/opentripplanner/astar/spi/TraverseVisitor.java rename to application/src/main/java/org/opentripplanner/astar/spi/TraverseVisitor.java diff --git a/src/main/java/org/opentripplanner/astar/strategy/ComposingSkipEdgeStrategy.java b/application/src/main/java/org/opentripplanner/astar/strategy/ComposingSkipEdgeStrategy.java similarity index 100% rename from src/main/java/org/opentripplanner/astar/strategy/ComposingSkipEdgeStrategy.java rename to application/src/main/java/org/opentripplanner/astar/strategy/ComposingSkipEdgeStrategy.java diff --git a/src/main/java/org/opentripplanner/astar/strategy/DurationComparator.java b/application/src/main/java/org/opentripplanner/astar/strategy/DurationComparator.java similarity index 100% rename from src/main/java/org/opentripplanner/astar/strategy/DurationComparator.java rename to application/src/main/java/org/opentripplanner/astar/strategy/DurationComparator.java diff --git a/src/main/java/org/opentripplanner/astar/strategy/DurationSkipEdgeStrategy.java b/application/src/main/java/org/opentripplanner/astar/strategy/DurationSkipEdgeStrategy.java similarity index 100% rename from src/main/java/org/opentripplanner/astar/strategy/DurationSkipEdgeStrategy.java rename to application/src/main/java/org/opentripplanner/astar/strategy/DurationSkipEdgeStrategy.java diff --git a/src/main/java/org/opentripplanner/astar/strategy/MaxCountSkipEdgeStrategy.java b/application/src/main/java/org/opentripplanner/astar/strategy/MaxCountSkipEdgeStrategy.java similarity index 100% rename from src/main/java/org/opentripplanner/astar/strategy/MaxCountSkipEdgeStrategy.java rename to application/src/main/java/org/opentripplanner/astar/strategy/MaxCountSkipEdgeStrategy.java diff --git a/src/main/java/org/opentripplanner/astar/strategy/PathComparator.java b/application/src/main/java/org/opentripplanner/astar/strategy/PathComparator.java similarity index 100% rename from src/main/java/org/opentripplanner/astar/strategy/PathComparator.java rename to application/src/main/java/org/opentripplanner/astar/strategy/PathComparator.java diff --git a/src/main/java/org/opentripplanner/datastore/OtpDataStore.java b/application/src/main/java/org/opentripplanner/datastore/OtpDataStore.java similarity index 95% rename from src/main/java/org/opentripplanner/datastore/OtpDataStore.java rename to application/src/main/java/org/opentripplanner/datastore/OtpDataStore.java index 397d3f64c70..b85622de7f1 100644 --- a/src/main/java/org/opentripplanner/datastore/OtpDataStore.java +++ b/application/src/main/java/org/opentripplanner/datastore/OtpDataStore.java @@ -21,7 +21,6 @@ import java.util.Optional; import java.util.function.Function; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.datastore.api.CompositeDataSource; import org.opentripplanner.datastore.api.DataSource; @@ -135,25 +134,21 @@ public List getRepositoryDescriptions() { * @return The collection may contain elements of type {@link DataSource} or {@link * CompositeDataSource}. */ - @Nonnull public Collection listExistingSourcesFor(FileType type) { assertDataStoreIsOpened(); return sources.get(type).stream().filter(DataSource::exists).collect(Collectors.toList()); } - @Nonnull public DataSource getStreetGraph() { assertDataStoreIsOpened(); return streetGraph; } - @Nonnull public DataSource getGraph() { assertDataStoreIsOpened(); return graph; } - @Nonnull public CompositeDataSource getBuildReportDir() { assertDataStoreIsOpened(); return buildReportDir; @@ -188,11 +183,7 @@ private LocalDataSourceRepository getLocalDataSourceRepo( return localRepos.get(0); } - private DataSource findSingleSource( - @Nullable URI uri, - @Nonnull String filename, - @Nonnull FileType type - ) { + private DataSource findSingleSource(@Nullable URI uri, String filename, FileType type) { if (uri != null) { return findSourceUsingAllRepos(it -> it.findSource(uri, type)); } @@ -201,8 +192,8 @@ private DataSource findSingleSource( private CompositeDataSource findCompositeSource( @Nullable URI uri, - @Nonnull String filename, - @Nonnull FileType type + String filename, + FileType type ) { if (uri != null) { return findSourceUsingAllRepos(it -> it.findCompositeSource(uri, type)); @@ -211,10 +202,7 @@ private CompositeDataSource findCompositeSource( } } - private List findMultipleSources( - @Nonnull Collection uris, - @Nonnull FileType type - ) { + private List findMultipleSources(Collection uris, FileType type) { if (uris == null || uris.isEmpty()) { return localRepository.listExistingSources(type); } @@ -227,8 +215,8 @@ private List findMultipleSources( } private List findMultipleCompositeSources( - @Nonnull Collection uris, - @Nonnull FileType type + Collection uris, + FileType type ) { if (uris.isEmpty()) { return localRepository diff --git a/src/main/java/org/opentripplanner/datastore/api/CompositeDataSource.java b/application/src/main/java/org/opentripplanner/datastore/api/CompositeDataSource.java similarity index 100% rename from src/main/java/org/opentripplanner/datastore/api/CompositeDataSource.java rename to application/src/main/java/org/opentripplanner/datastore/api/CompositeDataSource.java diff --git a/src/main/java/org/opentripplanner/datastore/api/DataSource.java b/application/src/main/java/org/opentripplanner/datastore/api/DataSource.java similarity index 100% rename from src/main/java/org/opentripplanner/datastore/api/DataSource.java rename to application/src/main/java/org/opentripplanner/datastore/api/DataSource.java diff --git a/src/main/java/org/opentripplanner/datastore/api/FileType.java b/application/src/main/java/org/opentripplanner/datastore/api/FileType.java similarity index 100% rename from src/main/java/org/opentripplanner/datastore/api/FileType.java rename to application/src/main/java/org/opentripplanner/datastore/api/FileType.java diff --git a/src/main/java/org/opentripplanner/datastore/api/GoogleStorageDSRepository.java b/application/src/main/java/org/opentripplanner/datastore/api/GoogleStorageDSRepository.java similarity index 100% rename from src/main/java/org/opentripplanner/datastore/api/GoogleStorageDSRepository.java rename to application/src/main/java/org/opentripplanner/datastore/api/GoogleStorageDSRepository.java diff --git a/src/main/java/org/opentripplanner/datastore/api/OtpBaseDirectory.java b/application/src/main/java/org/opentripplanner/datastore/api/OtpBaseDirectory.java similarity index 100% rename from src/main/java/org/opentripplanner/datastore/api/OtpBaseDirectory.java rename to application/src/main/java/org/opentripplanner/datastore/api/OtpBaseDirectory.java diff --git a/src/main/java/org/opentripplanner/datastore/api/OtpDataStoreConfig.java b/application/src/main/java/org/opentripplanner/datastore/api/OtpDataStoreConfig.java similarity index 97% rename from src/main/java/org/opentripplanner/datastore/api/OtpDataStoreConfig.java rename to application/src/main/java/org/opentripplanner/datastore/api/OtpDataStoreConfig.java index 984d66de2e9..ac220d932d6 100644 --- a/src/main/java/org/opentripplanner/datastore/api/OtpDataStoreConfig.java +++ b/application/src/main/java/org/opentripplanner/datastore/api/OtpDataStoreConfig.java @@ -3,7 +3,6 @@ import java.net.URI; import java.util.List; import java.util.regex.Pattern; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.datastore.OtpDataStore; @@ -48,7 +47,6 @@ public interface OtpDataStoreConfig { *

* This parameter is optional. If {@code null} GTFS files are loaded from {@code baseDirectory}. */ - @Nonnull List gtfsFiles(); /** @@ -56,7 +54,6 @@ public interface OtpDataStoreConfig { *

* This parameter is optional. If {@code null} Netex files are loaded from {@code baseDirectory}. */ - @Nonnull List netexFiles(); /** diff --git a/src/main/java/org/opentripplanner/datastore/base/ByteArrayDataSource.java b/application/src/main/java/org/opentripplanner/datastore/base/ByteArrayDataSource.java similarity index 100% rename from src/main/java/org/opentripplanner/datastore/base/ByteArrayDataSource.java rename to application/src/main/java/org/opentripplanner/datastore/base/ByteArrayDataSource.java diff --git a/src/main/java/org/opentripplanner/datastore/base/DataSourceRepository.java b/application/src/main/java/org/opentripplanner/datastore/base/DataSourceRepository.java similarity index 92% rename from src/main/java/org/opentripplanner/datastore/base/DataSourceRepository.java rename to application/src/main/java/org/opentripplanner/datastore/base/DataSourceRepository.java index 92f2a5769b3..51f3e23347e 100644 --- a/src/main/java/org/opentripplanner/datastore/base/DataSourceRepository.java +++ b/application/src/main/java/org/opentripplanner/datastore/base/DataSourceRepository.java @@ -1,7 +1,6 @@ package org.opentripplanner.datastore.base; import java.net.URI; -import javax.annotation.Nonnull; import org.opentripplanner.datastore.api.CompositeDataSource; import org.opentripplanner.datastore.api.DataSource; import org.opentripplanner.datastore.api.FileType; @@ -43,7 +42,7 @@ public interface DataSourceRepository { * @param type the file type to load. * @return the datasource wrapper that can be used to access the data source. */ - DataSource findSource(@Nonnull URI uri, @Nonnull FileType type); + DataSource findSource(URI uri, FileType type); /** * Get the a composite data source (zip/directory) for the given uri and type. @@ -54,5 +53,5 @@ public interface DataSourceRepository { * @param type the file type to load. * @return the datasource wrapper that can be used to access the data source. */ - CompositeDataSource findCompositeSource(@Nonnull URI uri, @Nonnull FileType type); + CompositeDataSource findCompositeSource(URI uri, FileType type); } diff --git a/src/main/java/org/opentripplanner/datastore/base/LocalDataSourceRepository.java b/application/src/main/java/org/opentripplanner/datastore/base/LocalDataSourceRepository.java similarity index 97% rename from src/main/java/org/opentripplanner/datastore/base/LocalDataSourceRepository.java rename to application/src/main/java/org/opentripplanner/datastore/base/LocalDataSourceRepository.java index a68b6753fa1..10776c31f6e 100644 --- a/src/main/java/org/opentripplanner/datastore/base/LocalDataSourceRepository.java +++ b/application/src/main/java/org/opentripplanner/datastore/base/LocalDataSourceRepository.java @@ -1,7 +1,6 @@ package org.opentripplanner.datastore.base; import java.util.List; -import javax.annotation.Nonnull; import org.opentripplanner.datastore.api.CompositeDataSource; import org.opentripplanner.datastore.api.DataSource; import org.opentripplanner.datastore.api.FileType; @@ -43,7 +42,7 @@ static boolean isCurrentDir(String filename) { * @param type the file type to load. * @return the datasource wrapper that can be used to access the data source. */ - CompositeDataSource findCompositeSource(String localFilename, @Nonnull FileType type); + CompositeDataSource findCompositeSource(String localFilename, FileType type); /** * List all existing data sources for the given type. diff --git a/src/main/java/org/opentripplanner/datastore/configure/DataStoreModule.java b/application/src/main/java/org/opentripplanner/datastore/configure/DataStoreModule.java similarity index 100% rename from src/main/java/org/opentripplanner/datastore/configure/DataStoreModule.java rename to application/src/main/java/org/opentripplanner/datastore/configure/DataStoreModule.java diff --git a/src/main/java/org/opentripplanner/datastore/file/AbstractFileDataSource.java b/application/src/main/java/org/opentripplanner/datastore/file/AbstractFileDataSource.java similarity index 100% rename from src/main/java/org/opentripplanner/datastore/file/AbstractFileDataSource.java rename to application/src/main/java/org/opentripplanner/datastore/file/AbstractFileDataSource.java diff --git a/src/main/java/org/opentripplanner/datastore/file/DirectoryDataSource.java b/application/src/main/java/org/opentripplanner/datastore/file/DirectoryDataSource.java similarity index 100% rename from src/main/java/org/opentripplanner/datastore/file/DirectoryDataSource.java rename to application/src/main/java/org/opentripplanner/datastore/file/DirectoryDataSource.java diff --git a/src/main/java/org/opentripplanner/datastore/file/FileDataSource.java b/application/src/main/java/org/opentripplanner/datastore/file/FileDataSource.java similarity index 100% rename from src/main/java/org/opentripplanner/datastore/file/FileDataSource.java rename to application/src/main/java/org/opentripplanner/datastore/file/FileDataSource.java diff --git a/src/main/java/org/opentripplanner/datastore/file/FileDataSourceRepository.java b/application/src/main/java/org/opentripplanner/datastore/file/FileDataSourceRepository.java similarity index 96% rename from src/main/java/org/opentripplanner/datastore/file/FileDataSourceRepository.java rename to application/src/main/java/org/opentripplanner/datastore/file/FileDataSourceRepository.java index 75a157d83a0..ec5555be29e 100644 --- a/src/main/java/org/opentripplanner/datastore/file/FileDataSourceRepository.java +++ b/application/src/main/java/org/opentripplanner/datastore/file/FileDataSourceRepository.java @@ -16,7 +16,6 @@ import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; -import javax.annotation.Nonnull; import org.opentripplanner.datastore.api.CompositeDataSource; import org.opentripplanner.datastore.api.DataSource; import org.opentripplanner.datastore.api.FileType; @@ -56,7 +55,6 @@ public FileDataSourceRepository( /** * Use for unit testing */ - @Nonnull public static CompositeDataSource compositeSource(File file, FileType type) { // The cast is safe return createCompositeSource(file, type); @@ -73,12 +71,12 @@ public void open() { } @Override - public DataSource findSource(@Nonnull URI uri, @Nonnull FileType type) { + public DataSource findSource(URI uri, FileType type) { return new FileDataSource(openFile(uri, type), type); } @Override - public CompositeDataSource findCompositeSource(@Nonnull URI uri, @Nonnull FileType type) { + public CompositeDataSource findCompositeSource(URI uri, FileType type) { return createCompositeSource(openFile(uri, type), type); } diff --git a/src/main/java/org/opentripplanner/datastore/file/TemporaryFileDataSource.java b/application/src/main/java/org/opentripplanner/datastore/file/TemporaryFileDataSource.java similarity index 100% rename from src/main/java/org/opentripplanner/datastore/file/TemporaryFileDataSource.java rename to application/src/main/java/org/opentripplanner/datastore/file/TemporaryFileDataSource.java diff --git a/src/main/java/org/opentripplanner/datastore/file/ZipFileDataSource.java b/application/src/main/java/org/opentripplanner/datastore/file/ZipFileDataSource.java similarity index 100% rename from src/main/java/org/opentripplanner/datastore/file/ZipFileDataSource.java rename to application/src/main/java/org/opentripplanner/datastore/file/ZipFileDataSource.java diff --git a/src/main/java/org/opentripplanner/datastore/file/ZipFileEntryDataSource.java b/application/src/main/java/org/opentripplanner/datastore/file/ZipFileEntryDataSource.java similarity index 100% rename from src/main/java/org/opentripplanner/datastore/file/ZipFileEntryDataSource.java rename to application/src/main/java/org/opentripplanner/datastore/file/ZipFileEntryDataSource.java diff --git a/src/main/java/org/opentripplanner/datastore/file/ZipFileEntryParent.java b/application/src/main/java/org/opentripplanner/datastore/file/ZipFileEntryParent.java similarity index 100% rename from src/main/java/org/opentripplanner/datastore/file/ZipFileEntryParent.java rename to application/src/main/java/org/opentripplanner/datastore/file/ZipFileEntryParent.java diff --git a/src/main/java/org/opentripplanner/datastore/file/ZipStreamDataSourceDecorator.java b/application/src/main/java/org/opentripplanner/datastore/file/ZipStreamDataSourceDecorator.java similarity index 100% rename from src/main/java/org/opentripplanner/datastore/file/ZipStreamDataSourceDecorator.java rename to application/src/main/java/org/opentripplanner/datastore/file/ZipStreamDataSourceDecorator.java diff --git a/src/main/java/org/opentripplanner/datastore/https/HttpsDataSourceMetadata.java b/application/src/main/java/org/opentripplanner/datastore/https/HttpsDataSourceMetadata.java similarity index 100% rename from src/main/java/org/opentripplanner/datastore/https/HttpsDataSourceMetadata.java rename to application/src/main/java/org/opentripplanner/datastore/https/HttpsDataSourceMetadata.java diff --git a/src/main/java/org/opentripplanner/datastore/https/HttpsDataSourceRepository.java b/application/src/main/java/org/opentripplanner/datastore/https/HttpsDataSourceRepository.java similarity index 93% rename from src/main/java/org/opentripplanner/datastore/https/HttpsDataSourceRepository.java rename to application/src/main/java/org/opentripplanner/datastore/https/HttpsDataSourceRepository.java index 56afc888c73..a0abd07cf38 100644 --- a/src/main/java/org/opentripplanner/datastore/https/HttpsDataSourceRepository.java +++ b/application/src/main/java/org/opentripplanner/datastore/https/HttpsDataSourceRepository.java @@ -4,7 +4,6 @@ import java.time.Duration; import java.util.List; import java.util.Map; -import javax.annotation.Nonnull; import org.apache.hc.core5.http.Header; import org.opentripplanner.datastore.api.CompositeDataSource; import org.opentripplanner.datastore.api.DataSource; @@ -33,7 +32,7 @@ public String description() { public void open() {} @Override - public DataSource findSource(@Nonnull URI uri, @Nonnull FileType type) { + public DataSource findSource(URI uri, FileType type) { if (skipUri(uri)) { return null; } @@ -41,7 +40,7 @@ public DataSource findSource(@Nonnull URI uri, @Nonnull FileType type) { } @Override - public CompositeDataSource findCompositeSource(@Nonnull URI uri, @Nonnull FileType type) { + public CompositeDataSource findCompositeSource(URI uri, FileType type) { if (skipUri(uri)) { return null; } diff --git a/src/main/java/org/opentripplanner/datastore/https/HttpsFileDataSource.java b/application/src/main/java/org/opentripplanner/datastore/https/HttpsFileDataSource.java similarity index 100% rename from src/main/java/org/opentripplanner/datastore/https/HttpsFileDataSource.java rename to application/src/main/java/org/opentripplanner/datastore/https/HttpsFileDataSource.java diff --git a/src/main/java/org/opentripplanner/framework/application/ApplicationShutdownSupport.java b/application/src/main/java/org/opentripplanner/framework/application/ApplicationShutdownSupport.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/application/ApplicationShutdownSupport.java rename to application/src/main/java/org/opentripplanner/framework/application/ApplicationShutdownSupport.java diff --git a/src/main/java/org/opentripplanner/framework/application/LogMDCSupport.java b/application/src/main/java/org/opentripplanner/framework/application/LogMDCSupport.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/application/LogMDCSupport.java rename to application/src/main/java/org/opentripplanner/framework/application/LogMDCSupport.java diff --git a/src/main/java/org/opentripplanner/framework/application/OTPFeature.java b/application/src/main/java/org/opentripplanner/framework/application/OTPFeature.java similarity index 96% rename from src/main/java/org/opentripplanner/framework/application/OTPFeature.java rename to application/src/main/java/org/opentripplanner/framework/application/OTPFeature.java index 749772fae12..324f5397673 100644 --- a/src/main/java/org/opentripplanner/framework/application/OTPFeature.java +++ b/application/src/main/java/org/opentripplanner/framework/application/OTPFeature.java @@ -4,6 +4,7 @@ import java.util.Map; import java.util.function.Supplier; import java.util.stream.Collectors; +import javax.annotation.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -31,6 +32,11 @@ public enum OTPFeature { Use the [vector tiles feature if](sandbox/MapboxVectorTilesApi.md) you want a stable map tiles API. """ ), + ExtraTransferLegOnSameStop( + false, + false, + "Should there be a transfer leg when transferring on the very same stop. Note that for in-seat/interlined transfers no transfer leg will be generated." + ), FloatingBike(true, false, "Enable floating bike routing."), GtfsGraphQlApi(true, false, "Enable the [GTFS GraphQL API](apis/GTFS-GraphQL-API.md)."), GtfsGraphQlApiRentalStationFuzzyMatching( @@ -194,6 +200,7 @@ public boolean isOff() { /** * If feature is turned on, then return supplied object if not return {@code null}. */ + @Nullable public T isOnElseNull(Supplier supplier) { return isOn() ? supplier.get() : null; } diff --git a/src/main/java/org/opentripplanner/framework/application/OTPRequestTimeoutException.java b/application/src/main/java/org/opentripplanner/framework/application/OTPRequestTimeoutException.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/application/OTPRequestTimeoutException.java rename to application/src/main/java/org/opentripplanner/framework/application/OTPRequestTimeoutException.java diff --git a/src/main/java/org/opentripplanner/framework/application/OtpAppException.java b/application/src/main/java/org/opentripplanner/framework/application/OtpAppException.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/application/OtpAppException.java rename to application/src/main/java/org/opentripplanner/framework/application/OtpAppException.java diff --git a/src/main/java/org/opentripplanner/framework/application/OtpFileNames.java b/application/src/main/java/org/opentripplanner/framework/application/OtpFileNames.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/application/OtpFileNames.java rename to application/src/main/java/org/opentripplanner/framework/application/OtpFileNames.java diff --git a/src/main/java/org/opentripplanner/framework/collection/CollectionUtils.java b/application/src/main/java/org/opentripplanner/framework/collection/CollectionUtils.java similarity index 77% rename from src/main/java/org/opentripplanner/framework/collection/CollectionUtils.java rename to application/src/main/java/org/opentripplanner/framework/collection/CollectionUtils.java index 1e86f49770f..27473dd1383 100644 --- a/src/main/java/org/opentripplanner/framework/collection/CollectionUtils.java +++ b/application/src/main/java/org/opentripplanner/framework/collection/CollectionUtils.java @@ -37,6 +37,10 @@ public static String toString(@Nullable Collection c, String nullText) { /** * A null-safe version of isEmpty() for a collection. *

+ * The main strategy for handling collections in OTP is to avoid nullable collection fields and + * use empty collections instead. So, before using this method check if the variable/field is + * indeed `@Nullable`. + *

* If the collection is {@code null} then {@code true} is returned. *

* If the collection is empty then {@code true} is returned. @@ -47,6 +51,19 @@ public static boolean isEmpty(@Nullable Collection c) { return c == null || c.isEmpty(); } + /** + * A null-safe version of isEmpty() for a collection. + *

+ * If the collection is {@code null} then {@code true} is returned. + *

+ * If the collection is empty then {@code true} is returned. + *

+ * Otherwise {@code false} is returned. + */ + public static boolean isEmpty(@Nullable Map m) { + return m == null || m.isEmpty(); + } + /** * Look up the given key in a Map, return null if the key is null. * This prevents a NullPointerException if the underlying implementation of the map does not diff --git a/src/main/java/org/opentripplanner/framework/collection/CollectionsView.java b/application/src/main/java/org/opentripplanner/framework/collection/CollectionsView.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/collection/CollectionsView.java rename to application/src/main/java/org/opentripplanner/framework/collection/CollectionsView.java diff --git a/src/main/java/org/opentripplanner/framework/collection/CompositeComparator.java b/application/src/main/java/org/opentripplanner/framework/collection/CompositeComparator.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/collection/CompositeComparator.java rename to application/src/main/java/org/opentripplanner/framework/collection/CompositeComparator.java diff --git a/src/main/java/org/opentripplanner/framework/collection/ListSection.java b/application/src/main/java/org/opentripplanner/framework/collection/ListSection.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/collection/ListSection.java rename to application/src/main/java/org/opentripplanner/framework/collection/ListSection.java diff --git a/src/main/java/org/opentripplanner/framework/collection/ListUtils.java b/application/src/main/java/org/opentripplanner/framework/collection/ListUtils.java similarity index 84% rename from src/main/java/org/opentripplanner/framework/collection/ListUtils.java rename to application/src/main/java/org/opentripplanner/framework/collection/ListUtils.java index 5964a1674e3..35b7e083695 100644 --- a/src/main/java/org/opentripplanner/framework/collection/ListUtils.java +++ b/application/src/main/java/org/opentripplanner/framework/collection/ListUtils.java @@ -69,4 +69,13 @@ public static List ofNullable(T input) { return List.of(input); } } + + /** + * This method converts the given collection to an instance of a List. If the input is + * {@code null} an empty collection is returned. If not the {@link List#copyOf(Collection)} is + * called. + */ + public static List nullSafeImmutableList(Collection c) { + return (c == null) ? List.of() : List.copyOf(c); + } } diff --git a/src/main/java/org/opentripplanner/framework/collection/MapUtils.java b/application/src/main/java/org/opentripplanner/framework/collection/MapUtils.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/collection/MapUtils.java rename to application/src/main/java/org/opentripplanner/framework/collection/MapUtils.java diff --git a/src/main/java/org/opentripplanner/framework/collection/SetUtils.java b/application/src/main/java/org/opentripplanner/framework/collection/SetUtils.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/collection/SetUtils.java rename to application/src/main/java/org/opentripplanner/framework/collection/SetUtils.java diff --git a/src/main/java/org/opentripplanner/framework/concurrent/LogMDCRunnableDecorator.java b/application/src/main/java/org/opentripplanner/framework/concurrent/LogMDCRunnableDecorator.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/concurrent/LogMDCRunnableDecorator.java rename to application/src/main/java/org/opentripplanner/framework/concurrent/LogMDCRunnableDecorator.java diff --git a/src/main/java/org/opentripplanner/framework/concurrent/OtpRequestThreadFactory.java b/application/src/main/java/org/opentripplanner/framework/concurrent/OtpRequestThreadFactory.java similarity index 95% rename from src/main/java/org/opentripplanner/framework/concurrent/OtpRequestThreadFactory.java rename to application/src/main/java/org/opentripplanner/framework/concurrent/OtpRequestThreadFactory.java index e88bbb420cd..cb738363bcb 100644 --- a/src/main/java/org/opentripplanner/framework/concurrent/OtpRequestThreadFactory.java +++ b/application/src/main/java/org/opentripplanner/framework/concurrent/OtpRequestThreadFactory.java @@ -2,7 +2,6 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder; import java.util.concurrent.ThreadFactory; -import javax.annotation.Nonnull; import org.opentripplanner.framework.application.LogMDCSupport; /** @@ -34,7 +33,7 @@ public static ThreadFactory of(String nameFormat) { } @Override - public Thread newThread(@Nonnull Runnable r) { + public Thread newThread(Runnable r) { if (LogMDCSupport.isRequestTracingInLoggingEnabled()) { return delegate.newThread(new LogMDCRunnableDecorator(r)); } diff --git a/src/main/java/org/opentripplanner/framework/doc/DocumentedEnum.java b/application/src/main/java/org/opentripplanner/framework/doc/DocumentedEnum.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/doc/DocumentedEnum.java rename to application/src/main/java/org/opentripplanner/framework/doc/DocumentedEnum.java diff --git a/src/main/java/org/opentripplanner/framework/error/DefaultOtpError.java b/application/src/main/java/org/opentripplanner/framework/error/DefaultOtpError.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/error/DefaultOtpError.java rename to application/src/main/java/org/opentripplanner/framework/error/DefaultOtpError.java diff --git a/src/main/java/org/opentripplanner/framework/error/OtpError.java b/application/src/main/java/org/opentripplanner/framework/error/OtpError.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/error/OtpError.java rename to application/src/main/java/org/opentripplanner/framework/error/OtpError.java diff --git a/src/main/java/org/opentripplanner/framework/functional/FunctionUtils.java b/application/src/main/java/org/opentripplanner/framework/functional/FunctionUtils.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/functional/FunctionUtils.java rename to application/src/main/java/org/opentripplanner/framework/functional/FunctionUtils.java diff --git a/src/main/java/org/opentripplanner/framework/geometry/CompactElevationProfile.java b/application/src/main/java/org/opentripplanner/framework/geometry/CompactElevationProfile.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/geometry/CompactElevationProfile.java rename to application/src/main/java/org/opentripplanner/framework/geometry/CompactElevationProfile.java diff --git a/src/main/java/org/opentripplanner/framework/geometry/CompactLineStringUtils.java b/application/src/main/java/org/opentripplanner/framework/geometry/CompactLineStringUtils.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/geometry/CompactLineStringUtils.java rename to application/src/main/java/org/opentripplanner/framework/geometry/CompactLineStringUtils.java diff --git a/src/main/java/org/opentripplanner/framework/geometry/CoordinateArrayListSequence.java b/application/src/main/java/org/opentripplanner/framework/geometry/CoordinateArrayListSequence.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/geometry/CoordinateArrayListSequence.java rename to application/src/main/java/org/opentripplanner/framework/geometry/CoordinateArrayListSequence.java diff --git a/src/main/java/org/opentripplanner/framework/geometry/DirectionUtils.java b/application/src/main/java/org/opentripplanner/framework/geometry/DirectionUtils.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/geometry/DirectionUtils.java rename to application/src/main/java/org/opentripplanner/framework/geometry/DirectionUtils.java diff --git a/src/main/java/org/opentripplanner/framework/geometry/DlugoszVarLenIntPacker.java b/application/src/main/java/org/opentripplanner/framework/geometry/DlugoszVarLenIntPacker.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/geometry/DlugoszVarLenIntPacker.java rename to application/src/main/java/org/opentripplanner/framework/geometry/DlugoszVarLenIntPacker.java diff --git a/src/main/java/org/opentripplanner/framework/geometry/EncodedPolyline.java b/application/src/main/java/org/opentripplanner/framework/geometry/EncodedPolyline.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/geometry/EncodedPolyline.java rename to application/src/main/java/org/opentripplanner/framework/geometry/EncodedPolyline.java diff --git a/src/main/java/org/opentripplanner/framework/geometry/GeometryUtils.java b/application/src/main/java/org/opentripplanner/framework/geometry/GeometryUtils.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/geometry/GeometryUtils.java rename to application/src/main/java/org/opentripplanner/framework/geometry/GeometryUtils.java diff --git a/src/main/java/org/opentripplanner/framework/geometry/HashGridSpatialIndex.java b/application/src/main/java/org/opentripplanner/framework/geometry/HashGridSpatialIndex.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/geometry/HashGridSpatialIndex.java rename to application/src/main/java/org/opentripplanner/framework/geometry/HashGridSpatialIndex.java diff --git a/src/main/java/org/opentripplanner/framework/geometry/PolylineEncoder.java b/application/src/main/java/org/opentripplanner/framework/geometry/PolylineEncoder.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/geometry/PolylineEncoder.java rename to application/src/main/java/org/opentripplanner/framework/geometry/PolylineEncoder.java diff --git a/src/main/java/org/opentripplanner/framework/geometry/SphericalDistanceLibrary.java b/application/src/main/java/org/opentripplanner/framework/geometry/SphericalDistanceLibrary.java similarity index 95% rename from src/main/java/org/opentripplanner/framework/geometry/SphericalDistanceLibrary.java rename to application/src/main/java/org/opentripplanner/framework/geometry/SphericalDistanceLibrary.java index 38c80e86d79..531170ad137 100644 --- a/src/main/java/org/opentripplanner/framework/geometry/SphericalDistanceLibrary.java +++ b/application/src/main/java/org/opentripplanner/framework/geometry/SphericalDistanceLibrary.java @@ -196,6 +196,20 @@ public static double metersToLonDegrees(double distanceMeters, double latDeg) { return dLatDeg / minCosLat; } + /** + * Approximately move a coordinate a given number of meters. This will fail if crossing the anti- + * meridian or any of the poles. + */ + public static WgsCoordinate moveMeters( + WgsCoordinate coordinate, + double latMeters, + double lonMeters + ) { + var degreesLat = metersToDegrees(latMeters); + var degreesLon = metersToLonDegrees(lonMeters, coordinate.latitude()); + return coordinate.add(degreesLat, degreesLon); + } + public static Envelope bounds(double lat, double lon, double latDistance, double lonDistance) { double radiusOfEarth = RADIUS_OF_EARTH_IN_M; diff --git a/src/main/java/org/opentripplanner/framework/geometry/SplitLineString.java b/application/src/main/java/org/opentripplanner/framework/geometry/SplitLineString.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/geometry/SplitLineString.java rename to application/src/main/java/org/opentripplanner/framework/geometry/SplitLineString.java diff --git a/src/main/java/org/opentripplanner/framework/geometry/UnsupportedGeometryException.java b/application/src/main/java/org/opentripplanner/framework/geometry/UnsupportedGeometryException.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/geometry/UnsupportedGeometryException.java rename to application/src/main/java/org/opentripplanner/framework/geometry/UnsupportedGeometryException.java diff --git a/src/main/java/org/opentripplanner/framework/geometry/WgsCoordinate.java b/application/src/main/java/org/opentripplanner/framework/geometry/WgsCoordinate.java similarity index 88% rename from src/main/java/org/opentripplanner/framework/geometry/WgsCoordinate.java rename to application/src/main/java/org/opentripplanner/framework/geometry/WgsCoordinate.java index e818d50c1f6..6c3dbf0f9d3 100644 --- a/src/main/java/org/opentripplanner/framework/geometry/WgsCoordinate.java +++ b/application/src/main/java/org/opentripplanner/framework/geometry/WgsCoordinate.java @@ -163,6 +163,34 @@ public WgsCoordinate roundToApproximate100m() { return new WgsCoordinate(lat, lng); } + /** + * Return a new coordinate that is moved an approximate number of meters east. + */ + public WgsCoordinate moveEastMeters(double meters) { + return SphericalDistanceLibrary.moveMeters(this, 0, meters); + } + + /** + * Return a new coordinate that is moved an approximate number of meters west. + */ + public WgsCoordinate moveWestMeters(double meters) { + return SphericalDistanceLibrary.moveMeters(this, 0, -meters); + } + + /** + * Return a new coordinate that is moved an approximate number of meters north. + */ + public WgsCoordinate moveNorthMeters(double meters) { + return SphericalDistanceLibrary.moveMeters(this, meters, 0); + } + + /** + * Return a new coordinate that is moved an approximate number of meters south. + */ + public WgsCoordinate moveSouthMeters(double meters) { + return SphericalDistanceLibrary.moveMeters(this, -meters, 0); + } + /** * Return a string on the form: {@code "(60.12345, 11.12345)"}. Up to 5 digits are used after the * period(.), even if the coordinate is specified with a higher precision. diff --git a/src/main/java/org/opentripplanner/framework/graphql/GraphQLResponseSerializer.java b/application/src/main/java/org/opentripplanner/framework/graphql/GraphQLResponseSerializer.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/graphql/GraphQLResponseSerializer.java rename to application/src/main/java/org/opentripplanner/framework/graphql/GraphQLResponseSerializer.java diff --git a/src/main/java/org/opentripplanner/framework/graphql/GraphQLUtils.java b/application/src/main/java/org/opentripplanner/framework/graphql/GraphQLUtils.java similarity index 95% rename from src/main/java/org/opentripplanner/framework/graphql/GraphQLUtils.java rename to application/src/main/java/org/opentripplanner/framework/graphql/GraphQLUtils.java index 334513fd419..ff5485d75b2 100644 --- a/src/main/java/org/opentripplanner/framework/graphql/GraphQLUtils.java +++ b/application/src/main/java/org/opentripplanner/framework/graphql/GraphQLUtils.java @@ -4,7 +4,6 @@ import java.util.Locale; import java.util.Map; import java.util.Optional; -import javax.annotation.Nonnull; import org.opentripplanner.framework.i18n.I18NString; public class GraphQLUtils { @@ -65,7 +64,7 @@ private static Optional getDefaultLocale(DataFetchingEnvironment environ return Optional.ofNullable((Locale) localContext.get("locale")); } - private static boolean acceptAnyLocale(@Nonnull Locale locale) { + private static boolean acceptAnyLocale(Locale locale) { return locale.getLanguage().equals("*"); } } diff --git a/src/main/java/org/opentripplanner/framework/graphql/scalar/CostScalarFactory.java b/application/src/main/java/org/opentripplanner/framework/graphql/scalar/CostScalarFactory.java similarity index 94% rename from src/main/java/org/opentripplanner/framework/graphql/scalar/CostScalarFactory.java rename to application/src/main/java/org/opentripplanner/framework/graphql/scalar/CostScalarFactory.java index 6f710328174..415118013f3 100644 --- a/src/main/java/org/opentripplanner/framework/graphql/scalar/CostScalarFactory.java +++ b/application/src/main/java/org/opentripplanner/framework/graphql/scalar/CostScalarFactory.java @@ -10,7 +10,6 @@ import graphql.schema.GraphQLScalarType; import java.util.Locale; import java.util.NoSuchElementException; -import javax.annotation.Nonnull; import org.opentripplanner.framework.model.Cost; import org.opentripplanner.framework.time.DurationUtils; @@ -54,7 +53,7 @@ private static Cost parseCost(String input) throws CoercingParseValueException { private static Coercing createCoercing() { return new Coercing<>() { @Override - public String serialize(@Nonnull Object result, GraphQLContext c, Locale l) { + public String serialize(Object result, GraphQLContext c, Locale l) { return serializeCost((Cost) result); } @@ -74,7 +73,6 @@ public Cost parseLiteral(Value input, CoercedVariables v, GraphQLContext c, L } @Override - @Nonnull public Value valueToLiteral(Object input, GraphQLContext c, Locale l) { return StringValue.of((String) input); } diff --git a/src/main/java/org/opentripplanner/framework/graphql/scalar/DateScalarFactory.java b/application/src/main/java/org/opentripplanner/framework/graphql/scalar/DateScalarFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/graphql/scalar/DateScalarFactory.java rename to application/src/main/java/org/opentripplanner/framework/graphql/scalar/DateScalarFactory.java diff --git a/src/main/java/org/opentripplanner/framework/graphql/scalar/DurationScalarFactory.java b/application/src/main/java/org/opentripplanner/framework/graphql/scalar/DurationScalarFactory.java similarity index 83% rename from src/main/java/org/opentripplanner/framework/graphql/scalar/DurationScalarFactory.java rename to application/src/main/java/org/opentripplanner/framework/graphql/scalar/DurationScalarFactory.java index 50af0fbc759..b685ecc597e 100644 --- a/src/main/java/org/opentripplanner/framework/graphql/scalar/DurationScalarFactory.java +++ b/application/src/main/java/org/opentripplanner/framework/graphql/scalar/DurationScalarFactory.java @@ -8,7 +8,6 @@ import graphql.schema.GraphQLScalarType; import java.time.Duration; import java.time.format.DateTimeParseException; -import javax.annotation.Nonnull; import org.opentripplanner.framework.time.DurationUtils; public class DurationScalarFactory { @@ -30,8 +29,7 @@ public static GraphQLScalarType createDurationScalar() { private static class DurationCoercing implements Coercing { @Override - @Nonnull - public String serialize(@Nonnull Object input) throws CoercingSerializeException { + public String serialize(Object input) throws CoercingSerializeException { if (input instanceof Duration duration) { return DurationUtils.formatDurationWithLeadingMinus(duration); } @@ -40,8 +38,7 @@ public String serialize(@Nonnull Object input) throws CoercingSerializeException } @Override - @Nonnull - public Duration parseValue(@Nonnull Object input) throws CoercingParseValueException { + public Duration parseValue(Object input) throws CoercingParseValueException { try { return DurationUtils.duration(input.toString()); } catch (DateTimeParseException dtpe) { @@ -50,8 +47,7 @@ public Duration parseValue(@Nonnull Object input) throws CoercingParseValueExcep } @Override - @Nonnull - public Duration parseLiteral(@Nonnull Object input) throws CoercingParseLiteralException { + public Duration parseLiteral(Object input) throws CoercingParseLiteralException { if (input instanceof StringValue) { return parseValue(((StringValue) input).getValue()); } diff --git a/src/main/java/org/opentripplanner/framework/http/OtpHttpStatus.java b/application/src/main/java/org/opentripplanner/framework/http/OtpHttpStatus.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/http/OtpHttpStatus.java rename to application/src/main/java/org/opentripplanner/framework/http/OtpHttpStatus.java diff --git a/src/main/java/org/opentripplanner/framework/i18n/I18NString.java b/application/src/main/java/org/opentripplanner/framework/i18n/I18NString.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/i18n/I18NString.java rename to application/src/main/java/org/opentripplanner/framework/i18n/I18NString.java diff --git a/src/main/java/org/opentripplanner/framework/i18n/I18NStringMapper.java b/application/src/main/java/org/opentripplanner/framework/i18n/I18NStringMapper.java similarity index 93% rename from src/main/java/org/opentripplanner/framework/i18n/I18NStringMapper.java rename to application/src/main/java/org/opentripplanner/framework/i18n/I18NStringMapper.java index acdb30b301f..ca3de85c221 100644 --- a/src/main/java/org/opentripplanner/framework/i18n/I18NStringMapper.java +++ b/application/src/main/java/org/opentripplanner/framework/i18n/I18NStringMapper.java @@ -1,7 +1,6 @@ package org.opentripplanner.framework.i18n; import java.util.Locale; -import javax.annotation.Nonnull; import javax.annotation.Nullable; public class I18NStringMapper { @@ -17,7 +16,6 @@ public String mapToApi(I18NString string) { return string == null ? null : string.toString(locale); } - @Nonnull public String mapNonnullToApi(I18NString string) { return string.toString(locale); } diff --git a/src/main/java/org/opentripplanner/framework/i18n/LocalizedString.java b/application/src/main/java/org/opentripplanner/framework/i18n/LocalizedString.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/i18n/LocalizedString.java rename to application/src/main/java/org/opentripplanner/framework/i18n/LocalizedString.java diff --git a/src/main/java/org/opentripplanner/framework/i18n/LocalizedStringFormat.java b/application/src/main/java/org/opentripplanner/framework/i18n/LocalizedStringFormat.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/i18n/LocalizedStringFormat.java rename to application/src/main/java/org/opentripplanner/framework/i18n/LocalizedStringFormat.java diff --git a/src/main/java/org/opentripplanner/framework/i18n/NonLocalizedString.java b/application/src/main/java/org/opentripplanner/framework/i18n/NonLocalizedString.java similarity index 84% rename from src/main/java/org/opentripplanner/framework/i18n/NonLocalizedString.java rename to application/src/main/java/org/opentripplanner/framework/i18n/NonLocalizedString.java index 3eddae235e4..dd7dfc8df05 100644 --- a/src/main/java/org/opentripplanner/framework/i18n/NonLocalizedString.java +++ b/application/src/main/java/org/opentripplanner/framework/i18n/NonLocalizedString.java @@ -4,7 +4,6 @@ import java.util.Locale; import java.util.Objects; import java.util.function.Function; -import javax.annotation.Nonnull; import javax.annotation.Nullable; /** @@ -18,7 +17,7 @@ public class NonLocalizedString implements I18NString, Serializable { private final String name; - public NonLocalizedString(@Nonnull String name) { + public NonLocalizedString(String name) { this.name = Objects.requireNonNull(name); } @@ -40,7 +39,7 @@ public static NonLocalizedString ofNullable(@Nullable String name) { */ public static NonLocalizedString ofNullable( @Nullable W wrapper, - @Nonnull Function getValueOp + Function getValueOp ) { return wrapper == null ? null : new NonLocalizedString(getValueOp.apply(wrapper)); } @@ -51,8 +50,8 @@ public static NonLocalizedString ofNullable( */ public static NonLocalizedString ofNullable( @Nullable W wrapper, - @Nonnull Function getValueOp, - @Nonnull String defaultValue + Function getValueOp, + String defaultValue ) { return new NonLocalizedString(wrapper == null ? defaultValue : getValueOp.apply(wrapper)); } @@ -61,11 +60,7 @@ public static NonLocalizedString ofNullable( * Check if name is non-null and returns an instance of {@link NonLocalizedString}, otherwise * returns a {@link NonLocalizedString} with the default name. */ - @Nonnull - public static NonLocalizedString ofNullableOrElse( - @Nullable String name, - @Nonnull String defaultName - ) { + public static NonLocalizedString ofNullableOrElse(@Nullable String name, String defaultName) { return new NonLocalizedString(name == null ? defaultName : name); } @@ -73,11 +68,7 @@ public static NonLocalizedString ofNullableOrElse( * Check if name is non-null and returns an instance of {@link NonLocalizedString}, otherwise * returns a {@link I18NString} with the default name. */ - @Nonnull - public static I18NString ofNullableOrElse( - @Nullable String name, - @Nonnull I18NString defaultName - ) { + public static I18NString ofNullableOrElse(@Nullable String name, I18NString defaultName) { return name == null ? defaultName : new NonLocalizedString(name); } diff --git a/src/main/java/org/opentripplanner/framework/i18n/TranslatedString.java b/application/src/main/java/org/opentripplanner/framework/i18n/TranslatedString.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/i18n/TranslatedString.java rename to application/src/main/java/org/opentripplanner/framework/i18n/TranslatedString.java diff --git a/src/main/java/org/opentripplanner/framework/io/FileUtils.java b/application/src/main/java/org/opentripplanner/framework/io/FileUtils.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/io/FileUtils.java rename to application/src/main/java/org/opentripplanner/framework/io/FileUtils.java diff --git a/src/main/java/org/opentripplanner/framework/io/HttpUtils.java b/application/src/main/java/org/opentripplanner/framework/io/HttpUtils.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/io/HttpUtils.java rename to application/src/main/java/org/opentripplanner/framework/io/HttpUtils.java diff --git a/src/main/java/org/opentripplanner/framework/io/JsonDataListDownloader.java b/application/src/main/java/org/opentripplanner/framework/io/JsonDataListDownloader.java similarity index 89% rename from src/main/java/org/opentripplanner/framework/io/JsonDataListDownloader.java rename to application/src/main/java/org/opentripplanner/framework/io/JsonDataListDownloader.java index 3affa734605..81f8ee5b3c4 100644 --- a/src/main/java/org/opentripplanner/framework/io/JsonDataListDownloader.java +++ b/application/src/main/java/org/opentripplanner/framework/io/JsonDataListDownloader.java @@ -11,7 +11,6 @@ import java.util.Map; import java.util.Objects; import java.util.function.Function; -import javax.annotation.Nonnull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -25,20 +24,20 @@ public class JsonDataListDownloader { private final OtpHttpClient otpHttpClient; public JsonDataListDownloader( - @Nonnull String url, - @Nonnull String jsonParsePath, - @Nonnull Function elementParser, - @Nonnull Map headers + String url, + String jsonParsePath, + Function elementParser, + Map headers ) { this(url, jsonParsePath, elementParser, headers, new OtpHttpClientFactory().create(LOG)); } public JsonDataListDownloader( - @Nonnull String url, - @Nonnull String jsonParsePath, - @Nonnull Function elementParser, - @Nonnull Map headers, - @Nonnull OtpHttpClient OtpHttpClient + String url, + String jsonParsePath, + Function elementParser, + Map headers, + OtpHttpClient OtpHttpClient ) { this.url = Objects.requireNonNull(url); this.jsonParsePath = Objects.requireNonNull(jsonParsePath); diff --git a/src/main/java/org/opentripplanner/framework/io/OtpHttpClient.java b/application/src/main/java/org/opentripplanner/framework/io/OtpHttpClient.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/io/OtpHttpClient.java rename to application/src/main/java/org/opentripplanner/framework/io/OtpHttpClient.java diff --git a/src/main/java/org/opentripplanner/framework/io/OtpHttpClientException.java b/application/src/main/java/org/opentripplanner/framework/io/OtpHttpClientException.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/io/OtpHttpClientException.java rename to application/src/main/java/org/opentripplanner/framework/io/OtpHttpClientException.java diff --git a/src/main/java/org/opentripplanner/framework/io/OtpHttpClientFactory.java b/application/src/main/java/org/opentripplanner/framework/io/OtpHttpClientFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/io/OtpHttpClientFactory.java rename to application/src/main/java/org/opentripplanner/framework/io/OtpHttpClientFactory.java diff --git a/src/main/java/org/opentripplanner/framework/json/JsonUtils.java b/application/src/main/java/org/opentripplanner/framework/json/JsonUtils.java similarity index 75% rename from src/main/java/org/opentripplanner/framework/json/JsonUtils.java rename to application/src/main/java/org/opentripplanner/framework/json/JsonUtils.java index 1f235eb6483..17b875b5596 100644 --- a/src/main/java/org/opentripplanner/framework/json/JsonUtils.java +++ b/application/src/main/java/org/opentripplanner/framework/json/JsonUtils.java @@ -2,11 +2,10 @@ import com.fasterxml.jackson.databind.JsonNode; import java.util.Optional; -import javax.annotation.Nonnull; public class JsonUtils { - public static Optional asText(@Nonnull JsonNode node, @Nonnull String field) { + public static Optional asText(JsonNode node, String field) { JsonNode valueNode = node.get(field); if (valueNode == null) { return Optional.empty(); diff --git a/src/main/java/org/opentripplanner/framework/json/ObjectMappers.java b/application/src/main/java/org/opentripplanner/framework/json/ObjectMappers.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/json/ObjectMappers.java rename to application/src/main/java/org/opentripplanner/framework/json/ObjectMappers.java diff --git a/src/main/java/org/opentripplanner/framework/lang/ArrayUtils.java b/application/src/main/java/org/opentripplanner/framework/lang/ArrayUtils.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/lang/ArrayUtils.java rename to application/src/main/java/org/opentripplanner/framework/lang/ArrayUtils.java diff --git a/src/main/java/org/opentripplanner/framework/lang/BitSetUtils.java b/application/src/main/java/org/opentripplanner/framework/lang/BitSetUtils.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/lang/BitSetUtils.java rename to application/src/main/java/org/opentripplanner/framework/lang/BitSetUtils.java diff --git a/src/main/java/org/opentripplanner/framework/lang/Box.java b/application/src/main/java/org/opentripplanner/framework/lang/Box.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/lang/Box.java rename to application/src/main/java/org/opentripplanner/framework/lang/Box.java diff --git a/src/main/java/org/opentripplanner/framework/lang/DoubleUtils.java b/application/src/main/java/org/opentripplanner/framework/lang/DoubleUtils.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/lang/DoubleUtils.java rename to application/src/main/java/org/opentripplanner/framework/lang/DoubleUtils.java diff --git a/src/main/java/org/opentripplanner/framework/lang/IntBox.java b/application/src/main/java/org/opentripplanner/framework/lang/IntBox.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/lang/IntBox.java rename to application/src/main/java/org/opentripplanner/framework/lang/IntBox.java diff --git a/src/main/java/org/opentripplanner/framework/lang/IntRange.java b/application/src/main/java/org/opentripplanner/framework/lang/IntRange.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/lang/IntRange.java rename to application/src/main/java/org/opentripplanner/framework/lang/IntRange.java diff --git a/src/main/java/org/opentripplanner/framework/lang/IntUtils.java b/application/src/main/java/org/opentripplanner/framework/lang/IntUtils.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/lang/IntUtils.java rename to application/src/main/java/org/opentripplanner/framework/lang/IntUtils.java diff --git a/src/main/java/org/opentripplanner/framework/lang/MemEfficientArrayBuilder.java b/application/src/main/java/org/opentripplanner/framework/lang/MemEfficientArrayBuilder.java similarity index 96% rename from src/main/java/org/opentripplanner/framework/lang/MemEfficientArrayBuilder.java rename to application/src/main/java/org/opentripplanner/framework/lang/MemEfficientArrayBuilder.java index 8b3a6ba6cd0..7bf36dd5b86 100644 --- a/src/main/java/org/opentripplanner/framework/lang/MemEfficientArrayBuilder.java +++ b/application/src/main/java/org/opentripplanner/framework/lang/MemEfficientArrayBuilder.java @@ -2,7 +2,6 @@ import java.util.Arrays; import java.util.Objects; -import javax.annotation.Nonnull; /** * This array builder is used to minimize the creation of new objects (arrays). It takes an array as base, @@ -20,7 +19,7 @@ public final class MemEfficientArrayBuilder { private final T[] original; private T[] array = null; - private MemEfficientArrayBuilder(@Nonnull T[] original) { + private MemEfficientArrayBuilder(T[] original) { this.original = Objects.requireNonNull(original); } diff --git a/src/main/java/org/opentripplanner/framework/lang/ObjectUtils.java b/application/src/main/java/org/opentripplanner/framework/lang/ObjectUtils.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/lang/ObjectUtils.java rename to application/src/main/java/org/opentripplanner/framework/lang/ObjectUtils.java diff --git a/src/main/java/org/opentripplanner/framework/lang/OtpNumberFormat.java b/application/src/main/java/org/opentripplanner/framework/lang/OtpNumberFormat.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/lang/OtpNumberFormat.java rename to application/src/main/java/org/opentripplanner/framework/lang/OtpNumberFormat.java diff --git a/src/main/java/org/opentripplanner/framework/lang/Sandbox.java b/application/src/main/java/org/opentripplanner/framework/lang/Sandbox.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/lang/Sandbox.java rename to application/src/main/java/org/opentripplanner/framework/lang/Sandbox.java diff --git a/src/main/java/org/opentripplanner/framework/lang/StringUtils.java b/application/src/main/java/org/opentripplanner/framework/lang/StringUtils.java similarity index 98% rename from src/main/java/org/opentripplanner/framework/lang/StringUtils.java rename to application/src/main/java/org/opentripplanner/framework/lang/StringUtils.java index 9eff448d0c7..5d18981e0e3 100644 --- a/src/main/java/org/opentripplanner/framework/lang/StringUtils.java +++ b/application/src/main/java/org/opentripplanner/framework/lang/StringUtils.java @@ -1,7 +1,6 @@ package org.opentripplanner.framework.lang; import java.util.regex.Pattern; -import javax.annotation.Nonnull; /** * OTP String utils extending the Java lang String... @@ -120,7 +119,7 @@ public static String padRight(String value, char ch, int width) { } /** Replace single quotes with double quotes. */ - public static String quoteReplace(@Nonnull String text) { + public static String quoteReplace(String text) { return text.replace('\'', '\"'); } diff --git a/src/main/java/org/opentripplanner/framework/logging/AbstractFilterLogger.java b/application/src/main/java/org/opentripplanner/framework/logging/AbstractFilterLogger.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/logging/AbstractFilterLogger.java rename to application/src/main/java/org/opentripplanner/framework/logging/AbstractFilterLogger.java diff --git a/src/main/java/org/opentripplanner/framework/logging/MaxCountLogger.java b/application/src/main/java/org/opentripplanner/framework/logging/MaxCountLogger.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/logging/MaxCountLogger.java rename to application/src/main/java/org/opentripplanner/framework/logging/MaxCountLogger.java diff --git a/src/main/java/org/opentripplanner/framework/logging/ProgressTracker.java b/application/src/main/java/org/opentripplanner/framework/logging/ProgressTracker.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/logging/ProgressTracker.java rename to application/src/main/java/org/opentripplanner/framework/logging/ProgressTracker.java diff --git a/src/main/java/org/opentripplanner/framework/logging/ProgressTrackerInputStream.java b/application/src/main/java/org/opentripplanner/framework/logging/ProgressTrackerInputStream.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/logging/ProgressTrackerInputStream.java rename to application/src/main/java/org/opentripplanner/framework/logging/ProgressTrackerInputStream.java diff --git a/src/main/java/org/opentripplanner/framework/logging/ProgressTrackerOutputStream.java b/application/src/main/java/org/opentripplanner/framework/logging/ProgressTrackerOutputStream.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/logging/ProgressTrackerOutputStream.java rename to application/src/main/java/org/opentripplanner/framework/logging/ProgressTrackerOutputStream.java diff --git a/src/main/java/org/opentripplanner/framework/logging/Throttle.java b/application/src/main/java/org/opentripplanner/framework/logging/Throttle.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/logging/Throttle.java rename to application/src/main/java/org/opentripplanner/framework/logging/Throttle.java diff --git a/src/main/java/org/opentripplanner/framework/model/Cost.java b/application/src/main/java/org/opentripplanner/framework/model/Cost.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/model/Cost.java rename to application/src/main/java/org/opentripplanner/framework/model/Cost.java diff --git a/src/main/java/org/opentripplanner/framework/model/Grams.java b/application/src/main/java/org/opentripplanner/framework/model/Grams.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/model/Grams.java rename to application/src/main/java/org/opentripplanner/framework/model/Grams.java diff --git a/src/main/java/org/opentripplanner/framework/model/TimeAndCost.java b/application/src/main/java/org/opentripplanner/framework/model/TimeAndCost.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/model/TimeAndCost.java rename to application/src/main/java/org/opentripplanner/framework/model/TimeAndCost.java diff --git a/src/main/java/org/opentripplanner/framework/model/Units.java b/application/src/main/java/org/opentripplanner/framework/model/Units.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/model/Units.java rename to application/src/main/java/org/opentripplanner/framework/model/Units.java diff --git a/src/main/java/org/opentripplanner/framework/resources/ResourceBundleAdaptor.java b/application/src/main/java/org/opentripplanner/framework/resources/ResourceBundleAdaptor.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/resources/ResourceBundleAdaptor.java rename to application/src/main/java/org/opentripplanner/framework/resources/ResourceBundleAdaptor.java diff --git a/src/main/java/org/opentripplanner/framework/resources/ResourceBundleSingleton.java b/application/src/main/java/org/opentripplanner/framework/resources/ResourceBundleSingleton.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/resources/ResourceBundleSingleton.java rename to application/src/main/java/org/opentripplanner/framework/resources/ResourceBundleSingleton.java diff --git a/src/main/java/org/opentripplanner/framework/retry/OtpRetry.java b/application/src/main/java/org/opentripplanner/framework/retry/OtpRetry.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/retry/OtpRetry.java rename to application/src/main/java/org/opentripplanner/framework/retry/OtpRetry.java diff --git a/src/main/java/org/opentripplanner/framework/retry/OtpRetryBuilder.java b/application/src/main/java/org/opentripplanner/framework/retry/OtpRetryBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/retry/OtpRetryBuilder.java rename to application/src/main/java/org/opentripplanner/framework/retry/OtpRetryBuilder.java diff --git a/src/main/java/org/opentripplanner/framework/retry/OtpRetryException.java b/application/src/main/java/org/opentripplanner/framework/retry/OtpRetryException.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/retry/OtpRetryException.java rename to application/src/main/java/org/opentripplanner/framework/retry/OtpRetryException.java diff --git a/src/main/java/org/opentripplanner/framework/text/CharacterEscapeFormatter.java b/application/src/main/java/org/opentripplanner/framework/text/CharacterEscapeFormatter.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/text/CharacterEscapeFormatter.java rename to application/src/main/java/org/opentripplanner/framework/text/CharacterEscapeFormatter.java diff --git a/src/main/java/org/opentripplanner/framework/text/FileSizeToTextConverter.java b/application/src/main/java/org/opentripplanner/framework/text/FileSizeToTextConverter.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/text/FileSizeToTextConverter.java rename to application/src/main/java/org/opentripplanner/framework/text/FileSizeToTextConverter.java diff --git a/src/main/java/org/opentripplanner/framework/text/HexString.java b/application/src/main/java/org/opentripplanner/framework/text/HexString.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/text/HexString.java rename to application/src/main/java/org/opentripplanner/framework/text/HexString.java diff --git a/src/main/java/org/opentripplanner/framework/text/MarkdownFormatter.java b/application/src/main/java/org/opentripplanner/framework/text/MarkdownFormatter.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/text/MarkdownFormatter.java rename to application/src/main/java/org/opentripplanner/framework/text/MarkdownFormatter.java diff --git a/src/main/java/org/opentripplanner/framework/text/Table.java b/application/src/main/java/org/opentripplanner/framework/text/Table.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/text/Table.java rename to application/src/main/java/org/opentripplanner/framework/text/Table.java diff --git a/src/main/java/org/opentripplanner/framework/text/TableBuilder.java b/application/src/main/java/org/opentripplanner/framework/text/TableBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/text/TableBuilder.java rename to application/src/main/java/org/opentripplanner/framework/text/TableBuilder.java diff --git a/src/main/java/org/opentripplanner/framework/text/TableRowFormatter.java b/application/src/main/java/org/opentripplanner/framework/text/TableRowFormatter.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/text/TableRowFormatter.java rename to application/src/main/java/org/opentripplanner/framework/text/TableRowFormatter.java diff --git a/src/main/java/org/opentripplanner/framework/time/CountdownTimer.java b/application/src/main/java/org/opentripplanner/framework/time/CountdownTimer.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/time/CountdownTimer.java rename to application/src/main/java/org/opentripplanner/framework/time/CountdownTimer.java diff --git a/src/main/java/org/opentripplanner/framework/time/DateUtils.java b/application/src/main/java/org/opentripplanner/framework/time/DateUtils.java similarity index 98% rename from src/main/java/org/opentripplanner/framework/time/DateUtils.java rename to application/src/main/java/org/opentripplanner/framework/time/DateUtils.java index d212af56b79..36f62fb0448 100644 --- a/src/main/java/org/opentripplanner/framework/time/DateUtils.java +++ b/application/src/main/java/org/opentripplanner/framework/time/DateUtils.java @@ -10,7 +10,6 @@ import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; import java.util.List; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -86,7 +85,7 @@ public static ZonedDateTime toZonedDateTime(String date, String time, ZoneId tz) } // TODO: could be replaced with Apache's DateFormat.parseDate ??? - public static LocalDate parseDate(@Nonnull String input) { + public static LocalDate parseDate(String input) { LocalDate retVal = null; try { String newString = input diff --git a/src/main/java/org/opentripplanner/framework/time/DurationUtils.java b/application/src/main/java/org/opentripplanner/framework/time/DurationUtils.java similarity index 85% rename from src/main/java/org/opentripplanner/framework/time/DurationUtils.java rename to application/src/main/java/org/opentripplanner/framework/time/DurationUtils.java index 9d16ed7d269..362fe17410e 100644 --- a/src/main/java/org/opentripplanner/framework/time/DurationUtils.java +++ b/application/src/main/java/org/opentripplanner/framework/time/DurationUtils.java @@ -187,43 +187,45 @@ public static Duration requireNonNegative(Duration value) { } /** - * Checks that duration is not negative and not over 2 days. + * Checks that duration is positive and less than the given {@code maxLimit} (exclusive). * * @param subject used to identify name of the problematic value when throwing an exception. */ - public static Duration requireNonNegativeLong(Duration value, String subject) { + public static Duration requireNonNegative(Duration value, Duration maxLimit, String subject) { Objects.requireNonNull(value); if (value.isNegative()) { throw new IllegalArgumentException( - "Duration %s can't be negative: %s.".formatted(subject, value) + "Duration %s can't be negative: %s".formatted(subject, value) ); } - if (value.compareTo(Duration.ofDays(2)) > 0) { + if (value.compareTo(maxLimit) >= 0) { throw new IllegalArgumentException( - "Duration %s can't be longer than two days: %s.".formatted(subject, value) + "Duration %s can't be longer or equals too %s: %s".formatted( + subject, + durationToStr(maxLimit), + value + ) ); } return value; } + /** + * Checks that duration is not negative and not over 2 days. + * + * @param subject used to identify name of the problematic value when throwing an exception. + */ + public static Duration requireNonNegativeMax2days(Duration value, String subject) { + return requireNonNegative(value, Duration.ofDays(2), subject); + } + /** * Checks that duration is not negative and not over 2 hours. * * @param subject used to identify name of the problematic value when throwing an exception. */ - public static Duration requireNonNegativeMedium(Duration value, String subject) { - Objects.requireNonNull(value); - if (value.isNegative()) { - throw new IllegalArgumentException( - "Duration %s can't be negative: %s.".formatted(subject, value) - ); - } - if (value.compareTo(Duration.ofHours(2)) > 0) { - throw new IllegalArgumentException( - "Duration %s can't be longer than two hours: %s.".formatted(subject, value) - ); - } - return value; + public static Duration requireNonNegativeMax2hours(Duration value, String subject) { + return requireNonNegative(value, Duration.ofHours(2), subject); } /** @@ -231,19 +233,8 @@ public static Duration requireNonNegativeMedium(Duration value, String subject) * * @param subject used to identify name of the problematic value when throwing an exception. */ - public static Duration requireNonNegativeShort(Duration value, String subject) { - Objects.requireNonNull(value); - if (value.isNegative()) { - throw new IllegalArgumentException( - "Duration %s can't be negative: %s.".formatted(subject, value) - ); - } - if (value.compareTo(Duration.ofMinutes(30)) > 0) { - throw new IllegalArgumentException( - "Duration %s can't be longer than 30 minutes: %s.".formatted(subject, value) - ); - } - return value; + public static Duration requireNonNegativeMax30minutes(Duration value, String subject) { + return requireNonNegative(value, Duration.ofMinutes(30), subject); } /** diff --git a/src/main/java/org/opentripplanner/framework/time/LocalDateUtils.java b/application/src/main/java/org/opentripplanner/framework/time/LocalDateUtils.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/time/LocalDateUtils.java rename to application/src/main/java/org/opentripplanner/framework/time/LocalDateUtils.java diff --git a/src/main/java/org/opentripplanner/framework/time/OffsetDateTimeParser.java b/application/src/main/java/org/opentripplanner/framework/time/OffsetDateTimeParser.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/time/OffsetDateTimeParser.java rename to application/src/main/java/org/opentripplanner/framework/time/OffsetDateTimeParser.java diff --git a/src/main/java/org/opentripplanner/framework/time/RelativeTime.java b/application/src/main/java/org/opentripplanner/framework/time/RelativeTime.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/time/RelativeTime.java rename to application/src/main/java/org/opentripplanner/framework/time/RelativeTime.java diff --git a/src/main/java/org/opentripplanner/framework/time/ServiceDateUtils.java b/application/src/main/java/org/opentripplanner/framework/time/ServiceDateUtils.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/time/ServiceDateUtils.java rename to application/src/main/java/org/opentripplanner/framework/time/ServiceDateUtils.java diff --git a/src/main/java/org/opentripplanner/framework/time/TimeUtils.java b/application/src/main/java/org/opentripplanner/framework/time/TimeUtils.java similarity index 99% rename from src/main/java/org/opentripplanner/framework/time/TimeUtils.java rename to application/src/main/java/org/opentripplanner/framework/time/TimeUtils.java index 9cc5594cb76..f2d2cf5de41 100644 --- a/src/main/java/org/opentripplanner/framework/time/TimeUtils.java +++ b/application/src/main/java/org/opentripplanner/framework/time/TimeUtils.java @@ -14,7 +14,6 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.regex.Matcher; import java.util.regex.Pattern; -import javax.annotation.Nonnull; /** * Time utility methods. See the unit test for examples on how to use this class. @@ -108,7 +107,7 @@ public static int time(String hhmmss, int defaultValue) { * very helpful when specifying a schedule using a sting instead of using a int array with seconds * past midnight. */ - public static int[] times(@Nonnull String input) { + public static int[] times(String input) { return Arrays.stream(input.split("[ ,;]+")).mapToInt(TimeUtils::time).toArray(); } diff --git a/src/main/java/org/opentripplanner/framework/time/ZoneIdFallback.java b/application/src/main/java/org/opentripplanner/framework/time/ZoneIdFallback.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/time/ZoneIdFallback.java rename to application/src/main/java/org/opentripplanner/framework/time/ZoneIdFallback.java diff --git a/src/main/java/org/opentripplanner/framework/token/Deserializer.java b/application/src/main/java/org/opentripplanner/framework/token/Deserializer.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/token/Deserializer.java rename to application/src/main/java/org/opentripplanner/framework/token/Deserializer.java diff --git a/src/main/java/org/opentripplanner/framework/token/FieldDefinition.java b/application/src/main/java/org/opentripplanner/framework/token/FieldDefinition.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/token/FieldDefinition.java rename to application/src/main/java/org/opentripplanner/framework/token/FieldDefinition.java diff --git a/src/main/java/org/opentripplanner/framework/token/Serializer.java b/application/src/main/java/org/opentripplanner/framework/token/Serializer.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/token/Serializer.java rename to application/src/main/java/org/opentripplanner/framework/token/Serializer.java diff --git a/src/main/java/org/opentripplanner/framework/token/Token.java b/application/src/main/java/org/opentripplanner/framework/token/Token.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/token/Token.java rename to application/src/main/java/org/opentripplanner/framework/token/Token.java diff --git a/src/main/java/org/opentripplanner/framework/token/TokenBuilder.java b/application/src/main/java/org/opentripplanner/framework/token/TokenBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/token/TokenBuilder.java rename to application/src/main/java/org/opentripplanner/framework/token/TokenBuilder.java diff --git a/src/main/java/org/opentripplanner/framework/token/TokenDefinition.java b/application/src/main/java/org/opentripplanner/framework/token/TokenDefinition.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/token/TokenDefinition.java rename to application/src/main/java/org/opentripplanner/framework/token/TokenDefinition.java diff --git a/src/main/java/org/opentripplanner/framework/token/TokenDefinitionBuilder.java b/application/src/main/java/org/opentripplanner/framework/token/TokenDefinitionBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/token/TokenDefinitionBuilder.java rename to application/src/main/java/org/opentripplanner/framework/token/TokenDefinitionBuilder.java diff --git a/src/main/java/org/opentripplanner/framework/token/TokenFormatterConfiguration.java b/application/src/main/java/org/opentripplanner/framework/token/TokenFormatterConfiguration.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/token/TokenFormatterConfiguration.java rename to application/src/main/java/org/opentripplanner/framework/token/TokenFormatterConfiguration.java diff --git a/src/main/java/org/opentripplanner/framework/token/TokenSchema.java b/application/src/main/java/org/opentripplanner/framework/token/TokenSchema.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/token/TokenSchema.java rename to application/src/main/java/org/opentripplanner/framework/token/TokenSchema.java diff --git a/src/main/java/org/opentripplanner/framework/token/TokenType.java b/application/src/main/java/org/opentripplanner/framework/token/TokenType.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/token/TokenType.java rename to application/src/main/java/org/opentripplanner/framework/token/TokenType.java diff --git a/src/main/java/org/opentripplanner/framework/token/package.md b/application/src/main/java/org/opentripplanner/framework/token/package.md similarity index 100% rename from src/main/java/org/opentripplanner/framework/token/package.md rename to application/src/main/java/org/opentripplanner/framework/token/package.md diff --git a/src/main/java/org/opentripplanner/framework/tostring/MultiLineToStringBuilder.java b/application/src/main/java/org/opentripplanner/framework/tostring/MultiLineToStringBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/tostring/MultiLineToStringBuilder.java rename to application/src/main/java/org/opentripplanner/framework/tostring/MultiLineToStringBuilder.java diff --git a/src/main/java/org/opentripplanner/framework/tostring/ToStringBuilder.java b/application/src/main/java/org/opentripplanner/framework/tostring/ToStringBuilder.java similarity index 98% rename from src/main/java/org/opentripplanner/framework/tostring/ToStringBuilder.java rename to application/src/main/java/org/opentripplanner/framework/tostring/ToStringBuilder.java index 6480b6f1187..f600a2a31bc 100644 --- a/src/main/java/org/opentripplanner/framework/tostring/ToStringBuilder.java +++ b/application/src/main/java/org/opentripplanner/framework/tostring/ToStringBuilder.java @@ -15,7 +15,6 @@ import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.framework.lang.ObjectUtils; import org.opentripplanner.framework.lang.OtpNumberFormat; @@ -372,7 +371,7 @@ private ToStringBuilder addIfNotIgnored( return addIt(name, mapToString.apply(value)); } - private ToStringBuilder addIt(String name, @Nonnull String value) { + private ToStringBuilder addIt(String name, String value) { addLabel(name); addValue(value); return this; @@ -387,7 +386,7 @@ private void addLabel(String name) { sb.append(name); } - private void addValue(@Nonnull String value) { + private void addValue(String value) { sb.append(FIELD_VALUE_SEP); sb.append(value); } diff --git a/src/main/java/org/opentripplanner/framework/tostring/ValueObjectToStringBuilder.java b/application/src/main/java/org/opentripplanner/framework/tostring/ValueObjectToStringBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/framework/tostring/ValueObjectToStringBuilder.java rename to application/src/main/java/org/opentripplanner/framework/tostring/ValueObjectToStringBuilder.java diff --git a/src/main/java/org/opentripplanner/graph_builder/ConfiguredDataSource.java b/application/src/main/java/org/opentripplanner/graph_builder/ConfiguredDataSource.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/ConfiguredDataSource.java rename to application/src/main/java/org/opentripplanner/graph_builder/ConfiguredDataSource.java diff --git a/src/main/java/org/opentripplanner/graph_builder/GraphBuilder.java b/application/src/main/java/org/opentripplanner/graph_builder/GraphBuilder.java similarity index 98% rename from src/main/java/org/opentripplanner/graph_builder/GraphBuilder.java rename to application/src/main/java/org/opentripplanner/graph_builder/GraphBuilder.java index 3c1408089a4..d6f91696e64 100644 --- a/src/main/java/org/opentripplanner/graph_builder/GraphBuilder.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/GraphBuilder.java @@ -8,7 +8,6 @@ import java.time.Duration; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.ext.emissions.EmissionsDataModel; import org.opentripplanner.ext.stopconsolidation.StopConsolidationRepository; @@ -44,11 +43,7 @@ public class GraphBuilder implements Runnable { private boolean hasTransitData = false; @Inject - public GraphBuilder( - @Nonnull Graph baseGraph, - @Nonnull TransitModel transitModel, - @Nonnull DataImportIssueStore issueStore - ) { + public GraphBuilder(Graph baseGraph, TransitModel transitModel, DataImportIssueStore issueStore) { this.graph = baseGraph; this.transitModel = transitModel; this.issueStore = issueStore; @@ -167,6 +162,8 @@ public static GraphBuilder create( graphBuilder.addModule(factory.emissionsModule()); } + graphBuilder.addModuleOptional(factory.routeToCentroidStationIdValidator()); + if (config.dataImportReport) { graphBuilder.addModule(factory.dataImportIssueReporter()); } diff --git a/src/main/java/org/opentripplanner/graph_builder/GraphBuilderDataSources.java b/application/src/main/java/org/opentripplanner/graph_builder/GraphBuilderDataSources.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/GraphBuilderDataSources.java rename to application/src/main/java/org/opentripplanner/graph_builder/GraphBuilderDataSources.java diff --git a/src/main/java/org/opentripplanner/graph_builder/GraphStats.java b/application/src/main/java/org/opentripplanner/graph_builder/GraphStats.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/GraphStats.java rename to application/src/main/java/org/opentripplanner/graph_builder/GraphStats.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issue/api/DataImportIssue.java b/application/src/main/java/org/opentripplanner/graph_builder/issue/api/DataImportIssue.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issue/api/DataImportIssue.java rename to application/src/main/java/org/opentripplanner/graph_builder/issue/api/DataImportIssue.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issue/api/DataImportIssueStore.java b/application/src/main/java/org/opentripplanner/graph_builder/issue/api/DataImportIssueStore.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issue/api/DataImportIssueStore.java rename to application/src/main/java/org/opentripplanner/graph_builder/issue/api/DataImportIssueStore.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issue/api/DataImportIssueSummary.java b/application/src/main/java/org/opentripplanner/graph_builder/issue/api/DataImportIssueSummary.java similarity index 98% rename from src/main/java/org/opentripplanner/graph_builder/issue/api/DataImportIssueSummary.java rename to application/src/main/java/org/opentripplanner/graph_builder/issue/api/DataImportIssueSummary.java index ba1e6610a30..da3110d0ce7 100644 --- a/src/main/java/org/opentripplanner/graph_builder/issue/api/DataImportIssueSummary.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/issue/api/DataImportIssueSummary.java @@ -8,7 +8,6 @@ import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -74,7 +73,6 @@ public void logSummary() { .forEach(issueType -> ISSUE_LOG.info(String.format(FMT, issueType, summary.get(issueType)))); } - @Nonnull public Map asMap() { return summary; } diff --git a/src/main/java/org/opentripplanner/graph_builder/issue/api/Issue.java b/application/src/main/java/org/opentripplanner/graph_builder/issue/api/Issue.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issue/api/Issue.java rename to application/src/main/java/org/opentripplanner/graph_builder/issue/api/Issue.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issue/api/IssueWithSource.java b/application/src/main/java/org/opentripplanner/graph_builder/issue/api/IssueWithSource.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issue/api/IssueWithSource.java rename to application/src/main/java/org/opentripplanner/graph_builder/issue/api/IssueWithSource.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issue/api/NoopDataImportIssueStore.java b/application/src/main/java/org/opentripplanner/graph_builder/issue/api/NoopDataImportIssueStore.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issue/api/NoopDataImportIssueStore.java rename to application/src/main/java/org/opentripplanner/graph_builder/issue/api/NoopDataImportIssueStore.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issue/api/OsmUrlGenerator.java b/application/src/main/java/org/opentripplanner/graph_builder/issue/api/OsmUrlGenerator.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issue/api/OsmUrlGenerator.java rename to application/src/main/java/org/opentripplanner/graph_builder/issue/api/OsmUrlGenerator.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issue/report/Bucket.java b/application/src/main/java/org/opentripplanner/graph_builder/issue/report/Bucket.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issue/report/Bucket.java rename to application/src/main/java/org/opentripplanner/graph_builder/issue/report/Bucket.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issue/report/BucketKey.java b/application/src/main/java/org/opentripplanner/graph_builder/issue/report/BucketKey.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issue/report/BucketKey.java rename to application/src/main/java/org/opentripplanner/graph_builder/issue/report/BucketKey.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issue/report/DataImportIssueReporter.java b/application/src/main/java/org/opentripplanner/graph_builder/issue/report/DataImportIssueReporter.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issue/report/DataImportIssueReporter.java rename to application/src/main/java/org/opentripplanner/graph_builder/issue/report/DataImportIssueReporter.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issue/report/GeoJsonWriter.java b/application/src/main/java/org/opentripplanner/graph_builder/issue/report/GeoJsonWriter.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issue/report/GeoJsonWriter.java rename to application/src/main/java/org/opentripplanner/graph_builder/issue/report/GeoJsonWriter.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issue/report/HTMLWriter.java b/application/src/main/java/org/opentripplanner/graph_builder/issue/report/HTMLWriter.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issue/report/HTMLWriter.java rename to application/src/main/java/org/opentripplanner/graph_builder/issue/report/HTMLWriter.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issue/report/IssueColors.java b/application/src/main/java/org/opentripplanner/graph_builder/issue/report/IssueColors.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issue/report/IssueColors.java rename to application/src/main/java/org/opentripplanner/graph_builder/issue/report/IssueColors.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issue/service/DefaultDataImportIssueStore.java b/application/src/main/java/org/opentripplanner/graph_builder/issue/service/DefaultDataImportIssueStore.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issue/service/DefaultDataImportIssueStore.java rename to application/src/main/java/org/opentripplanner/graph_builder/issue/service/DefaultDataImportIssueStore.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/BogusShapeDistanceTraveled.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/BogusShapeDistanceTraveled.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/BogusShapeDistanceTraveled.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/BogusShapeDistanceTraveled.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/BogusShapeGeometry.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/BogusShapeGeometry.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/BogusShapeGeometry.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/BogusShapeGeometry.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/BogusShapeGeometryCaught.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/BogusShapeGeometryCaught.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/BogusShapeGeometryCaught.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/BogusShapeGeometryCaught.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/DisconnectedOsmNode.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/DisconnectedOsmNode.java similarity index 83% rename from src/main/java/org/opentripplanner/graph_builder/issues/DisconnectedOsmNode.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/DisconnectedOsmNode.java index f1c341a46fe..2996bec2d9d 100644 --- a/src/main/java/org/opentripplanner/graph_builder/issues/DisconnectedOsmNode.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/issues/DisconnectedOsmNode.java @@ -3,10 +3,10 @@ import org.locationtech.jts.geom.Geometry; import org.opentripplanner.framework.geometry.GeometryUtils; import org.opentripplanner.graph_builder.issue.api.DataImportIssue; -import org.opentripplanner.openstreetmap.model.OSMNode; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmNode; +import org.opentripplanner.osm.model.OsmWithTags; -public record DisconnectedOsmNode(OSMNode node, OSMWithTags way, OSMWithTags area) +public record DisconnectedOsmNode(OsmNode node, OsmWithTags way, OsmWithTags area) implements DataImportIssue { private static final String FMT = "Node %s in way %s is coincident but disconnected with area %s"; private static final String HTMLFMT = diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/ElevationFlattened.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/ElevationFlattened.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/ElevationFlattened.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/ElevationFlattened.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/ElevationProfileFailure.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/ElevationProfileFailure.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/ElevationProfileFailure.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/ElevationProfileFailure.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/GraphConnectivity.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/GraphConnectivity.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/GraphConnectivity.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/GraphConnectivity.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/Graphwide.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/Graphwide.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/Graphwide.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/Graphwide.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/HopSpeedFast.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/HopSpeedFast.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/HopSpeedFast.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/HopSpeedFast.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/HopSpeedSlow.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/HopSpeedSlow.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/HopSpeedSlow.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/HopSpeedSlow.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/HopZeroDistance.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/HopZeroDistance.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/HopZeroDistance.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/HopZeroDistance.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/HopZeroTime.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/HopZeroTime.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/HopZeroTime.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/HopZeroTime.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/IgnoredGtfsTransfer.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/IgnoredGtfsTransfer.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/IgnoredGtfsTransfer.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/IgnoredGtfsTransfer.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/InterliningTeleport.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/InterliningTeleport.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/InterliningTeleport.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/InterliningTeleport.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/InvalidGtfsTransfer.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/InvalidGtfsTransfer.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/InvalidGtfsTransfer.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/InvalidGtfsTransfer.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/InvalidOsmGeometry.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/InvalidOsmGeometry.java similarity index 80% rename from src/main/java/org/opentripplanner/graph_builder/issues/InvalidOsmGeometry.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/InvalidOsmGeometry.java index 7f84453a6d8..2f3eca39aeb 100644 --- a/src/main/java/org/opentripplanner/graph_builder/issues/InvalidOsmGeometry.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/issues/InvalidOsmGeometry.java @@ -1,9 +1,9 @@ package org.opentripplanner.graph_builder.issues; import org.opentripplanner.graph_builder.issue.api.DataImportIssue; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; -public record InvalidOsmGeometry(OSMWithTags entity) implements DataImportIssue { +public record InvalidOsmGeometry(OsmWithTags entity) implements DataImportIssue { private static final String FMT = "Invalid OSM geometry %s"; private static final String HTMLFMT = "Invalid OSM geometry '%s'"; diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/InvalidVehicleParkingCapacity.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/InvalidVehicleParkingCapacity.java similarity index 84% rename from src/main/java/org/opentripplanner/graph_builder/issues/InvalidVehicleParkingCapacity.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/InvalidVehicleParkingCapacity.java index c4f5498a769..1e31462178a 100644 --- a/src/main/java/org/opentripplanner/graph_builder/issues/InvalidVehicleParkingCapacity.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/issues/InvalidVehicleParkingCapacity.java @@ -1,9 +1,9 @@ package org.opentripplanner.graph_builder.issues; import org.opentripplanner.graph_builder.issue.api.DataImportIssue; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; -public record InvalidVehicleParkingCapacity(OSMWithTags entity, String capacityValue) +public record InvalidVehicleParkingCapacity(OsmWithTags entity, String capacityValue) implements DataImportIssue { private static final String FMT = "Capacity for osm node %d is not a number: '%s'; it's replaced with '-1' (unknown)."; diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/IsolatedStop.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/IsolatedStop.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/IsolatedStop.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/IsolatedStop.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/LevelAmbiguous.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/LevelAmbiguous.java similarity index 87% rename from src/main/java/org/opentripplanner/graph_builder/issues/LevelAmbiguous.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/LevelAmbiguous.java index 650c8b299ac..a448540b2c5 100644 --- a/src/main/java/org/opentripplanner/graph_builder/issues/LevelAmbiguous.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/issues/LevelAmbiguous.java @@ -1,9 +1,9 @@ package org.opentripplanner.graph_builder.issues; import org.opentripplanner.graph_builder.issue.api.DataImportIssue; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; -public record LevelAmbiguous(String layerName, OSMWithTags entity) implements DataImportIssue { +public record LevelAmbiguous(String layerName, OsmWithTags entity) implements DataImportIssue { private static final String FMT = "Could not infer floor number for layer called '%s' at %s. " + "Vertical movement will still be possible, but elevator cost might be incorrect. " + diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/MissingProjectionInServiceLink.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/MissingProjectionInServiceLink.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/MissingProjectionInServiceLink.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/MissingProjectionInServiceLink.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/MissingShapeGeometry.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/MissingShapeGeometry.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/MissingShapeGeometry.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/MissingShapeGeometry.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/NegativeDwellTime.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/NegativeDwellTime.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/NegativeDwellTime.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/NegativeDwellTime.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/NegativeHopTime.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/NegativeHopTime.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/NegativeHopTime.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/NegativeHopTime.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/NoFutureDates.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/NoFutureDates.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/NoFutureDates.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/NoFutureDates.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/ParkAndRideEntranceRemoved.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/ParkAndRideEntranceRemoved.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/ParkAndRideEntranceRemoved.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/ParkAndRideEntranceRemoved.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/ParkAndRideUnlinked.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/ParkAndRideUnlinked.java similarity index 84% rename from src/main/java/org/opentripplanner/graph_builder/issues/ParkAndRideUnlinked.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/ParkAndRideUnlinked.java index 7da16a2891f..4e8ccd14318 100644 --- a/src/main/java/org/opentripplanner/graph_builder/issues/ParkAndRideUnlinked.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/issues/ParkAndRideUnlinked.java @@ -1,9 +1,9 @@ package org.opentripplanner.graph_builder.issues; import org.opentripplanner.graph_builder.issue.api.DataImportIssue; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; -public record ParkAndRideUnlinked(String name, OSMWithTags entity) implements DataImportIssue { +public record ParkAndRideUnlinked(String name, OsmWithTags entity) implements DataImportIssue { private static final String FMT = "Park and ride '%s' (%s) not linked to any streets in OSM; entrance might not be placed correctly."; private static final String HTMLFMT = diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/RepeatedStops.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/RepeatedStops.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/RepeatedStops.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/RepeatedStops.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/ShapeGeometryTooFar.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/ShapeGeometryTooFar.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/ShapeGeometryTooFar.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/ShapeGeometryTooFar.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/StopNotLinkedForTransfers.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/StopNotLinkedForTransfers.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/StopNotLinkedForTransfers.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/StopNotLinkedForTransfers.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/TripDegenerate.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/TripDegenerate.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/TripDegenerate.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/TripDegenerate.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/TripUndefinedService.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/TripUndefinedService.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/TripUndefinedService.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/TripUndefinedService.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/TurnRestrictionBad.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/TurnRestrictionBad.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/TurnRestrictionBad.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/TurnRestrictionBad.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/TurnRestrictionException.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/TurnRestrictionException.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/TurnRestrictionException.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/TurnRestrictionException.java diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/TurnRestrictionUnknown.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/TurnRestrictionUnknown.java similarity index 82% rename from src/main/java/org/opentripplanner/graph_builder/issues/TurnRestrictionUnknown.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/TurnRestrictionUnknown.java index 36e913cba6a..23e20638d86 100644 --- a/src/main/java/org/opentripplanner/graph_builder/issues/TurnRestrictionUnknown.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/issues/TurnRestrictionUnknown.java @@ -1,9 +1,9 @@ package org.opentripplanner.graph_builder.issues; import org.opentripplanner.graph_builder.issue.api.DataImportIssue; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; -public record TurnRestrictionUnknown(OSMWithTags entity, String tagval) implements DataImportIssue { +public record TurnRestrictionUnknown(OsmWithTags entity, String tagval) implements DataImportIssue { private static final String FMT = "Invalid turn restriction tag %s in turn restriction %d"; private static final String HTMLFMT = "Invalid turn restriction tag %s in '%s'"; diff --git a/src/main/java/org/opentripplanner/graph_builder/issues/package-info.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/package-info.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/issues/package-info.java rename to application/src/main/java/org/opentripplanner/graph_builder/issues/package-info.java diff --git a/src/main/java/org/opentripplanner/graph_builder/model/DataSourceConfig.java b/application/src/main/java/org/opentripplanner/graph_builder/model/DataSourceConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/model/DataSourceConfig.java rename to application/src/main/java/org/opentripplanner/graph_builder/model/DataSourceConfig.java diff --git a/src/main/java/org/opentripplanner/graph_builder/model/GraphBuilderModule.java b/application/src/main/java/org/opentripplanner/graph_builder/model/GraphBuilderModule.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/model/GraphBuilderModule.java rename to application/src/main/java/org/opentripplanner/graph_builder/model/GraphBuilderModule.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/AddTransitModelEntitiesToGraph.java b/application/src/main/java/org/opentripplanner/graph_builder/module/AddTransitModelEntitiesToGraph.java similarity index 97% rename from src/main/java/org/opentripplanner/graph_builder/module/AddTransitModelEntitiesToGraph.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/AddTransitModelEntitiesToGraph.java index a53730b104c..a4bbb10da68 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/AddTransitModelEntitiesToGraph.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/AddTransitModelEntitiesToGraph.java @@ -39,6 +39,7 @@ import org.opentripplanner.transit.model.site.PathwayMode; import org.opentripplanner.transit.model.site.PathwayNode; import org.opentripplanner.transit.model.site.RegularStop; +import org.opentripplanner.transit.model.site.Station; import org.opentripplanner.transit.model.site.StationElement; import org.opentripplanner.transit.model.site.StopLocation; import org.opentripplanner.transit.service.TransitModel; @@ -86,6 +87,7 @@ private void applyToGraph(TransitModel transitModel) { addStopsToGraphAndGenerateStopVertexes(transitModel); addEntrancesToGraph(); + addStationCentroidsToGraph(); addPathwayNodesToGraph(); addBoardingAreasToGraph(); @@ -142,6 +144,14 @@ private void addEntrancesToGraph() { } } + private void addStationCentroidsToGraph() { + for (Station station : otpTransitService.stopModel().listStations()) { + if (station.shouldRouteToCentroid()) { + vertexFactory.stationCentroid(station); + } + } + } + private void addPathwayNodesToGraph() { for (PathwayNode node : otpTransitService.getAllPathwayNodes()) { TransitPathwayNodeVertex nodeVertex = vertexFactory.transitPathwayNode(node); diff --git a/src/main/java/org/opentripplanner/graph_builder/module/DirectTransferGenerator.java b/application/src/main/java/org/opentripplanner/graph_builder/module/DirectTransferGenerator.java similarity index 94% rename from src/main/java/org/opentripplanner/graph_builder/module/DirectTransferGenerator.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/DirectTransferGenerator.java index 3137b66070f..a87f28182ff 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/DirectTransferGenerator.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/DirectTransferGenerator.java @@ -104,8 +104,7 @@ public void buildGraph() { LOG.debug("Linking stop '{}' {}", stop, ts0); for (RouteRequest transferProfile : transferRequests) { - for (NearbyStop sd : findNearbyStops( - nearbyStopFinder, + for (NearbyStop sd : nearbyStopFinder.findNearbyStops( ts0, transferProfile, transferProfile.journey().transfer(), @@ -126,8 +125,7 @@ public void buildGraph() { if (OTPFeature.FlexRouting.isOn()) { // This code is for finding transfers from AreaStops to Stops, transfers // from Stops to AreaStops and between Stops are already covered above. - for (NearbyStop sd : findNearbyStops( - nearbyStopFinder, + for (NearbyStop sd : nearbyStopFinder.findNearbyStops( ts0, transferProfile, transferProfile.journey().transfer(), @@ -203,15 +201,5 @@ private NearbyStopFinder createNearbyStopFinder() { } } - private static Iterable findNearbyStops( - NearbyStopFinder nearbyStopFinder, - Vertex vertex, - RouteRequest request, - StreetRequest streetRequest, - boolean reverseDirection - ) { - return nearbyStopFinder.findNearbyStops(vertex, request, streetRequest, reverseDirection); - } - private record TransferKey(StopLocation source, StopLocation target, List edges) {} } diff --git a/src/main/java/org/opentripplanner/graph_builder/module/GraphCoherencyCheckerModule.java b/application/src/main/java/org/opentripplanner/graph_builder/module/GraphCoherencyCheckerModule.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/GraphCoherencyCheckerModule.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/GraphCoherencyCheckerModule.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/GtfsFeedId.java b/application/src/main/java/org/opentripplanner/graph_builder/module/GtfsFeedId.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/GtfsFeedId.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/GtfsFeedId.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModule.java b/application/src/main/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModule.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModule.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModule.java diff --git a/application/src/main/java/org/opentripplanner/graph_builder/module/RouteToCentroidStationIdsValidator.java b/application/src/main/java/org/opentripplanner/graph_builder/module/RouteToCentroidStationIdsValidator.java new file mode 100644 index 00000000000..0b17f956ae8 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/RouteToCentroidStationIdsValidator.java @@ -0,0 +1,50 @@ +package org.opentripplanner.graph_builder.module; + +import java.util.Collection; +import java.util.stream.Collectors; +import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; +import org.opentripplanner.graph_builder.model.GraphBuilderModule; +import org.opentripplanner.transit.model.framework.AbstractTransitEntity; +import org.opentripplanner.transit.model.framework.FeedScopedId; +import org.opentripplanner.transit.service.TransitModel; + +public class RouteToCentroidStationIdsValidator implements GraphBuilderModule { + + private final DataImportIssueStore issueStore; + private final Collection transitRouteToStationCentroid; + private final TransitModel transitModel; + + public RouteToCentroidStationIdsValidator( + DataImportIssueStore issueStore, + Collection transitRouteToStationCentroid, + TransitModel transitModel + ) { + this.issueStore = issueStore; + this.transitRouteToStationCentroid = transitRouteToStationCentroid; + this.transitModel = transitModel; + } + + private void validate() { + var stationIds = transitModel + .getStopModel() + .listStations() + .stream() + .map(AbstractTransitEntity::getId) + .collect(Collectors.toSet()); + transitRouteToStationCentroid + .stream() + .filter(id -> !stationIds.contains(id)) + .forEach(id -> + issueStore.add( + "UnknownStationId", + "Config parameter 'transitRouteToStationCentroid' specified a station that does not exist: %s", + id + ) + ); + } + + @Override + public void buildGraph() { + validate(); + } +} diff --git a/src/main/java/org/opentripplanner/graph_builder/module/StreetLinkerModule.java b/application/src/main/java/org/opentripplanner/graph_builder/module/StreetLinkerModule.java similarity index 91% rename from src/main/java/org/opentripplanner/graph_builder/module/StreetLinkerModule.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/StreetLinkerModule.java index 48e6e484a0c..a134dd3c75b 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/StreetLinkerModule.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/StreetLinkerModule.java @@ -3,8 +3,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; +import java.util.function.BiFunction; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import org.opentripplanner.framework.application.OTPFeature; import org.opentripplanner.framework.logging.ProgressTracker; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; @@ -15,14 +15,17 @@ import org.opentripplanner.routing.vehicle_parking.VehicleParking; import org.opentripplanner.routing.vehicle_parking.VehicleParkingHelper; import org.opentripplanner.street.model.edge.Edge; +import org.opentripplanner.street.model.edge.StreetStationCentroidLink; import org.opentripplanner.street.model.edge.StreetTransitEntranceLink; import org.opentripplanner.street.model.edge.StreetTransitStopLink; import org.opentripplanner.street.model.edge.StreetVehicleParkingLink; import org.opentripplanner.street.model.edge.VehicleParkingEdge; +import org.opentripplanner.street.model.vertex.StationCentroidVertex; import org.opentripplanner.street.model.vertex.StreetVertex; import org.opentripplanner.street.model.vertex.TransitEntranceVertex; import org.opentripplanner.street.model.vertex.TransitStopVertex; import org.opentripplanner.street.model.vertex.VehicleParkingEntranceVertex; +import org.opentripplanner.street.model.vertex.Vertex; import org.opentripplanner.street.search.TraverseMode; import org.opentripplanner.street.search.TraverseModeSet; import org.opentripplanner.transit.model.site.GroupStop; @@ -70,6 +73,7 @@ public void buildGraph() { if (graph.hasStreets) { linkTransitStops(graph, transitModel); linkTransitEntrances(graph); + linkStationCentroids(graph); linkVehicleParks(graph, issueStore); } @@ -175,7 +179,6 @@ private void linkToDriveableEdge(TransitStopVertex tStop) { ); } - @Nonnull private static List createStopLinkEdges( TransitStopVertex vertex, StreetVertex streetVertex @@ -257,6 +260,34 @@ private void linkTransitEntrances(Graph graph) { } } + private void linkStationCentroids(Graph graph) { + BiFunction> stationAndStreetVertexLinker = ( + theStation, + streetVertex + ) -> + List.of( + StreetStationCentroidLink.createStreetStationLink( + (StationCentroidVertex) theStation, + streetVertex + ), + StreetStationCentroidLink.createStreetStationLink( + streetVertex, + (StationCentroidVertex) theStation + ) + ); + + for (StationCentroidVertex station : graph.getVerticesOfType(StationCentroidVertex.class)) { + graph + .getLinker() + .linkVertexPermanently( + station, + new TraverseModeSet(TraverseMode.WALK), + LinkingDirection.BOTH_WAYS, + stationAndStreetVertexLinker + ); + } + } + private void linkVehicleParks(Graph graph, DataImportIssueStore issueStore) { LOG.info("Linking vehicle parks to graph..."); List vehicleParkingToRemove = new ArrayList<>(); diff --git a/src/main/java/org/opentripplanner/graph_builder/module/TimeZoneAdjusterModule.java b/application/src/main/java/org/opentripplanner/graph_builder/module/TimeZoneAdjusterModule.java similarity index 75% rename from src/main/java/org/opentripplanner/graph_builder/module/TimeZoneAdjusterModule.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/TimeZoneAdjusterModule.java index eb3674bf76a..7168066afe3 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/TimeZoneAdjusterModule.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/TimeZoneAdjusterModule.java @@ -7,6 +7,7 @@ import java.util.HashMap; import java.util.Map; import org.opentripplanner.graph_builder.model.GraphBuilderModule; +import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.service.TransitModel; /** @@ -45,9 +46,15 @@ public void buildGraph() { return; } - pattern - .getScheduledTimetable() - .updateAllTripTimes(it -> it.adjustTimesToGraphTimeZone(timeShift)); + TripPattern updatedPattern = pattern + .copy() + .withScheduledTimeTableBuilder(builder -> + builder.updateAllTripTimes(tt -> tt.adjustTimesToGraphTimeZone(timeShift)) + ) + .build(); + // replace the original pattern with the updated pattern in the transit model + transitModel.addTripPattern(updatedPattern.getId(), updatedPattern); }); + transitModel.index(); } } diff --git a/src/main/java/org/opentripplanner/graph_builder/module/TripPatternNamer.java b/application/src/main/java/org/opentripplanner/graph_builder/module/TripPatternNamer.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/TripPatternNamer.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/TripPatternNamer.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/ValidateAndInterpolateStopTimesForEachTrip.java b/application/src/main/java/org/opentripplanner/graph_builder/module/ValidateAndInterpolateStopTimesForEachTrip.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/ValidateAndInterpolateStopTimesForEachTrip.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/ValidateAndInterpolateStopTimesForEachTrip.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/configure/GraphBuilderFactory.java b/application/src/main/java/org/opentripplanner/graph_builder/module/configure/GraphBuilderFactory.java similarity index 95% rename from src/main/java/org/opentripplanner/graph_builder/module/configure/GraphBuilderFactory.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/configure/GraphBuilderFactory.java index 9c778481d4d..21b125b1188 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/configure/GraphBuilderFactory.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/configure/GraphBuilderFactory.java @@ -19,6 +19,7 @@ import org.opentripplanner.graph_builder.module.DirectTransferGenerator; import org.opentripplanner.graph_builder.module.GraphCoherencyCheckerModule; import org.opentripplanner.graph_builder.module.OsmBoardingLocationsModule; +import org.opentripplanner.graph_builder.module.RouteToCentroidStationIdsValidator; import org.opentripplanner.graph_builder.module.StreetLinkerModule; import org.opentripplanner.graph_builder.module.TimeZoneAdjusterModule; import org.opentripplanner.graph_builder.module.TripPatternNamer; @@ -58,6 +59,9 @@ public interface GraphBuilderFactory { CalculateWorldEnvelopeModule calculateWorldEnvelopeModule(); StreetLimitationParameters streetLimitationParameters(); + @Nullable + RouteToCentroidStationIdsValidator routeToCentroidStationIdValidator(); + @Nullable StopConsolidationModule stopConsolidationModule(); diff --git a/src/main/java/org/opentripplanner/graph_builder/module/configure/GraphBuilderModules.java b/application/src/main/java/org/opentripplanner/graph_builder/module/configure/GraphBuilderModules.java similarity index 95% rename from src/main/java/org/opentripplanner/graph_builder/module/configure/GraphBuilderModules.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/configure/GraphBuilderModules.java index 10d3a997579..85b34b5704b 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/configure/GraphBuilderModules.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/configure/GraphBuilderModules.java @@ -24,6 +24,7 @@ import org.opentripplanner.graph_builder.issue.report.DataImportIssueReporter; import org.opentripplanner.graph_builder.issue.service.DefaultDataImportIssueStore; import org.opentripplanner.graph_builder.module.DirectTransferGenerator; +import org.opentripplanner.graph_builder.module.RouteToCentroidStationIdsValidator; import org.opentripplanner.graph_builder.module.StreetLinkerModule; import org.opentripplanner.graph_builder.module.islandpruning.PruneIslands; import org.opentripplanner.graph_builder.module.ned.DegreeGridNEDTileSource; @@ -39,7 +40,7 @@ import org.opentripplanner.gtfs.graphbuilder.GtfsModule; import org.opentripplanner.netex.NetexModule; import org.opentripplanner.netex.configure.NetexConfigure; -import org.opentripplanner.openstreetmap.OsmProvider; +import org.opentripplanner.osm.OsmProvider; import org.opentripplanner.routing.api.request.preference.WalkPreferences; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.standalone.config.BuildConfig; @@ -54,7 +55,7 @@ public class GraphBuilderModules { @Provides @Singleton - static OsmModule provideOpenStreetMapModule( + static OsmModule provideOsmModule( GraphBuilderDataSources dataSources, BuildConfig config, Graph graph, @@ -302,6 +303,20 @@ static StopConsolidationModule providesStopConsolidationModule( .orElse(null); } + @Provides + @Singleton + @Nullable + static RouteToCentroidStationIdsValidator routeToCentroidStationIdValidator( + DataImportIssueStore issueStore, + BuildConfig config, + TransitModel transitModel + ) { + var ids = config.transitRouteToStationCentroid(); + return ids.isEmpty() + ? null + : new RouteToCentroidStationIdsValidator(issueStore, ids, transitModel); + } + /* private methods */ private static ElevationGridCoverageFactory createNedElevationFactory( diff --git a/src/main/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModule.java b/application/src/main/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModule.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModule.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModule.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/geometry/GeometryProcessor.java b/application/src/main/java/org/opentripplanner/graph_builder/module/geometry/GeometryProcessor.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/geometry/GeometryProcessor.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/geometry/GeometryProcessor.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/geometry/IndexedLineSegment.java b/application/src/main/java/org/opentripplanner/graph_builder/module/geometry/IndexedLineSegment.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/geometry/IndexedLineSegment.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/geometry/IndexedLineSegment.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/geometry/IndexedLineSegmentComparator.java b/application/src/main/java/org/opentripplanner/graph_builder/module/geometry/IndexedLineSegmentComparator.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/geometry/IndexedLineSegmentComparator.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/geometry/IndexedLineSegmentComparator.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/geometry/ShapeSegmentKey.java b/application/src/main/java/org/opentripplanner/graph_builder/module/geometry/ShapeSegmentKey.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/geometry/ShapeSegmentKey.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/geometry/ShapeSegmentKey.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/GraphIsland.java b/application/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/GraphIsland.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/islandpruning/GraphIsland.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/GraphIsland.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/PruneIslands.java b/application/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/PruneIslands.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/islandpruning/PruneIslands.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/PruneIslands.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/PrunedStopIsland.java b/application/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/PrunedStopIsland.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/islandpruning/PrunedStopIsland.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/PrunedStopIsland.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/Subgraph.java b/application/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/Subgraph.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/islandpruning/Subgraph.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/Subgraph.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/MinMap.java b/application/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/MinMap.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/nearbystops/MinMap.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/MinMap.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/NearbyStopFinder.java b/application/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/NearbyStopFinder.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/nearbystops/NearbyStopFinder.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/NearbyStopFinder.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/PatternConsideringNearbyStopFinder.java b/application/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/PatternConsideringNearbyStopFinder.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/nearbystops/PatternConsideringNearbyStopFinder.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/PatternConsideringNearbyStopFinder.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/StraightLineNearbyStopFinder.java b/application/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/StraightLineNearbyStopFinder.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/nearbystops/StraightLineNearbyStopFinder.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/StraightLineNearbyStopFinder.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/StreetNearbyStopFinder.java b/application/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/StreetNearbyStopFinder.java similarity index 80% rename from src/main/java/org/opentripplanner/graph_builder/module/nearbystops/StreetNearbyStopFinder.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/StreetNearbyStopFinder.java index baf528a739f..e54c27249e1 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/StreetNearbyStopFinder.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/StreetNearbyStopFinder.java @@ -2,6 +2,7 @@ import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; +import com.google.common.collect.Sets; import java.time.Duration; import java.util.ArrayList; import java.util.Collection; @@ -40,18 +41,39 @@ public class StreetNearbyStopFinder implements NearbyStopFinder { private final Duration durationLimit; private final int maxStopCount; private final DataOverlayContext dataOverlayContext; + private final Set ignoreVertices; /** * Construct a NearbyStopFinder for the given graph and search radius. + * + * @param maxStopCount The maximum stops to return. 0 means no limit. Regardless of the maxStopCount + * we will always return all the directly connected stops. */ public StreetNearbyStopFinder( Duration durationLimit, int maxStopCount, DataOverlayContext dataOverlayContext + ) { + this(durationLimit, maxStopCount, dataOverlayContext, Set.of()); + } + + /** + * Construct a NearbyStopFinder for the given graph and search radius. + * + * @param maxStopCount The maximum stops to return. 0 means no limit. Regardless of the maxStopCount + * we will always return all the directly connected stops. + * @param ignoreVertices A set of stop vertices to ignore and not return NearbyStops for. + */ + public StreetNearbyStopFinder( + Duration durationLimit, + int maxStopCount, + DataOverlayContext dataOverlayContext, + Set ignoreVertices ) { this.dataOverlayContext = dataOverlayContext; this.durationLimit = durationLimit; this.maxStopCount = maxStopCount; + this.ignoreVertices = ignoreVertices; } /** @@ -66,36 +88,40 @@ public Collection findNearbyStops( StreetRequest streetRequest, boolean reverseDirection ) { - return findNearbyStops(Set.of(vertex), reverseDirection, routingRequest, streetRequest); + return findNearbyStops(Set.of(vertex), routingRequest, streetRequest, reverseDirection); } /** * Return all stops within a certain radius of the given vertex, using network distance along * streets. If the origin vertex is a StopVertex, the result will include it. * - * @param originVertices the origin point of the street search + * @param originVertices the origin point of the street search. * @param reverseDirection if true the paths returned instead originate at the nearby stops and - * have the originVertex as the destination + * have the originVertex as the destination. */ public Collection findNearbyStops( Set originVertices, - boolean reverseDirection, RouteRequest request, - StreetRequest streetRequest + StreetRequest streetRequest, + boolean reverseDirection ) { OTPRequestTimeoutException.checkForTimeout(); - List stopsFound = createDirectlyConnectedStops( - originVertices, + List stopsFound = NearbyStop.nearbyStopsForTransitStopVerticesFiltered( + Sets.difference(originVertices, ignoreVertices), reverseDirection, request, streetRequest ); // Return only the origin vertices if there are no valid street modes - if (streetRequest.mode() == StreetMode.NOT_SET) { + if ( + streetRequest.mode() == StreetMode.NOT_SET || + (maxStopCount != 0 && stopsFound.size() >= maxStopCount) + ) { return stopsFound; } + stopsFound = new ArrayList<>(stopsFound); ShortestPathTree spt = StreetSearchBuilder .of() @@ -116,7 +142,9 @@ public Collection findNearbyStops( // TODO use GenericAStar and a traverseVisitor? Add an earliestArrival switch to genericAStar? for (State state : spt.getAllStates()) { Vertex targetVertex = state.getVertex(); - if (originVertices.contains(targetVertex)) continue; + if (originVertices.contains(targetVertex) || ignoreVertices.contains(targetVertex)) { + continue; + } if (targetVertex instanceof TransitStopVertex tsv && state.isFinal()) { stopsFound.add(NearbyStop.nearbyStopForState(state, tsv.getStop())); } @@ -162,46 +190,12 @@ private SkipEdgeStrategy getSkipEdgeStrategy() { var durationSkipEdgeStrategy = new DurationSkipEdgeStrategy(durationLimit); if (maxStopCount > 0) { - var strategy = new MaxCountSkipEdgeStrategy<>( - maxStopCount, - StreetNearbyStopFinder::hasReachedStop - ); + var strategy = new MaxCountSkipEdgeStrategy<>(maxStopCount, this::hasReachedStop); return new ComposingSkipEdgeStrategy<>(strategy, durationSkipEdgeStrategy); } return durationSkipEdgeStrategy; } - private static List createDirectlyConnectedStops( - Set originVertices, - boolean reverseDirection, - RouteRequest request, - StreetRequest streetRequest - ) { - List stopsFound = new ArrayList<>(); - - StreetSearchRequest streetSearchRequest = StreetSearchRequestMapper - .mapToTransferRequest(request) - .withArriveBy(reverseDirection) - .withMode(streetRequest.mode()) - .build(); - - /* Add the origin vertices if they are stops */ - for (Vertex vertex : originVertices) { - if (vertex instanceof TransitStopVertex tsv) { - stopsFound.add( - new NearbyStop( - tsv.getStop(), - 0, - Collections.emptyList(), - new State(vertex, streetSearchRequest) - ) - ); - } - } - - return stopsFound; - } - private boolean canBoardFlex(State state, boolean reverse) { Collection edges = reverse ? state.getVertex().getIncoming() @@ -224,7 +218,10 @@ private boolean canBoardFlex(State state, boolean reverse) { * states that speculatively rent a vehicle move the walk states down the A* priority queue until * the required number of stops are reached to abort the search, leading to zero egress results. */ - public static boolean hasReachedStop(State state) { - return state.getVertex() instanceof TransitStopVertex && state.isFinal(); + public boolean hasReachedStop(State state) { + var vertex = state.getVertex(); + return ( + vertex instanceof TransitStopVertex && state.isFinal() && !ignoreVertices.contains(vertex) + ); } } diff --git a/src/main/java/org/opentripplanner/graph_builder/module/ned/DegreeGridNEDTileSource.java b/application/src/main/java/org/opentripplanner/graph_builder/module/ned/DegreeGridNEDTileSource.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/ned/DegreeGridNEDTileSource.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/ned/DegreeGridNEDTileSource.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/ned/ElevationModule.java b/application/src/main/java/org/opentripplanner/graph_builder/module/ned/ElevationModule.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/ned/ElevationModule.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/ned/ElevationModule.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/ned/GeotiffGridCoverageFactoryImpl.java b/application/src/main/java/org/opentripplanner/graph_builder/module/ned/GeotiffGridCoverageFactoryImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/ned/GeotiffGridCoverageFactoryImpl.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/ned/GeotiffGridCoverageFactoryImpl.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/ned/MissingElevationHandler.java b/application/src/main/java/org/opentripplanner/graph_builder/module/ned/MissingElevationHandler.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/ned/MissingElevationHandler.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/ned/MissingElevationHandler.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/ned/NEDGridCoverageFactoryImpl.java b/application/src/main/java/org/opentripplanner/graph_builder/module/ned/NEDGridCoverageFactoryImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/ned/NEDGridCoverageFactoryImpl.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/ned/NEDGridCoverageFactoryImpl.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/ned/NoDataGridCoverage.java b/application/src/main/java/org/opentripplanner/graph_builder/module/ned/NoDataGridCoverage.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/ned/NoDataGridCoverage.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/ned/NoDataGridCoverage.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/ned/UnifiedGridCoverage.java b/application/src/main/java/org/opentripplanner/graph_builder/module/ned/UnifiedGridCoverage.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/ned/UnifiedGridCoverage.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/ned/UnifiedGridCoverage.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/ned/VerticalDatum.java b/application/src/main/java/org/opentripplanner/graph_builder/module/ned/VerticalDatum.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/ned/VerticalDatum.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/ned/VerticalDatum.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/ned/parameter/DemExtractParameters.java b/application/src/main/java/org/opentripplanner/graph_builder/module/ned/parameter/DemExtractParameters.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/ned/parameter/DemExtractParameters.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/ned/parameter/DemExtractParameters.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/ned/parameter/DemExtractParametersBuilder.java b/application/src/main/java/org/opentripplanner/graph_builder/module/ned/parameter/DemExtractParametersBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/ned/parameter/DemExtractParametersBuilder.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/ned/parameter/DemExtractParametersBuilder.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/ned/parameter/DemExtractParametersList.java b/application/src/main/java/org/opentripplanner/graph_builder/module/ned/parameter/DemExtractParametersList.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/ned/parameter/DemExtractParametersList.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/ned/parameter/DemExtractParametersList.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/Area.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/Area.java similarity index 89% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/Area.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/Area.java index f0a61e94c5a..a9de4dd6d6e 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/osm/Area.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/Area.java @@ -12,9 +12,9 @@ import org.locationtech.jts.geom.Polygon; import org.locationtech.jts.geom.TopologyException; import org.opentripplanner.framework.geometry.GeometryUtils; -import org.opentripplanner.openstreetmap.model.OSMNode; -import org.opentripplanner.openstreetmap.model.OSMWay; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmNode; +import org.opentripplanner.osm.model.OsmWay; +import org.opentripplanner.osm.model.OsmWithTags; /** * Stores information about an OSM area needed for visibility graph construction. Algorithm based on @@ -25,14 +25,14 @@ class Area { final List outermostRings; // This is the way or relation that has the relevant tags for the area - final OSMWithTags parent; + final OsmWithTags parent; public MultiPolygon jtsMultiPolygon; Area( - OSMWithTags parent, - List outerRingWays, - List innerRingWays, - TLongObjectMap nodes + OsmWithTags parent, + List outerRingWays, + List innerRingWays, + TLongObjectMap nodes ) { this.parent = parent; // ring assignment @@ -84,7 +84,7 @@ class Area { jtsMultiPolygon = calculateJTSMultiPolygon(); } - public List constructRings(List ways) { + public List constructRings(List ways) { if (ways.size() == 0) { // no rings is no rings return Collections.emptyList(); @@ -92,8 +92,8 @@ public List constructRings(List ways) { List closedRings = new ArrayList<>(); - ArrayListMultimap waysByEndpoint = ArrayListMultimap.create(); - for (OSMWay way : ways) { + ArrayListMultimap waysByEndpoint = ArrayListMultimap.create(); + for (OsmWay way : ways) { TLongList refs = way.getNodeRefs(); long start = refs.get(0); @@ -110,7 +110,7 @@ public List constructRings(List ways) { // Precheck for impossible situations, and remove those. TLongList endpointsToRemove = new TLongArrayList(); for (Long endpoint : waysByEndpoint.keySet()) { - Collection list = waysByEndpoint.get(endpoint); + Collection list = waysByEndpoint.get(endpoint); if (list.size() % 2 == 1) { endpointsToRemove.add(endpoint); } @@ -126,9 +126,9 @@ public List constructRings(List ways) { } long firstEndpoint = 0, otherEndpoint = 0; - OSMWay firstWay = null; + OsmWay firstWay = null; for (Long endpoint : waysByEndpoint.keySet()) { - List list = waysByEndpoint.get(endpoint); + List list = waysByEndpoint.get(endpoint); firstWay = list.get(0); TLongList nodeRefs = firstWay.getNodeRefs(); partialRing.addAll(nodeRefs); @@ -161,14 +161,14 @@ private MultiPolygon calculateJTSMultiPolygon() { } private boolean constructRingsRecursive( - ArrayListMultimap waysByEndpoint, + ArrayListMultimap waysByEndpoint, TLongList ring, List closedRings, long endpoint ) { - List ways = new ArrayList<>(waysByEndpoint.get(endpoint)); + List ways = new ArrayList<>(waysByEndpoint.get(endpoint)); - for (OSMWay way : ways) { + for (OsmWay way : ways) { // remove this way from the map TLongList nodeRefs = way.getNodeRefs(); long firstEndpoint = nodeRefs.get(0); @@ -200,9 +200,9 @@ private boolean constructRingsRecursive( // otherwise, we need to start a new partial ring newRing = new TLongArrayList(); - OSMWay firstWay = null; + OsmWay firstWay = null; for (Long entry : waysByEndpoint.keySet()) { - List list = waysByEndpoint.get(entry); + List list = waysByEndpoint.get(entry); firstWay = list.get(0); nodeRefs = firstWay.getNodeRefs(); newRing.addAll(nodeRefs); diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/AreaGroup.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/AreaGroup.java similarity index 82% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/AreaGroup.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/AreaGroup.java index a7bcc9ccb94..4d5428f5596 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/osm/AreaGroup.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/AreaGroup.java @@ -17,9 +17,9 @@ import org.locationtech.jts.geom.Polygon; import org.opentripplanner.framework.geometry.GeometryUtils; import org.opentripplanner.graph_builder.module.osm.Ring.RingConstructionException; -import org.opentripplanner.openstreetmap.model.OSMLevel; -import org.opentripplanner.openstreetmap.model.OSMNode; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmLevel; +import org.opentripplanner.osm.model.OsmNode; +import org.opentripplanner.osm.model.OsmWithTags; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -51,15 +51,15 @@ public AreaGroup(Collection areas) { List allRings = new ArrayList<>(); // However, JTS will lose the coord<->osmnode mapping, and we will have to reconstruct it. - HashMap nodeMap = new HashMap<>(); + HashMap nodeMap = new HashMap<>(); for (Area area : areas) { for (Ring ring : area.outermostRings) { allRings.add(ring.jtsPolygon); - for (OSMNode node : ring.nodes) { + for (OsmNode node : ring.nodes) { nodeMap.put(new Coordinate(node.lon, node.lat), node); } for (Ring inner : ring.getHoles()) { - for (OSMNode node : inner.nodes) { + for (OsmNode node : inner.nodes) { nodeMap.put(new Coordinate(node.lon, node.lat), node); } } @@ -86,28 +86,28 @@ public AreaGroup(Collection areas) { } } - public static List groupAreas(Map areasLevels) { + public static List groupAreas(Map areasLevels) { DisjointSet groups = new DisjointSet<>(); - Multimap areasForNode = LinkedListMultimap.create(); + Multimap areasForNode = LinkedListMultimap.create(); for (Area area : areasLevels.keySet()) { for (Ring ring : area.outermostRings) { for (Ring inner : ring.getHoles()) { - for (OSMNode node : inner.nodes) { + for (OsmNode node : inner.nodes) { areasForNode.put(node, area); } } - for (OSMNode node : ring.nodes) { + for (OsmNode node : ring.nodes) { areasForNode.put(node, area); } } } // areas that can be joined must share nodes and levels - for (OSMNode osmNode : areasForNode.keySet()) { + for (OsmNode osmNode : areasForNode.keySet()) { for (Area area1 : areasForNode.get(osmNode)) { - OSMLevel level1 = areasLevels.get(area1); + OsmLevel level1 = areasLevels.get(area1); for (Area area2 : areasForNode.get(osmNode)) { - OSMLevel level2 = areasLevels.get(area2); + OsmLevel level2 = areasLevels.get(area2); if ((level1 == null && level2 == null) || (level1 != null && level1.equals(level2))) { groups.union(area1, area2); } @@ -133,14 +133,14 @@ public static List groupAreas(Map areasLevels) { return out; } - public OSMWithTags getSomeOSMObject() { + public OsmWithTags getSomeOsmObject() { return areas.iterator().next().parent; } - private Ring toRing(Polygon polygon, HashMap nodeMap) { - List shell = new ArrayList<>(); + private Ring toRing(Polygon polygon, HashMap nodeMap) { + List shell = new ArrayList<>(); for (Coordinate coord : polygon.getExteriorRing().getCoordinates()) { - OSMNode node = nodeMap.get(coord); + OsmNode node = nodeMap.get(coord); if (node == null) { throw new RingConstructionException(); } @@ -150,9 +150,9 @@ private Ring toRing(Polygon polygon, HashMap nodeMap) { // now the holes for (int i = 0; i < polygon.getNumInteriorRing(); ++i) { LineString interior = polygon.getInteriorRingN(i); - List hole = new ArrayList<>(); + List hole = new ArrayList<>(); for (Coordinate coord : interior.getCoordinates()) { - OSMNode node = nodeMap.get(coord); + OsmNode node = nodeMap.get(coord); if (node == null) { throw new RingConstructionException(); } diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/AreaTooComplicated.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/AreaTooComplicated.java similarity index 82% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/AreaTooComplicated.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/AreaTooComplicated.java index 65d03ba84ce..224045fceb2 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/osm/AreaTooComplicated.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/AreaTooComplicated.java @@ -2,7 +2,7 @@ import org.locationtech.jts.geom.Geometry; import org.opentripplanner.graph_builder.issue.api.DataImportIssue; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; public record AreaTooComplicated(AreaGroup areaGroup, int nbNodes, int maxAreaNodes) implements DataImportIssue { @@ -11,12 +11,12 @@ public record AreaTooComplicated(AreaGroup areaGroup, int nbNodes, int maxAreaNo @Override public String getMessage() { - return String.format(FMT, areaGroup.getSomeOSMObject().getId(), nbNodes, maxAreaNodes); + return String.format(FMT, areaGroup.getSomeOsmObject().getId(), nbNodes, maxAreaNodes); } @Override public String getHTMLMessage() { - OSMWithTags entity = areaGroup.getSomeOSMObject(); + OsmWithTags entity = areaGroup.getSomeOsmObject(); return String.format(HTMLFMT, entity.url(), entity.getId(), nbNodes, maxAreaNodes); } diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/DisjointSet.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/DisjointSet.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/DisjointSet.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/DisjointSet.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/ElevatorProcessor.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/ElevatorProcessor.java similarity index 90% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/ElevatorProcessor.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/ElevatorProcessor.java index 3a0a9fa404b..490d6a266b9 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/osm/ElevatorProcessor.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/ElevatorProcessor.java @@ -7,14 +7,13 @@ import java.util.List; import java.util.Map; import java.util.OptionalInt; -import javax.annotation.Nonnull; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.graph_builder.issue.api.Issue; -import org.opentripplanner.openstreetmap.model.OSMLevel; -import org.opentripplanner.openstreetmap.model.OSMNode; -import org.opentripplanner.openstreetmap.model.OSMWay; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmLevel; +import org.opentripplanner.osm.model.OsmNode; +import org.opentripplanner.osm.model.OsmWay; +import org.opentripplanner.osm.model.OsmWithTags; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.street.model.StreetTraversalPermission; import org.opentripplanner.street.model.edge.ElevatorAlightEdge; @@ -46,9 +45,9 @@ class ElevatorProcessor { private final VertexGenerator vertexGenerator; public ElevatorProcessor( - @Nonnull DataImportIssueStore issueStore, - @Nonnull OsmDatabase osmdb, - @Nonnull VertexGenerator vertexGenerator + DataImportIssueStore issueStore, + OsmDatabase osmdb, + VertexGenerator vertexGenerator ) { this.issueStore = issueStore; this.osmdb = osmdb; @@ -58,14 +57,14 @@ public ElevatorProcessor( public void buildElevatorEdges(Graph graph) { /* build elevator edges */ for (Long nodeId : vertexGenerator.multiLevelNodes().keySet()) { - OSMNode node = osmdb.getNode(nodeId); + OsmNode node = osmdb.getNode(nodeId); // this allows skipping levels, e.g., an elevator that stops // at floor 0, 2, 3, and 5. // Converting to an Array allows us to // subscript it so we can loop over it in twos. Assumedly, it will stay // sorted when we convert it to an Array. // The objects are Integers, but toArray returns Object[] - Map vertices = vertexGenerator.multiLevelNodes().get(nodeId); + Map vertices = vertexGenerator.multiLevelNodes().get(nodeId); /* * first, build FreeEdges to disconnect from the graph, GenericVertices to serve as attachment points, and ElevatorBoard and @@ -78,10 +77,10 @@ public void buildElevatorEdges(Graph graph) { * + GenericVertex, X EndpointVertex, ~~ FreeEdge, == ElevatorBoardEdge/ElevatorAlightEdge Another loop will fill in the * ElevatorHopEdges. */ - OSMLevel[] levels = vertices.keySet().toArray(new OSMLevel[0]); + OsmLevel[] levels = vertices.keySet().toArray(new OsmLevel[0]); Arrays.sort(levels); ArrayList onboardVertices = new ArrayList<>(); - for (OSMLevel level : levels) { + for (OsmLevel level : levels) { // get the node to build the elevator out from OsmVertex sourceVertex = vertices.get(level); String levelName = level.longName; @@ -108,10 +107,10 @@ public void buildElevatorEdges(Graph graph) { } // END elevator edge loop // Add highway=elevators to graph as elevators - Iterator elevators = osmdb.getWays().stream().filter(this::isElevatorWay).iterator(); + Iterator elevators = osmdb.getWays().stream().filter(this::isElevatorWay).iterator(); while (elevators.hasNext()) { - OSMWay elevatorWay = elevators.next(); + OsmWay elevatorWay = elevators.next(); List nodes = Arrays .stream(elevatorWay.getNodeRefs().toArray()) @@ -207,7 +206,7 @@ private static void createElevatorHopEdges( } } - private boolean isElevatorWay(OSMWay way) { + private boolean isElevatorWay(OsmWay way) { if (!way.isElevator()) { return false; } @@ -223,7 +222,7 @@ private boolean isElevatorWay(OSMWay way) { return nodeRefs.get(0) != nodeRefs.get(nodeRefs.size() - 1); } - private OptionalInt parseDuration(OSMWithTags element) { + private OptionalInt parseDuration(OsmWithTags element) { return element.getTagAsInt( "duration", v -> diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/EscalatorProcessor.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/EscalatorProcessor.java similarity index 93% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/EscalatorProcessor.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/EscalatorProcessor.java index 51cd230a1a4..75e0965d82f 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/osm/EscalatorProcessor.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/EscalatorProcessor.java @@ -3,7 +3,7 @@ import java.util.Arrays; import java.util.List; import java.util.Map; -import org.opentripplanner.openstreetmap.model.OSMWay; +import org.opentripplanner.osm.model.OsmWay; import org.opentripplanner.street.model.edge.EscalatorEdge; import org.opentripplanner.street.model.vertex.IntersectionVertex; @@ -18,7 +18,7 @@ public EscalatorProcessor(Map intersectionNodes) { this.intersectionNodes = intersectionNodes; } - public void buildEscalatorEdge(OSMWay escalatorWay, double length) { + public void buildEscalatorEdge(OsmWay escalatorWay, double length) { List nodes = Arrays .stream(escalatorWay.getNodeRefs().toArray()) .filter(nodeRef -> diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/OsmDatabase.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/OsmDatabase.java similarity index 89% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/OsmDatabase.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/OsmDatabase.java index 60525b3cb6c..88b1fe9f7da 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/osm/OsmDatabase.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/OsmDatabase.java @@ -37,14 +37,14 @@ import org.opentripplanner.graph_builder.issues.TurnRestrictionException; import org.opentripplanner.graph_builder.issues.TurnRestrictionUnknown; import org.opentripplanner.graph_builder.module.osm.TurnRestrictionTag.Direction; -import org.opentripplanner.openstreetmap.model.OSMLevel; -import org.opentripplanner.openstreetmap.model.OSMLevel.Source; -import org.opentripplanner.openstreetmap.model.OSMNode; -import org.opentripplanner.openstreetmap.model.OSMRelation; -import org.opentripplanner.openstreetmap.model.OSMRelationMember; -import org.opentripplanner.openstreetmap.model.OSMTag; -import org.opentripplanner.openstreetmap.model.OSMWay; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmLevel; +import org.opentripplanner.osm.model.OsmLevel.Source; +import org.opentripplanner.osm.model.OsmNode; +import org.opentripplanner.osm.model.OsmRelation; +import org.opentripplanner.osm.model.OsmRelationMember; +import org.opentripplanner.osm.model.OsmTag; +import org.opentripplanner.osm.model.OsmWay; +import org.opentripplanner.osm.model.OsmWithTags; import org.opentripplanner.street.model.RepeatingTimePeriod; import org.opentripplanner.street.model.StreetTraversalPermission; import org.opentripplanner.street.model.TurnRestrictionType; @@ -60,22 +60,22 @@ public class OsmDatabase { private final DataImportIssueStore issueStore; /* Map of all nodes used in ways/areas keyed by their OSM ID */ - private final TLongObjectMap nodesById = new TLongObjectHashMap<>(); + private final TLongObjectMap nodesById = new TLongObjectHashMap<>(); /* Map of all bike parking nodes, keyed by their OSM ID */ - private final TLongObjectMap bikeParkingNodes = new TLongObjectHashMap<>(); + private final TLongObjectMap bikeParkingNodes = new TLongObjectHashMap<>(); /* Map of all bike parking nodes, keyed by their OSM ID */ - private final TLongObjectMap carParkingNodes = new TLongObjectHashMap<>(); + private final TLongObjectMap carParkingNodes = new TLongObjectHashMap<>(); /* Map of all non-area ways keyed by their OSM ID */ - private final TLongObjectMap waysById = new TLongObjectHashMap<>(); + private final TLongObjectMap waysById = new TLongObjectHashMap<>(); /* Map of all area ways keyed by their OSM ID */ - private final TLongObjectMap areaWaysById = new TLongObjectHashMap<>(); + private final TLongObjectMap areaWaysById = new TLongObjectHashMap<>(); /* Map of all relations keyed by their OSM ID */ - private final TLongObjectMap relationsById = new TLongObjectHashMap<>(); + private final TLongObjectMap relationsById = new TLongObjectHashMap<>(); /* All walkable areas */ private final List walkableAreas = new ArrayList<>(); @@ -87,12 +87,12 @@ public class OsmDatabase { private final List bikeParkingAreas = new ArrayList<>(); /* Map of all area OSMWay for a given node */ - private final TLongObjectMap> areasForNode = new TLongObjectHashMap<>(); + private final TLongObjectMap> areasForNode = new TLongObjectHashMap<>(); /* Map of all area OSMWay for a given node */ - private final List singleWayAreas = new ArrayList<>(); + private final List singleWayAreas = new ArrayList<>(); - private final Set processedAreas = new HashSet<>(); + private final Set processedAreas = new HashSet<>(); /* Set of area way IDs */ private final TLongSet areaWayIds = new TLongHashSet(); @@ -104,7 +104,7 @@ public class OsmDatabase { private final TLongSet areaNodeIds = new TLongHashSet(); /* Track which vertical level each OSM way belongs to, for building elevators etc. */ - private final Map wayLevels = new HashMap<>(); + private final Map wayLevels = new HashMap<>(); /* Set of turn restrictions for each turn "from" way ID */ private final Multimap turnRestrictionsByFromWay = ArrayListMultimap.create(); @@ -116,7 +116,7 @@ public class OsmDatabase { * Map of all transit stop nodes that lie within an area and which are connected to the area by * a relation. Keyed by the area's OSM way. */ - private final Multimap stopsInAreas = HashMultimap.create(); + private final Multimap stopsInAreas = HashMultimap.create(); /* * ID of the next virtual node we create during building phase. Negative to prevent conflicts @@ -134,15 +134,15 @@ public OsmDatabase(DataImportIssueStore issueStore) { this.issueStore = issueStore; } - public OSMNode getNode(Long nodeId) { + public OsmNode getNode(Long nodeId) { return nodesById.get(nodeId); } - public OSMWay getWay(Long nodeId) { + public OsmWay getWay(Long nodeId) { return waysById.get(nodeId); } - public Collection getWays() { + public Collection getWays() { return Collections.unmodifiableCollection(waysById.valueCollection()); } @@ -158,11 +158,11 @@ public int wayCount() { return waysById.size(); } - public Collection getBikeParkingNodes() { + public Collection getBikeParkingNodes() { return Collections.unmodifiableCollection(bikeParkingNodes.valueCollection()); } - public Collection getCarParkingNodes() { + public Collection getCarParkingNodes() { return Collections.unmodifiableCollection(carParkingNodes.valueCollection()); } @@ -190,16 +190,16 @@ public Collection getToWayTurnRestrictions(Long toWayId) { return turnRestrictionsByToWay.get(toWayId); } - public Collection getStopsInArea(OSMWithTags areaParent) { + public Collection getStopsInArea(OsmWithTags areaParent) { return stopsInAreas.get(areaParent); } - public OSMLevel getLevelForWay(OSMWithTags way) { - return Objects.requireNonNullElse(wayLevels.get(way), OSMLevel.DEFAULT); + public OsmLevel getLevelForWay(OsmWithTags way) { + return Objects.requireNonNullElse(wayLevels.get(way), OsmLevel.DEFAULT); } - public Set getAreasForNode(Long nodeId) { - Set areas = areasForNode.get(nodeId); + public Set getAreasForNode(Long nodeId) { + Set areas = areasForNode.get(nodeId); if (areas == null) { return Set.of(); } @@ -210,7 +210,7 @@ public boolean isNodeBelongsToWay(Long nodeId) { return waysNodeIds.contains(nodeId); } - public void addNode(OSMNode node) { + public void addNode(OsmNode node) { if (node.isBikeParking()) { bikeParkingNodes.put(node.getId(), node); } @@ -233,7 +233,7 @@ public void addNode(OSMNode node) { nodesById.put(node.getId(), node); } - public void addWay(OSMWay way) { + public void addWay(OsmWay way) { /* only add ways once */ long wayId = way.getId(); if (waysById.containsKey(wayId) || areaWaysById.containsKey(wayId)) { @@ -277,7 +277,7 @@ public void addWay(OSMWay way) { waysById.put(wayId, way); } - public void addRelation(OSMRelation relation) { + public void addRelation(OsmRelation relation) { if (relationsById.containsKey(relation.getId())) { return; } @@ -294,7 +294,7 @@ public void addRelation(OSMRelation relation) { if (!relation.isRoutable() && !relation.isParkAndRide() && !relation.isBikeParking()) { return; } - for (OSMRelationMember member : relation.getMembers()) { + for (OsmRelationMember member : relation.getMembers()) { areaWayIds.add(member.getRef()); } applyLevelsForWay(relation); @@ -350,14 +350,14 @@ public void postLoad() { /** * Check if a point is within an epsilon of a node. */ - private static boolean checkIntersectionDistance(Point p, OSMNode n, double epsilon) { + private static boolean checkIntersectionDistance(Point p, OsmNode n, double epsilon) { return Math.abs(p.getY() - n.lat) < epsilon && Math.abs(p.getX() - n.lon) < epsilon; } /** * Check if two nodes are within an epsilon. */ - private static boolean checkDistanceWithin(OSMNode a, OSMNode b, double epsilon) { + private static boolean checkDistanceWithin(OsmNode a, OsmNode b, double epsilon) { return Math.abs(a.lat - b.lat) < epsilon && Math.abs(a.lon - b.lon) < epsilon; } @@ -385,13 +385,13 @@ private void processUnconnectedAreas() { // For each way, intersect with areas int nCreatedNodes = 0; - for (OSMWay way : waysById.valueCollection()) { - OSMLevel wayLevel = getLevelForWay(way); + for (OsmWay way : waysById.valueCollection()) { + OsmLevel wayLevel = getLevelForWay(way); // For each segment of the way for (int i = 0; i < way.getNodeRefs().size() - 1; i++) { - OSMNode nA = nodesById.get(way.getNodeRefs().get(i)); - OSMNode nB = nodesById.get(way.getNodeRefs().get(i + 1)); + OsmNode nA = nodesById.get(way.getNodeRefs().get(i)); + OsmNode nB = nodesById.get(way.getNodeRefs().get(i + 1)); if (nA == null || nB == null) { continue; } @@ -417,7 +417,7 @@ private void processUnconnectedAreas() { } // Skip if area and way are from "incompatible" levels - OSMLevel areaLevel = getLevelForWay(ringSegment.area.parent); + OsmLevel areaLevel = getLevelForWay(ringSegment.area.parent); if (!wayLevel.equals(areaLevel)) { continue; } @@ -455,7 +455,7 @@ private void processUnconnectedAreas() { // if the intersection is extremely close to one of the nodes of the road or the parking lot, just use that node // rather than splitting anything. See issue 1605. - OSMNode splitNode; + OsmNode splitNode; double epsilon = 0.0000001; // note that the if . . . else if structure of this means that if a node at one end of a (way|ring) segment is snapped, @@ -629,8 +629,8 @@ private void processAreaRingForUnconnectedAreas( * @param c The location of the node to create. * @return The created node. */ - private OSMNode createVirtualNode(Coordinate c) { - OSMNode node = new OSMNode(); + private OsmNode createVirtualNode(Coordinate c) { + OsmNode node = new OsmNode(); node.lon = c.x; node.lat = c.y; node.setId(virtualNodeId); @@ -640,7 +640,7 @@ private OSMNode createVirtualNode(Coordinate c) { return node; } - private void applyLevelsForWay(OSMWithTags way) { + private void applyLevelsForWay(OsmWithTags way) { /* Determine OSM level for each way, if it was not already set */ if (!wayLevels.containsKey(way)) { // if this way is not a key in the wayLevels map, a level map was not @@ -648,26 +648,26 @@ private void applyLevelsForWay(OSMWithTags way) { /* try to find a level name in tags */ String levelName = null; - OSMLevel level = OSMLevel.DEFAULT; + OsmLevel level = OsmLevel.DEFAULT; if (way.hasTag("level")) { // TODO: floating-point levels &c. levelName = way.getTag("level"); level = - OSMLevel.fromString(levelName, OSMLevel.Source.LEVEL_TAG, noZeroLevels, issueStore, way); + OsmLevel.fromString(levelName, OsmLevel.Source.LEVEL_TAG, noZeroLevels, issueStore, way); } else if (way.hasTag("layer")) { levelName = way.getTag("layer"); level = - OSMLevel.fromString(levelName, OSMLevel.Source.LAYER_TAG, noZeroLevels, issueStore, way); + OsmLevel.fromString(levelName, OsmLevel.Source.LAYER_TAG, noZeroLevels, issueStore, way); } if (level == null || (!level.reliable)) { issueStore.add(new LevelAmbiguous(levelName, way)); - level = OSMLevel.DEFAULT; + level = OsmLevel.DEFAULT; } wayLevels.put(way, level); } } - private void markNodesForKeeping(Collection osmWays, TLongSet nodeSet) { - for (OSMWay way : osmWays) { + private void markNodesForKeeping(Collection osmWays, TLongSet nodeSet) { + for (OsmWay way : osmWays) { // Since the way is kept, update nodes-with-neighbors TLongList nodes = way.getNodeRefs(); if (nodes.size() > 1) { @@ -680,7 +680,7 @@ private void markNodesForKeeping(Collection osmWays, TLongSet nodeSet) { * Create areas from single ways. */ private void processSingleWayAreas() { - AREA:for (OSMWay way : singleWayAreas) { + AREA:for (OsmWay way : singleWayAreas) { if (processedAreas.contains(way)) { continue; } @@ -713,7 +713,7 @@ private void processSingleWayAreas() { * the used ways. */ private void processMultipolygonRelations() { - RELATION:for (OSMRelation relation : relationsById.valueCollection()) { + RELATION:for (OsmRelation relation : relationsById.valueCollection()) { if (processedAreas.contains(relation)) { continue; } @@ -726,10 +726,10 @@ private void processMultipolygonRelations() { continue; } // Area multipolygons -- pedestrian plazas - ArrayList innerWays = new ArrayList<>(); - ArrayList outerWays = new ArrayList<>(); - for (OSMRelationMember member : relation.getMembers()) { - OSMWay way = areaWaysById.get(member.getRef()); + ArrayList innerWays = new ArrayList<>(); + ArrayList outerWays = new ArrayList<>(); + for (OsmRelationMember member : relation.getMembers()) { + OsmWay way = areaWaysById.get(member.getRef()); if (way == null) { // relation includes way which does not exist in the data. Skip. continue RELATION; @@ -761,13 +761,13 @@ private void processMultipolygonRelations() { continue; } - for (OSMRelationMember member : relation.getMembers()) { + for (OsmRelationMember member : relation.getMembers()) { // multipolygons for attribute mapping if (!(member.hasTypeWay() && waysById.containsKey(member.getRef()))) { continue; } - OSMWithTags way = waysById.get(member.getRef()); + OsmWithTags way = waysById.get(member.getRef()); if (way == null) { continue; } @@ -812,7 +812,7 @@ private void newArea(Area area) { private void processRelations() { LOG.debug("Processing relations..."); - for (OSMRelation relation : relationsById.valueCollection()) { + for (OsmRelation relation : relationsById.valueCollection()) { if (relation.isRestriction()) { processRestriction(relation); } else if (relation.isLevelMap()) { @@ -830,7 +830,7 @@ private void processRelations() { * * @see "https://wiki.openstreetmap.org/wiki/Tag:route%3Dbicycle" */ - private void processBicycleRoute(OSMRelation relation) { + private void processBicycleRoute(OsmRelation relation) { if (relation.isBicycleRoute()) { // we treat networks without known network type like local networks var network = relation.getTagOpt("network").orElse("lcn"); @@ -838,7 +838,7 @@ private void processBicycleRoute(OSMRelation relation) { } } - private void setNetworkForAllMembers(OSMRelation relation, String key) { + private void setNetworkForAllMembers(OsmRelation relation, String key) { relation .getMembers() .forEach(member -> { @@ -855,9 +855,9 @@ private void setNetworkForAllMembers(OSMRelation relation, String key) { /** * Store turn restrictions. */ - private void processRestriction(OSMRelation relation) { + private void processRestriction(OsmRelation relation) { long from = -1, to = -1, via = -1; - for (OSMRelationMember member : relation.getMembers()) { + for (OsmRelationMember member : relation.getMembers()) { String role = member.getRole(); if (role.equals("from")) { from = member.getRef(); @@ -965,7 +965,7 @@ private void processRestriction(OSMRelation relation) { /** * Process an OSM level map. */ - private void processLevelMap(OSMRelation relation) { + private void processLevelMap(OsmRelation relation) { var levelsTag = relation.getTag("levels"); if (!StringUtils.hasValue(levelsTag)) { issueStore.add( @@ -978,16 +978,16 @@ private void processLevelMap(OSMRelation relation) { return; } - Map levels = OSMLevel.mapFromSpecList( + Map levels = OsmLevel.mapFromSpecList( levelsTag, Source.LEVEL_MAP, true, issueStore, relation ); - for (OSMRelationMember member : relation.getMembers()) { + for (OsmRelationMember member : relation.getMembers()) { if (member.hasTypeWay() && waysById.containsKey(member.getRef())) { - OSMWay way = waysById.get(member.getRef()); + OsmWay way = waysById.get(member.getRef()); if (way != null) { String role = member.getRole(); // if the level map relation has a role:xyz tag, this way is something @@ -1007,13 +1007,13 @@ private void processLevelMap(OSMRelation relation) { /** * Handle route=road and route=bicycle relations. */ - private void processRoute(OSMRelation relation) { - for (OSMRelationMember member : relation.getMembers()) { + private void processRoute(OsmRelation relation) { + for (OsmRelationMember member : relation.getMembers()) { if (!(member.hasTypeWay() && waysById.containsKey(member.getRef()))) { continue; } - OSMWithTags way = waysById.get(member.getRef()); + OsmWithTags way = waysById.get(member.getRef()); if (way == null) { continue; } @@ -1025,7 +1025,7 @@ private void processRoute(OSMRelation relation) { addUniqueName(way.getTag("otp:route_name"), relation.getTag("name")) ); } else { - way.addTag(new OSMTag("otp:route_name", relation.getTag("name"))); + way.addTag(new OsmTag("otp:route_name", relation.getTag("name"))); } } if (relation.hasTag("ref")) { @@ -1035,7 +1035,7 @@ private void processRoute(OSMRelation relation) { addUniqueName(way.getTag("otp:route_ref"), relation.getTag("ref")) ); } else { - way.addTag(new OSMTag("otp:route_ref", relation.getTag("ref"))); + way.addTag(new OsmTag("otp:route_ref", relation.getTag("ref"))); } } } @@ -1053,10 +1053,10 @@ private void processRoute(OSMRelation relation) { * @author hannesj * @see "http://wiki.openstreetmap.org/wiki/Tag:public_transport%3Dstop_area" */ - private void processPublicTransportStopArea(OSMRelation relation) { - Set platformAreas = new HashSet<>(); - Set platformNodes = new HashSet<>(); - for (OSMRelationMember member : relation.getMembers()) { + private void processPublicTransportStopArea(OsmRelation relation) { + Set platformAreas = new HashSet<>(); + Set platformNodes = new HashSet<>(); + for (OsmRelationMember member : relation.getMembers()) { switch (member.getType()) { case NODE -> { var node = nodesById.get(member.getRef()); @@ -1077,7 +1077,7 @@ private void processPublicTransportStopArea(OSMRelation relation) { } } - for (OSMWithTags area : platformAreas) { + for (OsmWithTags area : platformAreas) { if (area == null) { throw new RuntimeException( "Could not process public transport relation '%s' (%s)".formatted( @@ -1114,9 +1114,9 @@ static class RingSegment { Ring ring; - OSMNode nA; + OsmNode nA; - OSMNode nB; + OsmNode nB; } private record KeyPair(long id0, long id1) {} diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/OsmModule.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/OsmModule.java similarity index 94% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/OsmModule.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/OsmModule.java index 10c215ee448..98ed4953b91 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/osm/OsmModule.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/OsmModule.java @@ -8,7 +8,6 @@ import java.util.List; import java.util.Map; import java.util.Objects; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.LineString; @@ -19,12 +18,12 @@ import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.graph_builder.model.GraphBuilderModule; import org.opentripplanner.graph_builder.module.osm.parameters.OsmProcessingParameters; -import org.opentripplanner.openstreetmap.OsmProvider; -import org.opentripplanner.openstreetmap.model.OSMLevel; -import org.opentripplanner.openstreetmap.model.OSMNode; -import org.opentripplanner.openstreetmap.model.OSMWay; -import org.opentripplanner.openstreetmap.model.OSMWithTags; -import org.opentripplanner.openstreetmap.wayproperty.WayProperties; +import org.opentripplanner.osm.OsmProvider; +import org.opentripplanner.osm.model.OsmLevel; +import org.opentripplanner.osm.model.OsmNode; +import org.opentripplanner.osm.model.OsmWay; +import org.opentripplanner.osm.model.OsmWithTags; +import org.opentripplanner.osm.wayproperty.WayProperties; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.routing.util.ElevationUtils; import org.opentripplanner.routing.vehicle_parking.VehicleParking; @@ -63,7 +62,7 @@ public class OsmModule implements GraphBuilderModule { Collection providers, Graph graph, DataImportIssueStore issueStore, - @Nonnull StreetLimitationParameters streetLimitationParameters, + StreetLimitationParameters streetLimitationParameters, OsmProcessingParameters params ) { this.providers = List.copyOf(providers); @@ -92,7 +91,7 @@ public void buildGraph() { "Using OSM way configuration from {}.", provider.getOsmTagMapper().getClass().getSimpleName() ); - provider.readOSM(osmdb); + provider.readOsm(osmdb); } osmdb.postLoad(); @@ -190,7 +189,7 @@ private static double getGeometryLengthMeters(Geometry geometry) { } private List groupAreas(Collection areas) { - Map areasLevels = new HashMap<>(areas.size()); + Map areasLevels = new HashMap<>(areas.size()); for (Area area : areas) { areasLevels.put(area, osmdb.getLevelForWay(area.parent)); } @@ -250,7 +249,7 @@ private void buildBasicGraph() { LOG.info(progress.startMessage()); var escalatorProcessor = new EscalatorProcessor(vertexGenerator.intersectionNodes()); - WAY:for (OSMWay way : osmdb.getWays()) { + WAY:for (OsmWay way : osmdb.getWays()) { WayProperties wayData = way.getOsmProvider().getWayPropertySet().getDataForWay(way); setWayName(way); @@ -268,7 +267,7 @@ private void buildBasicGraph() { String lastLevel = null; for (TLongIterator iter = way.getNodeRefs().iterator(); iter.hasNext();) { long nodeId = iter.next(); - OSMNode node = osmdb.getNode(nodeId); + OsmNode node = osmdb.getNode(nodeId); if (node == null) continue WAY; boolean levelsDiffer = false; String level = node.getTag("level"); @@ -303,12 +302,12 @@ private void buildBasicGraph() { */ Long startNode = null; // where the current edge should start - OSMNode osmStartNode = null; + OsmNode osmStartNode = null; for (int i = 0; i < nodes.size() - 1; i++) { - OSMNode segmentStartOSMNode = osmdb.getNode(nodes.get(i)); + OsmNode segmentStartOsmNode = osmdb.getNode(nodes.get(i)); - if (segmentStartOSMNode == null) { + if (segmentStartOsmNode == null) { continue; } @@ -316,10 +315,10 @@ private void buildBasicGraph() { if (osmStartNode == null) { startNode = nodes.get(i); - osmStartNode = segmentStartOSMNode; + osmStartNode = segmentStartOsmNode; } // where the current edge might end - OSMNode osmEndNode = osmdb.getNode(endNode); + OsmNode osmEndNode = osmdb.getNode(endNode); LineString geometry; @@ -356,7 +355,7 @@ private void buildBasicGraph() { // make or get a shared vertex for flat intersections, // one vertex per level for multilevel nodes like elevators startEndpoint = vertexGenerator.getVertexForOsmNode(osmStartNode, way); - String ele = segmentStartOSMNode.getTag("ele"); + String ele = segmentStartOsmNode.getTag("ele"); if (ele != null) { Double elevation = ElevationUtils.parseEleTag(ele); if (elevation != null) { @@ -413,7 +412,7 @@ private void validateBarriers() { vertices.forEach(bv -> bv.makeBarrierAtEndReachable()); } - private void setWayName(OSMWithTags way) { + private void setWayName(OsmWithTags way) { if (!way.hasTag("name")) { I18NString creativeName = way.getOsmProvider().getWayPropertySet().getCreativeNameForWay(way); if (creativeName != null) { @@ -423,7 +422,7 @@ private void setWayName(OSMWithTags way) { } private void applyEdgesToTurnRestrictions( - OSMWay way, + OsmWay way, long startNode, long endNode, StreetEdge street, @@ -462,7 +461,7 @@ private void applyEdgesToTurnRestrictions( private StreetEdgePair getEdgesForStreet( IntersectionVertex startEndpoint, IntersectionVertex endEndpoint, - OSMWay way, + OsmWay way, int index, StreetTraversalPermission permissions, LineString geometry @@ -516,7 +515,7 @@ private StreetEdgePair getEdgesForStreet( private StreetEdge getEdgeForStreet( IntersectionVertex startEndpoint, IntersectionVertex endEndpoint, - OSMWay way, + OsmWay way, int index, double length, StreetTraversalPermission permissions, diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/OsmModuleBuilder.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/OsmModuleBuilder.java similarity index 98% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/OsmModuleBuilder.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/OsmModuleBuilder.java index f0a40fa678f..6e90fb20b1c 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/osm/OsmModuleBuilder.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/OsmModuleBuilder.java @@ -6,7 +6,7 @@ import org.opentripplanner.graph_builder.module.osm.naming.DefaultNamer; import org.opentripplanner.graph_builder.module.osm.parameters.OsmProcessingParameters; import org.opentripplanner.graph_builder.services.osm.EdgeNamer; -import org.opentripplanner.openstreetmap.OsmProvider; +import org.opentripplanner.osm.OsmProvider; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.street.model.StreetLimitationParameters; diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/ParkingProcessor.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/ParkingProcessor.java similarity index 94% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/ParkingProcessor.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/ParkingProcessor.java index 940ffa68198..f372f0c82e2 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/osm/ParkingProcessor.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/ParkingProcessor.java @@ -20,9 +20,9 @@ import org.opentripplanner.graph_builder.issues.InvalidVehicleParkingCapacity; import org.opentripplanner.graph_builder.issues.ParkAndRideUnlinked; import org.opentripplanner.model.calendar.openinghours.OHCalendar; -import org.opentripplanner.openstreetmap.OSMOpeningHoursParser; -import org.opentripplanner.openstreetmap.model.OSMNode; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.OsmOpeningHoursParser; +import org.opentripplanner.osm.model.OsmNode; +import org.opentripplanner.osm.model.OsmWithTags; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.routing.vehicle_parking.VehicleParking; import org.opentripplanner.routing.vehicle_parking.VehicleParkingHelper; @@ -43,26 +43,26 @@ class ParkingProcessor { private static final Logger LOG = LoggerFactory.getLogger(ParkingProcessor.class); private static final String VEHICLE_PARKING_OSM_FEED_ID = "OSM"; private final DataImportIssueStore issueStore; - private final OSMOpeningHoursParser osmOpeningHoursParser; - private final BiFunction getVertexForOsmNode; + private final OsmOpeningHoursParser osmOpeningHoursParser; + private final BiFunction getVertexForOsmNode; private final VertexFactory vertexFactory; private final VehicleParkingHelper vehicleParkingHelper; public ParkingProcessor( Graph graph, DataImportIssueStore issueStore, - BiFunction getVertexForOsmNode + BiFunction getVertexForOsmNode ) { this.issueStore = issueStore; this.getVertexForOsmNode = getVertexForOsmNode; this.osmOpeningHoursParser = - new OSMOpeningHoursParser(graph.getOpeningHoursCalendarService(), issueStore); + new OsmOpeningHoursParser(graph.getOpeningHoursCalendarService(), issueStore); this.vertexFactory = new VertexFactory(graph); this.vehicleParkingHelper = new VehicleParkingHelper(graph); } public List buildParkAndRideNodes( - Collection nodes, + Collection nodes, boolean isCarParkAndRide ) { LOG.info("Processing {} P+R nodes.", isCarParkAndRide ? "car" : "bike"); @@ -70,7 +70,7 @@ public List buildParkAndRideNodes( List vehicleParkingToAdd = new ArrayList<>(); - for (OSMNode node : nodes) { + for (OsmNode node : nodes) { n++; I18NString creativeName = nameParkAndRideEntity(node); @@ -130,7 +130,7 @@ private List buildParkAndRideAreasForGroups( return vehicleParkingToAdd; } - private OHCalendar parseOpeningHours(OSMWithTags entity) { + private OHCalendar parseOpeningHours(OsmWithTags entity) { final var openingHoursTag = entity.getTag("opening_hours"); if (openingHoursTag != null) { final ZoneId zoneId = entity.getOsmProvider().getZoneId(); @@ -145,7 +145,7 @@ private OHCalendar parseOpeningHours(OSMWithTags entity) { ); } catch (OpeningHoursParseException e) { issueStore.add( - "OSMOpeningHoursUnparsed", + "OsmOpeningHoursUnparsed", "OSM object with id '%s' (%s) has an invalid opening_hours value, it will always be open", id, link @@ -164,11 +164,11 @@ private List processVehicleParkingArea(Area area, Envelope envelo private List processVehicleParkingArea( Ring ring, - OSMWithTags entity, + OsmWithTags entity, Envelope envelope ) { List accessVertices = new ArrayList<>(); - for (OSMNode node : ring.nodes) { + for (OsmNode node : ring.nodes) { envelope.expandToInclude(new Coordinate(node.lon, node.lat)); var accessVertex = getVertexForOsmNode.apply(node, entity); if (accessVertex.getIncoming().isEmpty() || accessVertex.getOutgoing().isEmpty()) { @@ -192,7 +192,7 @@ private VehicleParking buildParkAndRideAreasForGroup(AreaGroup group, boolean is Envelope envelope = new Envelope(); Set accessVertices = new HashSet<>(); - OSMWithTags entity = null; + OsmWithTags entity = null; // Process all nodes from outer rings // These are IntersectionVertices not OsmVertices because there can be both OsmVertices and TransitStopStreetVertices. @@ -288,7 +288,7 @@ private VehicleParking buildParkAndRideAreasForGroup(AreaGroup group, boolean is private List createArtificialEntrances( AreaGroup group, I18NString vehicleParkingName, - OSMWithTags entity, + OsmWithTags entity, boolean isCarPark ) { LOG.debug( @@ -315,7 +315,7 @@ private List createArtificialEntra private VehicleParking createVehicleParkingObjectFromOsmEntity( boolean isCarParkAndRide, Coordinate coordinate, - OSMWithTags entity, + OsmWithTags entity, I18NString creativeName, List entrances ) { @@ -395,7 +395,7 @@ private VehicleParking createVehicleParkingObjectFromOsmEntity( .build(); } - private I18NString nameParkAndRideEntity(OSMWithTags osmWithTags) { + private I18NString nameParkAndRideEntity(OsmWithTags osmWithTags) { // If there is an explicit name user that. The explicit name is used so that tag-based // translations are used, which are not handled by "CreativeNamer"s. I18NString creativeName = osmWithTags.getAssumedName(); @@ -416,11 +416,11 @@ private I18NString nameParkAndRideEntity(OSMWithTags osmWithTags) { return creativeName; } - private OptionalInt parseCapacity(OSMWithTags element) { + private OptionalInt parseCapacity(OsmWithTags element) { return parseCapacity(element, "capacity"); } - private OptionalInt parseCapacity(OSMWithTags element, String capacityTag) { + private OptionalInt parseCapacity(OsmWithTags element, String capacityTag) { return element.getTagAsInt( capacityTag, v -> issueStore.add(new InvalidVehicleParkingCapacity(element, v)) @@ -430,7 +430,7 @@ private OptionalInt parseCapacity(OSMWithTags element, String capacityTag) { private List createParkingEntrancesFromAccessVertices( Set accessVertices, I18NString vehicleParkingName, - OSMWithTags entity + OsmWithTags entity ) { List entrances = new ArrayList<>(); var sortedAccessVertices = accessVertices diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/Ring.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/Ring.java similarity index 91% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/Ring.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/Ring.java index 754bdbc36b2..53209c0ea8e 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/osm/Ring.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/Ring.java @@ -17,20 +17,20 @@ import org.locationtech.jts.geom.Polygon; import org.opentripplanner.framework.geometry.CoordinateArrayListSequence; import org.opentripplanner.framework.geometry.GeometryUtils; -import org.opentripplanner.openstreetmap.model.OSMNode; +import org.opentripplanner.osm.model.OsmNode; class Ring { private final LinearRing shell; private final List holes = new ArrayList<>(); - public List nodes; + public List nodes; // equivalent to the ring representation, but used for JTS operations public Polygon jtsPolygon; - public Ring(List osmNodes) { + public Ring(List osmNodes) { ArrayList vertices = new ArrayList<>(); nodes = osmNodes; - for (OSMNode node : osmNodes) { + for (OsmNode node : osmNodes) { Coordinate point = new Coordinate(node.lon, node.lat); vertices.add(point); } @@ -49,7 +49,7 @@ public Ring(List osmNodes) { jtsPolygon = calculateJtsPolygon(); } - public Ring(TLongList osmNodes, TLongObjectMap _nodes) { + public Ring(TLongList osmNodes, TLongObjectMap _nodes) { // The collection needs to be mutable, so collect into an ArrayList this( LongStream @@ -73,9 +73,9 @@ public void addHole(Ring hole) { */ boolean isNodeConvex(int i) { int n = nodes.size() - 1; - OSMNode cur = nodes.get(i); - OSMNode prev = nodes.get((i + n - 1) % n); - OSMNode next = nodes.get((i + 1) % n); + OsmNode cur = nodes.get(i); + OsmNode prev = nodes.get((i + n - 1) % n); + OsmNode next = nodes.get((i + 1) % n); return ( (cur.lon - prev.lon) * (next.lat - cur.lat) - (cur.lat - prev.lat) * (next.lon - cur.lon) > 0 ); diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/SafetyValueNormalizer.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/SafetyValueNormalizer.java similarity index 96% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/SafetyValueNormalizer.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/SafetyValueNormalizer.java index a9603d59417..2f070f272c6 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/osm/SafetyValueNormalizer.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/SafetyValueNormalizer.java @@ -4,9 +4,9 @@ import java.util.Set; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.graph_builder.issues.Graphwide; -import org.opentripplanner.openstreetmap.model.OSMWithTags; -import org.opentripplanner.openstreetmap.tagmapping.OsmTagMapper; -import org.opentripplanner.openstreetmap.wayproperty.WayProperties; +import org.opentripplanner.osm.model.OsmWithTags; +import org.opentripplanner.osm.tagmapping.OsmTagMapper; +import org.opentripplanner.osm.wayproperty.WayProperties; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.street.model.edge.AreaEdge; import org.opentripplanner.street.model.edge.AreaEdgeList; @@ -77,7 +77,7 @@ void applyWayProperties( StreetEdge street, StreetEdge backStreet, WayProperties wayData, - OSMWithTags way + OsmWithTags way ) { OsmTagMapper tagMapperForWay = way.getOsmProvider().getOsmTagMapper(); diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/StreetEdgePair.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/StreetEdgePair.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/StreetEdgePair.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/StreetEdgePair.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/StreetTraversalPermissionPair.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/StreetTraversalPermissionPair.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/StreetTraversalPermissionPair.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/StreetTraversalPermissionPair.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/TurnRestrictionTag.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/TurnRestrictionTag.java similarity index 91% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/TurnRestrictionTag.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/TurnRestrictionTag.java index 8bd1464667c..6d6e2af1c18 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/osm/TurnRestrictionTag.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/TurnRestrictionTag.java @@ -15,7 +15,7 @@ class TurnRestrictionTag { long via; //Used only for issues so that it can be visualized in a map - long relationOSMID; + long relationOsmID; TurnRestrictionType type; Direction direction; RepeatingTimePeriod time; @@ -23,11 +23,11 @@ class TurnRestrictionTag { public List possibleTo = new ArrayList<>(); public TraverseModeSet modes; - TurnRestrictionTag(long via, TurnRestrictionType type, Direction direction, long relationOSMID) { + TurnRestrictionTag(long via, TurnRestrictionType type, Direction direction, long relationOsmID) { this.via = via; this.type = type; this.direction = direction; - this.relationOSMID = relationOSMID; + this.relationOsmID = relationOsmID; } @Override diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/TurnRestrictionUnifier.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/TurnRestrictionUnifier.java similarity index 88% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/TurnRestrictionUnifier.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/TurnRestrictionUnifier.java index fc645bd16da..ca0bc4f146b 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/osm/TurnRestrictionUnifier.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/TurnRestrictionUnifier.java @@ -14,25 +14,25 @@ static void unifyTurnRestrictions(OsmDatabase osmdb, DataImportIssueStore issueS for (TurnRestrictionTag restrictionTag : osmdb.getFromWayTurnRestrictions(fromWay)) { if (restrictionTag.possibleFrom.isEmpty()) { issueStore.add( - new TurnRestrictionBad(restrictionTag.relationOSMID, "No from edge found") + new TurnRestrictionBad(restrictionTag.relationOsmID, "No from edge found") ); continue; } if (restrictionTag.possibleTo.isEmpty()) { - issueStore.add(new TurnRestrictionBad(restrictionTag.relationOSMID, "No to edge found")); + issueStore.add(new TurnRestrictionBad(restrictionTag.relationOsmID, "No to edge found")); continue; } for (StreetEdge from : restrictionTag.possibleFrom) { if (from == null) { issueStore.add( - new TurnRestrictionBad(restrictionTag.relationOSMID, "from-edge is null") + new TurnRestrictionBad(restrictionTag.relationOsmID, "from-edge is null") ); continue; } for (StreetEdge to : restrictionTag.possibleTo) { if (to == null) { issueStore.add( - new TurnRestrictionBad(restrictionTag.relationOSMID, "to-edge is null") + new TurnRestrictionBad(restrictionTag.relationOsmID, "to-edge is null") ); continue; } @@ -45,7 +45,7 @@ static void unifyTurnRestrictions(OsmDatabase osmdb, DataImportIssueStore issueS if (angleDiff >= 160) { issueStore.add( new TurnRestrictionBad( - restrictionTag.relationOSMID, + restrictionTag.relationOsmID, "Left turn restriction is not on edges which turn left" ) ); @@ -56,7 +56,7 @@ static void unifyTurnRestrictions(OsmDatabase osmdb, DataImportIssueStore issueS if (angleDiff <= 200) { issueStore.add( new TurnRestrictionBad( - restrictionTag.relationOSMID, + restrictionTag.relationOsmID, "Right turn restriction is not on edges which turn right" ) ); @@ -67,7 +67,7 @@ static void unifyTurnRestrictions(OsmDatabase osmdb, DataImportIssueStore issueS if ((angleDiff <= 150 || angleDiff > 210)) { issueStore.add( new TurnRestrictionBad( - restrictionTag.relationOSMID, + restrictionTag.relationOsmID, "U-turn restriction is not on U-turn" ) ); @@ -78,7 +78,7 @@ static void unifyTurnRestrictions(OsmDatabase osmdb, DataImportIssueStore issueS if (angleDiff >= 30 && angleDiff < 330) { issueStore.add( new TurnRestrictionBad( - restrictionTag.relationOSMID, + restrictionTag.relationOsmID, "Straight turn restriction is not on edges which go straight" ) ); diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/UnconnectedArea.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/UnconnectedArea.java similarity index 93% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/UnconnectedArea.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/UnconnectedArea.java index 5dd5f851ac2..85366ed66db 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/osm/UnconnectedArea.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/UnconnectedArea.java @@ -16,7 +16,7 @@ public String getMessage() { @Override public String getHTMLMessage() { - return String.format(HTMLFMT, areaGroup.getSomeOSMObject().url(), idList()); + return String.format(HTMLFMT, areaGroup.getSomeOsmObject().url(), idList()); } @Override diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/VertexGenerator.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/VertexGenerator.java similarity index 90% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/VertexGenerator.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/VertexGenerator.java index 14489777dd4..e6fec74b798 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/osm/VertexGenerator.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/VertexGenerator.java @@ -8,10 +8,10 @@ import java.util.Set; import org.locationtech.jts.geom.Coordinate; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.openstreetmap.model.OSMLevel; -import org.opentripplanner.openstreetmap.model.OSMNode; -import org.opentripplanner.openstreetmap.model.OSMWay; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmLevel; +import org.opentripplanner.osm.model.OsmNode; +import org.opentripplanner.osm.model.OsmWay; +import org.opentripplanner.osm.model.OsmWithTags; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.street.model.edge.ElevatorEdge; import org.opentripplanner.street.model.vertex.BarrierVertex; @@ -30,7 +30,7 @@ class VertexGenerator { private final Map intersectionNodes = new HashMap<>(); - private final HashMap> multiLevelNodes = new HashMap<>(); + private final HashMap> multiLevelNodes = new HashMap<>(); private final OsmDatabase osmdb; private final Set boardingAreaRefTags; private final VertexFactory vertexFactory; @@ -51,7 +51,7 @@ public VertexGenerator(OsmDatabase osmdb, Graph graph, Set boardingAreaR * @return vertex The graph vertex. This is not always an OSM vertex; it can also be a * {@link OsmBoardingLocationVertex} */ - IntersectionVertex getVertexForOsmNode(OSMNode node, OSMWithTags way) { + IntersectionVertex getVertexForOsmNode(OsmNode node, OsmWithTags way) { // If the node should be decomposed to multiple levels, // use the numeric level because it is unique, the human level may not be (although // it will likely lead to some head-scratching if it is not). @@ -115,13 +115,13 @@ IntersectionVertex getVertexForOsmNode(OSMNode node, OSMWithTags way) { * Tracks OSM nodes which are decomposed into multiple graph vertices because they are * elevators. They can then be iterated over to build {@link ElevatorEdge} between them. */ - Map> multiLevelNodes() { + Map> multiLevelNodes() { return multiLevelNodes; } void initIntersectionNodes() { Set possibleIntersectionNodes = new HashSet<>(); - for (OSMWay way : osmdb.getWays()) { + for (OsmWay way : osmdb.getWays()) { TLongList nodes = way.getNodeRefs(); nodes.forEach(node -> { if (possibleIntersectionNodes.contains(node)) { @@ -159,9 +159,9 @@ Map intersectionNodes() { * @param node the node to record for * @author mattwigway */ - private OsmVertex recordLevel(OSMNode node, OSMWithTags way) { - OSMLevel level = osmdb.getLevelForWay(way); - Map vertices; + private OsmVertex recordLevel(OsmNode node, OsmWithTags way) { + OsmLevel level = osmdb.getLevelForWay(way); + Map vertices; long nodeId = node.getId(); if (multiLevelNodes.containsKey(nodeId)) { vertices = multiLevelNodes.get(nodeId); @@ -179,7 +179,7 @@ private OsmVertex recordLevel(OSMNode node, OSMWithTags way) { } private void intersectAreaRingNodes(Set possibleIntersectionNodes, Ring outerRing) { - for (OSMNode node : outerRing.nodes) { + for (OsmNode node : outerRing.nodes) { long nodeId = node.getId(); if (possibleIntersectionNodes.contains(nodeId)) { intersectionNodes.put(nodeId, null); diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/WalkableAreaBuilder.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/WalkableAreaBuilder.java similarity index 95% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/WalkableAreaBuilder.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/WalkableAreaBuilder.java index 89b71403232..f27d80d5617 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/osm/WalkableAreaBuilder.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/WalkableAreaBuilder.java @@ -26,11 +26,11 @@ import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.graph_builder.services.osm.EdgeNamer; -import org.opentripplanner.openstreetmap.model.OSMNode; -import org.opentripplanner.openstreetmap.model.OSMRelation; -import org.opentripplanner.openstreetmap.model.OSMRelationMember; -import org.opentripplanner.openstreetmap.model.OSMWithTags; -import org.opentripplanner.openstreetmap.wayproperty.WayProperties; +import org.opentripplanner.osm.model.OsmNode; +import org.opentripplanner.osm.model.OsmRelation; +import org.opentripplanner.osm.model.OsmRelationMember; +import org.opentripplanner.osm.model.OsmWithTags; +import org.opentripplanner.osm.wayproperty.WayProperties; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.api.request.StreetMode; import org.opentripplanner.routing.api.request.request.StreetRequest; @@ -78,7 +78,7 @@ class WalkableAreaBuilder { private final OsmDatabase osmdb; - private final Map wayPropertiesCache = new HashMap<>(); + private final Map wayPropertiesCache = new HashMap<>(); private final VertexGenerator vertexBuilder; @@ -179,7 +179,7 @@ public void buildWithoutVisibility(AreaGroup group) { public void buildWithVisibility(AreaGroup group) { // These sets contain the nodes/vertices which can be used to traverse from the rest of the // street network onto the walkable area - Set startingNodes = new HashSet<>(); + Set startingNodes = new HashSet<>(); Set startingVertices = new HashSet<>(); // List of edges belonging to the walkable area @@ -194,8 +194,8 @@ public void buildWithVisibility(AreaGroup group) { .stream() .map(area -> area.parent) .flatMap(osmWithTags -> - osmWithTags instanceof OSMRelation - ? ((OSMRelation) osmWithTags).getMembers().stream().map(OSMRelationMember::getRef) + osmWithTags instanceof OsmRelation + ? ((OsmRelation) osmWithTags).getMembers().stream().map(OsmRelationMember::getRef) : Stream.of(osmWithTags.getId()) ) .collect(Collectors.toSet()); @@ -210,7 +210,7 @@ public void buildWithVisibility(AreaGroup group) { // the points corresponding to concave or hole vertices // or those linked to ways - HashSet visibilityNodes = new HashSet<>(); + HashSet visibilityNodes = new HashSet<>(); HashSet alreadyAddedEdges = new HashSet<>(); HashSet platformLinkingVertices = new HashSet<>(); // we need to accumulate visibility points from all contained areas @@ -219,7 +219,7 @@ public void buildWithVisibility(AreaGroup group) { GeometryFactory geometryFactory = GeometryUtils.getGeometryFactory(); - OSMWithTags areaEntity = group.getSomeOSMObject(); + OsmWithTags areaEntity = group.getSomeOsmObject(); // we also want to fill in the edges of this area anyway, because we can, // and to avoid the numerical problems that they tend to cause @@ -231,8 +231,8 @@ public void buildWithVisibility(AreaGroup group) { // Add stops/entrances from public transit relations into the area // they may provide the only entrance to a platform // which otherwise would be pruned as unconnected island - Collection entrances = osmdb.getStopsInArea(area.parent); - for (OSMNode node : entrances) { + Collection entrances = osmdb.getStopsInArea(area.parent); + for (OsmNode node : entrances) { var vertex = vertexBuilder.getVertexForOsmNode(node, areaEntity); platformLinkingVertices.add(vertex); visibilityNodes.add(node); @@ -253,7 +253,7 @@ public void buildWithVisibility(AreaGroup group) { .toList(); platformLinkingVertices.addAll(endpointsWithin); for (OsmVertex v : endpointsWithin) { - OSMNode node = osmdb.getNode(v.nodeId); + OsmNode node = osmdb.getNode(v.nodeId); visibilityNodes.add(node); startingNodes.add(node); edgeList.addVisibilityVertex(v); @@ -262,7 +262,7 @@ public void buildWithVisibility(AreaGroup group) { } for (int i = 0; i < outerRing.nodes.size(); ++i) { - OSMNode node = outerRing.nodes.get(i); + OsmNode node = outerRing.nodes.get(i); Set newEdges = createEdgesForRingSegment( edgeList, area, @@ -292,7 +292,7 @@ public void buildWithVisibility(AreaGroup group) { } for (Ring innerRing : outerRing.getHoles()) { for (int j = 0; j < innerRing.nodes.size(); ++j) { - OSMNode node = innerRing.nodes.get(j); + OsmNode node = innerRing.nodes.get(j); edges.addAll( createEdgesForRingSegment(edgeList, area, innerRing, j, alreadyAddedEdges) ); @@ -334,7 +334,7 @@ public void buildWithVisibility(AreaGroup group) { float skip_ratio = (float) maxAreaNodes / (float) visibilityNodes.size(); int i = 0; float sum_i = 0; - for (OSMNode nodeI : visibilityNodes) { + for (OsmNode nodeI : visibilityNodes) { sum_i += skip_ratio; if (Math.floor(sum_i) < i + 1) { continue; @@ -346,7 +346,7 @@ public void buildWithVisibility(AreaGroup group) { } int j = 0; float sum_j = 0; - for (OSMNode nodeJ : visibilityNodes) { + for (OsmNode nodeJ : visibilityNodes) { sum_j += skip_ratio; if (Math.floor(sum_j) < j + 1) { continue; @@ -437,7 +437,7 @@ private void pruneAreaEdges( } } - private boolean isStartingNode(OSMNode node, Set osmWayIds) { + private boolean isStartingNode(OsmNode node, Set osmWayIds) { return ( osmdb.isNodeBelongsToWay(node.getId()) || // Do not add if part of same areaGroup @@ -456,8 +456,8 @@ private Set createEdgesForRingSegment( int i, HashSet alreadyAddedEdges ) { - OSMNode node = ring.nodes.get(i); - OSMNode nextNode = ring.nodes.get((i + 1) % ring.nodes.size()); + OsmNode node = ring.nodes.get(i); + OsmNode nextNode = ring.nodes.get((i + 1) % ring.nodes.size()); NodeEdge nodeEdge = new NodeEdge(node, nextNode); if (alreadyAddedEdges.contains(nodeEdge)) { return Set.of(); @@ -497,7 +497,7 @@ private Set createSegments( // do we need to recurse? if (intersects.size() == 1) { Area area = intersects.getFirst(); - OSMWithTags areaEntity = area.parent; + OsmWithTags areaEntity = area.parent; StreetTraversalPermission areaPermissions = areaEntity.overridePermissions( StreetTraversalPermission.PEDESTRIAN_AND_BICYCLE @@ -634,7 +634,7 @@ private void createNamedAreas(AreaEdgeList edgeList, Ring ring, Collection continue; } NamedArea namedArea = new NamedArea(); - OSMWithTags areaEntity = area.parent; + OsmWithTags areaEntity = area.parent; String id = "way (area) " + areaEntity.getId() + " (splitter linking)"; I18NString name = namer.getNameForWay(areaEntity, id); @@ -700,5 +700,5 @@ public boolean shouldSkipEdge(State current, Edge edge) { } } - private record NodeEdge(OSMNode from, OSMNode to) {} + private record NodeEdge(OsmNode from, OsmNode to) {} } diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/naming/DefaultNamer.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/naming/DefaultNamer.java similarity index 70% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/naming/DefaultNamer.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/naming/DefaultNamer.java index ff7b7d17666..4e8cdaeee08 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/osm/naming/DefaultNamer.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/naming/DefaultNamer.java @@ -3,17 +3,17 @@ import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.graph_builder.module.osm.StreetEdgePair; import org.opentripplanner.graph_builder.services.osm.EdgeNamer; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; public class DefaultNamer implements EdgeNamer { @Override - public I18NString name(OSMWithTags way) { + public I18NString name(OsmWithTags way) { return way.getAssumedName(); } @Override - public void recordEdges(OSMWithTags way, StreetEdgePair edge) {} + public void recordEdges(OsmWithTags way, StreetEdgePair edge) {} @Override public void postprocess() {} diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/naming/PortlandCustomNamer.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/naming/PortlandCustomNamer.java similarity index 94% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/naming/PortlandCustomNamer.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/naming/PortlandCustomNamer.java index c0ca595fbd7..e05bc736cbb 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/osm/naming/PortlandCustomNamer.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/naming/PortlandCustomNamer.java @@ -5,7 +5,7 @@ import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.graph_builder.module.osm.StreetEdgePair; import org.opentripplanner.graph_builder.services.osm.EdgeNamer; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; import org.opentripplanner.street.model.edge.StreetEdge; /** @@ -45,7 +45,7 @@ public class PortlandCustomNamer implements EdgeNamer { private final HashSet nameByDestination = new HashSet<>(); @Override - public I18NString name(OSMWithTags way) { + public I18NString name(OsmWithTags way) { var defaultName = way.getAssumedName(); if (!way.hasTag("name")) { // this is already a generated name, so there's no need to add any @@ -70,7 +70,7 @@ public I18NString name(OSMWithTags way) { } @Override - public void recordEdges(OSMWithTags way, StreetEdgePair edgePair) { + public void recordEdges(OsmWithTags way, StreetEdgePair edgePair) { final boolean isHighwayLink = isHighwayLink(way); final boolean isLowerLink = isLowerLink(way); edgePair @@ -186,12 +186,12 @@ private static String nameAccordingToOrigin(StreetEdge e, int maxDepth) { return null; } - private static boolean isHighwayLink(OSMWithTags way) { + private static boolean isHighwayLink(OsmWithTags way) { String highway = way.getTag("highway"); return "motorway_link".equals(highway) || "trunk_link".equals(highway); } - private static boolean isLowerLink(OSMWithTags way) { + private static boolean isLowerLink(OsmWithTags way) { String highway = way.getTag("highway"); return ( "secondary_link".equals(highway) || diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/naming/SidewalkNamer.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/naming/SidewalkNamer.java similarity index 98% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/naming/SidewalkNamer.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/naming/SidewalkNamer.java index eafccc0da1b..f2bb2951239 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/osm/naming/SidewalkNamer.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/naming/SidewalkNamer.java @@ -31,7 +31,7 @@ import org.opentripplanner.framework.logging.ProgressTracker; import org.opentripplanner.graph_builder.module.osm.StreetEdgePair; import org.opentripplanner.graph_builder.services.osm.EdgeNamer; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; import org.opentripplanner.street.model.edge.StreetEdge; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -65,12 +65,12 @@ public class SidewalkNamer implements EdgeNamer { private PreciseBuffer preciseBuffer; @Override - public I18NString name(OSMWithTags way) { + public I18NString name(OsmWithTags way) { return way.getAssumedName(); } @Override - public void recordEdges(OSMWithTags way, StreetEdgePair pair) { + public void recordEdges(OsmWithTags way, StreetEdgePair pair) { // This way is a sidewalk and hasn't been named yet (and is not explicitly unnamed) if (way.isSidewalk() && way.hasNoName() && !way.isExplicitlyUnnamed()) { pair diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/parameters/OsmExtractParameters.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/parameters/OsmExtractParameters.java similarity index 94% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/parameters/OsmExtractParameters.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/parameters/OsmExtractParameters.java index 9d2eead5f7e..175b9c04c5b 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/osm/parameters/OsmExtractParameters.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/parameters/OsmExtractParameters.java @@ -4,7 +4,7 @@ import java.time.ZoneId; import javax.annotation.Nullable; import org.opentripplanner.graph_builder.model.DataSourceConfig; -import org.opentripplanner.openstreetmap.tagmapping.OsmTagMapperSource; +import org.opentripplanner.osm.tagmapping.OsmTagMapperSource; /** * Configure an OpenStreetMap extract. diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/parameters/OsmExtractParametersBuilder.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/parameters/OsmExtractParametersBuilder.java similarity index 95% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/parameters/OsmExtractParametersBuilder.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/parameters/OsmExtractParametersBuilder.java index 03fd7eaec4e..2d9bb71d9f5 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/osm/parameters/OsmExtractParametersBuilder.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/parameters/OsmExtractParametersBuilder.java @@ -2,7 +2,7 @@ import java.net.URI; import java.time.ZoneId; -import org.opentripplanner.openstreetmap.tagmapping.OsmTagMapperSource; +import org.opentripplanner.osm.tagmapping.OsmTagMapperSource; /** * Configure an OpenStreetMap extract. diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/parameters/OsmExtractParametersList.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/parameters/OsmExtractParametersList.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/parameters/OsmExtractParametersList.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/parameters/OsmExtractParametersList.java diff --git a/src/main/java/org/opentripplanner/graph_builder/module/osm/parameters/OsmProcessingParameters.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/parameters/OsmProcessingParameters.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/module/osm/parameters/OsmProcessingParameters.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/osm/parameters/OsmProcessingParameters.java diff --git a/src/main/java/org/opentripplanner/graph_builder/services/ned/ElevationGridCoverageFactory.java b/application/src/main/java/org/opentripplanner/graph_builder/services/ned/ElevationGridCoverageFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/services/ned/ElevationGridCoverageFactory.java rename to application/src/main/java/org/opentripplanner/graph_builder/services/ned/ElevationGridCoverageFactory.java diff --git a/src/main/java/org/opentripplanner/graph_builder/services/ned/NEDTileSource.java b/application/src/main/java/org/opentripplanner/graph_builder/services/ned/NEDTileSource.java similarity index 100% rename from src/main/java/org/opentripplanner/graph_builder/services/ned/NEDTileSource.java rename to application/src/main/java/org/opentripplanner/graph_builder/services/ned/NEDTileSource.java diff --git a/src/main/java/org/opentripplanner/graph_builder/services/osm/EdgeNamer.java b/application/src/main/java/org/opentripplanner/graph_builder/services/osm/EdgeNamer.java similarity index 87% rename from src/main/java/org/opentripplanner/graph_builder/services/osm/EdgeNamer.java rename to application/src/main/java/org/opentripplanner/graph_builder/services/osm/EdgeNamer.java index 60cf780f714..215a5fefc18 100644 --- a/src/main/java/org/opentripplanner/graph_builder/services/osm/EdgeNamer.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/services/osm/EdgeNamer.java @@ -1,13 +1,12 @@ package org.opentripplanner.graph_builder.services.osm; -import javax.annotation.Nonnull; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.graph_builder.module.osm.StreetEdgePair; import org.opentripplanner.graph_builder.module.osm.naming.DefaultNamer; import org.opentripplanner.graph_builder.module.osm.naming.PortlandCustomNamer; import org.opentripplanner.graph_builder.module.osm.naming.SidewalkNamer; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; import org.opentripplanner.standalone.config.framework.json.NodeAdapter; import org.opentripplanner.standalone.config.framework.json.OtpVersion; @@ -19,21 +18,21 @@ public interface EdgeNamer { /** * Get the edge name from an OSM way. */ - I18NString name(OSMWithTags way); + I18NString name(OsmWithTags way); /** * Callback function for each way/edge combination so that more complicated names can be built * in the post-processing step. */ - void recordEdges(OSMWithTags way, StreetEdgePair edge); + void recordEdges(OsmWithTags way, StreetEdgePair edge); /** * Called after each edge has been named to build a more complex name out of the relationships - * tracked in {@link EdgeNamer#recordEdges(OSMWithTags, StreetEdgePair)}. + * tracked in {@link EdgeNamer#recordEdges(OsmWithTags, StreetEdgePair)}. */ void postprocess(); - default I18NString getNameForWay(OSMWithTags way, @Nonnull String id) { + default I18NString getNameForWay(OsmWithTags way, String id) { var name = name(way); if (name == null) { diff --git a/src/main/java/org/opentripplanner/gtfs/GenerateTripPatternsOperation.java b/application/src/main/java/org/opentripplanner/gtfs/GenerateTripPatternsOperation.java similarity index 77% rename from src/main/java/org/opentripplanner/gtfs/GenerateTripPatternsOperation.java rename to application/src/main/java/org/opentripplanner/gtfs/GenerateTripPatternsOperation.java index bf26f9c6d7b..08ad300fa9a 100644 --- a/src/main/java/org/opentripplanner/gtfs/GenerateTripPatternsOperation.java +++ b/application/src/main/java/org/opentripplanner/gtfs/GenerateTripPatternsOperation.java @@ -3,6 +3,7 @@ import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ListMultimap; import com.google.common.collect.Multimap; +import com.google.common.collect.MultimapBuilder; import java.util.Collection; import java.util.HashMap; import java.util.List; @@ -23,6 +24,7 @@ import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.network.StopPattern; import org.opentripplanner.transit.model.network.TripPattern; +import org.opentripplanner.transit.model.network.TripPatternBuilder; import org.opentripplanner.transit.model.timetable.Direction; import org.opentripplanner.transit.model.timetable.FrequencyEntry; import org.opentripplanner.transit.model.timetable.Trip; @@ -40,13 +42,18 @@ public class GenerateTripPatternsOperation { private final Map tripPatternIdCounters = new HashMap<>(); - private final OtpTransitServiceBuilder transitDaoBuilder; + private final OtpTransitServiceBuilder transitServiceBuilder; private final DataImportIssueStore issueStore; private final Deduplicator deduplicator; private final Set calendarServiceIds; private final GeometryProcessor geometryProcessor; - private final Multimap tripPatterns; + // TODO the linked hashset configuration ensures that TripPatterns are created in the same order + // as Trips are imported, as a workaround for issue #6067 + private final Multimap tripPatternBuilders = MultimapBuilder + .linkedHashKeys() + .linkedHashSetValues() + .build(); private final ListMultimap frequenciesForTrip = ArrayListMultimap.create(); private int freqCount = 0; @@ -59,18 +66,17 @@ public GenerateTripPatternsOperation( Set calendarServiceIds, GeometryProcessor geometryProcessor ) { - this.transitDaoBuilder = builder; + this.transitServiceBuilder = builder; this.issueStore = issueStore; this.deduplicator = deduplicator; this.calendarServiceIds = calendarServiceIds; this.geometryProcessor = geometryProcessor; - this.tripPatterns = transitDaoBuilder.getTripPatterns(); } public void run() { collectFrequencyByTrip(); - final Collection trips = transitDaoBuilder.getTripsById().values(); + final Collection trips = transitServiceBuilder.getTripsById().values(); var progressLogger = ProgressTracker.track("build trip patterns", 50_000, trips.size()); LOG.info(progressLogger.startMessage()); @@ -85,6 +91,14 @@ public void run() { } } + tripPatternBuilders + .values() + .stream() + .map(TripPatternBuilder::build) + .forEach(tripPattern -> + transitServiceBuilder.getTripPatterns().put(tripPattern.getStopPattern(), tripPattern) + ); + LOG.info(progressLogger.completeMessage()); LOG.info( "Added {} frequency-based and {} single-trip timetable entries.", @@ -107,7 +121,7 @@ public boolean hasScheduledTrips() { * the same trip can be added at once to the same Timetable/TripPattern. */ private void collectFrequencyByTrip() { - for (Frequency freq : transitDaoBuilder.getFrequencies()) { + for (Frequency freq : transitServiceBuilder.getFrequencies()) { frequenciesForTrip.put(freq.getTrip(), freq); } } @@ -119,7 +133,7 @@ private void buildTripPatternForTrip(Trip trip) { return; // Invalid trip, skip it, it will break later } - List stopTimes = transitDaoBuilder.getStopTimesSortedByTrip().get(trip); + List stopTimes = transitServiceBuilder.getStopTimesSortedByTrip().get(trip); // If after filtering this trip does not contain at least 2 stoptimes, it does not serve any purpose. var staticTripWithFewerThan2Stops = @@ -134,8 +148,7 @@ private void buildTripPatternForTrip(Trip trip) { // Get the existing TripPattern for this filtered StopPattern, or create one. StopPattern stopPattern = new StopPattern(stopTimes); - Direction direction = trip.getDirection(); - TripPattern tripPattern = findOrCreateTripPattern(stopPattern, trip, direction); + TripPatternBuilder tripPatternBuilder = findOrCreateTripPattern(stopPattern, trip); // Create a TripTimes object for this list of stoptimes, which form one trip. TripTimes tripTimes = TripTimesFactory.tripTimes(trip, stopTimes, deduplicator); @@ -144,44 +157,42 @@ private void buildTripPatternForTrip(Trip trip) { List frequencies = frequenciesForTrip.get(trip); if (!frequencies.isEmpty()) { for (Frequency freq : frequencies) { - tripPattern.add(new FrequencyEntry(freq, tripTimes)); + tripPatternBuilder.withScheduledTimeTableBuilder(builder -> + builder.addFrequencyEntry(new FrequencyEntry(freq, tripTimes)) + ); freqCount++; } } // This trip was not frequency-based. Add the TripTimes directly to the TripPattern's scheduled timetable. else { - tripPattern.add(tripTimes); + tripPatternBuilder.withScheduledTimeTableBuilder(builder -> builder.addTripTimes(tripTimes)); scheduledCount++; } } - private TripPattern findOrCreateTripPattern( - StopPattern stopPattern, - Trip trip, - Direction direction - ) { + private TripPatternBuilder findOrCreateTripPattern(StopPattern stopPattern, Trip trip) { Route route = trip.getRoute(); - for (TripPattern tripPattern : tripPatterns.get(stopPattern)) { + Direction direction = trip.getDirection(); + for (TripPatternBuilder tripPatternBuilder : tripPatternBuilders.get(stopPattern)) { if ( - tripPattern.getRoute().equals(route) && - tripPattern.getDirection().equals(direction) && - tripPattern.getMode().equals(trip.getMode()) && - tripPattern.getNetexSubmode().equals(trip.getNetexSubMode()) + tripPatternBuilder.getRoute().equals(route) && + tripPatternBuilder.getDirection().equals(direction) && + tripPatternBuilder.getMode().equals(trip.getMode()) && + tripPatternBuilder.getNetexSubmode().equals(trip.getNetexSubMode()) ) { - return tripPattern; + return tripPatternBuilder; } } FeedScopedId patternId = generateUniqueIdForTripPattern(route, direction); - TripPattern tripPattern = TripPattern + TripPatternBuilder tripPatternBuilder = TripPattern .of(patternId) .withRoute(route) .withStopPattern(stopPattern) .withMode(trip.getMode()) .withNetexSubmode(trip.getNetexSubMode()) - .withHopGeometries(geometryProcessor.createHopGeometries(trip)) - .build(); - tripPatterns.put(stopPattern, tripPattern); - return tripPattern; + .withHopGeometries(geometryProcessor.createHopGeometries(trip)); + tripPatternBuilders.put(stopPattern, tripPatternBuilder); + return tripPatternBuilder; } /** diff --git a/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsBundle.java b/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsBundle.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsBundle.java rename to application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsBundle.java diff --git a/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsFeedParameters.java b/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsFeedParameters.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsFeedParameters.java rename to application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsFeedParameters.java diff --git a/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsFeedParametersBuilder.java b/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsFeedParametersBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsFeedParametersBuilder.java rename to application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsFeedParametersBuilder.java diff --git a/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java b/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java rename to application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java diff --git a/src/main/java/org/opentripplanner/gtfs/interlining/InterlineProcessor.java b/application/src/main/java/org/opentripplanner/gtfs/interlining/InterlineProcessor.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/interlining/InterlineProcessor.java rename to application/src/main/java/org/opentripplanner/gtfs/interlining/InterlineProcessor.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/AgencyAndIdMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/AgencyAndIdMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/AgencyAndIdMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/AgencyAndIdMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/AgencyMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/AgencyMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/AgencyMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/AgencyMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/BikeAccessMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/BikeAccessMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/BikeAccessMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/BikeAccessMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/BoardingAreaMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/BoardingAreaMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/BoardingAreaMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/BoardingAreaMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/BookingRuleMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/BookingRuleMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/BookingRuleMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/BookingRuleMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/BrandingMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/BrandingMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/BrandingMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/BrandingMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/DirectionMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/DirectionMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/DirectionMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/DirectionMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/EntranceMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/EntranceMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/EntranceMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/EntranceMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/FareAttributeMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/FareAttributeMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/FareAttributeMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/FareAttributeMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/FareLegRuleMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/FareLegRuleMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/FareLegRuleMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/FareLegRuleMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/FareProductMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/FareProductMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/FareProductMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/FareProductMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/FareRuleMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/FareRuleMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/FareRuleMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/FareRuleMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/FareTransferRuleMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/FareTransferRuleMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/FareTransferRuleMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/FareTransferRuleMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/FeedInfoMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/FeedInfoMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/FeedInfoMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/FeedInfoMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/FrequencyMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/FrequencyMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/FrequencyMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/FrequencyMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/GTFSToOtpTransitServiceMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/GTFSToOtpTransitServiceMapper.java similarity index 96% rename from src/main/java/org/opentripplanner/gtfs/mapping/GTFSToOtpTransitServiceMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/GTFSToOtpTransitServiceMapper.java index d58410741f9..b7aea1c2e2f 100644 --- a/src/main/java/org/opentripplanner/gtfs/mapping/GTFSToOtpTransitServiceMapper.java +++ b/application/src/main/java/org/opentripplanner/gtfs/mapping/GTFSToOtpTransitServiceMapper.java @@ -72,7 +72,6 @@ public class GTFSToOtpTransitServiceMapper { private final FareTransferRuleMapper fareTransferRuleMapper; - private final StopAreaMapper stopAreaMapper; private final DirectionMapper directionMapper; private final DataImportIssueStore issueStore; @@ -112,9 +111,6 @@ public GTFSToOtpTransitServiceMapper( boardingAreaMapper = new BoardingAreaMapper(translationHelper, stopLookup); locationMapper = new LocationMapper(builder.stopModel(), issueStore); locationGroupMapper = new LocationGroupMapper(stopMapper, locationMapper, builder.stopModel()); - // the use of stop areas were reverted in the spec - // this code will go away, please migrate now! - stopAreaMapper = new StopAreaMapper(stopMapper, locationMapper, builder.stopModel()); pathwayMapper = new PathwayMapper(stopMapper, entranceMapper, pathwayNodeMapper, boardingAreaMapper); routeMapper = new RouteMapper(agencyMapper, issueStore, translationHelper); @@ -126,7 +122,6 @@ public GTFSToOtpTransitServiceMapper( stopMapper, locationMapper, locationGroupMapper, - stopAreaMapper, tripMapper, bookingRuleMapper, translationHelper @@ -166,7 +161,6 @@ public void mapStopTripAndRouteDataIntoBuilder() { // Stop areas and Stop groups are only used in FLEX routes builder.stopModel().withAreaStops(locationMapper.map(data.getAllLocations())); builder.stopModel().withGroupStops(locationGroupMapper.map(data.getAllLocationGroups())); - builder.stopModel().withGroupStops(stopAreaMapper.map(data.getAllStopAreas())); } builder.getPathways().addAll(pathwayMapper.map(data.getAllPathways())); diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/LocationGroupMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/LocationGroupMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/LocationGroupMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/LocationGroupMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/LocationMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/LocationMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/LocationMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/LocationMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/PathwayMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/PathwayMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/PathwayMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/PathwayMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/PathwayModeMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/PathwayModeMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/PathwayModeMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/PathwayModeMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/PathwayNodeMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/PathwayNodeMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/PathwayNodeMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/PathwayNodeMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/PickDropMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/PickDropMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/PickDropMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/PickDropMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/RouteMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/RouteMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/RouteMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/RouteMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/ServiceCalendarDateMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/ServiceCalendarDateMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/ServiceCalendarDateMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/ServiceCalendarDateMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/ServiceCalendarMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/ServiceCalendarMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/ServiceCalendarMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/ServiceCalendarMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/ServiceDateMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/ServiceDateMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/ServiceDateMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/ServiceDateMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/ShapePointMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/ShapePointMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/ShapePointMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/ShapePointMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/StationMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/StationMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/StationMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/StationMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/StaySeatedNotAllowed.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/StaySeatedNotAllowed.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/StaySeatedNotAllowed.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/StaySeatedNotAllowed.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/StopMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/StopMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/StopMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/StopMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/StopMappingWrapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/StopMappingWrapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/StopMappingWrapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/StopMappingWrapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/StopTimeMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/StopTimeMapper.java similarity index 92% rename from src/main/java/org/opentripplanner/gtfs/mapping/StopTimeMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/StopTimeMapper.java index 67b250c5061..5f20b6e0224 100644 --- a/src/main/java/org/opentripplanner/gtfs/mapping/StopTimeMapper.java +++ b/application/src/main/java/org/opentripplanner/gtfs/mapping/StopTimeMapper.java @@ -7,7 +7,6 @@ import org.onebusaway.gtfs.model.Location; import org.onebusaway.gtfs.model.LocationGroup; import org.onebusaway.gtfs.model.Stop; -import org.onebusaway.gtfs.model.StopArea; import org.opentripplanner.framework.collection.MapUtils; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.model.StopTime; @@ -22,7 +21,6 @@ class StopTimeMapper { private final LocationMapper locationMapper; private final LocationGroupMapper locationGroupMapper; - private final StopAreaMapper stopAreaMapper; private final TripMapper tripMapper; private final BookingRuleMapper bookingRuleMapper; @@ -35,7 +33,6 @@ class StopTimeMapper { StopMapper stopMapper, LocationMapper locationMapper, LocationGroupMapper locationGroupMapper, - StopAreaMapper stopAreaMapper, TripMapper tripMapper, BookingRuleMapper bookingRuleMapper, TranslationHelper translationHelper @@ -43,7 +40,6 @@ class StopTimeMapper { this.stopMapper = stopMapper; this.locationMapper = locationMapper; this.locationGroupMapper = locationGroupMapper; - this.stopAreaMapper = stopAreaMapper; this.tripMapper = tripMapper; this.bookingRuleMapper = bookingRuleMapper; this.translationHelper = translationHelper; @@ -71,8 +67,6 @@ private StopTime doMap(org.onebusaway.gtfs.model.StopTime rhs) { case Stop stop -> lhs.setStop(stopMapper.map(stop)); case Location location -> lhs.setStop(locationMapper.map(location)); case LocationGroup locGroup -> lhs.setStop(locationGroupMapper.map(locGroup)); - // TODO: only here for backwards compatibility, this will be removed in the future - case StopArea area -> lhs.setStop(stopAreaMapper.map(area)); default -> throw new IllegalArgumentException( "Unknown location type: %s".formatted(stopLocation) ); diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/TransferMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/TransferMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/TransferMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/TransferMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/TransferMappingResult.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/TransferMappingResult.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/TransferMappingResult.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/TransferMappingResult.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/TransitModeMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/TransitModeMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/TransitModeMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/TransitModeMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/TranslationHelper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/TranslationHelper.java similarity index 96% rename from src/main/java/org/opentripplanner/gtfs/mapping/TranslationHelper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/TranslationHelper.java index 03ed54d55f7..ce61c01b05e 100644 --- a/src/main/java/org/opentripplanner/gtfs/mapping/TranslationHelper.java +++ b/application/src/main/java/org/opentripplanner/gtfs/mapping/TranslationHelper.java @@ -7,7 +7,6 @@ import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.onebusaway.csv_entities.schema.annotations.CsvField; import org.onebusaway.csv_entities.schema.annotations.CsvFieldNameConvention; @@ -83,9 +82,9 @@ void importTranslations(Collection allTranslations, Collection clazz, - @Nonnull String fieldName, - @Nonnull String recordId, + Class clazz, + String fieldName, + String recordId, @Nullable String defaultValue ) { return getTranslation(clazz, fieldName, recordId, null, defaultValue); @@ -93,9 +92,9 @@ I18NString getTranslation( @Nullable I18NString getTranslation( - @Nonnull Class clazz, - @Nonnull String fieldName, - @Nonnull String recordId, + Class clazz, + String fieldName, + String recordId, @Nullable String recordSubId, @Nullable String defaultValue ) { diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/TripMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/TripMapper.java similarity index 89% rename from src/main/java/org/opentripplanner/gtfs/mapping/TripMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/TripMapper.java index 593c73f58d8..fdef2bb4e0c 100644 --- a/src/main/java/org/opentripplanner/gtfs/mapping/TripMapper.java +++ b/application/src/main/java/org/opentripplanner/gtfs/mapping/TripMapper.java @@ -81,8 +81,13 @@ private Optional mapSafeTimePenalty(org.onebusaway.gtfs.model.Trip if (rhs.getSafeDurationFactor() == null && rhs.getSafeDurationOffset() == null) { return Optional.empty(); } else { - var offset = Duration.ofMinutes(rhs.getSafeDurationOffset().longValue()); - return Optional.of(TimePenalty.of(offset, rhs.getSafeDurationFactor().doubleValue())); + var offset = rhs.getSafeDurationOffset() == null + ? Duration.ZERO + : Duration.ofMinutes(rhs.getSafeDurationOffset().longValue()); + var factor = rhs.getSafeDurationFactor() == null + ? 1d + : rhs.getSafeDurationFactor().doubleValue(); + return Optional.of(TimePenalty.of(offset, factor)); } } } diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/WgsCoordinateMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/WgsCoordinateMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/WgsCoordinateMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/WgsCoordinateMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/WheelchairAccessibilityMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/WheelchairAccessibilityMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/WheelchairAccessibilityMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/WheelchairAccessibilityMapper.java diff --git a/src/main/java/org/opentripplanner/gtfs/package.md b/application/src/main/java/org/opentripplanner/gtfs/package.md similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/package.md rename to application/src/main/java/org/opentripplanner/gtfs/package.md diff --git a/src/main/java/org/opentripplanner/inspector/raster/AreaEdgeRenderer.java b/application/src/main/java/org/opentripplanner/inspector/raster/AreaEdgeRenderer.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/raster/AreaEdgeRenderer.java rename to application/src/main/java/org/opentripplanner/inspector/raster/AreaEdgeRenderer.java diff --git a/src/main/java/org/opentripplanner/inspector/raster/BikeSafetyEdgeRenderer.java b/application/src/main/java/org/opentripplanner/inspector/raster/BikeSafetyEdgeRenderer.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/raster/BikeSafetyEdgeRenderer.java rename to application/src/main/java/org/opentripplanner/inspector/raster/BikeSafetyEdgeRenderer.java diff --git a/src/main/java/org/opentripplanner/inspector/raster/DefaultScalarColorPalette.java b/application/src/main/java/org/opentripplanner/inspector/raster/DefaultScalarColorPalette.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/raster/DefaultScalarColorPalette.java rename to application/src/main/java/org/opentripplanner/inspector/raster/DefaultScalarColorPalette.java diff --git a/src/main/java/org/opentripplanner/inspector/raster/EdgeVertexTileRenderer.java b/application/src/main/java/org/opentripplanner/inspector/raster/EdgeVertexTileRenderer.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/raster/EdgeVertexTileRenderer.java rename to application/src/main/java/org/opentripplanner/inspector/raster/EdgeVertexTileRenderer.java diff --git a/src/main/java/org/opentripplanner/inspector/raster/ElevationEdgeRenderer.java b/application/src/main/java/org/opentripplanner/inspector/raster/ElevationEdgeRenderer.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/raster/ElevationEdgeRenderer.java rename to application/src/main/java/org/opentripplanner/inspector/raster/ElevationEdgeRenderer.java diff --git a/src/main/java/org/opentripplanner/inspector/raster/MapTile.java b/application/src/main/java/org/opentripplanner/inspector/raster/MapTile.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/raster/MapTile.java rename to application/src/main/java/org/opentripplanner/inspector/raster/MapTile.java diff --git a/src/main/java/org/opentripplanner/inspector/raster/NoThruTrafficEdgeRenderer.java b/application/src/main/java/org/opentripplanner/inspector/raster/NoThruTrafficEdgeRenderer.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/raster/NoThruTrafficEdgeRenderer.java rename to application/src/main/java/org/opentripplanner/inspector/raster/NoThruTrafficEdgeRenderer.java diff --git a/src/main/java/org/opentripplanner/inspector/raster/PathwayEdgeRenderer.java b/application/src/main/java/org/opentripplanner/inspector/raster/PathwayEdgeRenderer.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/raster/PathwayEdgeRenderer.java rename to application/src/main/java/org/opentripplanner/inspector/raster/PathwayEdgeRenderer.java diff --git a/src/main/java/org/opentripplanner/inspector/raster/ScalarColorPalette.java b/application/src/main/java/org/opentripplanner/inspector/raster/ScalarColorPalette.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/raster/ScalarColorPalette.java rename to application/src/main/java/org/opentripplanner/inspector/raster/ScalarColorPalette.java diff --git a/src/main/java/org/opentripplanner/inspector/raster/TileRenderer.java b/application/src/main/java/org/opentripplanner/inspector/raster/TileRenderer.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/raster/TileRenderer.java rename to application/src/main/java/org/opentripplanner/inspector/raster/TileRenderer.java diff --git a/src/main/java/org/opentripplanner/inspector/raster/TileRendererManager.java b/application/src/main/java/org/opentripplanner/inspector/raster/TileRendererManager.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/raster/TileRendererManager.java rename to application/src/main/java/org/opentripplanner/inspector/raster/TileRendererManager.java diff --git a/src/main/java/org/opentripplanner/inspector/raster/TraversalPermissionsEdgeRenderer.java b/application/src/main/java/org/opentripplanner/inspector/raster/TraversalPermissionsEdgeRenderer.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/raster/TraversalPermissionsEdgeRenderer.java rename to application/src/main/java/org/opentripplanner/inspector/raster/TraversalPermissionsEdgeRenderer.java diff --git a/src/main/java/org/opentripplanner/inspector/raster/WalkSafetyEdgeRenderer.java b/application/src/main/java/org/opentripplanner/inspector/raster/WalkSafetyEdgeRenderer.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/raster/WalkSafetyEdgeRenderer.java rename to application/src/main/java/org/opentripplanner/inspector/raster/WalkSafetyEdgeRenderer.java diff --git a/src/main/java/org/opentripplanner/inspector/raster/WheelchairEdgeRenderer.java b/application/src/main/java/org/opentripplanner/inspector/raster/WheelchairEdgeRenderer.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/raster/WheelchairEdgeRenderer.java rename to application/src/main/java/org/opentripplanner/inspector/raster/WheelchairEdgeRenderer.java diff --git a/src/main/java/org/opentripplanner/inspector/vector/KeyValue.java b/application/src/main/java/org/opentripplanner/inspector/vector/KeyValue.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/vector/KeyValue.java rename to application/src/main/java/org/opentripplanner/inspector/vector/KeyValue.java diff --git a/src/main/java/org/opentripplanner/inspector/vector/LayerBuilder.java b/application/src/main/java/org/opentripplanner/inspector/vector/LayerBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/vector/LayerBuilder.java rename to application/src/main/java/org/opentripplanner/inspector/vector/LayerBuilder.java diff --git a/src/main/java/org/opentripplanner/inspector/vector/LayerParameters.java b/application/src/main/java/org/opentripplanner/inspector/vector/LayerParameters.java similarity index 89% rename from src/main/java/org/opentripplanner/inspector/vector/LayerParameters.java rename to application/src/main/java/org/opentripplanner/inspector/vector/LayerParameters.java index cb849e0f0ac..70cb5a2ce43 100644 --- a/src/main/java/org/opentripplanner/inspector/vector/LayerParameters.java +++ b/application/src/main/java/org/opentripplanner/inspector/vector/LayerParameters.java @@ -1,6 +1,7 @@ package org.opentripplanner.inspector.vector; import org.opentripplanner.apis.support.mapping.PropertyMapper; +import org.opentripplanner.ext.vectortiles.layers.LayerFilters; /** * Configuration options for a single vector tile layer. @@ -53,4 +54,8 @@ default int cacheMaxSeconds() { default double expansionFactor() { return EXPANSION_FACTOR; } + + default LayerFilters.FilterType filterType() { + return LayerFilters.FilterType.NONE; + } } diff --git a/src/main/java/org/opentripplanner/inspector/vector/VectorTileResponseFactory.java b/application/src/main/java/org/opentripplanner/inspector/vector/VectorTileResponseFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/vector/VectorTileResponseFactory.java rename to application/src/main/java/org/opentripplanner/inspector/vector/VectorTileResponseFactory.java diff --git a/src/main/java/org/opentripplanner/inspector/vector/edge/EdgeLayerBuilder.java b/application/src/main/java/org/opentripplanner/inspector/vector/edge/EdgeLayerBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/vector/edge/EdgeLayerBuilder.java rename to application/src/main/java/org/opentripplanner/inspector/vector/edge/EdgeLayerBuilder.java diff --git a/src/main/java/org/opentripplanner/inspector/vector/edge/EdgePropertyMapper.java b/application/src/main/java/org/opentripplanner/inspector/vector/edge/EdgePropertyMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/vector/edge/EdgePropertyMapper.java rename to application/src/main/java/org/opentripplanner/inspector/vector/edge/EdgePropertyMapper.java diff --git a/src/main/java/org/opentripplanner/inspector/vector/geofencing/GeofencingZonesLayerBuilder.java b/application/src/main/java/org/opentripplanner/inspector/vector/geofencing/GeofencingZonesLayerBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/vector/geofencing/GeofencingZonesLayerBuilder.java rename to application/src/main/java/org/opentripplanner/inspector/vector/geofencing/GeofencingZonesLayerBuilder.java diff --git a/src/main/java/org/opentripplanner/inspector/vector/geofencing/GeofencingZonesPropertyMapper.java b/application/src/main/java/org/opentripplanner/inspector/vector/geofencing/GeofencingZonesPropertyMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/vector/geofencing/GeofencingZonesPropertyMapper.java rename to application/src/main/java/org/opentripplanner/inspector/vector/geofencing/GeofencingZonesPropertyMapper.java diff --git a/src/main/java/org/opentripplanner/inspector/vector/stop/GroupStopLayerBuilder.java b/application/src/main/java/org/opentripplanner/inspector/vector/stop/GroupStopLayerBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/vector/stop/GroupStopLayerBuilder.java rename to application/src/main/java/org/opentripplanner/inspector/vector/stop/GroupStopLayerBuilder.java diff --git a/src/main/java/org/opentripplanner/inspector/vector/stop/StopLayerBuilder.java b/application/src/main/java/org/opentripplanner/inspector/vector/stop/StopLayerBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/vector/stop/StopLayerBuilder.java rename to application/src/main/java/org/opentripplanner/inspector/vector/stop/StopLayerBuilder.java diff --git a/src/main/java/org/opentripplanner/inspector/vector/stop/StopLocationPropertyMapper.java b/application/src/main/java/org/opentripplanner/inspector/vector/stop/StopLocationPropertyMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/vector/stop/StopLocationPropertyMapper.java rename to application/src/main/java/org/opentripplanner/inspector/vector/stop/StopLocationPropertyMapper.java diff --git a/src/main/java/org/opentripplanner/inspector/vector/vertex/VertexLayerBuilder.java b/application/src/main/java/org/opentripplanner/inspector/vector/vertex/VertexLayerBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/vector/vertex/VertexLayerBuilder.java rename to application/src/main/java/org/opentripplanner/inspector/vector/vertex/VertexLayerBuilder.java diff --git a/src/main/java/org/opentripplanner/inspector/vector/vertex/VertexPropertyMapper.java b/application/src/main/java/org/opentripplanner/inspector/vector/vertex/VertexPropertyMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/inspector/vector/vertex/VertexPropertyMapper.java rename to application/src/main/java/org/opentripplanner/inspector/vector/vertex/VertexPropertyMapper.java diff --git a/src/main/java/org/opentripplanner/kryo/BuildConfigSerializer.java b/application/src/main/java/org/opentripplanner/kryo/BuildConfigSerializer.java similarity index 100% rename from src/main/java/org/opentripplanner/kryo/BuildConfigSerializer.java rename to application/src/main/java/org/opentripplanner/kryo/BuildConfigSerializer.java diff --git a/src/main/java/org/opentripplanner/kryo/RouterConfigSerializer.java b/application/src/main/java/org/opentripplanner/kryo/RouterConfigSerializer.java similarity index 100% rename from src/main/java/org/opentripplanner/kryo/RouterConfigSerializer.java rename to application/src/main/java/org/opentripplanner/kryo/RouterConfigSerializer.java diff --git a/src/main/java/org/opentripplanner/kryo/UnmodifiableCollectionsSerializer.java b/application/src/main/java/org/opentripplanner/kryo/UnmodifiableCollectionsSerializer.java similarity index 100% rename from src/main/java/org/opentripplanner/kryo/UnmodifiableCollectionsSerializer.java rename to application/src/main/java/org/opentripplanner/kryo/UnmodifiableCollectionsSerializer.java diff --git a/src/main/java/org/opentripplanner/model/FeedInfo.java b/application/src/main/java/org/opentripplanner/model/FeedInfo.java similarity index 100% rename from src/main/java/org/opentripplanner/model/FeedInfo.java rename to application/src/main/java/org/opentripplanner/model/FeedInfo.java diff --git a/src/main/java/org/opentripplanner/model/Frequency.java b/application/src/main/java/org/opentripplanner/model/Frequency.java similarity index 100% rename from src/main/java/org/opentripplanner/model/Frequency.java rename to application/src/main/java/org/opentripplanner/model/Frequency.java diff --git a/src/main/java/org/opentripplanner/model/GenericLocation.java b/application/src/main/java/org/opentripplanner/model/GenericLocation.java similarity index 91% rename from src/main/java/org/opentripplanner/model/GenericLocation.java rename to application/src/main/java/org/opentripplanner/model/GenericLocation.java index 2b0ecc3f697..fd270741e92 100644 --- a/src/main/java/org/opentripplanner/model/GenericLocation.java +++ b/application/src/main/java/org/opentripplanner/model/GenericLocation.java @@ -17,23 +17,32 @@ public class GenericLocation { * A label for the place, if provided. This is pass-through information and does not affect * routing in any way. */ + @Nullable public final String label; /** * Refers to a specific element in the OTP model. This can currently be a regular stop, area stop, * group stop, station, multi-modal station or group of stations. */ + @Nullable public final FeedScopedId stopId; /** * Coordinates of the location. These can be used by themselves or as a fallback if placeId is not * found. */ + @Nullable public final Double lat; + @Nullable public final Double lng; - public GenericLocation(String label, FeedScopedId stopId, Double lat, Double lng) { + public GenericLocation( + @Nullable String label, + @Nullable FeedScopedId stopId, + @Nullable Double lat, + @Nullable Double lng + ) { this.label = label; this.stopId = stopId; this.lat = lat; diff --git a/src/main/java/org/opentripplanner/model/OtpTransitService.java b/application/src/main/java/org/opentripplanner/model/OtpTransitService.java similarity index 100% rename from src/main/java/org/opentripplanner/model/OtpTransitService.java rename to application/src/main/java/org/opentripplanner/model/OtpTransitService.java diff --git a/src/main/java/org/opentripplanner/model/PathTransfer.java b/application/src/main/java/org/opentripplanner/model/PathTransfer.java similarity index 100% rename from src/main/java/org/opentripplanner/model/PathTransfer.java rename to application/src/main/java/org/opentripplanner/model/PathTransfer.java diff --git a/src/main/java/org/opentripplanner/model/PickDrop.java b/application/src/main/java/org/opentripplanner/model/PickDrop.java similarity index 100% rename from src/main/java/org/opentripplanner/model/PickDrop.java rename to application/src/main/java/org/opentripplanner/model/PickDrop.java diff --git a/src/main/java/org/opentripplanner/model/RealTimeTripUpdate.java b/application/src/main/java/org/opentripplanner/model/RealTimeTripUpdate.java similarity index 100% rename from src/main/java/org/opentripplanner/model/RealTimeTripUpdate.java rename to application/src/main/java/org/opentripplanner/model/RealTimeTripUpdate.java diff --git a/src/main/java/org/opentripplanner/model/ShapePoint.java b/application/src/main/java/org/opentripplanner/model/ShapePoint.java similarity index 100% rename from src/main/java/org/opentripplanner/model/ShapePoint.java rename to application/src/main/java/org/opentripplanner/model/ShapePoint.java diff --git a/src/main/java/org/opentripplanner/model/StopTime.java b/application/src/main/java/org/opentripplanner/model/StopTime.java similarity index 100% rename from src/main/java/org/opentripplanner/model/StopTime.java rename to application/src/main/java/org/opentripplanner/model/StopTime.java diff --git a/src/main/java/org/opentripplanner/model/StopTimesInPattern.java b/application/src/main/java/org/opentripplanner/model/StopTimesInPattern.java similarity index 100% rename from src/main/java/org/opentripplanner/model/StopTimesInPattern.java rename to application/src/main/java/org/opentripplanner/model/StopTimesInPattern.java diff --git a/src/main/java/org/opentripplanner/model/SystemNotice.java b/application/src/main/java/org/opentripplanner/model/SystemNotice.java similarity index 100% rename from src/main/java/org/opentripplanner/model/SystemNotice.java rename to application/src/main/java/org/opentripplanner/model/SystemNotice.java diff --git a/src/main/java/org/opentripplanner/model/Timetable.java b/application/src/main/java/org/opentripplanner/model/Timetable.java similarity index 86% rename from src/main/java/org/opentripplanner/model/Timetable.java rename to application/src/main/java/org/opentripplanner/model/Timetable.java index 10c384e6211..6740e2cc99d 100644 --- a/src/main/java/org/opentripplanner/model/Timetable.java +++ b/application/src/main/java/org/opentripplanner/model/Timetable.java @@ -16,13 +16,11 @@ import java.time.LocalDate; import java.time.ZoneId; import java.util.ArrayList; +import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Optional; -import java.util.function.UnaryOperator; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.framework.time.ServiceDateUtils; import org.opentripplanner.transit.model.framework.DataValidationException; @@ -48,8 +46,7 @@ * one Timetable when stop time updates are being applied: one for the scheduled stop times, one for * each snapshot of updated stop times, another for a working buffer of updated stop times, etc. *

- * TODO OTP2 - Move this to package: org.opentripplanner.model after as Entur NeTEx PRs are merged. - * Also consider moving its dependencies into package org.opentripplanner.routing. The NEW + * TODO OTP2 consider moving dependencies into package org.opentripplanner.routing. The NEW * Timetable should not have any dependencies to [?] */ public class Timetable implements Serializable { @@ -58,28 +55,30 @@ public class Timetable implements Serializable { private final TripPattern pattern; - private final List tripTimes = new ArrayList<>(); + private final List tripTimes; - private final List frequencyEntries = new ArrayList<>(); + private final List frequencyEntries; @Nullable private final LocalDate serviceDate; + Timetable(TimetableBuilder timetableBuilder) { + this.pattern = timetableBuilder.getPattern(); + this.serviceDate = timetableBuilder.getServiceDate(); + this.tripTimes = timetableBuilder.createImmutableOrderedListOfTripTimes(); + this.frequencyEntries = List.copyOf(timetableBuilder.getFrequencies()); + } + /** Construct an empty Timetable. */ - public Timetable(TripPattern pattern) { - this.pattern = pattern; - this.serviceDate = null; + public static TimetableBuilder of() { + return new TimetableBuilder(); } /** - * Copy constructor: create an un-indexed Timetable with the same TripTimes as the specified - * timetable. + * Copy timetable into a builder witch can be used to modify the timetable. */ - Timetable(Timetable tt, @Nonnull LocalDate serviceDate) { - Objects.requireNonNull(serviceDate); - tripTimes.addAll(tt.tripTimes); - this.serviceDate = serviceDate; - this.pattern = tt.pattern; + public TimetableBuilder copyOf() { + return new TimetableBuilder(this); } /** @return the index of TripTimes for this trip ID in this particular Timetable */ @@ -134,17 +133,6 @@ public TripTimes getTripTimes(FeedScopedId tripId) { return null; } - /** - * Set new trip times for trip given a trip index - * - * @param tripIndex trip index of trip - * @param tt new trip times for trip - * @return old trip times of trip - */ - public TripTimes setTripTimes(int tripIndex, TripTimes tt) { - return tripTimes.set(tripIndex, tt); - } - /** * Apply the TripUpdate to the appropriate TripTimes from this Timetable. The existing TripTimes * must not be modified directly because they may be shared with the underlying @@ -386,44 +374,6 @@ public Result createUpdatedTripTimesFromGTFSRT( return Result.success(new TripTimesPatch(newTimes, skippedStopIndices)); } - /** - * Add a trip to this Timetable. The Timetable must be analyzed, compacted, and indexed any time - * trips are added, but this is not done automatically because it is time consuming and should - * only be done once after an entire batch of trips are added. Note that the trip is not added to - * the enclosing pattern here, but in the pattern's wrapper function. Here we don't know if it's a - * scheduled trip or a realtime-added trip. - */ - public void addTripTimes(TripTimes tt) { - tripTimes.add(tt); - } - - /** - * Apply the same update to all trip-times inculuding scheduled and frequency based - * trip times. - *

- * THIS IS NOT THREAD-SAFE - ONLY USE THIS METHOD DURING GRAPH-BUILD! - */ - public void updateAllTripTimes(UnaryOperator update) { - tripTimes.replaceAll(update); - frequencyEntries.replaceAll(it -> - new FrequencyEntry( - it.startTime, - it.endTime, - it.headway, - it.exactTimes, - update.apply(it.tripTimes) - ) - ); - } - - /** - * Add a frequency entry to this Timetable. See addTripTimes method. Maybe Frequency Entries - * should just be TripTimes for simplicity. - */ - public void addFrequencyEntry(FrequencyEntry freq) { - frequencyEntries.add(freq); - } - public boolean isValidFor(LocalDate serviceDate) { return this.serviceDate == null || this.serviceDate.equals(serviceDate); } @@ -473,21 +423,61 @@ public LocalDate getServiceDate() { } /** - * The direction for all the trips in this pattern. + * Return the direction for all the trips in this timetable. + * By construction, all trips in a timetable have the same direction. */ public Direction getDirection() { + return getDirection(tripTimes, frequencyEntries); + } + + /** + * Return an arbitrary TripTimes in this Timetable. + * Return a scheduled trip times if it exists, otherwise return a frequency-based trip times. + */ + public TripTimes getRepresentativeTripTimes() { + return getRepresentativeTripTimes(tripTimes, frequencyEntries); + } + + /** + * @return true if the timetable was created by a real-time update, false if this + * timetable is based on scheduled data. + * Only real-time timetables have a service date. + */ + public boolean isCreatedByRealTimeUpdater() { + return serviceDate != null; + } + + /** + * The direction for the given collections of trip times. + * The method assumes that all trip times have the same directions and picks up one arbitrarily. + * @param scheduledTripTimes all the scheduled-based trip times in a timetable. + * @param frequencies all the frequency-based trip times in a timetable. + */ + static Direction getDirection( + Collection scheduledTripTimes, + Collection frequencies + ) { return Optional - .ofNullable(getRepresentativeTripTimes()) + .ofNullable(getRepresentativeTripTimes(scheduledTripTimes, frequencies)) .map(TripTimes::getTrip) .map(Trip::getDirection) .orElse(Direction.UNKNOWN); } - public TripTimes getRepresentativeTripTimes() { - if (!getTripTimes().isEmpty()) { - return getTripTimes(0); - } else if (!getFrequencyEntries().isEmpty()) { - return getFrequencyEntries().get(0).tripTimes; + /** + * Return an arbitrary TripTimes. + * @param scheduledTripTimes all the scheduled-based trip times in a timetable. + * @param frequencies all the frequency-based trip times in a timetable. + * + */ + private static TripTimes getRepresentativeTripTimes( + Collection scheduledTripTimes, + Collection frequencies + ) { + if (!scheduledTripTimes.isEmpty()) { + return scheduledTripTimes.iterator().next(); + } else if (!frequencies.isEmpty()) { + return frequencies.iterator().next().tripTimes; } else { // Pattern is created only for real-time updates return null; diff --git a/application/src/main/java/org/opentripplanner/model/TimetableBuilder.java b/application/src/main/java/org/opentripplanner/model/TimetableBuilder.java new file mode 100644 index 00000000000..74e89d0d973 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/model/TimetableBuilder.java @@ -0,0 +1,136 @@ +package org.opentripplanner.model; + +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.UnaryOperator; +import org.opentripplanner.transit.model.framework.FeedScopedId; +import org.opentripplanner.transit.model.network.TripPattern; +import org.opentripplanner.transit.model.timetable.Direction; +import org.opentripplanner.transit.model.timetable.FrequencyEntry; +import org.opentripplanner.transit.model.timetable.TripTimes; + +public class TimetableBuilder { + + private TripPattern pattern; + private LocalDate serviceDate; + private final Map tripTimes = new HashMap<>(); + private final List frequencies = new ArrayList<>(); + + TimetableBuilder() {} + + TimetableBuilder(Timetable tt) { + pattern = tt.getPattern(); + serviceDate = tt.getServiceDate(); + frequencies.addAll(tt.getFrequencyEntries()); + addAllTripTimes(tt.getTripTimes()); + } + + public TimetableBuilder withTripPattern(TripPattern tripPattern) { + this.pattern = tripPattern; + return this; + } + + public TimetableBuilder withServiceDate(LocalDate serviceDate) { + this.serviceDate = serviceDate; + return this; + } + + /** + * Add a new trip-times to the timetable. If the associated trip already exists, an exception is + * thrown. This is considered a programming error. Use {@link #addOrUpdateTripTimes(TripTimes)} + * if you want to replace an existing trip. + */ + public TimetableBuilder addTripTimes(TripTimes tripTimes) { + var trip = tripTimes.getTrip(); + if (this.tripTimes.containsKey(trip.getId())) { + throw new IllegalStateException( + "Error! TripTimes for the same trip is added twice. Trip: " + trip + ); + } + return addOrUpdateTripTimes(tripTimes); + } + + /** + * Add or update the trip-times. If the trip has an associated trip-times, then the trip-times + * are replaced. If not, the trip-times it is added. Consider using + * {@link #addTripTimes(TripTimes)}. + */ + public TimetableBuilder addOrUpdateTripTimes(TripTimes tripTimes) { + this.tripTimes.put(tripTimes.getTrip().getId(), tripTimes); + return this; + } + + public TimetableBuilder addAllTripTimes(List tripTimes) { + for (TripTimes it : tripTimes) { + addTripTimes(it); + } + return this; + } + + public TimetableBuilder removeTripTimes(TripTimes tripTimesToRemove) { + tripTimes.remove(tripTimesToRemove.getTrip().getId()); + return this; + } + + public TimetableBuilder removeAllTripTimes(Collection tripTimesToBeRemoved) { + for (TripTimes it : tripTimesToBeRemoved) { + tripTimes.remove(it.getTrip().getId()); + } + return this; + } + + /** + * Apply the same update to all trip-times including scheduled and frequency based + * trip times. + *

+ */ + public TimetableBuilder updateAllTripTimes(UnaryOperator update) { + tripTimes.replaceAll((t, tt) -> update.apply(tt)); + frequencies.replaceAll(it -> + new FrequencyEntry( + it.startTime, + it.endTime, + it.headway, + it.exactTimes, + update.apply(it.tripTimes) + ) + ); + return this; + } + + public TimetableBuilder addFrequencyEntry(FrequencyEntry frequencyEntry) { + this.frequencies.add(frequencyEntry); + return this; + } + + /** + * The direction for all the trips in this timetable. + */ + public Direction getDirection() { + return Timetable.getDirection(tripTimes.values(), frequencies); + } + + public Timetable build() { + return new Timetable(this); + } + + List createImmutableOrderedListOfTripTimes() { + return tripTimes.values().stream().sorted().toList(); + } + + TripPattern getPattern() { + return pattern; + } + + LocalDate getServiceDate() { + return serviceDate; + } + + List getFrequencies() { + return frequencies; + } +} diff --git a/src/main/java/org/opentripplanner/model/TimetableSnapshot.java b/application/src/main/java/org/opentripplanner/model/TimetableSnapshot.java similarity index 84% rename from src/main/java/org/opentripplanner/model/TimetableSnapshot.java rename to application/src/main/java/org/opentripplanner/model/TimetableSnapshot.java index d076bf9f1f0..6b1190a66b3 100644 --- a/src/main/java/org/opentripplanner/model/TimetableSnapshot.java +++ b/application/src/main/java/org/opentripplanner/model/TimetableSnapshot.java @@ -110,9 +110,12 @@ public class TimetableSnapshot { * For cases where the trip pattern (sequence of stops visited) has been changed by a realtime * update, a Map associating the updated trip pattern with a compound key of the feed-scoped * trip ID and the service date. + * This index includes only modified trip patterns for existing trips. + * It does not include trip patterns for new trips created by real-time updates (extra journeys). + * . * TODO RT_AB: clarify if this is an index or the original source of truth. */ - private final Map realtimeAddedTripPattern; + private final Map realTimeNewTripPatternsForModifiedTrips; /** * This is an index of TripPatterns, not the primary collection. It tracks which TripPatterns @@ -124,6 +127,11 @@ public class TimetableSnapshot { */ private final SetMultimap patternsForStop; + /** + * The realTimeAdded* maps are indexes on the trips created at runtime (extra-journey), and the + * Route, TripPattern, TripOnServiceDate they refer to. + * They are meant to override the corresponding indexes in TransitModelIndex. + */ private final Map realtimeAddedRoutes; private final Map realTimeAddedTrips; private final Map realTimeAddedPatternForTrip; @@ -160,7 +168,7 @@ public TimetableSnapshot() { private TimetableSnapshot( Map> timetables, - Map realtimeAddedTripPattern, + Map realTimeNewTripPatternsForModifiedTrips, Map realtimeAddedRoutes, Map realtimeAddedTrips, Map realTimeAddedPatternForTrip, @@ -171,7 +179,7 @@ private TimetableSnapshot( boolean readOnly ) { this.timetables = timetables; - this.realtimeAddedTripPattern = realtimeAddedTripPattern; + this.realTimeNewTripPatternsForModifiedTrips = realTimeNewTripPatternsForModifiedTrips; this.realtimeAddedRoutes = realtimeAddedRoutes; this.realTimeAddedTrips = realtimeAddedTrips; this.realTimeAddedPatternForTrip = realTimeAddedPatternForTrip; @@ -207,16 +215,16 @@ public Timetable resolve(TripPattern pattern, LocalDate serviceDate) { * @return trip pattern created by the updater; null if trip is on the original trip pattern */ @Nullable - public TripPattern getRealtimeAddedTripPattern(FeedScopedId tripId, LocalDate serviceDate) { + public TripPattern getNewTripPatternForModifiedTrip(FeedScopedId tripId, LocalDate serviceDate) { TripIdAndServiceDate tripIdAndServiceDate = new TripIdAndServiceDate(tripId, serviceDate); - return realtimeAddedTripPattern.get(tripIdAndServiceDate); + return realTimeNewTripPatternsForModifiedTrips.get(tripIdAndServiceDate); } /** - * @return if any trip patterns were added. + * @return if any trip patterns were modified */ - public boolean hasRealtimeAddedTripPatterns() { - return !realtimeAddedTripPattern.isEmpty(); + public boolean hasNewTripPatternsForModifiedTrips() { + return !realTimeNewTripPatternsForModifiedTrips.isEmpty(); } /** @@ -227,7 +235,7 @@ public Route getRealtimeAddedRoute(FeedScopedId id) { return getByNullableKey(id, realtimeAddedRoutes); } - public Collection getAllRealTimeAddedRoutes() { + public Collection listRealTimeAddedRoutes() { return Collections.unmodifiableCollection(realtimeAddedRoutes.values()); } @@ -239,7 +247,7 @@ public Trip getRealTimeAddedTrip(FeedScopedId id) { return getByNullableKey(id, realTimeAddedTrips); } - public Collection getAllRealTimeAddedTrips() { + public Collection listRealTimeAddedTrips() { return Collections.unmodifiableCollection(realTimeAddedTrips.values()); } @@ -276,7 +284,7 @@ public TripOnServiceDate getRealTimeAddedTripOnServiceDateForTripAndDay( return getByNullableKey(tripIdAndServiceDate, realTimeAddedTripOnServiceDateForTripAndDay); } - public Collection getAllRealTimeAddedTripOnServiceDate() { + public Collection listRealTimeAddedTripOnServiceDate() { return Collections.unmodifiableCollection(realTimeAddedTripOnServiceDateForTripAndDay.values()); } @@ -289,36 +297,27 @@ public Collection getAllRealTimeAddedTripOnServiceD * @return whether the update was actually applied */ public Result update(RealTimeTripUpdate realTimeTripUpdate) { + validateNotReadOnly(); + TripPattern pattern = realTimeTripUpdate.pattern(); LocalDate serviceDate = realTimeTripUpdate.serviceDate(); TripTimes updatedTripTimes = realTimeTripUpdate.updatedTripTimes(); - if (readOnly) { - throw new ConcurrentModificationException("This TimetableSnapshot is read-only."); - } - Timetable tt = resolve(pattern, serviceDate); - // we need to perform the copy of Timetable here rather than in Timetable.update() - // to avoid repeatedly copying in case several updates are applied to the same timetable - tt = copyTimetable(pattern, serviceDate, tt); + TimetableBuilder ttb = tt.copyOf().withServiceDate(serviceDate); // Assume all trips in a pattern are from the same feed, which should be the case. - // Find trip index - Trip trip = updatedTripTimes.getTrip(); - int tripIndex = tt.getTripIndex(trip.getId()); - if (tripIndex == -1) { - // Trip not found, add it - tt.addTripTimes(updatedTripTimes); - } else { - // Set updated trip times of trip - tt.setTripTimes(tripIndex, updatedTripTimes); - } + ttb.addOrUpdateTripTimes(updatedTripTimes); + Timetable updated = ttb.build(); + swapTimetable(pattern, tt, updated); + + Trip trip = updatedTripTimes.getTrip(); if (pattern.isCreatedByRealtimeUpdater()) { // Remember this pattern for the added trip id and service date FeedScopedId tripId = trip.getId(); TripIdAndServiceDate tripIdAndServiceDate = new TripIdAndServiceDate(tripId, serviceDate); - realtimeAddedTripPattern.put(tripIdAndServiceDate, pattern); + realTimeNewTripPatternsForModifiedTrips.put(tripIdAndServiceDate, pattern); } // To make these trip patterns visible for departureRow searches. @@ -364,18 +363,15 @@ public TimetableSnapshot commit() { return commit(null, false); } - @SuppressWarnings("unchecked") public TimetableSnapshot commit(TransitLayerUpdater transitLayerUpdater, boolean force) { - if (readOnly) { - throw new ConcurrentModificationException("This TimetableSnapshot is read-only."); - } + validateNotReadOnly(); if (!force && !this.isDirty()) { return null; } TimetableSnapshot ret = new TimetableSnapshot( Map.copyOf(timetables), - Map.copyOf(realtimeAddedTripPattern), + Map.copyOf(realTimeNewTripPatternsForModifiedTrips), Map.copyOf(realtimeAddedRoutes), Map.copyOf(realTimeAddedTrips), Map.copyOf(realTimeAddedPatternForTrip), @@ -402,15 +398,14 @@ public TimetableSnapshot commit(TransitLayerUpdater transitLayerUpdater, boolean * @param feedId feed id to clear the snapshot for */ public void clear(String feedId) { - if (readOnly) { - throw new ConcurrentModificationException("This TimetableSnapshot is read-only."); - } + validateNotReadOnly(); // Clear all data from snapshot. - boolean timetableWasModified = clearTimetable(feedId); - boolean realtimeAddedWasModified = clearRealtimeAddedTripPattern(feedId); - + boolean timetablesWereCleared = clearTimetables(feedId); + boolean newTripPatternsForModifiedTripsWereCleared = clearNewTripPatternsForModifiedTrips( + feedId + ); // If this snapshot was modified, it will be dirty after the clear actions. - if (timetableWasModified || realtimeAddedWasModified) { + if (timetablesWereCleared || newTripPatternsForModifiedTripsWereCleared) { dirty = true; } } @@ -427,17 +422,15 @@ public void clear(String feedId) { * message and an attempt was made to re-associate it with its originally scheduled trip pattern. */ public boolean revertTripToScheduledTripPattern(FeedScopedId tripId, LocalDate serviceDate) { - if (readOnly) { - throw new ConcurrentModificationException("This TimetableSnapshot is read-only."); - } + validateNotReadOnly(); boolean success = false; - final TripPattern pattern = getRealtimeAddedTripPattern(tripId, serviceDate); + final TripPattern pattern = getNewTripPatternForModifiedTrip(tripId, serviceDate); if (pattern != null) { // Dissociate the given trip from any realtime-added pattern. // The trip will then fall back to its original scheduled pattern. - realtimeAddedTripPattern.remove(new TripIdAndServiceDate(tripId, serviceDate)); + realTimeNewTripPatternsForModifiedTrips.remove(new TripIdAndServiceDate(tripId, serviceDate)); // Remove times for the trip from any timetables // under that now-obsolete realtime-added pattern. SortedSet sortedTimetables = this.timetables.get(pattern); @@ -459,8 +452,11 @@ public boolean revertTripToScheduledTripPattern(FeedScopedId tripId, LocalDate s if (tripTimesToRemove != null) { for (Timetable originalTimetable : sortedTimetables) { if (originalTimetable.getTripTimes().contains(tripTimesToRemove)) { - Timetable updatedTimetable = copyTimetable(pattern, serviceDate, originalTimetable); - updatedTimetable.getTripTimes().remove(tripTimesToRemove); + Timetable updatedTimetable = originalTimetable + .copyOf() + .removeTripTimes(tripTimesToRemove) + .build(); + swapTimetable(pattern, originalTimetable, updatedTimetable); } } } @@ -477,9 +473,7 @@ public boolean revertTripToScheduledTripPattern(FeedScopedId tripId, LocalDate s * @return true if any data has been modified and false if no purging has happened. */ public boolean purgeExpiredData(LocalDate serviceDate) { - if (readOnly) { - throw new ConcurrentModificationException("This TimetableSnapshot is read-only."); - } + validateNotReadOnly(); boolean modified = false; for (Iterator it = timetables.keySet().iterator(); it.hasNext();) { @@ -487,7 +481,7 @@ public boolean purgeExpiredData(LocalDate serviceDate) { SortedSet sortedTimetables = timetables.get(pattern); SortedSet toKeepTimetables = new TreeSet<>(new SortedTimetableComparator()); for (Timetable timetable : sortedTimetables) { - if (serviceDate.compareTo(timetable.getServiceDate()) < 0) { + if (serviceDate.isBefore(timetable.getServiceDate())) { toKeepTimetables.add(timetable); } else { modified = true; @@ -503,13 +497,13 @@ public boolean purgeExpiredData(LocalDate serviceDate) { // Also remove last added trip pattern for days that are purged for ( - Iterator> iterator = realtimeAddedTripPattern + Iterator> iterator = realTimeNewTripPatternsForModifiedTrips .entrySet() .iterator(); iterator.hasNext(); ) { TripIdAndServiceDate tripIdAndServiceDate = iterator.next().getKey(); - if (serviceDate.compareTo(tripIdAndServiceDate.serviceDate()) >= 0) { + if (!serviceDate.isBefore(tripIdAndServiceDate.serviceDate())) { iterator.remove(); modified = true; } @@ -538,7 +532,11 @@ public Collection getPatternsForStop(StopLocation stop) { * Does this snapshot contain any realtime data or is it completely empty? */ public boolean isEmpty() { - return dirtyTimetables.isEmpty() && timetables.isEmpty() && realtimeAddedTripPattern.isEmpty(); + return ( + dirtyTimetables.isEmpty() && + timetables.isEmpty() && + realTimeNewTripPatternsForModifiedTrips.isEmpty() + ); } /** @@ -547,7 +545,7 @@ public boolean isEmpty() { * @param feedId feed id to clear out * @return true if the timetable changed as a result of the call */ - private boolean clearTimetable(String feedId) { + private boolean clearTimetables(String feedId) { return timetables.keySet().removeIf(tripPattern -> feedId.equals(tripPattern.getFeedId())); } @@ -555,14 +553,12 @@ private boolean clearTimetable(String feedId) { * Clear all realtime added trip patterns matching the provided feed id. * * @param feedId feed id to clear out - * @return true if the realtimeAddedTripPattern changed as a result of the call + * @return true if the newTripPatternForModifiedTrip changed as a result of the call */ - private boolean clearRealtimeAddedTripPattern(String feedId) { - return realtimeAddedTripPattern + private boolean clearNewTripPatternsForModifiedTrips(String feedId) { + return realTimeNewTripPatternsForModifiedTrips .keySet() - .removeIf(realtimeAddedTripPattern -> - feedId.equals(realtimeAddedTripPattern.tripId().getFeedId()) - ); + .removeIf(tripIdAndServiceDate -> feedId.equals(tripIdAndServiceDate.tripId().getFeedId())); } /** @@ -579,36 +575,39 @@ private void addPatternToIndex(TripPattern tripPattern) { } /** - * Make a copy of the given timetable for a given pattern and service date. - * If the timetable was already copied-on write in this snapshot, the same instance will be - * returned. The SortedSet that holds the collection of Timetables for that pattern + * Replace the original Timetable by the updated one in the timetable index. + * The SortedSet that holds the collection of Timetables for that pattern * (sorted by service date) is shared between multiple snapshots and must be copied as well.
* Note on performance: if multiple Timetables are modified in a SortedSet, the SortedSet will be * copied multiple times. The impact on memory/garbage collection is assumed to be minimal * since the collection is small. * The SortedSet is made immutable to prevent change after snapshot publication. */ - private Timetable copyTimetable(TripPattern pattern, LocalDate serviceDate, Timetable tt) { - if (!dirtyTimetables.contains(tt)) { - Timetable old = tt; - tt = new Timetable(tt, serviceDate); - SortedSet sortedTimetables = timetables.get(pattern); - if (sortedTimetables == null) { - sortedTimetables = new TreeSet<>(new SortedTimetableComparator()); - } else { - SortedSet temp = new TreeSet<>(new SortedTimetableComparator()); - temp.addAll(sortedTimetables); - sortedTimetables = temp; - } - if (old.getServiceDate() != null) { - sortedTimetables.remove(old); - } - sortedTimetables.add(tt); - timetables.put(pattern, ImmutableSortedSet.copyOfSorted(sortedTimetables)); - dirtyTimetables.add(tt); - dirty = true; + private void swapTimetable(TripPattern pattern, Timetable original, Timetable updated) { + SortedSet sortedTimetables = timetables.get(pattern); + if (sortedTimetables == null) { + sortedTimetables = new TreeSet<>(new SortedTimetableComparator()); + } else { + SortedSet temp = new TreeSet<>(new SortedTimetableComparator()); + temp.addAll(sortedTimetables); + sortedTimetables = temp; + } + // This is a minor optimization: + // Since sortedTimetables contains only timetables created in real-time, no need to try to + // remove the original if it was not created by real-time. + if (original.isCreatedByRealTimeUpdater()) { + sortedTimetables.remove(original); + } + sortedTimetables.add(updated); + timetables.put(pattern, ImmutableSortedSet.copyOfSorted(sortedTimetables)); + dirtyTimetables.add(updated); + dirty = true; + } + + private void validateNotReadOnly() { + if (readOnly) { + throw new ConcurrentModificationException("This TimetableSnapshot is read-only."); } - return tt; } protected static class SortedTimetableComparator implements Comparator { diff --git a/src/main/java/org/opentripplanner/model/TimetableSnapshotProvider.java b/application/src/main/java/org/opentripplanner/model/TimetableSnapshotProvider.java similarity index 100% rename from src/main/java/org/opentripplanner/model/TimetableSnapshotProvider.java rename to application/src/main/java/org/opentripplanner/model/TimetableSnapshotProvider.java diff --git a/src/main/java/org/opentripplanner/model/TripStopTimes.java b/application/src/main/java/org/opentripplanner/model/TripStopTimes.java similarity index 100% rename from src/main/java/org/opentripplanner/model/TripStopTimes.java rename to application/src/main/java/org/opentripplanner/model/TripStopTimes.java diff --git a/src/main/java/org/opentripplanner/model/TripTimeOnDate.java b/application/src/main/java/org/opentripplanner/model/TripTimeOnDate.java similarity index 100% rename from src/main/java/org/opentripplanner/model/TripTimeOnDate.java rename to application/src/main/java/org/opentripplanner/model/TripTimeOnDate.java diff --git a/src/main/java/org/opentripplanner/model/TripTimesPatch.java b/application/src/main/java/org/opentripplanner/model/TripTimesPatch.java similarity index 100% rename from src/main/java/org/opentripplanner/model/TripTimesPatch.java rename to application/src/main/java/org/opentripplanner/model/TripTimesPatch.java diff --git a/src/main/java/org/opentripplanner/model/calendar/CalendarService.java b/application/src/main/java/org/opentripplanner/model/calendar/CalendarService.java similarity index 100% rename from src/main/java/org/opentripplanner/model/calendar/CalendarService.java rename to application/src/main/java/org/opentripplanner/model/calendar/CalendarService.java diff --git a/src/main/java/org/opentripplanner/model/calendar/CalendarServiceData.java b/application/src/main/java/org/opentripplanner/model/calendar/CalendarServiceData.java similarity index 100% rename from src/main/java/org/opentripplanner/model/calendar/CalendarServiceData.java rename to application/src/main/java/org/opentripplanner/model/calendar/CalendarServiceData.java diff --git a/src/main/java/org/opentripplanner/model/calendar/ServiceCalendar.java b/application/src/main/java/org/opentripplanner/model/calendar/ServiceCalendar.java similarity index 100% rename from src/main/java/org/opentripplanner/model/calendar/ServiceCalendar.java rename to application/src/main/java/org/opentripplanner/model/calendar/ServiceCalendar.java diff --git a/src/main/java/org/opentripplanner/model/calendar/ServiceCalendarDate.java b/application/src/main/java/org/opentripplanner/model/calendar/ServiceCalendarDate.java similarity index 100% rename from src/main/java/org/opentripplanner/model/calendar/ServiceCalendarDate.java rename to application/src/main/java/org/opentripplanner/model/calendar/ServiceCalendarDate.java diff --git a/src/main/java/org/opentripplanner/model/calendar/ServiceDateInterval.java b/application/src/main/java/org/opentripplanner/model/calendar/ServiceDateInterval.java similarity index 98% rename from src/main/java/org/opentripplanner/model/calendar/ServiceDateInterval.java rename to application/src/main/java/org/opentripplanner/model/calendar/ServiceDateInterval.java index 5d2657912fc..a879f6c790e 100644 --- a/src/main/java/org/opentripplanner/model/calendar/ServiceDateInterval.java +++ b/application/src/main/java/org/opentripplanner/model/calendar/ServiceDateInterval.java @@ -6,7 +6,6 @@ import java.time.LocalDate; import java.time.temporal.ChronoUnit; import java.util.Objects; -import javax.annotation.Nonnull; import org.opentripplanner.framework.time.ServiceDateUtils; /** @@ -52,7 +51,6 @@ public boolean isUnbounded() { * Return the interval start, inclusive. If the period start is unbounded the {@link * LocalDate#MIN} is returned. */ - @Nonnull public LocalDate getStart() { return start; } @@ -61,7 +59,6 @@ public LocalDate getStart() { * Return the interval end, inclusive. If the period start is unbounded the {@link * LocalDate#MAX} is returned. */ - @Nonnull public LocalDate getEnd() { return end; } diff --git a/src/main/java/org/opentripplanner/model/calendar/impl/CalendarServiceDataFactoryImpl.java b/application/src/main/java/org/opentripplanner/model/calendar/impl/CalendarServiceDataFactoryImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/model/calendar/impl/CalendarServiceDataFactoryImpl.java rename to application/src/main/java/org/opentripplanner/model/calendar/impl/CalendarServiceDataFactoryImpl.java diff --git a/src/main/java/org/opentripplanner/model/calendar/impl/CalendarServiceImpl.java b/application/src/main/java/org/opentripplanner/model/calendar/impl/CalendarServiceImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/model/calendar/impl/CalendarServiceImpl.java rename to application/src/main/java/org/opentripplanner/model/calendar/impl/CalendarServiceImpl.java diff --git a/src/main/java/org/opentripplanner/model/calendar/impl/MultipleCalendarsForServiceIdException.java b/application/src/main/java/org/opentripplanner/model/calendar/impl/MultipleCalendarsForServiceIdException.java similarity index 100% rename from src/main/java/org/opentripplanner/model/calendar/impl/MultipleCalendarsForServiceIdException.java rename to application/src/main/java/org/opentripplanner/model/calendar/impl/MultipleCalendarsForServiceIdException.java diff --git a/src/main/java/org/opentripplanner/model/calendar/impl/UnknownAgencyTimezoneException.java b/application/src/main/java/org/opentripplanner/model/calendar/impl/UnknownAgencyTimezoneException.java similarity index 100% rename from src/main/java/org/opentripplanner/model/calendar/impl/UnknownAgencyTimezoneException.java rename to application/src/main/java/org/opentripplanner/model/calendar/impl/UnknownAgencyTimezoneException.java diff --git a/src/main/java/org/opentripplanner/model/calendar/openinghours/OHCalendar.java b/application/src/main/java/org/opentripplanner/model/calendar/openinghours/OHCalendar.java similarity index 100% rename from src/main/java/org/opentripplanner/model/calendar/openinghours/OHCalendar.java rename to application/src/main/java/org/opentripplanner/model/calendar/openinghours/OHCalendar.java diff --git a/src/main/java/org/opentripplanner/model/calendar/openinghours/OHCalendarBuilder.java b/application/src/main/java/org/opentripplanner/model/calendar/openinghours/OHCalendarBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/model/calendar/openinghours/OHCalendarBuilder.java rename to application/src/main/java/org/opentripplanner/model/calendar/openinghours/OHCalendarBuilder.java diff --git a/src/main/java/org/opentripplanner/model/calendar/openinghours/OHSearchContext.java b/application/src/main/java/org/opentripplanner/model/calendar/openinghours/OHSearchContext.java similarity index 100% rename from src/main/java/org/opentripplanner/model/calendar/openinghours/OHSearchContext.java rename to application/src/main/java/org/opentripplanner/model/calendar/openinghours/OHSearchContext.java diff --git a/src/main/java/org/opentripplanner/model/calendar/openinghours/OpeningHours.java b/application/src/main/java/org/opentripplanner/model/calendar/openinghours/OpeningHours.java similarity index 100% rename from src/main/java/org/opentripplanner/model/calendar/openinghours/OpeningHours.java rename to application/src/main/java/org/opentripplanner/model/calendar/openinghours/OpeningHours.java diff --git a/src/main/java/org/opentripplanner/model/calendar/openinghours/OpeningHoursCalendarService.java b/application/src/main/java/org/opentripplanner/model/calendar/openinghours/OpeningHoursCalendarService.java similarity index 100% rename from src/main/java/org/opentripplanner/model/calendar/openinghours/OpeningHoursCalendarService.java rename to application/src/main/java/org/opentripplanner/model/calendar/openinghours/OpeningHoursCalendarService.java diff --git a/src/main/java/org/opentripplanner/model/calendar/openinghours/OsmOpeningHoursSupport.java b/application/src/main/java/org/opentripplanner/model/calendar/openinghours/OsmOpeningHoursSupport.java similarity index 100% rename from src/main/java/org/opentripplanner/model/calendar/openinghours/OsmOpeningHoursSupport.java rename to application/src/main/java/org/opentripplanner/model/calendar/openinghours/OsmOpeningHoursSupport.java diff --git a/src/main/java/org/opentripplanner/model/fare/FareMedium.java b/application/src/main/java/org/opentripplanner/model/fare/FareMedium.java similarity index 100% rename from src/main/java/org/opentripplanner/model/fare/FareMedium.java rename to application/src/main/java/org/opentripplanner/model/fare/FareMedium.java diff --git a/src/main/java/org/opentripplanner/model/fare/FareProduct.java b/application/src/main/java/org/opentripplanner/model/fare/FareProduct.java similarity index 100% rename from src/main/java/org/opentripplanner/model/fare/FareProduct.java rename to application/src/main/java/org/opentripplanner/model/fare/FareProduct.java diff --git a/src/main/java/org/opentripplanner/model/fare/FareProductBuilder.java b/application/src/main/java/org/opentripplanner/model/fare/FareProductBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/model/fare/FareProductBuilder.java rename to application/src/main/java/org/opentripplanner/model/fare/FareProductBuilder.java diff --git a/src/main/java/org/opentripplanner/model/fare/FareProductUse.java b/application/src/main/java/org/opentripplanner/model/fare/FareProductUse.java similarity index 100% rename from src/main/java/org/opentripplanner/model/fare/FareProductUse.java rename to application/src/main/java/org/opentripplanner/model/fare/FareProductUse.java diff --git a/src/main/java/org/opentripplanner/model/fare/ItineraryFares.java b/application/src/main/java/org/opentripplanner/model/fare/ItineraryFares.java similarity index 100% rename from src/main/java/org/opentripplanner/model/fare/ItineraryFares.java rename to application/src/main/java/org/opentripplanner/model/fare/ItineraryFares.java diff --git a/src/main/java/org/opentripplanner/model/fare/RiderCategory.java b/application/src/main/java/org/opentripplanner/model/fare/RiderCategory.java similarity index 70% rename from src/main/java/org/opentripplanner/model/fare/RiderCategory.java rename to application/src/main/java/org/opentripplanner/model/fare/RiderCategory.java index 43f777cd31a..df68d3a8ce6 100644 --- a/src/main/java/org/opentripplanner/model/fare/RiderCategory.java +++ b/application/src/main/java/org/opentripplanner/model/fare/RiderCategory.java @@ -1,13 +1,12 @@ package org.opentripplanner.model.fare; import java.util.Objects; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.framework.lang.Sandbox; import org.opentripplanner.transit.model.framework.FeedScopedId; @Sandbox -public record RiderCategory(@Nonnull FeedScopedId id, @Nonnull String name, @Nullable String url) { +public record RiderCategory(FeedScopedId id, String name, @Nullable String url) { public RiderCategory { Objects.requireNonNull(id); Objects.requireNonNull(name); diff --git a/src/main/java/org/opentripplanner/model/impl/OtpTransitServiceBuilder.java b/application/src/main/java/org/opentripplanner/model/impl/OtpTransitServiceBuilder.java similarity index 92% rename from src/main/java/org/opentripplanner/model/impl/OtpTransitServiceBuilder.java rename to application/src/main/java/org/opentripplanner/model/impl/OtpTransitServiceBuilder.java index 373b99f0bc6..d62d0331a34 100644 --- a/src/main/java/org/opentripplanner/model/impl/OtpTransitServiceBuilder.java +++ b/application/src/main/java/org/opentripplanner/model/impl/OtpTransitServiceBuilder.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.stream.Collectors; import org.opentripplanner.ext.flex.trip.FlexTrip; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.gtfs.mapping.StaySeatedNotAllowed; @@ -15,6 +16,7 @@ import org.opentripplanner.model.Frequency; import org.opentripplanner.model.OtpTransitService; import org.opentripplanner.model.ShapePoint; +import org.opentripplanner.model.Timetable; import org.opentripplanner.model.TripStopTimes; import org.opentripplanner.model.calendar.CalendarServiceData; import org.opentripplanner.model.calendar.ServiceCalendar; @@ -51,6 +53,7 @@ import org.opentripplanner.transit.model.site.Station; import org.opentripplanner.transit.model.timetable.Trip; import org.opentripplanner.transit.model.timetable.TripOnServiceDate; +import org.opentripplanner.transit.model.timetable.TripTimes; import org.opentripplanner.transit.service.StopModel; import org.opentripplanner.transit.service.StopModelBuilder; import org.slf4j.Logger; @@ -375,21 +378,40 @@ private void removeStopTimesForNoneExistingTrips() { private void fixOrRemovePatternsWhichReferenceNoneExistingTrips() { int orgSize = tripPatterns.size(); List> removePatterns = new ArrayList<>(); + List updatedPatterns = new ArrayList<>(); for (Map.Entry e : tripPatterns.entries()) { TripPattern ptn = e.getValue(); - ptn.removeTrips(t -> !tripsById.containsKey(t.getId())); - if (ptn.scheduledTripsAsStream().findAny().isEmpty()) { + Set tripTimesToBeRemoved = ptn + .getScheduledTimetable() + .getTripTimes() + .stream() + .filter(tripTimes -> !tripsById.containsKey(tripTimes.getTrip().getId())) + .collect(Collectors.toUnmodifiableSet()); + if (!tripTimesToBeRemoved.isEmpty()) { removePatterns.add(e); + Timetable updatedTimetable = ptn + .getScheduledTimetable() + .copyOf() + .removeAllTripTimes(tripTimesToBeRemoved) + .build(); + TripPattern updatedPattern = ptn.copy().withScheduledTimeTable(updatedTimetable).build(); + if (!updatedTimetable.getTripTimes().isEmpty()) { + updatedPatterns.add(updatedPattern); + } else { + issueStore.add( + "RemovedEmptyTripPattern", + "Removed trip pattern %s as it contains no trips", + updatedPattern.getId() + ); + } } } for (Map.Entry it : removePatterns) { tripPatterns.remove(it.getKey(), it.getValue()); - issueStore.add( - "RemovedEmptyTripPattern", - "Removed trip pattern %s as it contains no trips", - it.getValue().getId() - ); + } + for (TripPattern tripPattern : updatedPatterns) { + tripPatterns.put(tripPattern.getStopPattern(), tripPattern); } logRemove("TripPattern", orgSize, tripPatterns.size(), "No trips for pattern exist."); } diff --git a/src/main/java/org/opentripplanner/model/impl/OtpTransitServiceImpl.java b/application/src/main/java/org/opentripplanner/model/impl/OtpTransitServiceImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/model/impl/OtpTransitServiceImpl.java rename to application/src/main/java/org/opentripplanner/model/impl/OtpTransitServiceImpl.java diff --git a/src/main/java/org/opentripplanner/model/modes/AllowAllModesFilter.java b/application/src/main/java/org/opentripplanner/model/modes/AllowAllModesFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/model/modes/AllowAllModesFilter.java rename to application/src/main/java/org/opentripplanner/model/modes/AllowAllModesFilter.java diff --git a/src/main/java/org/opentripplanner/model/modes/AllowMainAndSubModeFilter.java b/application/src/main/java/org/opentripplanner/model/modes/AllowMainAndSubModeFilter.java similarity index 89% rename from src/main/java/org/opentripplanner/model/modes/AllowMainAndSubModeFilter.java rename to application/src/main/java/org/opentripplanner/model/modes/AllowMainAndSubModeFilter.java index ec197522590..1b34acd5327 100644 --- a/src/main/java/org/opentripplanner/model/modes/AllowMainAndSubModeFilter.java +++ b/application/src/main/java/org/opentripplanner/model/modes/AllowMainAndSubModeFilter.java @@ -1,7 +1,6 @@ package org.opentripplanner.model.modes; import java.util.Objects; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.framework.tostring.ToStringBuilder; import org.opentripplanner.transit.model.basic.MainAndSubMode; @@ -14,12 +13,12 @@ class AllowMainAndSubModeFilter implements AllowTransitModeFilter { private final SubMode subMode; - AllowMainAndSubModeFilter(@Nonnull TransitMode mainMode, @Nullable SubMode subMode) { + AllowMainAndSubModeFilter(TransitMode mainMode, @Nullable SubMode subMode) { this.mainMode = mainMode; this.subMode = subMode; } - AllowMainAndSubModeFilter(@Nonnull MainAndSubMode mode) { + AllowMainAndSubModeFilter(MainAndSubMode mode) { this(mode.mainMode(), mode.subMode()); } @@ -34,7 +33,6 @@ public boolean match(TransitMode transitMode, SubMode netexSubMode) { return mainMode == transitMode && subMode == netexSubMode; } - @Nonnull TransitMode mainMode() { return mainMode; } diff --git a/src/main/java/org/opentripplanner/model/modes/AllowMainAndSubModesFilter.java b/application/src/main/java/org/opentripplanner/model/modes/AllowMainAndSubModesFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/model/modes/AllowMainAndSubModesFilter.java rename to application/src/main/java/org/opentripplanner/model/modes/AllowMainAndSubModesFilter.java diff --git a/src/main/java/org/opentripplanner/model/modes/AllowMainModeFilter.java b/application/src/main/java/org/opentripplanner/model/modes/AllowMainModeFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/model/modes/AllowMainModeFilter.java rename to application/src/main/java/org/opentripplanner/model/modes/AllowMainModeFilter.java diff --git a/src/main/java/org/opentripplanner/model/modes/AllowMainModesFilter.java b/application/src/main/java/org/opentripplanner/model/modes/AllowMainModesFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/model/modes/AllowMainModesFilter.java rename to application/src/main/java/org/opentripplanner/model/modes/AllowMainModesFilter.java diff --git a/src/main/java/org/opentripplanner/model/modes/AllowTransitModeFilter.java b/application/src/main/java/org/opentripplanner/model/modes/AllowTransitModeFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/model/modes/AllowTransitModeFilter.java rename to application/src/main/java/org/opentripplanner/model/modes/AllowTransitModeFilter.java diff --git a/src/main/java/org/opentripplanner/model/modes/ExcludeAllTransitFilter.java b/application/src/main/java/org/opentripplanner/model/modes/ExcludeAllTransitFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/model/modes/ExcludeAllTransitFilter.java rename to application/src/main/java/org/opentripplanner/model/modes/ExcludeAllTransitFilter.java diff --git a/src/main/java/org/opentripplanner/model/modes/FilterCollection.java b/application/src/main/java/org/opentripplanner/model/modes/FilterCollection.java similarity index 100% rename from src/main/java/org/opentripplanner/model/modes/FilterCollection.java rename to application/src/main/java/org/opentripplanner/model/modes/FilterCollection.java diff --git a/src/main/java/org/opentripplanner/model/modes/FilterFactory.java b/application/src/main/java/org/opentripplanner/model/modes/FilterFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/model/modes/FilterFactory.java rename to application/src/main/java/org/opentripplanner/model/modes/FilterFactory.java diff --git a/src/main/java/org/opentripplanner/model/plan/AbsoluteDirection.java b/application/src/main/java/org/opentripplanner/model/plan/AbsoluteDirection.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/AbsoluteDirection.java rename to application/src/main/java/org/opentripplanner/model/plan/AbsoluteDirection.java diff --git a/src/main/java/org/opentripplanner/model/plan/ElevationProfile.java b/application/src/main/java/org/opentripplanner/model/plan/ElevationProfile.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/ElevationProfile.java rename to application/src/main/java/org/opentripplanner/model/plan/ElevationProfile.java diff --git a/src/main/java/org/opentripplanner/model/plan/Emissions.java b/application/src/main/java/org/opentripplanner/model/plan/Emissions.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/Emissions.java rename to application/src/main/java/org/opentripplanner/model/plan/Emissions.java diff --git a/src/main/java/org/opentripplanner/model/plan/FrequencyTransitLeg.java b/application/src/main/java/org/opentripplanner/model/plan/FrequencyTransitLeg.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/FrequencyTransitLeg.java rename to application/src/main/java/org/opentripplanner/model/plan/FrequencyTransitLeg.java diff --git a/src/main/java/org/opentripplanner/model/plan/FrequencyTransitLegBuilder.java b/application/src/main/java/org/opentripplanner/model/plan/FrequencyTransitLegBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/FrequencyTransitLegBuilder.java rename to application/src/main/java/org/opentripplanner/model/plan/FrequencyTransitLegBuilder.java diff --git a/src/main/java/org/opentripplanner/model/plan/ItinerariesCalculateLegTotals.java b/application/src/main/java/org/opentripplanner/model/plan/ItinerariesCalculateLegTotals.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/ItinerariesCalculateLegTotals.java rename to application/src/main/java/org/opentripplanner/model/plan/ItinerariesCalculateLegTotals.java diff --git a/src/main/java/org/opentripplanner/model/plan/Itinerary.java b/application/src/main/java/org/opentripplanner/model/plan/Itinerary.java similarity index 94% rename from src/main/java/org/opentripplanner/model/plan/Itinerary.java rename to application/src/main/java/org/opentripplanner/model/plan/Itinerary.java index dee80addd91..c3d8513c2f1 100644 --- a/src/main/java/org/opentripplanner/model/plan/Itinerary.java +++ b/application/src/main/java/org/opentripplanner/model/plan/Itinerary.java @@ -64,12 +64,14 @@ public class Itinerary implements ItinerarySortKey { /* other properties */ private final List systemNotices = new ArrayList<>(); + private final boolean searchWindowAware; private List legs; private ItineraryFares fare = ItineraryFares.empty(); - public Itinerary(List legs) { + private Itinerary(List legs, boolean searchWindowAware) { setLegs(legs); + this.searchWindowAware = searchWindowAware; // Set aggregated data ItinerariesCalculateLegTotals totals = new ItinerariesCalculateLegTotals(legs); @@ -87,6 +89,21 @@ public Itinerary(List legs) { this.setElevationLost(totals.totalElevationLost); } + /** + * Creates an itinerary that contains scheduled transit which is aware of the search window. + */ + public static Itinerary createScheduledTransitItinerary(List legs) { + return new Itinerary(legs, true); + } + + /** + * Creates an itinerary that creates only street or flex results which are not aware of the + * time window. + */ + public static Itinerary createDirectItinerary(List legs) { + return new Itinerary(legs, false); + } + /** * Time that the trip departs. */ @@ -162,6 +179,15 @@ public boolean isOnStreetAllTheWay() { return isStreetOnly(); } + /** + * Returns true if this itinerary has only flex and walking legs. + */ + public boolean isDirectFlex() { + var containsFlex = legs.stream().anyMatch(Leg::isFlexibleTrip); + var flexOrWalkOnly = legs.stream().allMatch(l -> l.isFlexibleTrip() || l.isWalkingLeg()); + return containsFlex && flexOrWalkOnly; + } + /** TRUE if at least one leg is a transit leg. */ public boolean hasTransit() { return legs @@ -169,6 +195,14 @@ public boolean hasTransit() { .anyMatch(l -> l instanceof ScheduledTransitLeg || l instanceof FlexibleTransitLeg); } + /** + * Returns true if this itinerary was produced by an algorithm that is aware of the search window. + * As of 2024 only the itineraries produced by RAPTOR that do that. + */ + public boolean isSearchWindowAware() { + return searchWindowAware; + } + public Leg firstLeg() { return getLegs().get(0); } @@ -215,7 +249,7 @@ public Itinerary withTimeShiftToStartAt(ZonedDateTime afterTime) { .stream() .map(leg -> leg.withTimeShift(duration)) .collect(Collectors.toList()); - var newItin = new Itinerary(timeShiftedLegs); + var newItin = new Itinerary(timeShiftedLegs, searchWindowAware); newItin.setGeneralizedCost(getGeneralizedCost()); return newItin; } diff --git a/src/main/java/org/opentripplanner/model/plan/ItinerarySortKey.java b/application/src/main/java/org/opentripplanner/model/plan/ItinerarySortKey.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/ItinerarySortKey.java rename to application/src/main/java/org/opentripplanner/model/plan/ItinerarySortKey.java diff --git a/src/main/java/org/opentripplanner/model/plan/Leg.java b/application/src/main/java/org/opentripplanner/model/plan/Leg.java similarity index 99% rename from src/main/java/org/opentripplanner/model/plan/Leg.java rename to application/src/main/java/org/opentripplanner/model/plan/Leg.java index 2a0b6726560..d9e3a4589d8 100644 --- a/src/main/java/org/opentripplanner/model/plan/Leg.java +++ b/application/src/main/java/org/opentripplanner/model/plan/Leg.java @@ -22,6 +22,7 @@ import org.opentripplanner.transit.model.organization.Agency; import org.opentripplanner.transit.model.organization.Operator; import org.opentripplanner.transit.model.site.FareZone; +import org.opentripplanner.transit.model.timetable.RealTimeState; import org.opentripplanner.transit.model.timetable.Trip; import org.opentripplanner.transit.model.timetable.TripOnServiceDate; import org.opentripplanner.transit.model.timetable.booking.BookingInfo; @@ -244,6 +245,10 @@ default boolean getRealTime() { return false; } + default RealTimeState getRealTimeState() { + return null; + } + /** * Whether this Leg describes a flexible trip. The reason we need this is that FlexTrip does not * inherit from Trip, so that the information that the Trip is flexible would be lost when diff --git a/src/main/java/org/opentripplanner/model/plan/LegTime.java b/application/src/main/java/org/opentripplanner/model/plan/LegTime.java similarity index 88% rename from src/main/java/org/opentripplanner/model/plan/LegTime.java rename to application/src/main/java/org/opentripplanner/model/plan/LegTime.java index 354ce4f4b0b..71ced95942a 100644 --- a/src/main/java/org/opentripplanner/model/plan/LegTime.java +++ b/application/src/main/java/org/opentripplanner/model/plan/LegTime.java @@ -3,24 +3,21 @@ import java.time.Duration; import java.time.ZonedDateTime; import java.util.Objects; -import javax.annotation.Nonnull; import javax.annotation.Nullable; /** * A scheduled time of a transit vehicle at a certain location with a optional realtime information. */ -public record LegTime(@Nonnull ZonedDateTime scheduledTime, @Nullable RealTimeEstimate estimated) { +public record LegTime(ZonedDateTime scheduledTime, @Nullable RealTimeEstimate estimated) { public LegTime { Objects.requireNonNull(scheduledTime); } - @Nonnull public static LegTime of(ZonedDateTime realtime, int delaySecs) { var delay = Duration.ofSeconds(delaySecs); return new LegTime(realtime.minus(delay), new RealTimeEstimate(realtime, delay)); } - @Nonnull public static LegTime ofStatic(ZonedDateTime staticTime) { return new LegTime(staticTime, null); } diff --git a/src/main/java/org/opentripplanner/model/plan/Place.java b/application/src/main/java/org/opentripplanner/model/plan/Place.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/Place.java rename to application/src/main/java/org/opentripplanner/model/plan/Place.java diff --git a/src/main/java/org/opentripplanner/model/plan/RelativeDirection.java b/application/src/main/java/org/opentripplanner/model/plan/RelativeDirection.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/RelativeDirection.java rename to application/src/main/java/org/opentripplanner/model/plan/RelativeDirection.java diff --git a/src/main/java/org/opentripplanner/model/plan/ScheduledTransitLeg.java b/application/src/main/java/org/opentripplanner/model/plan/ScheduledTransitLeg.java similarity index 98% rename from src/main/java/org/opentripplanner/model/plan/ScheduledTransitLeg.java rename to application/src/main/java/org/opentripplanner/model/plan/ScheduledTransitLeg.java index d94ec1895c2..7af091531e0 100644 --- a/src/main/java/org/opentripplanner/model/plan/ScheduledTransitLeg.java +++ b/application/src/main/java/org/opentripplanner/model/plan/ScheduledTransitLeg.java @@ -10,7 +10,6 @@ import java.util.List; import java.util.Objects; import java.util.Set; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.LineString; @@ -34,6 +33,7 @@ import org.opentripplanner.transit.model.organization.Agency; import org.opentripplanner.transit.model.organization.Operator; import org.opentripplanner.transit.model.site.StopLocation; +import org.opentripplanner.transit.model.timetable.RealTimeState; import org.opentripplanner.transit.model.timetable.Trip; import org.opentripplanner.transit.model.timetable.TripOnServiceDate; import org.opentripplanner.transit.model.timetable.TripTimes; @@ -181,7 +181,6 @@ public LegTime end() { } @Override - @Nonnull public TransitMode getMode() { return getTrip().getMode(); } @@ -227,6 +226,11 @@ public boolean getRealTime() { ); } + @Override + public RealTimeState getRealTimeState() { + return tripTimes.getRealTimeState(); + } + @Override public double getDistanceMeters() { return distanceMeters; diff --git a/src/main/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilder.java b/application/src/main/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilder.java rename to application/src/main/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilder.java diff --git a/src/main/java/org/opentripplanner/model/plan/SortOrder.java b/application/src/main/java/org/opentripplanner/model/plan/SortOrder.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/SortOrder.java rename to application/src/main/java/org/opentripplanner/model/plan/SortOrder.java diff --git a/src/main/java/org/opentripplanner/model/plan/StopArrival.java b/application/src/main/java/org/opentripplanner/model/plan/StopArrival.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/StopArrival.java rename to application/src/main/java/org/opentripplanner/model/plan/StopArrival.java diff --git a/src/main/java/org/opentripplanner/model/plan/StopArrivalMapper.java b/application/src/main/java/org/opentripplanner/model/plan/StopArrivalMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/StopArrivalMapper.java rename to application/src/main/java/org/opentripplanner/model/plan/StopArrivalMapper.java diff --git a/src/main/java/org/opentripplanner/model/plan/StreetLeg.java b/application/src/main/java/org/opentripplanner/model/plan/StreetLeg.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/StreetLeg.java rename to application/src/main/java/org/opentripplanner/model/plan/StreetLeg.java diff --git a/src/main/java/org/opentripplanner/model/plan/StreetLegBuilder.java b/application/src/main/java/org/opentripplanner/model/plan/StreetLegBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/StreetLegBuilder.java rename to application/src/main/java/org/opentripplanner/model/plan/StreetLegBuilder.java diff --git a/src/main/java/org/opentripplanner/model/plan/TransitLeg.java b/application/src/main/java/org/opentripplanner/model/plan/TransitLeg.java similarity index 91% rename from src/main/java/org/opentripplanner/model/plan/TransitLeg.java rename to application/src/main/java/org/opentripplanner/model/plan/TransitLeg.java index 736739ca970..f7ac3e42544 100644 --- a/src/main/java/org/opentripplanner/model/plan/TransitLeg.java +++ b/application/src/main/java/org/opentripplanner/model/plan/TransitLeg.java @@ -1,13 +1,11 @@ package org.opentripplanner.model.plan; -import javax.annotation.Nonnull; import org.opentripplanner.transit.model.basic.TransitMode; public interface TransitLeg extends Leg { /** * The mode (e.g., BUS) used when traversing this leg. */ - @Nonnull TransitMode getMode(); @Override diff --git a/src/main/java/org/opentripplanner/model/plan/TripPlan.java b/application/src/main/java/org/opentripplanner/model/plan/TripPlan.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/TripPlan.java rename to application/src/main/java/org/opentripplanner/model/plan/TripPlan.java diff --git a/src/main/java/org/opentripplanner/model/plan/UnknownTransitPathLeg.java b/application/src/main/java/org/opentripplanner/model/plan/UnknownTransitPathLeg.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/UnknownTransitPathLeg.java rename to application/src/main/java/org/opentripplanner/model/plan/UnknownTransitPathLeg.java diff --git a/src/main/java/org/opentripplanner/model/plan/VehicleParkingWithEntrance.java b/application/src/main/java/org/opentripplanner/model/plan/VehicleParkingWithEntrance.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/VehicleParkingWithEntrance.java rename to application/src/main/java/org/opentripplanner/model/plan/VehicleParkingWithEntrance.java diff --git a/src/main/java/org/opentripplanner/model/plan/VertexType.java b/application/src/main/java/org/opentripplanner/model/plan/VertexType.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/VertexType.java rename to application/src/main/java/org/opentripplanner/model/plan/VertexType.java diff --git a/src/main/java/org/opentripplanner/model/plan/WalkStep.java b/application/src/main/java/org/opentripplanner/model/plan/WalkStep.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/WalkStep.java rename to application/src/main/java/org/opentripplanner/model/plan/WalkStep.java diff --git a/src/main/java/org/opentripplanner/model/plan/WalkStepBuilder.java b/application/src/main/java/org/opentripplanner/model/plan/WalkStepBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/WalkStepBuilder.java rename to application/src/main/java/org/opentripplanner/model/plan/WalkStepBuilder.java diff --git a/src/main/java/org/opentripplanner/model/plan/grouppriority/TransitGroupPriorityItineraryDecorator.java b/application/src/main/java/org/opentripplanner/model/plan/grouppriority/TransitGroupPriorityItineraryDecorator.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/grouppriority/TransitGroupPriorityItineraryDecorator.java rename to application/src/main/java/org/opentripplanner/model/plan/grouppriority/TransitGroupPriorityItineraryDecorator.java diff --git a/src/main/java/org/opentripplanner/model/plan/legreference/LegReference.java b/application/src/main/java/org/opentripplanner/model/plan/legreference/LegReference.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/legreference/LegReference.java rename to application/src/main/java/org/opentripplanner/model/plan/legreference/LegReference.java diff --git a/src/main/java/org/opentripplanner/model/plan/legreference/LegReferenceSerializer.java b/application/src/main/java/org/opentripplanner/model/plan/legreference/LegReferenceSerializer.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/legreference/LegReferenceSerializer.java rename to application/src/main/java/org/opentripplanner/model/plan/legreference/LegReferenceSerializer.java diff --git a/src/main/java/org/opentripplanner/model/plan/legreference/LegReferenceType.java b/application/src/main/java/org/opentripplanner/model/plan/legreference/LegReferenceType.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/legreference/LegReferenceType.java rename to application/src/main/java/org/opentripplanner/model/plan/legreference/LegReferenceType.java diff --git a/src/main/java/org/opentripplanner/model/plan/legreference/ScheduledTransitLegReference.java b/application/src/main/java/org/opentripplanner/model/plan/legreference/ScheduledTransitLegReference.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/legreference/ScheduledTransitLegReference.java rename to application/src/main/java/org/opentripplanner/model/plan/legreference/ScheduledTransitLegReference.java diff --git a/src/main/java/org/opentripplanner/model/plan/paging/PagingSearchWindowAdjuster.java b/application/src/main/java/org/opentripplanner/model/plan/paging/PagingSearchWindowAdjuster.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/paging/PagingSearchWindowAdjuster.java rename to application/src/main/java/org/opentripplanner/model/plan/paging/PagingSearchWindowAdjuster.java diff --git a/src/main/java/org/opentripplanner/model/plan/paging/cursor/DeduplicationPageCut.java b/application/src/main/java/org/opentripplanner/model/plan/paging/cursor/DeduplicationPageCut.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/paging/cursor/DeduplicationPageCut.java rename to application/src/main/java/org/opentripplanner/model/plan/paging/cursor/DeduplicationPageCut.java diff --git a/src/main/java/org/opentripplanner/model/plan/paging/cursor/PageCursor.java b/application/src/main/java/org/opentripplanner/model/plan/paging/cursor/PageCursor.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/paging/cursor/PageCursor.java rename to application/src/main/java/org/opentripplanner/model/plan/paging/cursor/PageCursor.java diff --git a/src/main/java/org/opentripplanner/model/plan/paging/cursor/PageCursorFactory.java b/application/src/main/java/org/opentripplanner/model/plan/paging/cursor/PageCursorFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/paging/cursor/PageCursorFactory.java rename to application/src/main/java/org/opentripplanner/model/plan/paging/cursor/PageCursorFactory.java diff --git a/src/main/java/org/opentripplanner/model/plan/paging/cursor/PageCursorInput.java b/application/src/main/java/org/opentripplanner/model/plan/paging/cursor/PageCursorInput.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/paging/cursor/PageCursorInput.java rename to application/src/main/java/org/opentripplanner/model/plan/paging/cursor/PageCursorInput.java diff --git a/src/main/java/org/opentripplanner/model/plan/paging/cursor/PageCursorSerializer.java b/application/src/main/java/org/opentripplanner/model/plan/paging/cursor/PageCursorSerializer.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/paging/cursor/PageCursorSerializer.java rename to application/src/main/java/org/opentripplanner/model/plan/paging/cursor/PageCursorSerializer.java diff --git a/src/main/java/org/opentripplanner/model/plan/paging/cursor/PageType.java b/application/src/main/java/org/opentripplanner/model/plan/paging/cursor/PageType.java similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/paging/cursor/PageType.java rename to application/src/main/java/org/opentripplanner/model/plan/paging/cursor/PageType.java diff --git a/src/main/java/org/opentripplanner/model/plan/paging/cursor/images/pagecursor.excalidraw b/application/src/main/java/org/opentripplanner/model/plan/paging/cursor/images/pagecursor.excalidraw similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/paging/cursor/images/pagecursor.excalidraw rename to application/src/main/java/org/opentripplanner/model/plan/paging/cursor/images/pagecursor.excalidraw diff --git a/src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-arrival-crop-sw-prev-page.svg b/application/src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-arrival-crop-sw-prev-page.svg similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-arrival-crop-sw-prev-page.svg rename to application/src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-arrival-crop-sw-prev-page.svg diff --git a/src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-arrival-crop-sw.svg b/application/src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-arrival-crop-sw.svg similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-arrival-crop-sw.svg rename to application/src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-arrival-crop-sw.svg diff --git a/src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-arrival.svg b/application/src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-arrival.svg similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-arrival.svg rename to application/src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-arrival.svg diff --git a/src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-departure-crop-sw-next-page.svg b/application/src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-departure-crop-sw-next-page.svg similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-departure-crop-sw-next-page.svg rename to application/src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-departure-crop-sw-next-page.svg diff --git a/src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-departure-crop-sw.svg b/application/src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-departure-crop-sw.svg similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-departure-crop-sw.svg rename to application/src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-departure-crop-sw.svg diff --git a/src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-departure.svg b/application/src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-departure.svg similarity index 100% rename from src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-departure.svg rename to application/src/main/java/org/opentripplanner/model/plan/paging/cursor/images/sort-by-departure.svg diff --git a/src/main/java/org/opentripplanner/model/plan/paging/cursor/readme.md b/application/src/main/java/org/opentripplanner/model/plan/paging/cursor/readme.md similarity index 95% rename from src/main/java/org/opentripplanner/model/plan/paging/cursor/readme.md rename to application/src/main/java/org/opentripplanner/model/plan/paging/cursor/readme.md index e98071cfa62..0eab721bcc3 100644 --- a/src/main/java/org/opentripplanner/model/plan/paging/cursor/readme.md +++ b/application/src/main/java/org/opentripplanner/model/plan/paging/cursor/readme.md @@ -13,7 +13,7 @@ moving on to the next. ## Terminology -- **search-window (sw)** The search window is the minutes Raptor iterate over and the time-window +- **search-window (sw)** The search window is the minutes Raptor iterates over and the time-window the itinerary must start within to be included in the result. The search-window may change from a request to the next page. **sw'** is the search window for the new next/previous page. The search window may change between requests, so we need to account for it when computing the next/previous @@ -28,7 +28,7 @@ moving on to the next. - **<< previous page** The trip search constructed to retrieve itineraries AFTER the original search. - **crop-search-window** If the `maxNumOfItineraries` limit is reached in the - `ItineraryFilterChain`, then one or more itineraries are removed. The filter remove itineraries + `ItineraryFilterChain`, then one or more itineraries are removed. The filter removes itineraries from the beginning or end of the list depending on the page cursor type (next/previous) and the sort order(arrival/departure time). @@ -55,8 +55,8 @@ _previous-page_ must reverse the itinerary-filtering: `crop itineraries at START - In this case the `<< Previous page` is the same as in [sort-by-arrival](#sort-by-arrival) and not shown. - For the `Next page >>` we must adjust the `edt'`. -- In rare cases we get duplicate itineraries. This happens if the `removed itinerary` depart before, - but arrive after the `duplicate`. +- In rare cases we get duplicate itineraries. This happens if the `removed itinerary` departs before, + but arrives after the `duplicate`. ### sort-by-arrival, crop-search-window & original-prev-page @@ -99,7 +99,7 @@ This is the basic `sort-by-departure` (arrive-by search) without removing itiner In this case the itineraries are dropped from the search results in the `Original Search` and the `<< Previous page` must be adjusted. We use the first removed itinerary to set both the `edt'` and the `lat'`. An `optimal itinarary` in the original search is lost (not found) in the previous page -if it departs AFTER the `remoed itinerary` and arrive before - hopefully this is a rare case. +if it departs AFTER the `removed itinerary` and arrives before - hopefully this is a rare case. The `Next page >>` is the same as the basic case [sort-by-departure](#sort-by-departure). diff --git a/src/main/java/org/opentripplanner/model/projectinfo/GraphFileHeader.java b/application/src/main/java/org/opentripplanner/model/projectinfo/GraphFileHeader.java similarity index 100% rename from src/main/java/org/opentripplanner/model/projectinfo/GraphFileHeader.java rename to application/src/main/java/org/opentripplanner/model/projectinfo/GraphFileHeader.java diff --git a/src/main/java/org/opentripplanner/model/projectinfo/MavenProjectVersion.java b/application/src/main/java/org/opentripplanner/model/projectinfo/MavenProjectVersion.java similarity index 100% rename from src/main/java/org/opentripplanner/model/projectinfo/MavenProjectVersion.java rename to application/src/main/java/org/opentripplanner/model/projectinfo/MavenProjectVersion.java diff --git a/src/main/java/org/opentripplanner/model/projectinfo/OtpProjectInfo.java b/application/src/main/java/org/opentripplanner/model/projectinfo/OtpProjectInfo.java similarity index 100% rename from src/main/java/org/opentripplanner/model/projectinfo/OtpProjectInfo.java rename to application/src/main/java/org/opentripplanner/model/projectinfo/OtpProjectInfo.java diff --git a/src/main/java/org/opentripplanner/model/projectinfo/OtpProjectInfoParser.java b/application/src/main/java/org/opentripplanner/model/projectinfo/OtpProjectInfoParser.java similarity index 100% rename from src/main/java/org/opentripplanner/model/projectinfo/OtpProjectInfoParser.java rename to application/src/main/java/org/opentripplanner/model/projectinfo/OtpProjectInfoParser.java diff --git a/src/main/java/org/opentripplanner/model/projectinfo/VersionControlInfo.java b/application/src/main/java/org/opentripplanner/model/projectinfo/VersionControlInfo.java similarity index 100% rename from src/main/java/org/opentripplanner/model/projectinfo/VersionControlInfo.java rename to application/src/main/java/org/opentripplanner/model/projectinfo/VersionControlInfo.java diff --git a/src/main/java/org/opentripplanner/model/transfer/ConstrainedTransfer.java b/application/src/main/java/org/opentripplanner/model/transfer/ConstrainedTransfer.java similarity index 100% rename from src/main/java/org/opentripplanner/model/transfer/ConstrainedTransfer.java rename to application/src/main/java/org/opentripplanner/model/transfer/ConstrainedTransfer.java diff --git a/src/main/java/org/opentripplanner/model/transfer/DefaultTransferService.java b/application/src/main/java/org/opentripplanner/model/transfer/DefaultTransferService.java similarity index 100% rename from src/main/java/org/opentripplanner/model/transfer/DefaultTransferService.java rename to application/src/main/java/org/opentripplanner/model/transfer/DefaultTransferService.java diff --git a/src/main/java/org/opentripplanner/model/transfer/RouteStationTransferPoint.java b/application/src/main/java/org/opentripplanner/model/transfer/RouteStationTransferPoint.java similarity index 100% rename from src/main/java/org/opentripplanner/model/transfer/RouteStationTransferPoint.java rename to application/src/main/java/org/opentripplanner/model/transfer/RouteStationTransferPoint.java diff --git a/src/main/java/org/opentripplanner/model/transfer/RouteStopTransferPoint.java b/application/src/main/java/org/opentripplanner/model/transfer/RouteStopTransferPoint.java similarity index 100% rename from src/main/java/org/opentripplanner/model/transfer/RouteStopTransferPoint.java rename to application/src/main/java/org/opentripplanner/model/transfer/RouteStopTransferPoint.java diff --git a/src/main/java/org/opentripplanner/model/transfer/StationTransferPoint.java b/application/src/main/java/org/opentripplanner/model/transfer/StationTransferPoint.java similarity index 100% rename from src/main/java/org/opentripplanner/model/transfer/StationTransferPoint.java rename to application/src/main/java/org/opentripplanner/model/transfer/StationTransferPoint.java diff --git a/src/main/java/org/opentripplanner/model/transfer/StopTransferPoint.java b/application/src/main/java/org/opentripplanner/model/transfer/StopTransferPoint.java similarity index 100% rename from src/main/java/org/opentripplanner/model/transfer/StopTransferPoint.java rename to application/src/main/java/org/opentripplanner/model/transfer/StopTransferPoint.java diff --git a/src/main/java/org/opentripplanner/model/transfer/TransferConstraint.java b/application/src/main/java/org/opentripplanner/model/transfer/TransferConstraint.java similarity index 100% rename from src/main/java/org/opentripplanner/model/transfer/TransferConstraint.java rename to application/src/main/java/org/opentripplanner/model/transfer/TransferConstraint.java diff --git a/src/main/java/org/opentripplanner/model/transfer/TransferPoint.java b/application/src/main/java/org/opentripplanner/model/transfer/TransferPoint.java similarity index 100% rename from src/main/java/org/opentripplanner/model/transfer/TransferPoint.java rename to application/src/main/java/org/opentripplanner/model/transfer/TransferPoint.java diff --git a/src/main/java/org/opentripplanner/model/transfer/TransferPointMap.java b/application/src/main/java/org/opentripplanner/model/transfer/TransferPointMap.java similarity index 100% rename from src/main/java/org/opentripplanner/model/transfer/TransferPointMap.java rename to application/src/main/java/org/opentripplanner/model/transfer/TransferPointMap.java diff --git a/src/main/java/org/opentripplanner/model/transfer/TransferPriority.java b/application/src/main/java/org/opentripplanner/model/transfer/TransferPriority.java similarity index 100% rename from src/main/java/org/opentripplanner/model/transfer/TransferPriority.java rename to application/src/main/java/org/opentripplanner/model/transfer/TransferPriority.java diff --git a/src/main/java/org/opentripplanner/model/transfer/TransferService.java b/application/src/main/java/org/opentripplanner/model/transfer/TransferService.java similarity index 100% rename from src/main/java/org/opentripplanner/model/transfer/TransferService.java rename to application/src/main/java/org/opentripplanner/model/transfer/TransferService.java diff --git a/src/main/java/org/opentripplanner/model/transfer/TripTransferPoint.java b/application/src/main/java/org/opentripplanner/model/transfer/TripTransferPoint.java similarity index 100% rename from src/main/java/org/opentripplanner/model/transfer/TripTransferPoint.java rename to application/src/main/java/org/opentripplanner/model/transfer/TripTransferPoint.java diff --git a/src/main/java/org/opentripplanner/netex/NetexBundle.java b/application/src/main/java/org/opentripplanner/netex/NetexBundle.java similarity index 95% rename from src/main/java/org/opentripplanner/netex/NetexBundle.java rename to application/src/main/java/org/opentripplanner/netex/NetexBundle.java index 3cd52cd246e..a0e0aae8500 100644 --- a/src/main/java/org/opentripplanner/netex/NetexBundle.java +++ b/application/src/main/java/org/opentripplanner/netex/NetexBundle.java @@ -3,6 +3,7 @@ import jakarta.xml.bind.JAXBException; import java.io.Closeable; import java.io.IOException; +import java.util.Collection; import java.util.List; import java.util.Set; import org.opentripplanner.datastore.api.CompositeDataSource; @@ -19,6 +20,7 @@ import org.opentripplanner.netex.mapping.NetexMapper; import org.opentripplanner.netex.validation.Validator; import org.opentripplanner.transit.model.framework.Deduplicator; +import org.opentripplanner.transit.model.framework.FeedScopedId; import org.rutebanken.netex.model.PublicationDeliveryStructure; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,6 +46,7 @@ public class NetexBundle implements Closeable { private final String feedId; private final Set ferryIdsNotAllowedForBicycle; + private final Collection routeToCentroidStopPlaceIds; private final double maxStopToShapeSnapDistance; private final boolean noTransfersOnIsolatedStops; private final Set ignoredFeatures; @@ -61,6 +64,7 @@ public NetexBundle( NetexDataSourceHierarchy hierarchy, OtpTransitServiceBuilder transitBuilder, Set ferryIdsNotAllowedForBicycle, + Collection routeToCentroidStopPlaceIds, double maxStopToShapeSnapDistance, boolean noTransfersOnIsolatedStops, Set ignorableFeatures @@ -70,6 +74,7 @@ public NetexBundle( this.hierarchy = hierarchy; this.transitBuilder = transitBuilder; this.ferryIdsNotAllowedForBicycle = ferryIdsNotAllowedForBicycle; + this.routeToCentroidStopPlaceIds = Set.copyOf(routeToCentroidStopPlaceIds); this.maxStopToShapeSnapDistance = maxStopToShapeSnapDistance; this.noTransfersOnIsolatedStops = noTransfersOnIsolatedStops; this.ignoredFeatures = Set.copyOf(ignorableFeatures); @@ -93,6 +98,7 @@ public OtpTransitServiceBuilder loadBundle( deduplicator, issueStore, ferryIdsNotAllowedForBicycle, + routeToCentroidStopPlaceIds, maxStopToShapeSnapDistance, noTransfersOnIsolatedStops ); diff --git a/src/main/java/org/opentripplanner/netex/NetexModule.java b/application/src/main/java/org/opentripplanner/netex/NetexModule.java similarity index 96% rename from src/main/java/org/opentripplanner/netex/NetexModule.java rename to application/src/main/java/org/opentripplanner/netex/NetexModule.java index 2bf3403395c..92ee25dbab2 100644 --- a/src/main/java/org/opentripplanner/netex/NetexModule.java +++ b/application/src/main/java/org/opentripplanner/netex/NetexModule.java @@ -70,7 +70,7 @@ public void buildGraph() { ); transitBuilder.limitServiceDays(transitPeriodLimit); for (var tripOnServiceDate : transitBuilder.getTripOnServiceDates().values()) { - transitModel.addTripOnServiceDate(tripOnServiceDate.getId(), tripOnServiceDate); + transitModel.addTripOnServiceDate(tripOnServiceDate); } calendarServiceData.add(transitBuilder.buildCalendarServiceData()); @@ -90,7 +90,7 @@ public void buildGraph() { // TODO OTP2 - Move this into the AddTransitModelEntitiesToGraph // - and make sure they also work with GTFS feeds - GTFS do no // - have operators and notice assignments. - transitModel.getOperators().addAll(otpService.getAllOperators()); + transitModel.addOperators(otpService.getAllOperators()); transitModel.addNoticeAssignments(otpService.getNoticeAssignments()); AddTransitModelEntitiesToGraph.addToGraph( diff --git a/src/main/java/org/opentripplanner/netex/config/IgnorableFeature.java b/application/src/main/java/org/opentripplanner/netex/config/IgnorableFeature.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/config/IgnorableFeature.java rename to application/src/main/java/org/opentripplanner/netex/config/IgnorableFeature.java diff --git a/src/main/java/org/opentripplanner/netex/config/NetexFeedParameters.java b/application/src/main/java/org/opentripplanner/netex/config/NetexFeedParameters.java similarity index 96% rename from src/main/java/org/opentripplanner/netex/config/NetexFeedParameters.java rename to application/src/main/java/org/opentripplanner/netex/config/NetexFeedParameters.java index 0c6c75c4db3..723c707ecf1 100644 --- a/src/main/java/org/opentripplanner/netex/config/NetexFeedParameters.java +++ b/application/src/main/java/org/opentripplanner/netex/config/NetexFeedParameters.java @@ -34,6 +34,7 @@ public class NetexFeedParameters implements DataSourceConfig { private static final Set IGNORED_FEATURES = Set.of(PARKING); private static final Set FERRY_IDS_NOT_ALLOWED_FOR_BICYCLE = Collections.emptySet(); + private static final Set ROUTE_TO_CENTROID_STATION_IDS = Collections.emptySet(); public static final NetexFeedParameters DEFAULT = new NetexFeedParameters(); @@ -196,6 +197,7 @@ public static class Builder { private String groupFilePattern; private String ignoreFilePattern; private final Set ferryIdsNotAllowedForBicycle = new HashSet<>(); + private final Set routeToCentroidStopPlaceIds = new HashSet<>(); private boolean noTransfersOnIsolatedStops; private final Set ignoredFeatures; @@ -251,6 +253,11 @@ public Builder addFerryIdsNotAllowedForBicycle(Collection ferryId) { return this; } + public Builder addRouteToCentroidStopPlaceIds(Collection stationIds) { + routeToCentroidStopPlaceIds.addAll(stationIds); + return this; + } + public Builder withNoTransfersOnIsolatedStops(boolean noTransfersOnIsolatedStops) { this.noTransfersOnIsolatedStops = noTransfersOnIsolatedStops; return this; diff --git a/src/main/java/org/opentripplanner/netex/configure/NetexConfigure.java b/application/src/main/java/org/opentripplanner/netex/configure/NetexConfigure.java similarity index 98% rename from src/main/java/org/opentripplanner/netex/configure/NetexConfigure.java rename to application/src/main/java/org/opentripplanner/netex/configure/NetexConfigure.java index 50c49836246..5f4b665e362 100644 --- a/src/main/java/org/opentripplanner/netex/configure/NetexConfigure.java +++ b/application/src/main/java/org/opentripplanner/netex/configure/NetexConfigure.java @@ -73,6 +73,7 @@ public NetexBundle netexBundle( hierarchy(source, config), transitServiceBuilder, config.ferryIdsNotAllowedForBicycle(), + buildParams.transitRouteToStationCentroid(), buildParams.maxStopToShapeSnapDistance, config.noTransfersOnIsolatedStops(), config.ignoredFeatures() diff --git a/src/main/java/org/opentripplanner/netex/images/Colaboration.png b/application/src/main/java/org/opentripplanner/netex/images/Colaboration.png similarity index 100% rename from src/main/java/org/opentripplanner/netex/images/Colaboration.png rename to application/src/main/java/org/opentripplanner/netex/images/Colaboration.png diff --git a/src/main/java/org/opentripplanner/netex/images/Colaboration.uxf b/application/src/main/java/org/opentripplanner/netex/images/Colaboration.uxf similarity index 100% rename from src/main/java/org/opentripplanner/netex/images/Colaboration.uxf rename to application/src/main/java/org/opentripplanner/netex/images/Colaboration.uxf diff --git a/src/main/java/org/opentripplanner/netex/images/DegignOverview.png b/application/src/main/java/org/opentripplanner/netex/images/DegignOverview.png similarity index 100% rename from src/main/java/org/opentripplanner/netex/images/DegignOverview.png rename to application/src/main/java/org/opentripplanner/netex/images/DegignOverview.png diff --git a/src/main/java/org/opentripplanner/netex/images/DegignOverview.uxf b/application/src/main/java/org/opentripplanner/netex/images/DegignOverview.uxf similarity index 100% rename from src/main/java/org/opentripplanner/netex/images/DegignOverview.uxf rename to application/src/main/java/org/opentripplanner/netex/images/DegignOverview.uxf diff --git a/src/main/java/org/opentripplanner/netex/images/PackageDependencies.png b/application/src/main/java/org/opentripplanner/netex/images/PackageDependencies.png similarity index 100% rename from src/main/java/org/opentripplanner/netex/images/PackageDependencies.png rename to application/src/main/java/org/opentripplanner/netex/images/PackageDependencies.png diff --git a/src/main/java/org/opentripplanner/netex/images/PackageDependencies.uxf b/application/src/main/java/org/opentripplanner/netex/images/PackageDependencies.uxf similarity index 100% rename from src/main/java/org/opentripplanner/netex/images/PackageDependencies.uxf rename to application/src/main/java/org/opentripplanner/netex/images/PackageDependencies.uxf diff --git a/src/main/java/org/opentripplanner/netex/index/NetexEntityIndex.java b/application/src/main/java/org/opentripplanner/netex/index/NetexEntityIndex.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/index/NetexEntityIndex.java rename to application/src/main/java/org/opentripplanner/netex/index/NetexEntityIndex.java diff --git a/src/main/java/org/opentripplanner/netex/index/api/HMapValidationRule.java b/application/src/main/java/org/opentripplanner/netex/index/api/HMapValidationRule.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/index/api/HMapValidationRule.java rename to application/src/main/java/org/opentripplanner/netex/index/api/HMapValidationRule.java diff --git a/src/main/java/org/opentripplanner/netex/index/api/NetexEntityIndexReadOnlyView.java b/application/src/main/java/org/opentripplanner/netex/index/api/NetexEntityIndexReadOnlyView.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/index/api/NetexEntityIndexReadOnlyView.java rename to application/src/main/java/org/opentripplanner/netex/index/api/NetexEntityIndexReadOnlyView.java diff --git a/src/main/java/org/opentripplanner/netex/index/api/ReadOnlyHierarchicalMap.java b/application/src/main/java/org/opentripplanner/netex/index/api/ReadOnlyHierarchicalMap.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/index/api/ReadOnlyHierarchicalMap.java rename to application/src/main/java/org/opentripplanner/netex/index/api/ReadOnlyHierarchicalMap.java diff --git a/src/main/java/org/opentripplanner/netex/index/api/ReadOnlyHierarchicalMapById.java b/application/src/main/java/org/opentripplanner/netex/index/api/ReadOnlyHierarchicalMapById.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/index/api/ReadOnlyHierarchicalMapById.java rename to application/src/main/java/org/opentripplanner/netex/index/api/ReadOnlyHierarchicalMapById.java diff --git a/src/main/java/org/opentripplanner/netex/index/api/ReadOnlyHierarchicalVersionMapById.java b/application/src/main/java/org/opentripplanner/netex/index/api/ReadOnlyHierarchicalVersionMapById.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/index/api/ReadOnlyHierarchicalVersionMapById.java rename to application/src/main/java/org/opentripplanner/netex/index/api/ReadOnlyHierarchicalVersionMapById.java diff --git a/src/main/java/org/opentripplanner/netex/index/hierarchy/AbstractHierarchicalMap.java b/application/src/main/java/org/opentripplanner/netex/index/hierarchy/AbstractHierarchicalMap.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/index/hierarchy/AbstractHierarchicalMap.java rename to application/src/main/java/org/opentripplanner/netex/index/hierarchy/AbstractHierarchicalMap.java diff --git a/src/main/java/org/opentripplanner/netex/index/hierarchy/HierarchicalElement.java b/application/src/main/java/org/opentripplanner/netex/index/hierarchy/HierarchicalElement.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/index/hierarchy/HierarchicalElement.java rename to application/src/main/java/org/opentripplanner/netex/index/hierarchy/HierarchicalElement.java diff --git a/src/main/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMap.java b/application/src/main/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMap.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMap.java rename to application/src/main/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMap.java diff --git a/src/main/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMapById.java b/application/src/main/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMapById.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMapById.java rename to application/src/main/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMapById.java diff --git a/src/main/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMultimap.java b/application/src/main/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMultimap.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMultimap.java rename to application/src/main/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMultimap.java diff --git a/src/main/java/org/opentripplanner/netex/index/hierarchy/HierarchicalVersionMapById.java b/application/src/main/java/org/opentripplanner/netex/index/hierarchy/HierarchicalVersionMapById.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/index/hierarchy/HierarchicalVersionMapById.java rename to application/src/main/java/org/opentripplanner/netex/index/hierarchy/HierarchicalVersionMapById.java diff --git a/src/main/java/org/opentripplanner/netex/index/hierarchy/ValidOnDate.java b/application/src/main/java/org/opentripplanner/netex/index/hierarchy/ValidOnDate.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/index/hierarchy/ValidOnDate.java rename to application/src/main/java/org/opentripplanner/netex/index/hierarchy/ValidOnDate.java diff --git a/src/main/java/org/opentripplanner/netex/issues/DayTypeScheduleIsEmpty.java b/application/src/main/java/org/opentripplanner/netex/issues/DayTypeScheduleIsEmpty.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/issues/DayTypeScheduleIsEmpty.java rename to application/src/main/java/org/opentripplanner/netex/issues/DayTypeScheduleIsEmpty.java diff --git a/src/main/java/org/opentripplanner/netex/issues/InterchangeMaxWaitTimeNotGuaranteed.java b/application/src/main/java/org/opentripplanner/netex/issues/InterchangeMaxWaitTimeNotGuaranteed.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/issues/InterchangeMaxWaitTimeNotGuaranteed.java rename to application/src/main/java/org/opentripplanner/netex/issues/InterchangeMaxWaitTimeNotGuaranteed.java diff --git a/src/main/java/org/opentripplanner/netex/issues/InterchangePointMappingFailed.java b/application/src/main/java/org/opentripplanner/netex/issues/InterchangePointMappingFailed.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/issues/InterchangePointMappingFailed.java rename to application/src/main/java/org/opentripplanner/netex/issues/InterchangePointMappingFailed.java diff --git a/src/main/java/org/opentripplanner/netex/issues/InterchangeWithoutConstraint.java b/application/src/main/java/org/opentripplanner/netex/issues/InterchangeWithoutConstraint.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/issues/InterchangeWithoutConstraint.java rename to application/src/main/java/org/opentripplanner/netex/issues/InterchangeWithoutConstraint.java diff --git a/src/main/java/org/opentripplanner/netex/issues/ObjectNotFound.java b/application/src/main/java/org/opentripplanner/netex/issues/ObjectNotFound.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/issues/ObjectNotFound.java rename to application/src/main/java/org/opentripplanner/netex/issues/ObjectNotFound.java diff --git a/src/main/java/org/opentripplanner/netex/issues/StopPlaceWithoutCoordinates.java b/application/src/main/java/org/opentripplanner/netex/issues/StopPlaceWithoutCoordinates.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/issues/StopPlaceWithoutCoordinates.java rename to application/src/main/java/org/opentripplanner/netex/issues/StopPlaceWithoutCoordinates.java diff --git a/src/main/java/org/opentripplanner/netex/issues/StopPlaceWithoutQuays.java b/application/src/main/java/org/opentripplanner/netex/issues/StopPlaceWithoutQuays.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/issues/StopPlaceWithoutQuays.java rename to application/src/main/java/org/opentripplanner/netex/issues/StopPlaceWithoutQuays.java diff --git a/src/main/java/org/opentripplanner/netex/loader/GroupEntries.java b/application/src/main/java/org/opentripplanner/netex/loader/GroupEntries.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/loader/GroupEntries.java rename to application/src/main/java/org/opentripplanner/netex/loader/GroupEntries.java diff --git a/src/main/java/org/opentripplanner/netex/loader/NetexDataSourceHierarchy.java b/application/src/main/java/org/opentripplanner/netex/loader/NetexDataSourceHierarchy.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/loader/NetexDataSourceHierarchy.java rename to application/src/main/java/org/opentripplanner/netex/loader/NetexDataSourceHierarchy.java diff --git a/src/main/java/org/opentripplanner/netex/loader/NetexXmlParser.java b/application/src/main/java/org/opentripplanner/netex/loader/NetexXmlParser.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/loader/NetexXmlParser.java rename to application/src/main/java/org/opentripplanner/netex/loader/NetexXmlParser.java diff --git a/src/main/java/org/opentripplanner/netex/loader/parser/FareFrameParser.java b/application/src/main/java/org/opentripplanner/netex/loader/parser/FareFrameParser.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/loader/parser/FareFrameParser.java rename to application/src/main/java/org/opentripplanner/netex/loader/parser/FareFrameParser.java diff --git a/src/main/java/org/opentripplanner/netex/loader/parser/NetexDocumentParser.java b/application/src/main/java/org/opentripplanner/netex/loader/parser/NetexDocumentParser.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/loader/parser/NetexDocumentParser.java rename to application/src/main/java/org/opentripplanner/netex/loader/parser/NetexDocumentParser.java diff --git a/src/main/java/org/opentripplanner/netex/loader/parser/NetexParser.java b/application/src/main/java/org/opentripplanner/netex/loader/parser/NetexParser.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/loader/parser/NetexParser.java rename to application/src/main/java/org/opentripplanner/netex/loader/parser/NetexParser.java diff --git a/src/main/java/org/opentripplanner/netex/loader/parser/NoticeParser.java b/application/src/main/java/org/opentripplanner/netex/loader/parser/NoticeParser.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/loader/parser/NoticeParser.java rename to application/src/main/java/org/opentripplanner/netex/loader/parser/NoticeParser.java diff --git a/src/main/java/org/opentripplanner/netex/loader/parser/ResourceFrameParser.java b/application/src/main/java/org/opentripplanner/netex/loader/parser/ResourceFrameParser.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/loader/parser/ResourceFrameParser.java rename to application/src/main/java/org/opentripplanner/netex/loader/parser/ResourceFrameParser.java diff --git a/src/main/java/org/opentripplanner/netex/loader/parser/ServiceCalendarFrameParser.java b/application/src/main/java/org/opentripplanner/netex/loader/parser/ServiceCalendarFrameParser.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/loader/parser/ServiceCalendarFrameParser.java rename to application/src/main/java/org/opentripplanner/netex/loader/parser/ServiceCalendarFrameParser.java diff --git a/src/main/java/org/opentripplanner/netex/loader/parser/ServiceFrameParser.java b/application/src/main/java/org/opentripplanner/netex/loader/parser/ServiceFrameParser.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/loader/parser/ServiceFrameParser.java rename to application/src/main/java/org/opentripplanner/netex/loader/parser/ServiceFrameParser.java diff --git a/src/main/java/org/opentripplanner/netex/loader/parser/SiteFrameParser.java b/application/src/main/java/org/opentripplanner/netex/loader/parser/SiteFrameParser.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/loader/parser/SiteFrameParser.java rename to application/src/main/java/org/opentripplanner/netex/loader/parser/SiteFrameParser.java diff --git a/src/main/java/org/opentripplanner/netex/loader/parser/TimeTableFrameParser.java b/application/src/main/java/org/opentripplanner/netex/loader/parser/TimeTableFrameParser.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/loader/parser/TimeTableFrameParser.java rename to application/src/main/java/org/opentripplanner/netex/loader/parser/TimeTableFrameParser.java diff --git a/src/main/java/org/opentripplanner/netex/loader/parser/package-info.java b/application/src/main/java/org/opentripplanner/netex/loader/parser/package-info.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/loader/parser/package-info.java rename to application/src/main/java/org/opentripplanner/netex/loader/parser/package-info.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/AuthorityToAgencyMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/AuthorityToAgencyMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/AuthorityToAgencyMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/AuthorityToAgencyMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/BookingInfoMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/BookingInfoMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/BookingInfoMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/BookingInfoMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/BookingMethodMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/BookingMethodMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/BookingMethodMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/BookingMethodMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/BrandingMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/BrandingMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/BrandingMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/BrandingMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/DirectionMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/DirectionMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/DirectionMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/DirectionMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/DurationMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/DurationMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/DurationMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/DurationMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/FlexStopsMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/FlexStopsMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/FlexStopsMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/FlexStopsMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/GroupNetexMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/GroupNetexMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/GroupNetexMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/GroupNetexMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/GroupOfRoutesMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/GroupOfRoutesMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/GroupOfRoutesMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/GroupOfRoutesMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/GroupOfStationsMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/GroupOfStationsMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/GroupOfStationsMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/GroupOfStationsMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/MultiModalStationMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/MultiModalStationMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/MultiModalStationMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/MultiModalStationMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/MultilingualStringMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/MultilingualStringMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/MultilingualStringMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/MultilingualStringMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/NetexMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/NetexMapper.java similarity index 98% rename from src/main/java/org/opentripplanner/netex/mapping/NetexMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/NetexMapper.java index 025a2349874..909d7b1c69f 100644 --- a/src/main/java/org/opentripplanner/netex/mapping/NetexMapper.java +++ b/application/src/main/java/org/opentripplanner/netex/mapping/NetexMapper.java @@ -66,6 +66,7 @@ public class NetexMapper { private final CalendarServiceBuilder calendarServiceBuilder; private final TripCalendarBuilder tripCalendarBuilder; private final Set ferryIdsNotAllowedForBicycle; + private final Set routeToCentroidStopPlaceIds; private final double maxStopToShapeSnapDistance; private final boolean noTransfersOnIsolatedStops; @@ -93,6 +94,7 @@ public NetexMapper( Deduplicator deduplicator, DataImportIssueStore issueStore, Set ferryIdsNotAllowedForBicycle, + Collection routeToCentroidStopPlaceIds, double maxStopToShapeSnapDistance, boolean noTransfersOnIsolatedStops ) { @@ -101,6 +103,7 @@ public NetexMapper( this.idFactory = new FeedScopedIdFactory(feedId); this.issueStore = issueStore; this.ferryIdsNotAllowedForBicycle = ferryIdsNotAllowedForBicycle; + this.routeToCentroidStopPlaceIds = Set.copyOf(routeToCentroidStopPlaceIds); this.noTransfersOnIsolatedStops = noTransfersOnIsolatedStops; this.maxStopToShapeSnapDistance = maxStopToShapeSnapDistance; this.calendarServiceBuilder = new CalendarServiceBuilder(idFactory); @@ -309,7 +312,8 @@ private void mapStopPlaceAndQuays(TariffZoneMapper tariffZoneMapper) { transitBuilder.stopModel(), zoneId, issueStore, - noTransfersOnIsolatedStops + noTransfersOnIsolatedStops, + routeToCentroidStopPlaceIds ); for (String stopPlaceId : currentNetexIndex.getStopPlaceById().localKeys()) { Collection stopPlaceAllVersions = currentNetexIndex diff --git a/src/main/java/org/opentripplanner/netex/mapping/NoticeAssignmentMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/NoticeAssignmentMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/NoticeAssignmentMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/NoticeAssignmentMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/NoticeMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/NoticeMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/NoticeMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/NoticeMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/OpenGisMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/OpenGisMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/OpenGisMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/OpenGisMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/OperatorToAgencyMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/OperatorToAgencyMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/OperatorToAgencyMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/OperatorToAgencyMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/QuayMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/QuayMapper.java similarity index 97% rename from src/main/java/org/opentripplanner/netex/mapping/QuayMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/QuayMapper.java index 5e9285043d5..a304ca32f72 100644 --- a/src/main/java/org/opentripplanner/netex/mapping/QuayMapper.java +++ b/application/src/main/java/org/opentripplanner/netex/mapping/QuayMapper.java @@ -1,7 +1,6 @@ package org.opentripplanner.netex.mapping; import java.util.Collection; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; @@ -39,7 +38,7 @@ class QuayMapper { */ @Nullable RegularStop mapQuayToStop( - @Nonnull Quay quay, + Quay quay, Station parentStation, Collection fareZones, NetexMainAndSubMode transitMode, @@ -54,7 +53,7 @@ RegularStop mapQuayToStop( private RegularStop map( FeedScopedId id, - @Nonnull Quay quay, + Quay quay, Station parentStation, Collection fareZones, NetexMainAndSubMode transitMode, diff --git a/src/main/java/org/opentripplanner/netex/mapping/RouteMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/RouteMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/RouteMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/RouteMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/ServiceLinkMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/ServiceLinkMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/ServiceLinkMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/ServiceLinkMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/StationMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/StationMapper.java similarity index 92% rename from src/main/java/org/opentripplanner/netex/mapping/StationMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/StationMapper.java index e94cf23fc4a..8840f7e4bdf 100644 --- a/src/main/java/org/opentripplanner/netex/mapping/StationMapper.java +++ b/application/src/main/java/org/opentripplanner/netex/mapping/StationMapper.java @@ -7,6 +7,7 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import java.util.Set; import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; @@ -34,6 +35,9 @@ class StationMapper { private final ZoneId defaultTimeZone; private final boolean noTransfersOnIsolatedStops; + + private final Set routeToCentroidStopPlaceIds; + private final StopModelBuilder stopModelBuilder; StationMapper( @@ -41,12 +45,14 @@ class StationMapper { FeedScopedIdFactory idFactory, ZoneId defaultTimeZone, boolean noTransfersOnIsolatedStops, + Set routeToCentroidStopPlaceIds, StopModelBuilder stopModelBuilder ) { this.issueStore = issueStore; this.idFactory = idFactory; this.defaultTimeZone = defaultTimeZone; this.noTransfersOnIsolatedStops = noTransfersOnIsolatedStops; + this.routeToCentroidStopPlaceIds = routeToCentroidStopPlaceIds; this.stopModelBuilder = stopModelBuilder; } @@ -60,6 +66,7 @@ Station mapStopPlaceToStation(FeedScopedId id, StopPlace stopPlace) { .of(id) .withName(resolveName(stopPlace)) .withCoordinate(mapCoordinate(stopPlace)) + .withShouldRouteToCentroid(shouldRouteToCentroid(id)) .withDescription( NonLocalizedString.ofNullable(stopPlace.getDescription(), MultilingualString::getValue) ) @@ -81,6 +88,10 @@ Station mapStopPlaceToStation(FeedScopedId id, StopPlace stopPlace) { return builder.build(); } + private boolean shouldRouteToCentroid(FeedScopedId stopPlaceId) { + return routeToCentroidStopPlaceIds.contains(stopPlaceId); + } + private ZoneId ofZoneId(String stopPlaceId, String zoneId) { try { return ZoneId.of(zoneId); diff --git a/src/main/java/org/opentripplanner/netex/mapping/StopAndStationMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/StopAndStationMapper.java similarity index 97% rename from src/main/java/org/opentripplanner/netex/mapping/StopAndStationMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/StopAndStationMapper.java index dd6d6a6f9f7..c5618a03a1a 100644 --- a/src/main/java/org/opentripplanner/netex/mapping/StopAndStationMapper.java +++ b/application/src/main/java/org/opentripplanner/netex/mapping/StopAndStationMapper.java @@ -22,6 +22,7 @@ import org.opentripplanner.netex.mapping.support.NetexMainAndSubMode; import org.opentripplanner.netex.mapping.support.StopPlaceVersionAndValidityComparator; import org.opentripplanner.transit.model.basic.Accessibility; +import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.site.FareZone; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.Station; @@ -70,7 +71,8 @@ class StopAndStationMapper { StopModelBuilder stopModelBuilder, ZoneId defaultTimeZone, DataImportIssueStore issueStore, - boolean noTransfersOnIsolatedStops + boolean noTransfersOnIsolatedStops, + Set routeToCentroidStopPlaceIds ) { this.stationMapper = new StationMapper( @@ -78,6 +80,7 @@ class StopAndStationMapper { idFactory, defaultTimeZone, noTransfersOnIsolatedStops, + routeToCentroidStopPlaceIds, stopModelBuilder ); this.quayMapper = new QuayMapper(idFactory, issueStore, stopModelBuilder); diff --git a/src/main/java/org/opentripplanner/netex/mapping/StopPlaceTypeMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/StopPlaceTypeMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/StopPlaceTypeMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/StopPlaceTypeMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/StopTimesMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/StopTimesMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/StopTimesMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/StopTimesMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/StopTimesMapperResult.java b/application/src/main/java/org/opentripplanner/netex/mapping/StopTimesMapperResult.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/StopTimesMapperResult.java rename to application/src/main/java/org/opentripplanner/netex/mapping/StopTimesMapperResult.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/StopTransferPriorityMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/StopTransferPriorityMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/StopTransferPriorityMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/StopTransferPriorityMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/TariffZoneMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/TariffZoneMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/TariffZoneMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/TariffZoneMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/TransferMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/TransferMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/TransferMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/TransferMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/TransportModeMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/TransportModeMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/TransportModeMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/TransportModeMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/TripCalendarBuilder.java b/application/src/main/java/org/opentripplanner/netex/mapping/TripCalendarBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/TripCalendarBuilder.java rename to application/src/main/java/org/opentripplanner/netex/mapping/TripCalendarBuilder.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/TripMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/TripMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/TripMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/TripMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/TripPatternMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/TripPatternMapper.java similarity index 99% rename from src/main/java/org/opentripplanner/netex/mapping/TripPatternMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/TripPatternMapper.java index 740224b4489..c7b85e72af8 100644 --- a/src/main/java/org/opentripplanner/netex/mapping/TripPatternMapper.java +++ b/application/src/main/java/org/opentripplanner/netex/mapping/TripPatternMapper.java @@ -255,8 +255,10 @@ Optional mapTripPattern(JourneyPattern_VersionStructure .withHopGeometries( serviceLinkMapper.getGeometriesByJourneyPattern(journeyPattern, stopPattern) ) + .withScheduledTimeTableBuilder(builder -> + builder.addAllTripTimes(createTripTimes(trips, tripStopTimes)) + ) .build(); - createTripTimes(trips, tripStopTimes).forEach(tripPattern::add); return Optional.of( new TripPatternMapperResult( diff --git a/src/main/java/org/opentripplanner/netex/mapping/TripPatternMapperResult.java b/application/src/main/java/org/opentripplanner/netex/mapping/TripPatternMapperResult.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/TripPatternMapperResult.java rename to application/src/main/java/org/opentripplanner/netex/mapping/TripPatternMapperResult.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/TripServiceAlterationMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/TripServiceAlterationMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/TripServiceAlterationMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/TripServiceAlterationMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/VehicleParkingMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/VehicleParkingMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/VehicleParkingMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/VehicleParkingMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/WgsCoordinateMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/WgsCoordinateMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/WgsCoordinateMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/WgsCoordinateMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/WheelChairMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/WheelChairMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/WheelChairMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/WheelChairMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/calendar/CalendarServiceBuilder.java b/application/src/main/java/org/opentripplanner/netex/mapping/calendar/CalendarServiceBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/calendar/CalendarServiceBuilder.java rename to application/src/main/java/org/opentripplanner/netex/mapping/calendar/CalendarServiceBuilder.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/calendar/DatedServiceJourneyMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/calendar/DatedServiceJourneyMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/calendar/DatedServiceJourneyMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/calendar/DatedServiceJourneyMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/calendar/DayOfWeekMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/calendar/DayOfWeekMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/calendar/DayOfWeekMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/calendar/DayOfWeekMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/calendar/DayTypeAssignmentMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/calendar/DayTypeAssignmentMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/calendar/DayTypeAssignmentMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/calendar/DayTypeAssignmentMapper.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/calendar/OperatingDayMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/calendar/OperatingDayMapper.java similarity index 77% rename from src/main/java/org/opentripplanner/netex/mapping/calendar/OperatingDayMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/calendar/OperatingDayMapper.java index 63c554c95fa..be398d34902 100644 --- a/src/main/java/org/opentripplanner/netex/mapping/calendar/OperatingDayMapper.java +++ b/application/src/main/java/org/opentripplanner/netex/mapping/calendar/OperatingDayMapper.java @@ -1,7 +1,6 @@ package org.opentripplanner.netex.mapping.calendar; import java.time.LocalDate; -import javax.annotation.Nonnull; import org.rutebanken.netex.model.OperatingDay; class OperatingDayMapper { @@ -9,7 +8,7 @@ class OperatingDayMapper { /** Utility class, prevent instantiation. */ private OperatingDayMapper() {} - static LocalDate map(@Nonnull OperatingDay opDay) { + static LocalDate map(OperatingDay opDay) { return opDay.getCalendarDate().toLocalDate(); } } diff --git a/src/main/java/org/opentripplanner/netex/mapping/support/FeedScopedIdFactory.java b/application/src/main/java/org/opentripplanner/netex/mapping/support/FeedScopedIdFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/support/FeedScopedIdFactory.java rename to application/src/main/java/org/opentripplanner/netex/mapping/support/FeedScopedIdFactory.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/support/NetexMainAndSubMode.java b/application/src/main/java/org/opentripplanner/netex/mapping/support/NetexMainAndSubMode.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/support/NetexMainAndSubMode.java rename to application/src/main/java/org/opentripplanner/netex/mapping/support/NetexMainAndSubMode.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/support/NetexMapperIndexes.java b/application/src/main/java/org/opentripplanner/netex/mapping/support/NetexMapperIndexes.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/support/NetexMapperIndexes.java rename to application/src/main/java/org/opentripplanner/netex/mapping/support/NetexMapperIndexes.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/support/NetexObjectDecorator.java b/application/src/main/java/org/opentripplanner/netex/mapping/support/NetexObjectDecorator.java similarity index 91% rename from src/main/java/org/opentripplanner/netex/mapping/support/NetexObjectDecorator.java rename to application/src/main/java/org/opentripplanner/netex/mapping/support/NetexObjectDecorator.java index e096cc499b7..1f4b8b0c786 100644 --- a/src/main/java/org/opentripplanner/netex/mapping/support/NetexObjectDecorator.java +++ b/application/src/main/java/org/opentripplanner/netex/mapping/support/NetexObjectDecorator.java @@ -1,7 +1,6 @@ package org.opentripplanner.netex.mapping.support; import java.util.function.Consumer; -import javax.annotation.Nonnull; import org.rutebanken.netex.model.VersionOfObjectRefStructure; import org.slf4j.Logger; @@ -46,7 +45,7 @@ public static void foo() {} * the right scope - this class is just a utility class, or the messenger. * @param ref the unexpected reference to an unmapped object. */ - public static void logUnmappedEntityRef(Logger log, @Nonnull VersionOfObjectRefStructure ref) { + public static void logUnmappedEntityRef(Logger log, VersionOfObjectRefStructure ref) { log.warn("Unexpected entity {} in NeTEx import. The entity is ignored.", ref); } } diff --git a/src/main/java/org/opentripplanner/netex/mapping/support/ServiceAlterationFilter.java b/application/src/main/java/org/opentripplanner/netex/mapping/support/ServiceAlterationFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/support/ServiceAlterationFilter.java rename to application/src/main/java/org/opentripplanner/netex/mapping/support/ServiceAlterationFilter.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/support/StopPlaceVersionAndValidityComparator.java b/application/src/main/java/org/opentripplanner/netex/mapping/support/StopPlaceVersionAndValidityComparator.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/support/StopPlaceVersionAndValidityComparator.java rename to application/src/main/java/org/opentripplanner/netex/mapping/support/StopPlaceVersionAndValidityComparator.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/support/ValidityComparator.java b/application/src/main/java/org/opentripplanner/netex/mapping/support/ValidityComparator.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/support/ValidityComparator.java rename to application/src/main/java/org/opentripplanner/netex/mapping/support/ValidityComparator.java diff --git a/src/main/java/org/opentripplanner/netex/mapping/support/ValidityHelper.java b/application/src/main/java/org/opentripplanner/netex/mapping/support/ValidityHelper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/mapping/support/ValidityHelper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/support/ValidityHelper.java diff --git a/src/main/java/org/opentripplanner/netex/package.md b/application/src/main/java/org/opentripplanner/netex/package.md similarity index 100% rename from src/main/java/org/opentripplanner/netex/package.md rename to application/src/main/java/org/opentripplanner/netex/package.md diff --git a/src/main/java/org/opentripplanner/netex/support/JAXBUtils.java b/application/src/main/java/org/opentripplanner/netex/support/JAXBUtils.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/support/JAXBUtils.java rename to application/src/main/java/org/opentripplanner/netex/support/JAXBUtils.java diff --git a/src/main/java/org/opentripplanner/netex/support/JourneyPatternHelper.java b/application/src/main/java/org/opentripplanner/netex/support/JourneyPatternHelper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/support/JourneyPatternHelper.java rename to application/src/main/java/org/opentripplanner/netex/support/JourneyPatternHelper.java diff --git a/src/main/java/org/opentripplanner/netex/support/NetexVersionHelper.java b/application/src/main/java/org/opentripplanner/netex/support/NetexVersionHelper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/support/NetexVersionHelper.java rename to application/src/main/java/org/opentripplanner/netex/support/NetexVersionHelper.java diff --git a/src/main/java/org/opentripplanner/netex/support/ServiceJourneyHelper.java b/application/src/main/java/org/opentripplanner/netex/support/ServiceJourneyHelper.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/support/ServiceJourneyHelper.java rename to application/src/main/java/org/opentripplanner/netex/support/ServiceJourneyHelper.java diff --git a/src/main/java/org/opentripplanner/netex/support/ServiceJourneyInfo.java b/application/src/main/java/org/opentripplanner/netex/support/ServiceJourneyInfo.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/support/ServiceJourneyInfo.java rename to application/src/main/java/org/opentripplanner/netex/support/ServiceJourneyInfo.java diff --git a/src/main/java/org/opentripplanner/netex/support/stoptime/AbstractStopTimeAdaptor.java b/application/src/main/java/org/opentripplanner/netex/support/stoptime/AbstractStopTimeAdaptor.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/support/stoptime/AbstractStopTimeAdaptor.java rename to application/src/main/java/org/opentripplanner/netex/support/stoptime/AbstractStopTimeAdaptor.java diff --git a/src/main/java/org/opentripplanner/netex/support/stoptime/AreaStopTimeAdaptor.java b/application/src/main/java/org/opentripplanner/netex/support/stoptime/AreaStopTimeAdaptor.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/support/stoptime/AreaStopTimeAdaptor.java rename to application/src/main/java/org/opentripplanner/netex/support/stoptime/AreaStopTimeAdaptor.java diff --git a/src/main/java/org/opentripplanner/netex/support/stoptime/RegularStopTimeAdaptor.java b/application/src/main/java/org/opentripplanner/netex/support/stoptime/RegularStopTimeAdaptor.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/support/stoptime/RegularStopTimeAdaptor.java rename to application/src/main/java/org/opentripplanner/netex/support/stoptime/RegularStopTimeAdaptor.java diff --git a/src/main/java/org/opentripplanner/netex/support/stoptime/StopTimeAdaptor.java b/application/src/main/java/org/opentripplanner/netex/support/stoptime/StopTimeAdaptor.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/support/stoptime/StopTimeAdaptor.java rename to application/src/main/java/org/opentripplanner/netex/support/stoptime/StopTimeAdaptor.java diff --git a/src/main/java/org/opentripplanner/netex/validation/AbstractHMapValidationRule.java b/application/src/main/java/org/opentripplanner/netex/validation/AbstractHMapValidationRule.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/validation/AbstractHMapValidationRule.java rename to application/src/main/java/org/opentripplanner/netex/validation/AbstractHMapValidationRule.java diff --git a/src/main/java/org/opentripplanner/netex/validation/DSJOperatingDayNotFound.java b/application/src/main/java/org/opentripplanner/netex/validation/DSJOperatingDayNotFound.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/validation/DSJOperatingDayNotFound.java rename to application/src/main/java/org/opentripplanner/netex/validation/DSJOperatingDayNotFound.java diff --git a/src/main/java/org/opentripplanner/netex/validation/DSJServiceJourneyNotFound.java b/application/src/main/java/org/opentripplanner/netex/validation/DSJServiceJourneyNotFound.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/validation/DSJServiceJourneyNotFound.java rename to application/src/main/java/org/opentripplanner/netex/validation/DSJServiceJourneyNotFound.java diff --git a/src/main/java/org/opentripplanner/netex/validation/JourneyPatternNotFoundInSJ.java b/application/src/main/java/org/opentripplanner/netex/validation/JourneyPatternNotFoundInSJ.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/validation/JourneyPatternNotFoundInSJ.java rename to application/src/main/java/org/opentripplanner/netex/validation/JourneyPatternNotFoundInSJ.java diff --git a/src/main/java/org/opentripplanner/netex/validation/JourneyPatternSJMismatch.java b/application/src/main/java/org/opentripplanner/netex/validation/JourneyPatternSJMismatch.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/validation/JourneyPatternSJMismatch.java rename to application/src/main/java/org/opentripplanner/netex/validation/JourneyPatternSJMismatch.java diff --git a/src/main/java/org/opentripplanner/netex/validation/PassengerStopAssignmentQuayNotFound.java b/application/src/main/java/org/opentripplanner/netex/validation/PassengerStopAssignmentQuayNotFound.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/validation/PassengerStopAssignmentQuayNotFound.java rename to application/src/main/java/org/opentripplanner/netex/validation/PassengerStopAssignmentQuayNotFound.java diff --git a/src/main/java/org/opentripplanner/netex/validation/ServiceJourneyNonIncreasingPassingTime.java b/application/src/main/java/org/opentripplanner/netex/validation/ServiceJourneyNonIncreasingPassingTime.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/validation/ServiceJourneyNonIncreasingPassingTime.java rename to application/src/main/java/org/opentripplanner/netex/validation/ServiceJourneyNonIncreasingPassingTime.java diff --git a/src/main/java/org/opentripplanner/netex/validation/Validator.java b/application/src/main/java/org/opentripplanner/netex/validation/Validator.java similarity index 100% rename from src/main/java/org/opentripplanner/netex/validation/Validator.java rename to application/src/main/java/org/opentripplanner/netex/validation/Validator.java diff --git a/src/main/java/org/opentripplanner/openstreetmap/OSMOpeningHoursParser.java b/application/src/main/java/org/opentripplanner/osm/OsmOpeningHoursParser.java similarity index 98% rename from src/main/java/org/opentripplanner/openstreetmap/OSMOpeningHoursParser.java rename to application/src/main/java/org/opentripplanner/osm/OsmOpeningHoursParser.java index fcb8162f740..2391eb9aab4 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/OSMOpeningHoursParser.java +++ b/application/src/main/java/org/opentripplanner/osm/OsmOpeningHoursParser.java @@ -1,4 +1,4 @@ -package org.opentripplanner.openstreetmap; +package org.opentripplanner.osm; import static ch.poole.openinghoursparser.RuleModifier.Modifier.CLOSED; import static ch.poole.openinghoursparser.RuleModifier.Modifier.OFF; @@ -39,9 +39,9 @@ * * Part of the code is copied from https://github.com/leonardehrenfried/opening-hours-evaluator */ -public class OSMOpeningHoursParser { +public class OsmOpeningHoursParser { - private static final Logger LOG = LoggerFactory.getLogger(OSMOpeningHoursParser.class); + private static final Logger LOG = LoggerFactory.getLogger(OsmOpeningHoursParser.class); private final OpeningHoursCalendarService openingHoursCalendarService; @@ -76,14 +76,14 @@ public class OSMOpeningHoursParser { entry(Month.DEC, java.time.Month.DECEMBER) ); - public OSMOpeningHoursParser( + public OsmOpeningHoursParser( OpeningHoursCalendarService openingHoursCalendarService, DataImportIssueStore issueStore ) { this(openingHoursCalendarService, () -> null, issueStore); } - public OSMOpeningHoursParser( + public OsmOpeningHoursParser( OpeningHoursCalendarService openingHoursCalendarService, Supplier zoneIdSupplier, DataImportIssueStore issueStore @@ -94,7 +94,7 @@ public OSMOpeningHoursParser( this.issueStore = issueStore; } - public OSMOpeningHoursParser( + public OsmOpeningHoursParser( OpeningHoursCalendarService openingHoursCalendarService, ZoneId zoneId ) { diff --git a/src/main/java/org/opentripplanner/openstreetmap/OpenStreetMapParser.java b/application/src/main/java/org/opentripplanner/osm/OsmParser.java similarity index 83% rename from src/main/java/org/opentripplanner/openstreetmap/OpenStreetMapParser.java rename to application/src/main/java/org/opentripplanner/osm/OsmParser.java index e46fc94b784..8a5f8e32448 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/OpenStreetMapParser.java +++ b/application/src/main/java/org/opentripplanner/osm/OsmParser.java @@ -1,4 +1,4 @@ -package org.opentripplanner.openstreetmap; +package org.opentripplanner.osm; import java.util.HashMap; import java.util.List; @@ -7,26 +7,26 @@ import org.openstreetmap.osmosis.osmbinary.BinaryParser; import org.openstreetmap.osmosis.osmbinary.Osmformat; import org.opentripplanner.graph_builder.module.osm.OsmDatabase; -import org.opentripplanner.openstreetmap.model.OSMMemberType; -import org.opentripplanner.openstreetmap.model.OSMNode; -import org.opentripplanner.openstreetmap.model.OSMRelation; -import org.opentripplanner.openstreetmap.model.OSMRelationMember; -import org.opentripplanner.openstreetmap.model.OSMTag; -import org.opentripplanner.openstreetmap.model.OSMWay; +import org.opentripplanner.osm.model.OsmMemberType; +import org.opentripplanner.osm.model.OsmNode; +import org.opentripplanner.osm.model.OsmRelation; +import org.opentripplanner.osm.model.OsmRelationMember; +import org.opentripplanner.osm.model.OsmTag; +import org.opentripplanner.osm.model.OsmWay; /** * Parser for the OpenStreetMap PBF Format. * * @since 0.4 */ -class OpenStreetMapParser extends BinaryParser { +class OsmParser extends BinaryParser { private final OsmDatabase osmdb; private final Map stringTable = new HashMap<>(); private final OsmProvider provider; private OsmParserPhase parsePhase; - public OpenStreetMapParser(OsmDatabase osmdb, OsmProvider provider) { + public OsmParser(OsmDatabase osmdb, OsmProvider provider) { this.osmdb = Objects.requireNonNull(osmdb); this.provider = Objects.requireNonNull(provider); } @@ -63,12 +63,12 @@ protected void parseRelations(List rels) { } for (Osmformat.Relation i : rels) { - OSMRelation tmp = new OSMRelation(); + OsmRelation tmp = new OsmRelation(); tmp.setId(i.getId()); tmp.setOsmProvider(provider); for (int j = 0; j < i.getKeysCount(); j++) { - OSMTag tag = new OSMTag(); + OsmTag tag = new OsmTag(); String key = internalize(getStringById(i.getKeys(j))); String value = internalize(getStringById(i.getVals(j))); tag.setK(key); @@ -78,7 +78,7 @@ protected void parseRelations(List rels) { long lastMid = 0; for (int j = 0; j < i.getMemidsCount(); j++) { - OSMRelationMember relMember = new OSMRelationMember(); + OsmRelationMember relMember = new OsmRelationMember(); long mid = lastMid + i.getMemids(j); relMember.setRef(mid); @@ -87,11 +87,11 @@ protected void parseRelations(List rels) { relMember.setRole(internalize(getStringById(i.getRolesSid(j)))); if (i.getTypes(j) == Osmformat.Relation.MemberType.NODE) { - relMember.setType(OSMMemberType.NODE); + relMember.setType(OsmMemberType.NODE); } else if (i.getTypes(j) == Osmformat.Relation.MemberType.WAY) { - relMember.setType(OSMMemberType.WAY); + relMember.setType(OsmMemberType.WAY); } else if (i.getTypes(j) == Osmformat.Relation.MemberType.RELATION) { - relMember.setType(OSMMemberType.RELATION); + relMember.setType(OsmMemberType.RELATION); } else { assert false; // TODO; Illegal file? } @@ -113,7 +113,7 @@ protected void parseDense(Osmformat.DenseNodes nodes) { } for (int i = 0; i < nodes.getIdCount(); i++) { - OSMNode tmp = new OSMNode(); + OsmNode tmp = new OsmNode(); long lat = nodes.getLat(i) + lastLat; lastLat = lat; @@ -134,7 +134,7 @@ protected void parseDense(Osmformat.DenseNodes nodes) { int keyid = nodes.getKeysVals(j++); int valid = nodes.getKeysVals(j++); - OSMTag tag = new OSMTag(); + OsmTag tag = new OsmTag(); String key = internalize(getStringById(keyid)); String value = internalize(getStringById(valid)); tag.setK(key); @@ -155,7 +155,7 @@ protected void parseNodes(List nodes) { } for (Osmformat.Node i : nodes) { - OSMNode tmp = new OSMNode(); + OsmNode tmp = new OsmNode(); tmp.setId(i.getId()); tmp.setOsmProvider(provider); tmp.lat = parseLat(i.getLat()); @@ -165,7 +165,7 @@ protected void parseNodes(List nodes) { String key = internalize(getStringById(i.getKeys(j))); // if handler.retain_tag(key) // TODO: filter tags String value = internalize(getStringById(i.getVals(j))); - OSMTag tag = new OSMTag(); + OsmTag tag = new OsmTag(); tag.setK(key); tag.setV(value); tmp.addTag(tag); @@ -182,12 +182,12 @@ protected void parseWays(List ways) { } for (Osmformat.Way i : ways) { - OSMWay tmp = new OSMWay(); + OsmWay tmp = new OsmWay(); tmp.setId(i.getId()); tmp.setOsmProvider(provider); for (int j = 0; j < i.getKeysCount(); j++) { - OSMTag tag = new OSMTag(); + OsmTag tag = new OsmTag(); String key = internalize(getStringById(i.getKeys(j))); String value = internalize(getStringById(i.getVals(j))); tag.setK(key); diff --git a/src/main/java/org/opentripplanner/openstreetmap/OsmParserPhase.java b/application/src/main/java/org/opentripplanner/osm/OsmParserPhase.java similarity index 56% rename from src/main/java/org/opentripplanner/openstreetmap/OsmParserPhase.java rename to application/src/main/java/org/opentripplanner/osm/OsmParserPhase.java index 00b22aaa599..f4b1125aaea 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/OsmParserPhase.java +++ b/application/src/main/java/org/opentripplanner/osm/OsmParserPhase.java @@ -1,4 +1,4 @@ -package org.opentripplanner.openstreetmap; +package org.opentripplanner.osm; enum OsmParserPhase { Relations, diff --git a/src/main/java/org/opentripplanner/openstreetmap/OsmProvider.java b/application/src/main/java/org/opentripplanner/osm/OsmProvider.java similarity index 90% rename from src/main/java/org/opentripplanner/openstreetmap/OsmProvider.java rename to application/src/main/java/org/opentripplanner/osm/OsmProvider.java index e35a846cbbd..2569f666281 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/OsmProvider.java +++ b/application/src/main/java/org/opentripplanner/osm/OsmProvider.java @@ -1,4 +1,4 @@ -package org.opentripplanner.openstreetmap; +package org.opentripplanner.osm; import java.io.ByteArrayInputStream; import java.io.File; @@ -14,9 +14,9 @@ import org.opentripplanner.framework.tostring.ToStringBuilder; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.graph_builder.module.osm.OsmDatabase; -import org.opentripplanner.openstreetmap.tagmapping.OsmTagMapper; -import org.opentripplanner.openstreetmap.tagmapping.OsmTagMapperSource; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertySet; +import org.opentripplanner.osm.tagmapping.OsmTagMapper; +import org.opentripplanner.osm.tagmapping.OsmTagMapperSource; +import org.opentripplanner.osm.wayproperty.WayPropertySet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -66,9 +66,9 @@ public OsmProvider( this.cacheDataInMem = cacheDataInMem; } - public void readOSM(OsmDatabase osmdb) { + public void readOsm(OsmDatabase osmdb) { try { - OpenStreetMapParser parser = new OpenStreetMapParser(osmdb, this); + OsmParser parser = new OsmParser(osmdb, this); parsePhase(parser, OsmParserPhase.Relations); osmdb.doneFirstPhaseRelations(); @@ -105,7 +105,7 @@ private static InputStream track(OsmParserPhase phase, long size, InputStream in return ProgressTracker.track("Parse OSM " + phase, 1000, size, inputStream, m -> LOG.info(m)); } - private void parsePhase(OpenStreetMapParser parser, OsmParserPhase phase) throws IOException { + private void parsePhase(OsmParser parser, OsmParserPhase phase) throws IOException { parser.setPhase(phase); BlockInputStream in = null; try { diff --git a/src/main/java/org/opentripplanner/openstreetmap/issues/FloorNumberUnknownAssumedGroundLevel.java b/application/src/main/java/org/opentripplanner/osm/issues/FloorNumberUnknownAssumedGroundLevel.java similarity index 83% rename from src/main/java/org/opentripplanner/openstreetmap/issues/FloorNumberUnknownAssumedGroundLevel.java rename to application/src/main/java/org/opentripplanner/osm/issues/FloorNumberUnknownAssumedGroundLevel.java index bc7adeb07bd..c468f7dbd52 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/issues/FloorNumberUnknownAssumedGroundLevel.java +++ b/application/src/main/java/org/opentripplanner/osm/issues/FloorNumberUnknownAssumedGroundLevel.java @@ -1,9 +1,9 @@ -package org.opentripplanner.openstreetmap.issues; +package org.opentripplanner.osm.issues; import org.opentripplanner.graph_builder.issue.api.DataImportIssue; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; -public record FloorNumberUnknownAssumedGroundLevel(String layer, OSMWithTags entity) +public record FloorNumberUnknownAssumedGroundLevel(String layer, OsmWithTags entity) implements DataImportIssue { private static final String FMT = "%s : could not determine floor number for layer %s, assumed to be ground-level."; diff --git a/src/main/java/org/opentripplanner/openstreetmap/issues/FloorNumberUnknownGuessedFromAltitude.java b/application/src/main/java/org/opentripplanner/osm/issues/FloorNumberUnknownGuessedFromAltitude.java similarity index 84% rename from src/main/java/org/opentripplanner/openstreetmap/issues/FloorNumberUnknownGuessedFromAltitude.java rename to application/src/main/java/org/opentripplanner/osm/issues/FloorNumberUnknownGuessedFromAltitude.java index 74e7cff3fda..0f4022eb86f 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/issues/FloorNumberUnknownGuessedFromAltitude.java +++ b/application/src/main/java/org/opentripplanner/osm/issues/FloorNumberUnknownGuessedFromAltitude.java @@ -1,12 +1,12 @@ -package org.opentripplanner.openstreetmap.issues; +package org.opentripplanner.osm.issues; import org.opentripplanner.graph_builder.issue.api.DataImportIssue; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; public record FloorNumberUnknownGuessedFromAltitude( String layer, Integer floorNumber, - OSMWithTags entity + OsmWithTags entity ) implements DataImportIssue { private static final String FMT = diff --git a/src/main/java/org/opentripplanner/openstreetmap/model/OSMLevel.java b/application/src/main/java/org/opentripplanner/osm/model/OsmLevel.java similarity index 85% rename from src/main/java/org/opentripplanner/openstreetmap/model/OSMLevel.java rename to application/src/main/java/org/opentripplanner/osm/model/OsmLevel.java index 6f121ed0e13..6048260d486 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/model/OSMLevel.java +++ b/application/src/main/java/org/opentripplanner/osm/model/OsmLevel.java @@ -1,4 +1,4 @@ -package org.opentripplanner.openstreetmap.model; +package org.opentripplanner.osm.model; import java.util.ArrayList; import java.util.HashMap; @@ -7,14 +7,14 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; -import org.opentripplanner.openstreetmap.issues.FloorNumberUnknownAssumedGroundLevel; -import org.opentripplanner.openstreetmap.issues.FloorNumberUnknownGuessedFromAltitude; +import org.opentripplanner.osm.issues.FloorNumberUnknownAssumedGroundLevel; +import org.opentripplanner.osm.issues.FloorNumberUnknownGuessedFromAltitude; -public class OSMLevel implements Comparable { +public class OsmLevel implements Comparable { public static final Pattern RANGE_PATTERN = Pattern.compile("^[0-9]+-[0-9]+$"); public static final double METERS_PER_FLOOR = 3; - public static final OSMLevel DEFAULT = new OSMLevel( + public static final OsmLevel DEFAULT = new OsmLevel( 0, 0.0, "default level", @@ -29,7 +29,7 @@ public class OSMLevel implements Comparable { public final Source source; public final boolean reliable; - public OSMLevel( + public OsmLevel( int floorNumber, double altitudeMeters, String shortName, @@ -49,12 +49,12 @@ public OSMLevel( * makes an OSMLevel from one of the semicolon-separated fields in an OSM level map relation's * levels= tag. */ - public static OSMLevel fromString( + public static OsmLevel fromString( String spec, Source source, boolean incrementNonNegative, DataImportIssueStore issueStore, - OSMWithTags osmObj + OsmWithTags osmObj ) { /* extract any altitude information after the @ character */ Double altitude = null; @@ -126,15 +126,15 @@ public static OSMLevel fromString( issueStore.add(new FloorNumberUnknownAssumedGroundLevel(spec, osmObj)); reliable = false; } - return new OSMLevel(floorNumber, altitude, shortName, longName, source, reliable); + return new OsmLevel(floorNumber, altitude, shortName, longName, source, reliable); } - public static List fromSpecList( + public static List fromSpecList( String specList, Source source, boolean incrementNonNegative, DataImportIssueStore issueStore, - OSMWithTags osmObj + OsmWithTags osmObj ) { List levelSpecs = new ArrayList<>(); @@ -153,22 +153,22 @@ public static List fromSpecList( } /* build an OSMLevel for each level spec in the list */ - List levels = new ArrayList<>(); + List levels = new ArrayList<>(); for (String spec : levelSpecs) { levels.add(fromString(spec, source, incrementNonNegative, issueStore, osmObj)); } return levels; } - public static Map mapFromSpecList( + public static Map mapFromSpecList( String specList, Source source, boolean incrementNonNegative, DataImportIssueStore issueStore, - OSMWithTags osmObj + OsmWithTags osmObj ) { - Map map = new HashMap<>(); - for (OSMLevel level : fromSpecList( + Map map = new HashMap<>(); + for (OsmLevel level : fromSpecList( specList, source, incrementNonNegative, @@ -181,7 +181,7 @@ public static Map mapFromSpecList( } @Override - public int compareTo(OSMLevel other) { + public int compareTo(OsmLevel other) { return this.floorNumber - other.floorNumber; } @@ -195,10 +195,10 @@ public boolean equals(Object other) { if (other == null) { return false; } - if (!(other instanceof OSMLevel)) { + if (!(other instanceof OsmLevel)) { return false; } - return this.floorNumber == ((OSMLevel) other).floorNumber; + return this.floorNumber == ((OsmLevel) other).floorNumber; } public enum Source { diff --git a/application/src/main/java/org/opentripplanner/osm/model/OsmMemberType.java b/application/src/main/java/org/opentripplanner/osm/model/OsmMemberType.java new file mode 100644 index 00000000000..c27b6e577d1 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/osm/model/OsmMemberType.java @@ -0,0 +1,7 @@ +package org.opentripplanner.osm.model; + +public enum OsmMemberType { + NODE, + WAY, + RELATION, +} diff --git a/src/main/java/org/opentripplanner/openstreetmap/model/OSMNode.java b/application/src/main/java/org/opentripplanner/osm/model/OsmNode.java similarity index 95% rename from src/main/java/org/opentripplanner/openstreetmap/model/OSMNode.java rename to application/src/main/java/org/opentripplanner/osm/model/OsmNode.java index d181cde4564..c5539d1296e 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/model/OSMNode.java +++ b/application/src/main/java/org/opentripplanner/osm/model/OsmNode.java @@ -1,10 +1,10 @@ -package org.opentripplanner.openstreetmap.model; +package org.opentripplanner.osm.model; import java.util.Set; import org.locationtech.jts.geom.Coordinate; import org.opentripplanner.street.model.StreetTraversalPermission; -public class OSMNode extends OSMWithTags { +public class OsmNode extends OsmWithTags { static final Set MOTOR_VEHICLE_BARRIERS = Set.of("bollard", "bar", "chain"); diff --git a/src/main/java/org/opentripplanner/openstreetmap/model/OSMRelation.java b/application/src/main/java/org/opentripplanner/osm/model/OsmRelation.java similarity index 79% rename from src/main/java/org/opentripplanner/openstreetmap/model/OSMRelation.java rename to application/src/main/java/org/opentripplanner/osm/model/OsmRelation.java index e181cf97713..7c6d684ebfd 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/model/OSMRelation.java +++ b/application/src/main/java/org/opentripplanner/osm/model/OsmRelation.java @@ -1,17 +1,17 @@ -package org.opentripplanner.openstreetmap.model; +package org.opentripplanner.osm.model; import java.util.ArrayList; import java.util.List; -public class OSMRelation extends OSMWithTags { +public class OsmRelation extends OsmWithTags { - private final List members = new ArrayList<>(); + private final List members = new ArrayList<>(); - public void addMember(OSMRelationMember member) { + public void addMember(OsmRelationMember member) { members.add(member); } - public List getMembers() { + public List getMembers() { return members; } diff --git a/src/main/java/org/opentripplanner/openstreetmap/model/OSMRelationMember.java b/application/src/main/java/org/opentripplanner/osm/model/OsmRelationMember.java similarity index 72% rename from src/main/java/org/opentripplanner/openstreetmap/model/OSMRelationMember.java rename to application/src/main/java/org/opentripplanner/osm/model/OsmRelationMember.java index e2ad2ff9691..0cf1118f59f 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/model/OSMRelationMember.java +++ b/application/src/main/java/org/opentripplanner/osm/model/OsmRelationMember.java @@ -1,20 +1,20 @@ -package org.opentripplanner.openstreetmap.model; +package org.opentripplanner.osm.model; -import static org.opentripplanner.openstreetmap.model.OSMMemberType.WAY; +import static org.opentripplanner.osm.model.OsmMemberType.WAY; -public class OSMRelationMember { +public class OsmRelationMember { - private OSMMemberType type; + private OsmMemberType type; private long ref; private String role; - public OSMMemberType getType() { + public OsmMemberType getType() { return type; } - public void setType(OSMMemberType type) { + public void setType(OsmMemberType type) { this.type = type; } diff --git a/src/main/java/org/opentripplanner/openstreetmap/model/OSMTag.java b/application/src/main/java/org/opentripplanner/osm/model/OsmTag.java similarity index 71% rename from src/main/java/org/opentripplanner/openstreetmap/model/OSMTag.java rename to application/src/main/java/org/opentripplanner/osm/model/OsmTag.java index 40bfe1e8560..a0f90c01ab5 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/model/OSMTag.java +++ b/application/src/main/java/org/opentripplanner/osm/model/OsmTag.java @@ -1,13 +1,13 @@ -package org.opentripplanner.openstreetmap.model; +package org.opentripplanner.osm.model; -public class OSMTag { +public class OsmTag { private String k; private String v; - public OSMTag() {} + public OsmTag() {} - public OSMTag(String k, String v) { + public OsmTag(String k, String v) { this.k = k; this.v = v; } diff --git a/src/main/java/org/opentripplanner/openstreetmap/model/OSMWay.java b/application/src/main/java/org/opentripplanner/osm/model/OsmWay.java similarity index 98% rename from src/main/java/org/opentripplanner/openstreetmap/model/OSMWay.java rename to application/src/main/java/org/opentripplanner/osm/model/OsmWay.java index b1e90044bf2..7f102b27c5a 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/model/OSMWay.java +++ b/application/src/main/java/org/opentripplanner/osm/model/OsmWay.java @@ -1,4 +1,4 @@ -package org.opentripplanner.openstreetmap.model; +package org.opentripplanner.osm.model; import gnu.trove.list.TLongList; import gnu.trove.list.array.TLongArrayList; @@ -6,7 +6,7 @@ import org.opentripplanner.graph_builder.module.osm.StreetTraversalPermissionPair; import org.opentripplanner.street.model.StreetTraversalPermission; -public class OSMWay extends OSMWithTags { +public class OsmWay extends OsmWithTags { private static final Set ESCALATOR_CONVEYING_TAGS = Set.of( "yes", diff --git a/src/main/java/org/opentripplanner/openstreetmap/model/OSMWithTags.java b/application/src/main/java/org/opentripplanner/osm/model/OsmWithTags.java similarity index 95% rename from src/main/java/org/opentripplanner/openstreetmap/model/OSMWithTags.java rename to application/src/main/java/org/opentripplanner/osm/model/OsmWithTags.java index b53739bf6a1..1cd08d9fcd5 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/model/OSMWithTags.java +++ b/application/src/main/java/org/opentripplanner/osm/model/OsmWithTags.java @@ -1,4 +1,4 @@ -package org.opentripplanner.openstreetmap.model; +package org.opentripplanner.osm.model; import java.util.Arrays; import java.util.HashMap; @@ -11,21 +11,20 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.framework.i18n.TranslatedString; import org.opentripplanner.framework.tostring.ToStringBuilder; import org.opentripplanner.graph_builder.module.osm.OsmModule; -import org.opentripplanner.openstreetmap.OsmProvider; +import org.opentripplanner.osm.OsmProvider; import org.opentripplanner.street.model.StreetTraversalPermission; import org.opentripplanner.transit.model.basic.Accessibility; /** * A base class for OSM entities containing common methods. */ -public class OSMWithTags { +public class OsmWithTags { /** * highway=* values that we don't want to even consider when building the graph. @@ -83,7 +82,7 @@ public void setId(long id) { /** * Adds a tag. */ - public void addTag(OSMTag tag) { + public void addTag(OsmTag tag) { if (tags == null) tags = new HashMap<>(); tags.put(tag.getK().toLowerCase(), tag.getV()); @@ -92,7 +91,7 @@ public void addTag(OSMTag tag) { /** * Adds a tag. */ - public OSMWithTags addTag(String key, String value) { + public OsmWithTags addTag(String key, String value) { if (key == null || value == null) { return this; } @@ -199,7 +198,6 @@ public String getTag(String tag) { * * @return A tags value converted to lower case. An empty Optional if tags is not present. */ - @Nonnull public Optional getTagOpt(String network) { return Optional.ofNullable(getTag(network)); } @@ -243,6 +241,7 @@ public boolean isOneOfTags(String key, Set oneOfTags) { * Returns a name-like value for an entity (if one exists). The otp: namespaced tags are created * by {@link OsmModule} */ + @Nullable public I18NString getAssumedName() { if (tags == null) { return null; @@ -275,10 +274,6 @@ public I18NString getAssumedName() { * other language found in OSM tag. */ public Map generateI18NForPattern(String pattern) { - if (pattern == null) { - return null; - } - Map i18n = new HashMap<>(); i18n.put(null, new StringBuffer()); Matcher matcher = Pattern.compile("\\{(.*?)}").matcher(pattern); @@ -292,17 +287,15 @@ public Map generateI18NForPattern(String pattern) { String defKey = matcher.group(1); // scan all translated tags Map i18nTags = getTagsByPrefix(defKey); - if (i18nTags != null) { - for (Map.Entry kv : i18nTags.entrySet()) { - if (!kv.getKey().equals(defKey)) { - String lang = kv.getKey().substring(defKey.length() + 1); - if (!i18n.containsKey(lang)) i18n.put(lang, new StringBuffer(i18n.get(null))); - } + for (Map.Entry kv : i18nTags.entrySet()) { + if (!kv.getKey().equals(defKey)) { + String lang = kv.getKey().substring(defKey.length() + 1); + if (!i18n.containsKey(lang)) i18n.put(lang, new StringBuffer(i18n.get(null))); } } // get the simple value (eg: description=...) String defTag = getTag(defKey); - if (defTag == null && i18nTags != null && i18nTags.size() != 0) { + if (defTag == null && !i18nTags.isEmpty()) { defTag = i18nTags.values().iterator().next(); } // get the translated value, if exists @@ -320,7 +313,7 @@ public Map generateI18NForPattern(String pattern) { return out; } - public Map getTagsByPrefix(String prefix) { + private Map getTagsByPrefix(String prefix) { Map out = new HashMap<>(); for (Map.Entry entry : tags.entrySet()) { String k = entry.getKey(); @@ -328,9 +321,6 @@ public Map getTagsByPrefix(String prefix) { out.put(k, entry.getValue()); } } - if (out.isEmpty()) { - return null; - } return out; } @@ -504,6 +494,7 @@ public void setCreativeName(I18NString creativeName) { this.creativeName = creativeName; } + @Nullable public String url() { return null; } @@ -513,7 +504,6 @@ public String url() { *

* Values are split by semicolons. */ - @Nonnull public Set getMultiTagValues(Set refTags) { return refTags .stream() @@ -593,7 +583,7 @@ public boolean isNamed() { * Perhaps this entity has a name that isn't in the source data, but it's also possible that * it's explicitly tagged as not having one. * - * @see OSMWithTags#isExplicitlyUnnamed() + * @see OsmWithTags#isExplicitlyUnnamed() */ public boolean hasNoName() { return !isNamed(); @@ -603,7 +593,7 @@ public boolean hasNoName() { * Whether this entity explicitly doesn't have a name. This is different to no name being * set on the entity in OSM. * - * @see OSMWithTags#isNamed() + * @see OsmWithTags#isNamed() * @see https://wiki.openstreetmap.org/wiki/Tag:noname%3Dyes */ public boolean isExplicitlyUnnamed() { @@ -622,7 +612,6 @@ private boolean isTagDeniedAccess(String tagName) { * Returns level tag (i.e. building floor) or layer tag values, defaults to "0" * Some entities can have a semicolon separated list of levels (e.g. elevators) */ - @Nonnull public Set getLevels() { var levels = getMultiTagValues(LEVEL_TAGS); if (levels.isEmpty()) { diff --git a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/AtlantaMapper.java b/application/src/main/java/org/opentripplanner/osm/tagmapping/AtlantaMapper.java similarity index 83% rename from src/main/java/org/opentripplanner/openstreetmap/tagmapping/AtlantaMapper.java rename to application/src/main/java/org/opentripplanner/osm/tagmapping/AtlantaMapper.java index f9539188904..4d190c0b667 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/AtlantaMapper.java +++ b/application/src/main/java/org/opentripplanner/osm/tagmapping/AtlantaMapper.java @@ -1,9 +1,9 @@ -package org.opentripplanner.openstreetmap.tagmapping; +package org.opentripplanner.osm.tagmapping; -import static org.opentripplanner.openstreetmap.wayproperty.WayPropertiesBuilder.withModes; +import static org.opentripplanner.osm.wayproperty.WayPropertiesBuilder.withModes; import static org.opentripplanner.street.model.StreetTraversalPermission.ALL; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertySet; +import org.opentripplanner.osm.wayproperty.WayPropertySet; /** * OSM way properties for the Atlanta, Georgia, USA area. diff --git a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/ConstantSpeedMapper.java b/application/src/main/java/org/opentripplanner/osm/tagmapping/ConstantSpeedMapper.java similarity index 57% rename from src/main/java/org/opentripplanner/openstreetmap/tagmapping/ConstantSpeedMapper.java rename to application/src/main/java/org/opentripplanner/osm/tagmapping/ConstantSpeedMapper.java index b233b3f549e..9f1b1ac0ade 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/ConstantSpeedMapper.java +++ b/application/src/main/java/org/opentripplanner/osm/tagmapping/ConstantSpeedMapper.java @@ -1,15 +1,7 @@ -package org.opentripplanner.openstreetmap.tagmapping; +package org.opentripplanner.osm.tagmapping; -import static org.opentripplanner.openstreetmap.wayproperty.WayPropertiesBuilder.withModes; -import static org.opentripplanner.street.model.StreetTraversalPermission.ALL; -import static org.opentripplanner.street.model.StreetTraversalPermission.CAR; -import static org.opentripplanner.street.model.StreetTraversalPermission.NONE; -import static org.opentripplanner.street.model.StreetTraversalPermission.PEDESTRIAN; -import static org.opentripplanner.street.model.StreetTraversalPermission.PEDESTRIAN_AND_BICYCLE; - -import org.opentripplanner.openstreetmap.model.OSMWithTags; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertySet; -import org.opentripplanner.street.model.StreetTraversalPermission; +import org.opentripplanner.osm.model.OsmWithTags; +import org.opentripplanner.osm.wayproperty.WayPropertySet; /** * OSM way properties for optimizing distance (not traveling time) in routing. @@ -37,7 +29,7 @@ public void populateProperties(WayPropertySet props) { } @Override - public float getCarSpeedForWay(OSMWithTags way, boolean backward) { + public float getCarSpeedForWay(OsmWithTags way, boolean backward) { /* * Set the same 80 km/h speed for all roads, so that car routing finds shortest path */ diff --git a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/DefaultMapper.java b/application/src/main/java/org/opentripplanner/osm/tagmapping/DefaultMapper.java similarity index 97% rename from src/main/java/org/opentripplanner/openstreetmap/tagmapping/DefaultMapper.java rename to application/src/main/java/org/opentripplanner/osm/tagmapping/DefaultMapper.java index c5d1c0d1582..faa666c750a 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/DefaultMapper.java +++ b/application/src/main/java/org/opentripplanner/osm/tagmapping/DefaultMapper.java @@ -1,8 +1,8 @@ -package org.opentripplanner.openstreetmap.tagmapping; +package org.opentripplanner.osm.tagmapping; -import static org.opentripplanner.openstreetmap.wayproperty.MixinPropertiesBuilder.ofBicycleSafety; -import static org.opentripplanner.openstreetmap.wayproperty.MixinPropertiesBuilder.ofWalkSafety; -import static org.opentripplanner.openstreetmap.wayproperty.WayPropertiesBuilder.withModes; +import static org.opentripplanner.osm.wayproperty.MixinPropertiesBuilder.ofBicycleSafety; +import static org.opentripplanner.osm.wayproperty.MixinPropertiesBuilder.ofWalkSafety; +import static org.opentripplanner.osm.wayproperty.WayPropertiesBuilder.withModes; import static org.opentripplanner.street.model.StreetTraversalPermission.ALL; import static org.opentripplanner.street.model.StreetTraversalPermission.BICYCLE_AND_CAR; import static org.opentripplanner.street.model.StreetTraversalPermission.CAR; @@ -10,10 +10,10 @@ import static org.opentripplanner.street.model.StreetTraversalPermission.PEDESTRIAN; import static org.opentripplanner.street.model.StreetTraversalPermission.PEDESTRIAN_AND_BICYCLE; -import org.opentripplanner.openstreetmap.wayproperty.WayProperties; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertySet; -import org.opentripplanner.openstreetmap.wayproperty.specifier.BestMatchSpecifier; -import org.opentripplanner.openstreetmap.wayproperty.specifier.LogicalOrSpecifier; +import org.opentripplanner.osm.wayproperty.WayProperties; +import org.opentripplanner.osm.wayproperty.WayPropertySet; +import org.opentripplanner.osm.wayproperty.specifier.BestMatchSpecifier; +import org.opentripplanner.osm.wayproperty.specifier.LogicalOrSpecifier; import org.opentripplanner.routing.services.notes.StreetNotesService; /** @@ -613,7 +613,10 @@ public void populateProperties(WayPropertySet props) { // slope overrides props.setSlopeOverride(new BestMatchSpecifier("bridge=*"), true); props.setSlopeOverride(new BestMatchSpecifier("embankment=*"), true); + props.setSlopeOverride(new BestMatchSpecifier("cutting=*"), true); props.setSlopeOverride(new BestMatchSpecifier("tunnel=*"), true); + props.setSlopeOverride(new BestMatchSpecifier("location=underground"), true); + props.setSlopeOverride(new BestMatchSpecifier("indoor=yes"), true); } public void populateNotesAndNames(WayPropertySet props) { diff --git a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/FinlandMapper.java b/application/src/main/java/org/opentripplanner/osm/tagmapping/FinlandMapper.java similarity index 94% rename from src/main/java/org/opentripplanner/openstreetmap/tagmapping/FinlandMapper.java rename to application/src/main/java/org/opentripplanner/osm/tagmapping/FinlandMapper.java index 5ea949e8d5c..e796ebff17f 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/FinlandMapper.java +++ b/application/src/main/java/org/opentripplanner/osm/tagmapping/FinlandMapper.java @@ -1,7 +1,7 @@ -package org.opentripplanner.openstreetmap.tagmapping; +package org.opentripplanner.osm.tagmapping; -import static org.opentripplanner.openstreetmap.wayproperty.MixinPropertiesBuilder.ofWalkSafety; -import static org.opentripplanner.openstreetmap.wayproperty.WayPropertiesBuilder.withModes; +import static org.opentripplanner.osm.wayproperty.MixinPropertiesBuilder.ofWalkSafety; +import static org.opentripplanner.osm.wayproperty.WayPropertiesBuilder.withModes; import static org.opentripplanner.street.model.StreetTraversalPermission.ALL; import static org.opentripplanner.street.model.StreetTraversalPermission.CAR; import static org.opentripplanner.street.model.StreetTraversalPermission.NONE; @@ -9,8 +9,8 @@ import static org.opentripplanner.street.model.StreetTraversalPermission.PEDESTRIAN_AND_BICYCLE; import org.opentripplanner.framework.functional.FunctionUtils.TriFunction; -import org.opentripplanner.openstreetmap.model.OSMWithTags; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertySet; +import org.opentripplanner.osm.model.OsmWithTags; +import org.opentripplanner.osm.wayproperty.WayPropertySet; import org.opentripplanner.street.model.StreetTraversalPermission; /** @@ -29,7 +29,7 @@ class FinlandMapper implements OsmTagMapper { @Override public void populateProperties(WayPropertySet props) { - TriFunction defaultWalkSafetyForPermission = ( + TriFunction defaultWalkSafetyForPermission = ( permission, speedLimit, way @@ -208,7 +208,7 @@ else if (speedLimit <= 16.65f) { } @Override - public boolean isBicycleNoThroughTrafficExplicitlyDisallowed(OSMWithTags way) { + public boolean isBicycleNoThroughTrafficExplicitlyDisallowed(OsmWithTags way) { String bicycle = way.getTag("bicycle"); return ( isVehicleThroughTrafficExplicitlyDisallowed(way) || @@ -217,7 +217,7 @@ public boolean isBicycleNoThroughTrafficExplicitlyDisallowed(OSMWithTags way) { } @Override - public boolean isWalkNoThroughTrafficExplicitlyDisallowed(OSMWithTags way) { + public boolean isWalkNoThroughTrafficExplicitlyDisallowed(OsmWithTags way) { String foot = way.getTag("foot"); return isGeneralNoThroughTraffic(way) || doesTagValueDisallowThroughTraffic(foot); } diff --git a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/GermanyMapper.java b/application/src/main/java/org/opentripplanner/osm/tagmapping/GermanyMapper.java similarity index 92% rename from src/main/java/org/opentripplanner/openstreetmap/tagmapping/GermanyMapper.java rename to application/src/main/java/org/opentripplanner/osm/tagmapping/GermanyMapper.java index 908d9838f53..70a5bd593aa 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/GermanyMapper.java +++ b/application/src/main/java/org/opentripplanner/osm/tagmapping/GermanyMapper.java @@ -1,13 +1,13 @@ -package org.opentripplanner.openstreetmap.tagmapping; +package org.opentripplanner.osm.tagmapping; -import static org.opentripplanner.openstreetmap.wayproperty.MixinPropertiesBuilder.ofBicycleSafety; -import static org.opentripplanner.openstreetmap.wayproperty.WayPropertiesBuilder.withModes; +import static org.opentripplanner.osm.wayproperty.MixinPropertiesBuilder.ofBicycleSafety; +import static org.opentripplanner.osm.wayproperty.WayPropertiesBuilder.withModes; import static org.opentripplanner.street.model.StreetTraversalPermission.ALL; import static org.opentripplanner.street.model.StreetTraversalPermission.BICYCLE_AND_CAR; import static org.opentripplanner.street.model.StreetTraversalPermission.PEDESTRIAN; import static org.opentripplanner.street.model.StreetTraversalPermission.PEDESTRIAN_AND_BICYCLE; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertySet; +import org.opentripplanner.osm.wayproperty.WayPropertySet; /** * OSM way properties for German roads. Speed limits where adjusted to German regulation and some diff --git a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/HamburgMapper.java b/application/src/main/java/org/opentripplanner/osm/tagmapping/HamburgMapper.java similarity index 73% rename from src/main/java/org/opentripplanner/openstreetmap/tagmapping/HamburgMapper.java rename to application/src/main/java/org/opentripplanner/osm/tagmapping/HamburgMapper.java index f893fbb5519..47bd5164d1f 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/HamburgMapper.java +++ b/application/src/main/java/org/opentripplanner/osm/tagmapping/HamburgMapper.java @@ -1,6 +1,6 @@ -package org.opentripplanner.openstreetmap.tagmapping; +package org.opentripplanner.osm.tagmapping; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; /** * Modified mapper to allow through traffic for combination access=customers and customers=HVV. @@ -14,7 +14,7 @@ public class HamburgMapper extends GermanyMapper { @Override - public boolean isGeneralNoThroughTraffic(OSMWithTags way) { + public boolean isGeneralNoThroughTraffic(OsmWithTags way) { String access = way.getTag("access"); boolean isNoThroughTraffic = doesTagValueDisallowThroughTraffic(access); diff --git a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/HoustonMapper.java b/application/src/main/java/org/opentripplanner/osm/tagmapping/HoustonMapper.java similarity index 77% rename from src/main/java/org/opentripplanner/openstreetmap/tagmapping/HoustonMapper.java rename to application/src/main/java/org/opentripplanner/osm/tagmapping/HoustonMapper.java index 7fdde133465..7e4aba9da4e 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/HoustonMapper.java +++ b/application/src/main/java/org/opentripplanner/osm/tagmapping/HoustonMapper.java @@ -1,10 +1,10 @@ -package org.opentripplanner.openstreetmap.tagmapping; +package org.opentripplanner.osm.tagmapping; -import static org.opentripplanner.openstreetmap.wayproperty.WayPropertiesBuilder.withModes; +import static org.opentripplanner.osm.wayproperty.WayPropertiesBuilder.withModes; import static org.opentripplanner.street.model.StreetTraversalPermission.NONE; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertySet; -import org.opentripplanner.openstreetmap.wayproperty.specifier.ExactMatchSpecifier; +import org.opentripplanner.osm.wayproperty.WayPropertySet; +import org.opentripplanner.osm.wayproperty.specifier.ExactMatchSpecifier; /** * OSM way properties for the Houston, Texas, USA area. diff --git a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/NorwayMapper.java b/application/src/main/java/org/opentripplanner/osm/tagmapping/NorwayMapper.java similarity index 96% rename from src/main/java/org/opentripplanner/openstreetmap/tagmapping/NorwayMapper.java rename to application/src/main/java/org/opentripplanner/osm/tagmapping/NorwayMapper.java index efe7850f08b..9e06c0aa591 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/NorwayMapper.java +++ b/application/src/main/java/org/opentripplanner/osm/tagmapping/NorwayMapper.java @@ -1,8 +1,8 @@ -package org.opentripplanner.openstreetmap.tagmapping; +package org.opentripplanner.osm.tagmapping; -import static org.opentripplanner.openstreetmap.wayproperty.MixinPropertiesBuilder.ofBicycleSafety; -import static org.opentripplanner.openstreetmap.wayproperty.MixinPropertiesBuilder.ofWalkSafety; -import static org.opentripplanner.openstreetmap.wayproperty.WayPropertiesBuilder.withModes; +import static org.opentripplanner.osm.wayproperty.MixinPropertiesBuilder.ofBicycleSafety; +import static org.opentripplanner.osm.wayproperty.MixinPropertiesBuilder.ofWalkSafety; +import static org.opentripplanner.osm.wayproperty.WayPropertiesBuilder.withModes; import static org.opentripplanner.street.model.StreetTraversalPermission.ALL; import static org.opentripplanner.street.model.StreetTraversalPermission.CAR; import static org.opentripplanner.street.model.StreetTraversalPermission.NONE; @@ -10,12 +10,12 @@ import static org.opentripplanner.street.model.StreetTraversalPermission.PEDESTRIAN_AND_BICYCLE; import java.util.function.BiFunction; -import org.opentripplanner.openstreetmap.model.OSMWithTags; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertySet; -import org.opentripplanner.openstreetmap.wayproperty.specifier.BestMatchSpecifier; -import org.opentripplanner.openstreetmap.wayproperty.specifier.Condition; -import org.opentripplanner.openstreetmap.wayproperty.specifier.ExactMatchSpecifier; -import org.opentripplanner.openstreetmap.wayproperty.specifier.LogicalOrSpecifier; +import org.opentripplanner.osm.model.OsmWithTags; +import org.opentripplanner.osm.wayproperty.WayPropertySet; +import org.opentripplanner.osm.wayproperty.specifier.BestMatchSpecifier; +import org.opentripplanner.osm.wayproperty.specifier.Condition; +import org.opentripplanner.osm.wayproperty.specifier.ExactMatchSpecifier; +import org.opentripplanner.osm.wayproperty.specifier.LogicalOrSpecifier; /** * OSM way properties for Norwegian roads. The main difference compared to the default property set @@ -121,7 +121,7 @@ else if (speedLimit >= 11.1f) { "residential" ); - BiFunction cycleSafetyHighway = (speedLimit, way) -> { + BiFunction cycleSafetyHighway = (speedLimit, way) -> { if (way.isPedestrianExplicitlyDenied()) { return cycleSafetyVeryHighTraffic; } diff --git a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/OsmTagMapper.java b/application/src/main/java/org/opentripplanner/osm/tagmapping/OsmTagMapper.java similarity index 80% rename from src/main/java/org/opentripplanner/openstreetmap/tagmapping/OsmTagMapper.java rename to application/src/main/java/org/opentripplanner/osm/tagmapping/OsmTagMapper.java index 8bcfbfdf65a..9bf0ed2d20d 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/OsmTagMapper.java +++ b/application/src/main/java/org/opentripplanner/osm/tagmapping/OsmTagMapper.java @@ -1,7 +1,7 @@ -package org.opentripplanner.openstreetmap.tagmapping; +package org.opentripplanner.osm.tagmapping; -import org.opentripplanner.openstreetmap.model.OSMWithTags; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertySet; +import org.opentripplanner.osm.model.OsmWithTags; +import org.opentripplanner.osm.wayproperty.WayPropertySet; /** * Interface for populating a {@link WayPropertySet} that determine how OSM streets can be traversed @@ -22,7 +22,7 @@ default boolean doesTagValueDisallowThroughTraffic(String tagValue) { ); } - default float getCarSpeedForWay(OSMWithTags way, boolean backward) { + default float getCarSpeedForWay(OsmWithTags way, boolean backward) { return way.getOsmProvider().getWayPropertySet().getCarSpeedForWay(way, backward); } @@ -30,12 +30,12 @@ default Float getMaxUsedCarSpeed(WayPropertySet wayPropertySet) { return wayPropertySet.maxUsedCarSpeed; } - default boolean isGeneralNoThroughTraffic(OSMWithTags way) { + default boolean isGeneralNoThroughTraffic(OsmWithTags way) { String access = way.getTag("access"); return doesTagValueDisallowThroughTraffic(access); } - default boolean isVehicleThroughTrafficExplicitlyDisallowed(OSMWithTags way) { + default boolean isVehicleThroughTrafficExplicitlyDisallowed(OsmWithTags way) { String vehicle = way.getTag("vehicle"); if (vehicle != null) { return doesTagValueDisallowThroughTraffic(vehicle); @@ -47,7 +47,7 @@ default boolean isVehicleThroughTrafficExplicitlyDisallowed(OSMWithTags way) { /** * Returns true if through traffic for motor vehicles is not allowed. */ - default boolean isMotorVehicleThroughTrafficExplicitlyDisallowed(OSMWithTags way) { + default boolean isMotorVehicleThroughTrafficExplicitlyDisallowed(OsmWithTags way) { String motorVehicle = way.getTag("motor_vehicle"); if (motorVehicle != null) { return doesTagValueDisallowThroughTraffic(motorVehicle); @@ -59,7 +59,7 @@ default boolean isMotorVehicleThroughTrafficExplicitlyDisallowed(OSMWithTags way /** * Returns true if through traffic for bicycle is not allowed. */ - default boolean isBicycleNoThroughTrafficExplicitlyDisallowed(OSMWithTags way) { + default boolean isBicycleNoThroughTrafficExplicitlyDisallowed(OsmWithTags way) { String bicycle = way.getTag("bicycle"); if (bicycle != null) { return doesTagValueDisallowThroughTraffic(bicycle); @@ -71,7 +71,7 @@ default boolean isBicycleNoThroughTrafficExplicitlyDisallowed(OSMWithTags way) { /** * Returns true if through traffic for walk is not allowed. */ - default boolean isWalkNoThroughTrafficExplicitlyDisallowed(OSMWithTags way) { + default boolean isWalkNoThroughTrafficExplicitlyDisallowed(OsmWithTags way) { String foot = way.getTag("foot"); if (foot != null) { return doesTagValueDisallowThroughTraffic(foot); diff --git a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/OsmTagMapperSource.java b/application/src/main/java/org/opentripplanner/osm/tagmapping/OsmTagMapperSource.java similarity index 93% rename from src/main/java/org/opentripplanner/openstreetmap/tagmapping/OsmTagMapperSource.java rename to application/src/main/java/org/opentripplanner/osm/tagmapping/OsmTagMapperSource.java index d430ad05f7d..b40c2e7f75a 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/OsmTagMapperSource.java +++ b/application/src/main/java/org/opentripplanner/osm/tagmapping/OsmTagMapperSource.java @@ -1,4 +1,4 @@ -package org.opentripplanner.openstreetmap.tagmapping; +package org.opentripplanner.osm.tagmapping; /** * This is the list of {@link OsmTagMapper} sources. The enum provide a mapping between the enum diff --git a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/PortlandMapper.java b/application/src/main/java/org/opentripplanner/osm/tagmapping/PortlandMapper.java similarity index 81% rename from src/main/java/org/opentripplanner/openstreetmap/tagmapping/PortlandMapper.java rename to application/src/main/java/org/opentripplanner/osm/tagmapping/PortlandMapper.java index 1a09b3b6714..98379852689 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/PortlandMapper.java +++ b/application/src/main/java/org/opentripplanner/osm/tagmapping/PortlandMapper.java @@ -1,13 +1,13 @@ -package org.opentripplanner.openstreetmap.tagmapping; +package org.opentripplanner.osm.tagmapping; -import static org.opentripplanner.openstreetmap.wayproperty.MixinPropertiesBuilder.ofBicycleSafety; -import static org.opentripplanner.openstreetmap.wayproperty.MixinPropertiesBuilder.ofWalkSafety; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.ExactMatchSpecifier.exact; +import static org.opentripplanner.osm.wayproperty.MixinPropertiesBuilder.ofBicycleSafety; +import static org.opentripplanner.osm.wayproperty.MixinPropertiesBuilder.ofWalkSafety; +import static org.opentripplanner.osm.wayproperty.specifier.ExactMatchSpecifier.exact; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertySet; -import org.opentripplanner.openstreetmap.wayproperty.specifier.Condition.Absent; -import org.opentripplanner.openstreetmap.wayproperty.specifier.Condition.GreaterThan; -import org.opentripplanner.openstreetmap.wayproperty.specifier.ExactMatchSpecifier; +import org.opentripplanner.osm.wayproperty.WayPropertySet; +import org.opentripplanner.osm.wayproperty.specifier.Condition.Absent; +import org.opentripplanner.osm.wayproperty.specifier.Condition.GreaterThan; +import org.opentripplanner.osm.wayproperty.specifier.ExactMatchSpecifier; class PortlandMapper implements OsmTagMapper { diff --git a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/UKMapper.java b/application/src/main/java/org/opentripplanner/osm/tagmapping/UKMapper.java similarity index 94% rename from src/main/java/org/opentripplanner/openstreetmap/tagmapping/UKMapper.java rename to application/src/main/java/org/opentripplanner/osm/tagmapping/UKMapper.java index 7639c6594b2..bef0be4101b 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/tagmapping/UKMapper.java +++ b/application/src/main/java/org/opentripplanner/osm/tagmapping/UKMapper.java @@ -1,9 +1,9 @@ -package org.opentripplanner.openstreetmap.tagmapping; +package org.opentripplanner.osm.tagmapping; -import static org.opentripplanner.openstreetmap.wayproperty.WayPropertiesBuilder.withModes; +import static org.opentripplanner.osm.wayproperty.WayPropertiesBuilder.withModes; import static org.opentripplanner.street.model.StreetTraversalPermission.ALL; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertySet; +import org.opentripplanner.osm.wayproperty.WayPropertySet; /** * OSM way properties for UK roads. The main differences compared to the default property set are: diff --git a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/CreativeNamer.java b/application/src/main/java/org/opentripplanner/osm/wayproperty/CreativeNamer.java similarity index 81% rename from src/main/java/org/opentripplanner/openstreetmap/wayproperty/CreativeNamer.java rename to application/src/main/java/org/opentripplanner/osm/wayproperty/CreativeNamer.java index 24f39399761..87053ddb324 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/CreativeNamer.java +++ b/application/src/main/java/org/opentripplanner/osm/wayproperty/CreativeNamer.java @@ -1,7 +1,7 @@ -package org.opentripplanner.openstreetmap.wayproperty; +package org.opentripplanner.osm.wayproperty; import org.opentripplanner.framework.i18n.I18NString; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; /** * A CreativeNamer makes up names for ways that don't have one in the OSM data set. It does this by @@ -22,7 +22,7 @@ public CreativeNamer(String pattern) { this.creativeNamePattern = pattern; } - public I18NString generateCreativeName(OSMWithTags way) { + public I18NString generateCreativeName(OsmWithTags way) { return LocalizedStringMapper.getInstance().map(creativeNamePattern, way); } } diff --git a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/CreativeNamerPicker.java b/application/src/main/java/org/opentripplanner/osm/wayproperty/CreativeNamerPicker.java similarity index 79% rename from src/main/java/org/opentripplanner/openstreetmap/wayproperty/CreativeNamerPicker.java rename to application/src/main/java/org/opentripplanner/osm/wayproperty/CreativeNamerPicker.java index 15ea53c5b1e..5e57456c03a 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/CreativeNamerPicker.java +++ b/application/src/main/java/org/opentripplanner/osm/wayproperty/CreativeNamerPicker.java @@ -1,6 +1,6 @@ -package org.opentripplanner.openstreetmap.wayproperty; +package org.opentripplanner.osm.wayproperty; -import org.opentripplanner.openstreetmap.wayproperty.specifier.OsmSpecifier; +import org.opentripplanner.osm.wayproperty.specifier.OsmSpecifier; /** * Describes how unnamed OSM ways are to be named based on the tags they possess. The CreativeNamer diff --git a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/LocalizedStringMapper.java b/application/src/main/java/org/opentripplanner/osm/wayproperty/LocalizedStringMapper.java similarity index 94% rename from src/main/java/org/opentripplanner/openstreetmap/wayproperty/LocalizedStringMapper.java rename to application/src/main/java/org/opentripplanner/osm/wayproperty/LocalizedStringMapper.java index 9ea4268b6b7..50bc407e74d 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/LocalizedStringMapper.java +++ b/application/src/main/java/org/opentripplanner/osm/wayproperty/LocalizedStringMapper.java @@ -1,4 +1,4 @@ -package org.opentripplanner.openstreetmap.wayproperty; +package org.opentripplanner.osm.wayproperty; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ListMultimap; @@ -12,7 +12,7 @@ import org.opentripplanner.framework.i18n.LocalizedString; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.framework.resources.ResourceBundleSingleton; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; class LocalizedStringMapper { @@ -45,7 +45,7 @@ static LocalizedStringMapper getInstance() { * from properties Files * @param way OSM way from which tag values are read */ - LocalizedString map(String key, OSMWithTags way) { + LocalizedString map(String key, OsmWithTags way) { List lparams = new ArrayList<>(4); //Which tags do we want from way List tagNames = getTagNames(key); diff --git a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/MixinProperties.java b/application/src/main/java/org/opentripplanner/osm/wayproperty/MixinProperties.java similarity index 76% rename from src/main/java/org/opentripplanner/openstreetmap/wayproperty/MixinProperties.java rename to application/src/main/java/org/opentripplanner/osm/wayproperty/MixinProperties.java index fa7cd1db27e..66c550caf10 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/MixinProperties.java +++ b/application/src/main/java/org/opentripplanner/osm/wayproperty/MixinProperties.java @@ -1,6 +1,6 @@ -package org.opentripplanner.openstreetmap.wayproperty; +package org.opentripplanner.osm.wayproperty; -import org.opentripplanner.openstreetmap.wayproperty.specifier.OsmSpecifier; +import org.opentripplanner.osm.wayproperty.specifier.OsmSpecifier; /** * Mixins are like {@link WayProperties} but they only contain walk and bicycle safety features (not diff --git a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/MixinPropertiesBuilder.java b/application/src/main/java/org/opentripplanner/osm/wayproperty/MixinPropertiesBuilder.java similarity index 92% rename from src/main/java/org/opentripplanner/openstreetmap/wayproperty/MixinPropertiesBuilder.java rename to application/src/main/java/org/opentripplanner/osm/wayproperty/MixinPropertiesBuilder.java index dd16a28e3ec..a9b20a83864 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/MixinPropertiesBuilder.java +++ b/application/src/main/java/org/opentripplanner/osm/wayproperty/MixinPropertiesBuilder.java @@ -1,6 +1,6 @@ -package org.opentripplanner.openstreetmap.wayproperty; +package org.opentripplanner.osm.wayproperty; -import org.opentripplanner.openstreetmap.wayproperty.specifier.OsmSpecifier; +import org.opentripplanner.osm.wayproperty.specifier.OsmSpecifier; /** * Builder for {@link MixinProperties}. If you don't set the safety features they will have a default diff --git a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/NotePicker.java b/application/src/main/java/org/opentripplanner/osm/wayproperty/NotePicker.java similarity index 73% rename from src/main/java/org/opentripplanner/openstreetmap/wayproperty/NotePicker.java rename to application/src/main/java/org/opentripplanner/osm/wayproperty/NotePicker.java index 3d420aafa12..4b442f0ef33 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/NotePicker.java +++ b/application/src/main/java/org/opentripplanner/osm/wayproperty/NotePicker.java @@ -1,6 +1,6 @@ -package org.opentripplanner.openstreetmap.wayproperty; +package org.opentripplanner.osm.wayproperty; -import org.opentripplanner.openstreetmap.wayproperty.specifier.OsmSpecifier; +import org.opentripplanner.osm.wayproperty.specifier.OsmSpecifier; /** * Defines which OSM ways get notes and what kind of notes they get. diff --git a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/NoteProperties.java b/application/src/main/java/org/opentripplanner/osm/wayproperty/NoteProperties.java similarity index 84% rename from src/main/java/org/opentripplanner/openstreetmap/wayproperty/NoteProperties.java rename to application/src/main/java/org/opentripplanner/osm/wayproperty/NoteProperties.java index dc5affc1e61..aba20442090 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/NoteProperties.java +++ b/application/src/main/java/org/opentripplanner/osm/wayproperty/NoteProperties.java @@ -1,10 +1,10 @@ -package org.opentripplanner.openstreetmap.wayproperty; +package org.opentripplanner.osm.wayproperty; import java.util.Map; import java.util.regex.Pattern; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.TranslatedString; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; import org.opentripplanner.street.model.note.StreetNote; import org.opentripplanner.street.model.note.StreetNoteAndMatcher; import org.opentripplanner.street.model.note.StreetNoteMatcher; @@ -13,16 +13,16 @@ public class NoteProperties { private static final Pattern patternMatcher = Pattern.compile("\\{(.*?)}"); - public String notePattern; + private final String notePattern; - public StreetNoteMatcher noteMatcher; + private final StreetNoteMatcher noteMatcher; public NoteProperties(String notePattern, StreetNoteMatcher noteMatcher) { this.notePattern = notePattern; this.noteMatcher = noteMatcher; } - public StreetNoteAndMatcher generateNote(OSMWithTags way) { + public StreetNoteAndMatcher generateNote(OsmWithTags way) { I18NString text; //TODO: this could probably be made without patternMatch for {} since all notes (at least currently) have {note} as notePattern if (patternMatcher.matcher(notePattern).matches()) { diff --git a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/SafetyFeatures.java b/application/src/main/java/org/opentripplanner/osm/wayproperty/SafetyFeatures.java similarity index 89% rename from src/main/java/org/opentripplanner/openstreetmap/wayproperty/SafetyFeatures.java rename to application/src/main/java/org/opentripplanner/osm/wayproperty/SafetyFeatures.java index ab68fd978c2..e4f03ab3e29 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/SafetyFeatures.java +++ b/application/src/main/java/org/opentripplanner/osm/wayproperty/SafetyFeatures.java @@ -1,4 +1,4 @@ -package org.opentripplanner.openstreetmap.wayproperty; +package org.opentripplanner.osm.wayproperty; /** * Record that holds forward and back safety factors for cycling or walking. diff --git a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/SlopeOverridePicker.java b/application/src/main/java/org/opentripplanner/osm/wayproperty/SlopeOverridePicker.java similarity index 81% rename from src/main/java/org/opentripplanner/openstreetmap/wayproperty/SlopeOverridePicker.java rename to application/src/main/java/org/opentripplanner/osm/wayproperty/SlopeOverridePicker.java index 21b319a3310..5699bbe2533 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/SlopeOverridePicker.java +++ b/application/src/main/java/org/opentripplanner/osm/wayproperty/SlopeOverridePicker.java @@ -1,6 +1,6 @@ -package org.opentripplanner.openstreetmap.wayproperty; +package org.opentripplanner.osm.wayproperty; -import org.opentripplanner.openstreetmap.wayproperty.specifier.OsmSpecifier; +import org.opentripplanner.osm.wayproperty.specifier.OsmSpecifier; public class SlopeOverridePicker { diff --git a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/SpeedPicker.java b/application/src/main/java/org/opentripplanner/osm/wayproperty/SpeedPicker.java similarity index 54% rename from src/main/java/org/opentripplanner/openstreetmap/wayproperty/SpeedPicker.java rename to application/src/main/java/org/opentripplanner/osm/wayproperty/SpeedPicker.java index ca75f3858b0..44cdcdf5e08 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/SpeedPicker.java +++ b/application/src/main/java/org/opentripplanner/osm/wayproperty/SpeedPicker.java @@ -1,6 +1,6 @@ -package org.opentripplanner.openstreetmap.wayproperty; +package org.opentripplanner.osm.wayproperty; -import org.opentripplanner.openstreetmap.wayproperty.specifier.OsmSpecifier; +import org.opentripplanner.osm.wayproperty.specifier.OsmSpecifier; /** * Choose a speed that should be applied to a given segment diff --git a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/WayProperties.java b/application/src/main/java/org/opentripplanner/osm/wayproperty/WayProperties.java similarity index 93% rename from src/main/java/org/opentripplanner/openstreetmap/wayproperty/WayProperties.java rename to application/src/main/java/org/opentripplanner/osm/wayproperty/WayProperties.java index 4facfd041c8..7171a3cee3c 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/WayProperties.java +++ b/application/src/main/java/org/opentripplanner/osm/wayproperty/WayProperties.java @@ -1,8 +1,7 @@ -package org.opentripplanner.openstreetmap.wayproperty; +package org.opentripplanner.osm.wayproperty; import java.util.Objects; import java.util.Optional; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.street.model.StreetTraversalPermission; @@ -13,7 +12,6 @@ */ public class WayProperties { - @Nonnull private final StreetTraversalPermission permission; @Nullable @@ -31,7 +29,6 @@ public class WayProperties { /** * The value for the bicycle safety. If none has been set a default value of 1 is returned. */ - @Nonnull public SafetyFeatures bicycleSafety() { return Objects.requireNonNullElse(bicycleSafetyFeatures, SafetyFeatures.DEFAULT); } @@ -39,12 +36,10 @@ public SafetyFeatures bicycleSafety() { /** * The value for the walk safety. If none has been set a default value of 1 is returned. */ - @Nonnull public SafetyFeatures walkSafety() { return Objects.requireNonNullElse(walkSafetyFeatures, SafetyFeatures.DEFAULT); } - @Nonnull public StreetTraversalPermission getPermission() { return permission; } @@ -52,7 +47,6 @@ public StreetTraversalPermission getPermission() { /** * An optional value for the walk safety. If none has been set an empty Optional is returned. */ - @Nonnull protected Optional walkSafetyOpt() { return Optional.ofNullable(walkSafetyFeatures); } @@ -60,7 +54,6 @@ protected Optional walkSafetyOpt() { /** * An optional value for the bicycle safety. If none has been set an empty Optional is returned. */ - @Nonnull protected Optional bicycleSafetyOpt() { return Optional.ofNullable(bicycleSafetyFeatures); } diff --git a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/WayPropertiesBuilder.java b/application/src/main/java/org/opentripplanner/osm/wayproperty/WayPropertiesBuilder.java similarity index 98% rename from src/main/java/org/opentripplanner/openstreetmap/wayproperty/WayPropertiesBuilder.java rename to application/src/main/java/org/opentripplanner/osm/wayproperty/WayPropertiesBuilder.java index b91d1040a7d..505a6f84833 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/WayPropertiesBuilder.java +++ b/application/src/main/java/org/opentripplanner/osm/wayproperty/WayPropertiesBuilder.java @@ -1,4 +1,4 @@ -package org.opentripplanner.openstreetmap.wayproperty; +package org.opentripplanner.osm.wayproperty; import javax.annotation.Nullable; import org.opentripplanner.street.model.StreetTraversalPermission; diff --git a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/WayPropertyPicker.java b/application/src/main/java/org/opentripplanner/osm/wayproperty/WayPropertyPicker.java similarity index 69% rename from src/main/java/org/opentripplanner/openstreetmap/wayproperty/WayPropertyPicker.java rename to application/src/main/java/org/opentripplanner/osm/wayproperty/WayPropertyPicker.java index 351cdcc9911..93407f84357 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/WayPropertyPicker.java +++ b/application/src/main/java/org/opentripplanner/osm/wayproperty/WayPropertyPicker.java @@ -1,6 +1,6 @@ -package org.opentripplanner.openstreetmap.wayproperty; +package org.opentripplanner.osm.wayproperty; -import org.opentripplanner.openstreetmap.wayproperty.specifier.OsmSpecifier; +import org.opentripplanner.osm.wayproperty.specifier.OsmSpecifier; /** * Associates an OSMSpecifier with some WayProperties. The WayProperties will be applied an OSM way diff --git a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/WayPropertySet.java b/application/src/main/java/org/opentripplanner/osm/wayproperty/WayPropertySet.java similarity index 94% rename from src/main/java/org/opentripplanner/openstreetmap/wayproperty/WayPropertySet.java rename to application/src/main/java/org/opentripplanner/osm/wayproperty/WayPropertySet.java index 9a414a56080..d8d75e11054 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/WayPropertySet.java +++ b/application/src/main/java/org/opentripplanner/osm/wayproperty/WayPropertySet.java @@ -1,6 +1,6 @@ -package org.opentripplanner.openstreetmap.wayproperty; +package org.opentripplanner.osm.wayproperty; -import static org.opentripplanner.openstreetmap.wayproperty.WayPropertiesBuilder.withModes; +import static org.opentripplanner.osm.wayproperty.WayPropertiesBuilder.withModes; import static org.opentripplanner.street.model.StreetTraversalPermission.ALL; import java.util.ArrayList; @@ -15,9 +15,9 @@ import org.opentripplanner.framework.functional.FunctionUtils.TriFunction; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; -import org.opentripplanner.openstreetmap.model.OSMWithTags; -import org.opentripplanner.openstreetmap.wayproperty.specifier.BestMatchSpecifier; -import org.opentripplanner.openstreetmap.wayproperty.specifier.OsmSpecifier; +import org.opentripplanner.osm.model.OsmWithTags; +import org.opentripplanner.osm.wayproperty.specifier.BestMatchSpecifier; +import org.opentripplanner.osm.wayproperty.specifier.OsmSpecifier; import org.opentripplanner.street.model.StreetTraversalPermission; import org.opentripplanner.street.model.note.StreetNoteAndMatcher; import org.opentripplanner.street.model.note.StreetNoteMatcher; @@ -37,7 +37,7 @@ public class WayPropertySet { private static final Logger LOG = LoggerFactory.getLogger(WayPropertySet.class); /** Sets 1.0 as default safety value for all permissions. */ - private final TriFunction DEFAULT_SAFETY_RESOLVER = + private final TriFunction DEFAULT_SAFETY_RESOLVER = ((permission, speedLimit, osmWay) -> 1.0); private final List wayProperties; @@ -64,9 +64,9 @@ public class WayPropertySet { */ public float maxUsedCarSpeed = 0f; /** Resolves walk safety value for each {@link StreetTraversalPermission}. */ - private TriFunction defaultWalkSafetyForPermission; + private TriFunction defaultWalkSafetyForPermission; /** Resolves bicycle safety value for each {@link StreetTraversalPermission}. */ - private TriFunction defaultBicycleSafetyForPermission; + private TriFunction defaultBicycleSafetyForPermission; /** The WayProperties applied to all ways that do not match any WayPropertyPicker. */ private final WayProperties defaultProperties; private final DataImportIssueStore issueStore; @@ -105,7 +105,7 @@ public WayPropertySet(DataImportIssueStore issueStore) { * Applies the WayProperties whose OSMPicker best matches this way. In addition, WayProperties * that are mixins will have their safety values applied if they match at all. */ - public WayProperties getDataForWay(OSMWithTags way) { + public WayProperties getDataForWay(OsmWithTags way) { WayProperties backwardResult = defaultProperties; WayProperties forwardResult = defaultProperties; int bestBackwardScore = 0; @@ -187,7 +187,7 @@ public WayProperties getDataForWay(OSMWithTags way) { return result; } - public I18NString getCreativeNameForWay(OSMWithTags way) { + public I18NString getCreativeNameForWay(OsmWithTags way) { CreativeNamer bestNamer = null; int bestScore = 0; for (CreativeNamerPicker picker : creativeNamers) { @@ -208,7 +208,7 @@ public I18NString getCreativeNameForWay(OSMWithTags way) { /** * Calculate the automobile speed, in meters per second, for this way. */ - public float getCarSpeedForWay(OSMWithTags way, boolean backward) { + public float getCarSpeedForWay(OsmWithTags way, boolean backward) { // first, check for maxspeed tags Float speed = null; Float currentSpeed; @@ -288,7 +288,7 @@ public float getCarSpeedForWay(OSMWithTags way, boolean backward) { } } - public Set getNoteForWay(OSMWithTags way) { + public Set getNoteForWay(OsmWithTags way) { HashSet out = new HashSet<>(); for (NotePicker picker : notes) { OsmSpecifier specifier = picker.specifier; @@ -300,7 +300,7 @@ public Set getNoteForWay(OSMWithTags way) { return out; } - public boolean getSlopeOverride(OSMWithTags way) { + public boolean getSlopeOverride(OsmWithTags way) { boolean result = false; int bestScore = 0; for (SlopeOverridePicker picker : slopeOverrides) { @@ -418,7 +418,7 @@ public void createNotes(String spec, String patternKey, StreetNoteMatcher matche * provide a default for each permission. Safety can vary based on car speed limit on a way. */ public void setDefaultWalkSafetyForPermission( - TriFunction defaultWalkSafetyForPermission + TriFunction defaultWalkSafetyForPermission ) { if (!this.defaultWalkSafetyForPermission.equals(DEFAULT_SAFETY_RESOLVER)) { throw new IllegalStateException("A custom default walk safety resolver was already set"); @@ -431,7 +431,7 @@ public void setDefaultWalkSafetyForPermission( * provide a default for each permission. Safety can vary based on car speed limit on a way. */ public void setDefaultBicycleSafetyForPermission( - TriFunction defaultBicycleSafetyForPermission + TriFunction defaultBicycleSafetyForPermission ) { if (!this.defaultBicycleSafetyForPermission.equals(DEFAULT_SAFETY_RESOLVER)) { throw new IllegalStateException("A custom default cycling safety resolver was already set"); @@ -481,7 +481,7 @@ public List getWayProperties() { return Collections.unmodifiableList(wayProperties); } - private String dumpTags(OSMWithTags way) { + private String dumpTags(OsmWithTags way) { /* generate warning message */ String all_tags = null; Map tags = way.getTags(); diff --git a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/specifier/BestMatchSpecifier.java b/application/src/main/java/org/opentripplanner/osm/wayproperty/specifier/BestMatchSpecifier.java similarity index 94% rename from src/main/java/org/opentripplanner/openstreetmap/wayproperty/specifier/BestMatchSpecifier.java rename to application/src/main/java/org/opentripplanner/osm/wayproperty/specifier/BestMatchSpecifier.java index 293bcf84644..1d03d74956e 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/specifier/BestMatchSpecifier.java +++ b/application/src/main/java/org/opentripplanner/osm/wayproperty/specifier/BestMatchSpecifier.java @@ -1,9 +1,9 @@ -package org.opentripplanner.openstreetmap.wayproperty.specifier; +package org.opentripplanner.osm.wayproperty.specifier; import java.util.Arrays; import java.util.stream.Collectors; import org.opentripplanner.framework.tostring.ToStringBuilder; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; /** * Specifies a class of OSM tagged entities (e.g. ways) by a list of tags and their values (which @@ -31,7 +31,7 @@ public BestMatchSpecifier(String spec) { } @Override - public Scores matchScores(OSMWithTags way) { + public Scores matchScores(OsmWithTags way) { int backwardScore = 0, forwardScore = 0; int backwardMatches = 0, forwardMatches = 0; @@ -59,7 +59,7 @@ public Scores matchScores(OSMWithTags way) { } @Override - public int matchScore(OSMWithTags way) { + public int matchScore(OsmWithTags way) { int score = 0; int matches = 0; for (var test : conditions) { diff --git a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/specifier/Condition.java b/application/src/main/java/org/opentripplanner/osm/wayproperty/specifier/Condition.java similarity index 79% rename from src/main/java/org/opentripplanner/openstreetmap/wayproperty/specifier/Condition.java rename to application/src/main/java/org/opentripplanner/osm/wayproperty/specifier/Condition.java index 4ad180c16c3..24b3671ca98 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/specifier/Condition.java +++ b/application/src/main/java/org/opentripplanner/osm/wayproperty/specifier/Condition.java @@ -1,11 +1,11 @@ -package org.opentripplanner.openstreetmap.wayproperty.specifier; +package org.opentripplanner.osm.wayproperty.specifier; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.Condition.MatchResult.EXACT; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.Condition.MatchResult.NONE; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.Condition.MatchResult.WILDCARD; +import static org.opentripplanner.osm.wayproperty.specifier.Condition.MatchResult.EXACT; +import static org.opentripplanner.osm.wayproperty.specifier.Condition.MatchResult.NONE; +import static org.opentripplanner.osm.wayproperty.specifier.Condition.MatchResult.WILDCARD; import java.util.Arrays; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; public sealed interface Condition { String key(); @@ -14,17 +14,17 @@ default MatchResult matchType() { return EXACT; } - boolean isExtendedKeyMatch(OSMWithTags way, String exKey); + boolean isExtendedKeyMatch(OsmWithTags way, String exKey); /** * Test to what degree the OSM entity matches with this operation when taking the regular tag keys * into account. */ - default boolean isMatch(OSMWithTags way) { + default boolean isMatch(OsmWithTags way) { return isExtendedKeyMatch(way, this.key()); } - default MatchResult match(OSMWithTags way) { + default MatchResult match(OsmWithTags way) { return isMatch(way) ? matchType() : NONE; } @@ -35,7 +35,7 @@ default MatchResult match(OSMWithTags way) { * For example, it should not match a way with `cycleway:right=lane` when the `cycleway=lane` was * required but `cycleway:left=lane` should match. */ - default boolean isLeftMatch(OSMWithTags way) { + default boolean isLeftMatch(OsmWithTags way) { var leftKey = this.key() + ":left"; if (way.hasTag(leftKey)) { return isExtendedKeyMatch(way, leftKey); @@ -51,7 +51,7 @@ default boolean isLeftMatch(OSMWithTags way) { * For example, it should not match a way with `cycleway:left=lane` when the `cycleway=lane` was * required but `cycleway:right=lane` should match. */ - default boolean isRightMatch(OSMWithTags way) { + default boolean isRightMatch(OsmWithTags way) { var rightKey = this.key() + ":right"; if (way.hasTag(rightKey)) { return isExtendedKeyMatch(way, rightKey); @@ -64,7 +64,7 @@ default boolean isRightMatch(OSMWithTags way) { * Test to what degree the OSM entity matches with this operation when taking the ':both' key * suffixes into account. */ - default boolean isExplicitBothMatch(OSMWithTags way) { + default boolean isExplicitBothMatch(OsmWithTags way) { var bothKey = this.key() + ":both"; if (way.hasTag(bothKey)) { return isExtendedKeyMatch(way, bothKey); @@ -73,7 +73,7 @@ default boolean isExplicitBothMatch(OSMWithTags way) { } } - default boolean isForwardMatch(OSMWithTags way) { + default boolean isForwardMatch(OsmWithTags way) { var forwardKey = this.key() + ":forward"; if (way.hasTag(forwardKey)) { return isExtendedKeyMatch(way, forwardKey); @@ -83,11 +83,11 @@ default boolean isForwardMatch(OSMWithTags way) { } } - default MatchResult matchForward(OSMWithTags way) { + default MatchResult matchForward(OsmWithTags way) { return isForwardMatch(way) ? matchType() : NONE; } - default boolean isBackwardMatch(OSMWithTags way) { + default boolean isBackwardMatch(OsmWithTags way) { var backwardKey = this.key() + ":backward"; if (way.hasTag(backwardKey)) { return isExtendedKeyMatch(way, backwardKey); @@ -97,7 +97,7 @@ default boolean isBackwardMatch(OSMWithTags way) { } } - default MatchResult matchBackward(OSMWithTags way) { + default MatchResult matchBackward(OsmWithTags way) { return isBackwardMatch(way) ? matchType() : NONE; } @@ -112,7 +112,7 @@ enum MatchResult { */ record Equals(String key, String value) implements Condition { @Override - public boolean isExtendedKeyMatch(OSMWithTags way, String exKey) { + public boolean isExtendedKeyMatch(OsmWithTags way, String exKey) { return way.hasTag(exKey) && way.isTag(exKey, value); } @@ -131,7 +131,7 @@ public MatchResult matchType() { return WILDCARD; } @Override - public boolean isExtendedKeyMatch(OSMWithTags way, String exKey) { + public boolean isExtendedKeyMatch(OsmWithTags way, String exKey) { return way.hasTag(exKey); } @@ -146,7 +146,7 @@ public String toString() { */ record Absent(String key) implements Condition { @Override - public boolean isExtendedKeyMatch(OSMWithTags way, String exKey) { + public boolean isExtendedKeyMatch(OsmWithTags way, String exKey) { return !way.hasTag(exKey); } @@ -161,7 +161,7 @@ public String toString() { */ record GreaterThan(String key, int value) implements Condition { @Override - public boolean isExtendedKeyMatch(OSMWithTags way, String exKey) { + public boolean isExtendedKeyMatch(OsmWithTags way, String exKey) { var maybeInt = way.getTagAsInt(exKey, ignored -> {}); return maybeInt.isPresent() && maybeInt.getAsInt() > value; } @@ -177,7 +177,7 @@ public String toString() { */ record LessThan(String key, int value) implements Condition { @Override - public boolean isExtendedKeyMatch(OSMWithTags way, String exKey) { + public boolean isExtendedKeyMatch(OsmWithTags way, String exKey) { var maybeInt = way.getTagAsInt(exKey, ignored -> {}); return maybeInt.isPresent() && maybeInt.getAsInt() < value; } @@ -199,7 +199,7 @@ record InclusiveRange(String key, int upper, int lower) implements Condition { } @Override - public boolean isExtendedKeyMatch(OSMWithTags way, String exKey) { + public boolean isExtendedKeyMatch(OsmWithTags way, String exKey) { var maybeInt = way.getTagAsInt(exKey, ignored -> {}); return maybeInt.isPresent() && maybeInt.getAsInt() >= lower && maybeInt.getAsInt() <= upper; } @@ -215,7 +215,7 @@ public String toString() { */ record OneOf(String key, String... values) implements Condition { @Override - public boolean isExtendedKeyMatch(OSMWithTags way, String exKey) { + public boolean isExtendedKeyMatch(OsmWithTags way, String exKey) { return Arrays.stream(values).anyMatch(value -> way.isTag(exKey, value)); } @@ -237,7 +237,7 @@ public OneOfOrAbsent(String key) { } @Override - public boolean isExtendedKeyMatch(OSMWithTags way, String exKey) { + public boolean isExtendedKeyMatch(OsmWithTags way, String exKey) { return ( !way.hasTag(exKey) || Arrays.stream(values).anyMatch(value -> way.isTag(exKey, value)) ); diff --git a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/specifier/ExactMatchSpecifier.java b/application/src/main/java/org/opentripplanner/osm/wayproperty/specifier/ExactMatchSpecifier.java similarity index 81% rename from src/main/java/org/opentripplanner/openstreetmap/wayproperty/specifier/ExactMatchSpecifier.java rename to application/src/main/java/org/opentripplanner/osm/wayproperty/specifier/ExactMatchSpecifier.java index 48c3b5edb64..547c5caf6be 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/specifier/ExactMatchSpecifier.java +++ b/application/src/main/java/org/opentripplanner/osm/wayproperty/specifier/ExactMatchSpecifier.java @@ -1,9 +1,9 @@ -package org.opentripplanner.openstreetmap.wayproperty.specifier; +package org.opentripplanner.osm.wayproperty.specifier; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; /** * This specifier allows you to specify a very precise match. It will only result in a positive when @@ -15,7 +15,7 @@ * If you'd use a {@link BestMatchSpecifier} then the likelihood of the long spec matching unwanted * ways would be high. * - * @see org.opentripplanner.openstreetmap.tagmapping.HoustonMapper + * @see org.opentripplanner.osm.tagmapping.HoustonMapper */ public class ExactMatchSpecifier implements OsmSpecifier { @@ -39,7 +39,7 @@ public ExactMatchSpecifier(Condition... conditions) { } @Override - public Scores matchScores(OSMWithTags way) { + public Scores matchScores(OsmWithTags way) { return new Scores( allForwardTagsMatch(way) ? bestMatchScore : NO_MATCH_SCORE, allBackwardTagsMatch(way) ? bestMatchScore : NO_MATCH_SCORE @@ -47,7 +47,7 @@ public Scores matchScores(OSMWithTags way) { } @Override - public int matchScore(OSMWithTags way) { + public int matchScore(OsmWithTags way) { if (allTagsMatch(way)) { return bestMatchScore; } else { @@ -60,15 +60,15 @@ public String toDocString() { return conditions.stream().map(Object::toString).collect(Collectors.joining("; ")); } - public boolean allTagsMatch(OSMWithTags way) { + public boolean allTagsMatch(OsmWithTags way) { return conditions.stream().allMatch(o -> o.isMatch(way)); } - public boolean allBackwardTagsMatch(OSMWithTags way) { + public boolean allBackwardTagsMatch(OsmWithTags way) { return conditions.stream().allMatch(c -> c.isBackwardMatch(way)); } - public boolean allForwardTagsMatch(OSMWithTags way) { + public boolean allForwardTagsMatch(OsmWithTags way) { return conditions.stream().allMatch(c -> c.isForwardMatch(way)); } diff --git a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/specifier/LogicalOrSpecifier.java b/application/src/main/java/org/opentripplanner/osm/wayproperty/specifier/LogicalOrSpecifier.java similarity index 86% rename from src/main/java/org/opentripplanner/openstreetmap/wayproperty/specifier/LogicalOrSpecifier.java rename to application/src/main/java/org/opentripplanner/osm/wayproperty/specifier/LogicalOrSpecifier.java index 74db280115b..9d4e2d0d24f 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/specifier/LogicalOrSpecifier.java +++ b/application/src/main/java/org/opentripplanner/osm/wayproperty/specifier/LogicalOrSpecifier.java @@ -1,9 +1,9 @@ -package org.opentripplanner.openstreetmap.wayproperty.specifier; +package org.opentripplanner.osm.wayproperty.specifier; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; /** * Allows to specify a 'logical or' condition to specify a match. This intended to be used with a @@ -31,12 +31,12 @@ public LogicalOrSpecifier(String... specs) { } @Override - public Scores matchScores(OSMWithTags way) { + public Scores matchScores(OsmWithTags way) { return Scores.of(matchScore(way)); } @Override - public int matchScore(OSMWithTags way) { + public int matchScore(OsmWithTags way) { var oneMatchesExactly = subSpecs.stream().anyMatch(subspec -> subspec.allTagsMatch(way)); if (oneMatchesExactly) { return 1; diff --git a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/specifier/OsmSpecifier.java b/application/src/main/java/org/opentripplanner/osm/wayproperty/specifier/OsmSpecifier.java similarity index 87% rename from src/main/java/org/opentripplanner/openstreetmap/wayproperty/specifier/OsmSpecifier.java rename to application/src/main/java/org/opentripplanner/osm/wayproperty/specifier/OsmSpecifier.java index 71d629552ff..23604537f7a 100644 --- a/src/main/java/org/opentripplanner/openstreetmap/wayproperty/specifier/OsmSpecifier.java +++ b/application/src/main/java/org/opentripplanner/osm/wayproperty/specifier/OsmSpecifier.java @@ -1,7 +1,7 @@ -package org.opentripplanner.openstreetmap.wayproperty.specifier; +package org.opentripplanner.osm.wayproperty.specifier; import java.util.Arrays; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; /** * An interface for assigning match scores for OSM entities (mostly ways). The higher the score the @@ -33,14 +33,14 @@ static Condition[] parseConditions(String spec, String separator) { * * @param way an OSM tagged object to compare to this specifier */ - Scores matchScores(OSMWithTags way); + Scores matchScores(OsmWithTags way); /** * Calculates a score expressing how well an OSM entity's tags match this specifier. This does - * exactly the same thing as {@link OsmSpecifier#matchScores(OSMWithTags)} but without regard for + * exactly the same thing as {@link OsmSpecifier#matchScores(OsmWithTags)} but without regard for * :left, :right, :forward, :backward and :both. */ - int matchScore(OSMWithTags way); + int matchScore(OsmWithTags way); /** * Convert this specifier to a human-readable identifier that represents this in (generated) diff --git a/src/main/java/org/opentripplanner/raptor/RaptorService.java b/application/src/main/java/org/opentripplanner/raptor/RaptorService.java similarity index 95% rename from src/main/java/org/opentripplanner/raptor/RaptorService.java rename to application/src/main/java/org/opentripplanner/raptor/RaptorService.java index d8e7fcd3dcd..70156cbbfbe 100644 --- a/src/main/java/org/opentripplanner/raptor/RaptorService.java +++ b/application/src/main/java/org/opentripplanner/raptor/RaptorService.java @@ -68,8 +68,8 @@ private RaptorResponse routeUsingStdWorker( RaptorTransitDataProvider transitData, RaptorRequest request ) { - var worker = config.createStdWorker(transitData, request); - var result = worker.route(); + var rangeRaptorRouter = config.createRangeRaptorWithStdWorker(transitData, request); + var result = rangeRaptorRouter.route(); var arrivals = new DefaultStopArrivals(result); return new RaptorResponse<>(result.extractPaths(), arrivals, request, false); } diff --git a/src/main/java/org/opentripplanner/raptor/RaptorTimeLine.svg b/application/src/main/java/org/opentripplanner/raptor/RaptorTimeLine.svg similarity index 100% rename from src/main/java/org/opentripplanner/raptor/RaptorTimeLine.svg rename to application/src/main/java/org/opentripplanner/raptor/RaptorTimeLine.svg diff --git a/src/main/java/org/opentripplanner/raptor/api/debug/DebugEvent.java b/application/src/main/java/org/opentripplanner/raptor/api/debug/DebugEvent.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/debug/DebugEvent.java rename to application/src/main/java/org/opentripplanner/raptor/api/debug/DebugEvent.java diff --git a/src/main/java/org/opentripplanner/raptor/api/debug/DebugLogger.java b/application/src/main/java/org/opentripplanner/raptor/api/debug/DebugLogger.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/debug/DebugLogger.java rename to application/src/main/java/org/opentripplanner/raptor/api/debug/DebugLogger.java diff --git a/src/main/java/org/opentripplanner/raptor/api/debug/DebugTopic.java b/application/src/main/java/org/opentripplanner/raptor/api/debug/DebugTopic.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/debug/DebugTopic.java rename to application/src/main/java/org/opentripplanner/raptor/api/debug/DebugTopic.java diff --git a/src/main/java/org/opentripplanner/raptor/api/debug/RaptorTimers.java b/application/src/main/java/org/opentripplanner/raptor/api/debug/RaptorTimers.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/debug/RaptorTimers.java rename to application/src/main/java/org/opentripplanner/raptor/api/debug/RaptorTimers.java diff --git a/src/main/java/org/opentripplanner/raptor/api/model/AbstractAccessEgressDecorator.java b/application/src/main/java/org/opentripplanner/raptor/api/model/AbstractAccessEgressDecorator.java similarity index 89% rename from src/main/java/org/opentripplanner/raptor/api/model/AbstractAccessEgressDecorator.java rename to application/src/main/java/org/opentripplanner/raptor/api/model/AbstractAccessEgressDecorator.java index ddb266e0884..eb1a388f91c 100644 --- a/src/main/java/org/opentripplanner/raptor/api/model/AbstractAccessEgressDecorator.java +++ b/application/src/main/java/org/opentripplanner/raptor/api/model/AbstractAccessEgressDecorator.java @@ -16,6 +16,18 @@ public AbstractAccessEgressDecorator(RaptorAccessEgress delegate) { this.delegate = delegate; } + public static RaptorAccessEgress accessEgressWithExtraSlack( + RaptorAccessEgress delegate, + int slack + ) { + return new AbstractAccessEgressDecorator(delegate) { + @Override + public int durationInSeconds() { + return super.durationInSeconds() + slack; + } + }; + } + protected RaptorAccessEgress delegate() { return delegate; } diff --git a/src/main/java/org/opentripplanner/raptor/api/model/DominanceFunction.java b/application/src/main/java/org/opentripplanner/raptor/api/model/DominanceFunction.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/model/DominanceFunction.java rename to application/src/main/java/org/opentripplanner/raptor/api/model/DominanceFunction.java diff --git a/src/main/java/org/opentripplanner/raptor/api/model/GeneralizedCostRelaxFunction.java b/application/src/main/java/org/opentripplanner/raptor/api/model/GeneralizedCostRelaxFunction.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/model/GeneralizedCostRelaxFunction.java rename to application/src/main/java/org/opentripplanner/raptor/api/model/GeneralizedCostRelaxFunction.java diff --git a/src/main/java/org/opentripplanner/raptor/api/model/PathLegType.java b/application/src/main/java/org/opentripplanner/raptor/api/model/PathLegType.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/model/PathLegType.java rename to application/src/main/java/org/opentripplanner/raptor/api/model/PathLegType.java diff --git a/src/main/java/org/opentripplanner/raptor/api/model/RaptorAccessEgress.java b/application/src/main/java/org/opentripplanner/raptor/api/model/RaptorAccessEgress.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/model/RaptorAccessEgress.java rename to application/src/main/java/org/opentripplanner/raptor/api/model/RaptorAccessEgress.java diff --git a/src/main/java/org/opentripplanner/raptor/api/model/RaptorConstants.java b/application/src/main/java/org/opentripplanner/raptor/api/model/RaptorConstants.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/model/RaptorConstants.java rename to application/src/main/java/org/opentripplanner/raptor/api/model/RaptorConstants.java diff --git a/src/main/java/org/opentripplanner/raptor/api/model/RaptorConstrainedTransfer.java b/application/src/main/java/org/opentripplanner/raptor/api/model/RaptorConstrainedTransfer.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/model/RaptorConstrainedTransfer.java rename to application/src/main/java/org/opentripplanner/raptor/api/model/RaptorConstrainedTransfer.java diff --git a/src/main/java/org/opentripplanner/raptor/api/path/RaptorStopNameResolver.java b/application/src/main/java/org/opentripplanner/raptor/api/model/RaptorStopNameResolver.java similarity index 94% rename from src/main/java/org/opentripplanner/raptor/api/path/RaptorStopNameResolver.java rename to application/src/main/java/org/opentripplanner/raptor/api/model/RaptorStopNameResolver.java index 1825c7965fe..a973e1732be 100644 --- a/src/main/java/org/opentripplanner/raptor/api/path/RaptorStopNameResolver.java +++ b/application/src/main/java/org/opentripplanner/raptor/api/model/RaptorStopNameResolver.java @@ -1,4 +1,4 @@ -package org.opentripplanner.raptor.api.path; +package org.opentripplanner.raptor.api.model; import javax.annotation.Nullable; diff --git a/src/main/java/org/opentripplanner/raptor/api/model/RaptorTransfer.java b/application/src/main/java/org/opentripplanner/raptor/api/model/RaptorTransfer.java similarity index 88% rename from src/main/java/org/opentripplanner/raptor/api/model/RaptorTransfer.java rename to application/src/main/java/org/opentripplanner/raptor/api/model/RaptorTransfer.java index bab4b9ab166..856d6828b30 100644 --- a/src/main/java/org/opentripplanner/raptor/api/model/RaptorTransfer.java +++ b/application/src/main/java/org/opentripplanner/raptor/api/model/RaptorTransfer.java @@ -14,8 +14,7 @@ public interface RaptorTransfer { int stop(); /** - * The generalized cost of this transfer in centi-seconds. The value is used to compare with - * riding transit, and will be one component of a full itinerary. + * The generalized cost of this transfer in centi-seconds. *

* This method is called many times, so care needs to be taken that the value is stored, not * calculated for each invocation. diff --git a/src/main/java/org/opentripplanner/raptor/api/model/RaptorTransferConstraint.java b/application/src/main/java/org/opentripplanner/raptor/api/model/RaptorTransferConstraint.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/model/RaptorTransferConstraint.java rename to application/src/main/java/org/opentripplanner/raptor/api/model/RaptorTransferConstraint.java diff --git a/src/main/java/org/opentripplanner/raptor/api/model/RaptorTripPattern.java b/application/src/main/java/org/opentripplanner/raptor/api/model/RaptorTripPattern.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/model/RaptorTripPattern.java rename to application/src/main/java/org/opentripplanner/raptor/api/model/RaptorTripPattern.java diff --git a/src/main/java/org/opentripplanner/raptor/api/model/RaptorTripSchedule.java b/application/src/main/java/org/opentripplanner/raptor/api/model/RaptorTripSchedule.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/model/RaptorTripSchedule.java rename to application/src/main/java/org/opentripplanner/raptor/api/model/RaptorTripSchedule.java diff --git a/src/main/java/org/opentripplanner/raptor/api/model/RaptorValueFormatter.java b/application/src/main/java/org/opentripplanner/raptor/api/model/RaptorValueFormatter.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/model/RaptorValueFormatter.java rename to application/src/main/java/org/opentripplanner/raptor/api/model/RaptorValueFormatter.java diff --git a/src/main/java/org/opentripplanner/raptor/api/model/RelaxFunction.java b/application/src/main/java/org/opentripplanner/raptor/api/model/RelaxFunction.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/model/RelaxFunction.java rename to application/src/main/java/org/opentripplanner/raptor/api/model/RelaxFunction.java diff --git a/src/main/java/org/opentripplanner/raptor/api/model/SearchDirection.java b/application/src/main/java/org/opentripplanner/raptor/api/model/SearchDirection.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/model/SearchDirection.java rename to application/src/main/java/org/opentripplanner/raptor/api/model/SearchDirection.java diff --git a/src/main/java/org/opentripplanner/raptor/api/model/TransitArrival.java b/application/src/main/java/org/opentripplanner/raptor/api/model/TransitArrival.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/model/TransitArrival.java rename to application/src/main/java/org/opentripplanner/raptor/api/model/TransitArrival.java diff --git a/src/main/java/org/opentripplanner/raptor/api/path/AccessPathLeg.java b/application/src/main/java/org/opentripplanner/raptor/api/path/AccessPathLeg.java similarity index 95% rename from src/main/java/org/opentripplanner/raptor/api/path/AccessPathLeg.java rename to application/src/main/java/org/opentripplanner/raptor/api/path/AccessPathLeg.java index b76e0a1df4d..cb4a8030ff6 100644 --- a/src/main/java/org/opentripplanner/raptor/api/path/AccessPathLeg.java +++ b/application/src/main/java/org/opentripplanner/raptor/api/path/AccessPathLeg.java @@ -1,7 +1,6 @@ package org.opentripplanner.raptor.api.path; import java.util.Objects; -import javax.annotation.Nonnull; import org.opentripplanner.raptor.api.model.RaptorAccessEgress; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; @@ -20,11 +19,11 @@ public final class AccessPathLeg implements PathLe private final PathLeg next; public AccessPathLeg( - @Nonnull RaptorAccessEgress access, + RaptorAccessEgress access, int fromTime, int toTime, int c1, - @Nonnull PathLeg next + PathLeg next ) { this.access = access; this.fromTime = fromTime; diff --git a/src/main/java/org/opentripplanner/raptor/api/path/EgressPathLeg.java b/application/src/main/java/org/opentripplanner/raptor/api/path/EgressPathLeg.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/path/EgressPathLeg.java rename to application/src/main/java/org/opentripplanner/raptor/api/path/EgressPathLeg.java diff --git a/src/main/java/org/opentripplanner/raptor/api/path/PathLeg.java b/application/src/main/java/org/opentripplanner/raptor/api/path/PathLeg.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/path/PathLeg.java rename to application/src/main/java/org/opentripplanner/raptor/api/path/PathLeg.java diff --git a/src/main/java/org/opentripplanner/raptor/api/path/PathStringBuilder.java b/application/src/main/java/org/opentripplanner/raptor/api/path/PathStringBuilder.java similarity index 98% rename from src/main/java/org/opentripplanner/raptor/api/path/PathStringBuilder.java rename to application/src/main/java/org/opentripplanner/raptor/api/path/PathStringBuilder.java index b96d1a96f14..da56474ae02 100644 --- a/src/main/java/org/opentripplanner/raptor/api/path/PathStringBuilder.java +++ b/application/src/main/java/org/opentripplanner/raptor/api/path/PathStringBuilder.java @@ -7,6 +7,7 @@ import org.opentripplanner.framework.time.TimeUtils; import org.opentripplanner.raptor.api.model.RaptorAccessEgress; import org.opentripplanner.raptor.api.model.RaptorConstants; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; import org.opentripplanner.raptor.api.model.RaptorValueFormatter; import org.opentripplanner.raptor.spi.RaptorCostCalculator; diff --git a/src/main/java/org/opentripplanner/raptor/api/path/RaptorPath.java b/application/src/main/java/org/opentripplanner/raptor/api/path/RaptorPath.java similarity index 98% rename from src/main/java/org/opentripplanner/raptor/api/path/RaptorPath.java rename to application/src/main/java/org/opentripplanner/raptor/api/path/RaptorPath.java index b92d30643ec..78d90f1d9f4 100644 --- a/src/main/java/org/opentripplanner/raptor/api/path/RaptorPath.java +++ b/application/src/main/java/org/opentripplanner/raptor/api/path/RaptorPath.java @@ -4,6 +4,7 @@ import java.util.stream.Stream; import javax.annotation.Nullable; import org.opentripplanner.raptor.api.model.RaptorConstants; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.model.RelaxFunction; diff --git a/src/main/java/org/opentripplanner/raptor/api/path/TransferPathLeg.java b/application/src/main/java/org/opentripplanner/raptor/api/path/TransferPathLeg.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/path/TransferPathLeg.java rename to application/src/main/java/org/opentripplanner/raptor/api/path/TransferPathLeg.java diff --git a/src/main/java/org/opentripplanner/raptor/api/path/TransitPathLeg.java b/application/src/main/java/org/opentripplanner/raptor/api/path/TransitPathLeg.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/path/TransitPathLeg.java rename to application/src/main/java/org/opentripplanner/raptor/api/path/TransitPathLeg.java diff --git a/src/main/java/org/opentripplanner/raptor/api/request/DebugRequest.java b/application/src/main/java/org/opentripplanner/raptor/api/request/DebugRequest.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/request/DebugRequest.java rename to application/src/main/java/org/opentripplanner/raptor/api/request/DebugRequest.java diff --git a/src/main/java/org/opentripplanner/raptor/api/request/DebugRequestBuilder.java b/application/src/main/java/org/opentripplanner/raptor/api/request/DebugRequestBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/request/DebugRequestBuilder.java rename to application/src/main/java/org/opentripplanner/raptor/api/request/DebugRequestBuilder.java diff --git a/src/main/java/org/opentripplanner/raptor/api/request/DynamicSearchWindowCoefficients.java b/application/src/main/java/org/opentripplanner/raptor/api/request/DynamicSearchWindowCoefficients.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/request/DynamicSearchWindowCoefficients.java rename to application/src/main/java/org/opentripplanner/raptor/api/request/DynamicSearchWindowCoefficients.java diff --git a/src/main/java/org/opentripplanner/raptor/api/request/MultiCriteriaRequest.java b/application/src/main/java/org/opentripplanner/raptor/api/request/MultiCriteriaRequest.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/request/MultiCriteriaRequest.java rename to application/src/main/java/org/opentripplanner/raptor/api/request/MultiCriteriaRequest.java diff --git a/src/main/java/org/opentripplanner/raptor/api/request/Optimization.java b/application/src/main/java/org/opentripplanner/raptor/api/request/Optimization.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/request/Optimization.java rename to application/src/main/java/org/opentripplanner/raptor/api/request/Optimization.java diff --git a/src/main/java/org/opentripplanner/raptor/api/request/PassThroughPoint.java b/application/src/main/java/org/opentripplanner/raptor/api/request/PassThroughPoint.java similarity index 97% rename from src/main/java/org/opentripplanner/raptor/api/request/PassThroughPoint.java rename to application/src/main/java/org/opentripplanner/raptor/api/request/PassThroughPoint.java index b17fab84347..187436907fe 100644 --- a/src/main/java/org/opentripplanner/raptor/api/request/PassThroughPoint.java +++ b/application/src/main/java/org/opentripplanner/raptor/api/request/PassThroughPoint.java @@ -10,7 +10,10 @@ /** * A collection of stop indexes used to define a pass through-point. + * + * @deprecated This will be replaced by ViaLocation */ +@Deprecated public class PassThroughPoint { private final String name; diff --git a/src/main/java/org/opentripplanner/raptor/api/request/RaptorProfile.java b/application/src/main/java/org/opentripplanner/raptor/api/request/RaptorProfile.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/request/RaptorProfile.java rename to application/src/main/java/org/opentripplanner/raptor/api/request/RaptorProfile.java diff --git a/src/main/java/org/opentripplanner/raptor/api/request/RaptorRequest.java b/application/src/main/java/org/opentripplanner/raptor/api/request/RaptorRequest.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/request/RaptorRequest.java rename to application/src/main/java/org/opentripplanner/raptor/api/request/RaptorRequest.java diff --git a/src/main/java/org/opentripplanner/raptor/api/request/RaptorRequestBuilder.java b/application/src/main/java/org/opentripplanner/raptor/api/request/RaptorRequestBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/request/RaptorRequestBuilder.java rename to application/src/main/java/org/opentripplanner/raptor/api/request/RaptorRequestBuilder.java diff --git a/src/main/java/org/opentripplanner/raptor/api/request/RaptorTransitGroupPriorityCalculator.java b/application/src/main/java/org/opentripplanner/raptor/api/request/RaptorTransitGroupPriorityCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/request/RaptorTransitGroupPriorityCalculator.java rename to application/src/main/java/org/opentripplanner/raptor/api/request/RaptorTransitGroupPriorityCalculator.java diff --git a/src/main/java/org/opentripplanner/raptor/api/request/RaptorTuningParameters.java b/application/src/main/java/org/opentripplanner/raptor/api/request/RaptorTuningParameters.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/request/RaptorTuningParameters.java rename to application/src/main/java/org/opentripplanner/raptor/api/request/RaptorTuningParameters.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/request/RaptorViaConnection.java b/application/src/main/java/org/opentripplanner/raptor/api/request/RaptorViaConnection.java new file mode 100644 index 00000000000..45dc5394188 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/raptor/api/request/RaptorViaConnection.java @@ -0,0 +1,143 @@ +package org.opentripplanner.raptor.api.request; + +import java.util.Objects; +import javax.annotation.Nullable; +import org.opentripplanner.framework.time.DurationUtils; +import org.opentripplanner.raptor.api.model.RaptorConstants; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; +import org.opentripplanner.raptor.api.model.RaptorTransfer; + +/** + * A via-connection is used to define one of the physical locations in a via location Raptor must + * visit. At least one connection in a {@link RaptorViaLocation} must be used. A connection can be + * a single stop or a stop and a transfer to another stop. The last is useful if you want to use + * the connection to visit something other than a stop, like a street location. + * This is not an alternative to transfers. Raptor supports several use-cases + * through via-connections: + * + *

Route via a pass-through-stop

+ * Raptor will allow a path to go through a pass-through-stop. The stop can be visited on-board + * transit, or at the alight- or board-stop. The from-stop and to-stop must be the same, and the + * minimum-wait-time must be zero. + * + *

Route via a single stop with a minimum-wait-time

+ * Raptor will allow a path to go through a single stop, if the from-stop and to-stop is the + * same. If the minimum-wait-time is greater than zero(0) the path will either alight or board + * transit at this stop, and the minimum-wait-time criteria is enforced. + * + *

Route via a coordinate

+ * + * To route through a coordinate you need to find all nearby stops, then find all access and egress + * paths to and from the street location. Then combine all access and egress paths to form + * complete transfers. Raptor does not know/see the actual via street location, it only uses the + * connection from a stop to another, the total time it takes and the total cost. You must generate + * a transfer with two "legs" in it. One leg going from the 'from-stop' to the street location, and + * one leg going back to the 'to-stop'. If you have 10 stops around the via street location, then + * you must combine all ten access paths and egress paths. + * + * The min-wait-time in the {@link RaptorViaLocation} is added to the transfers + * {@code durationInSeconds}. The calculation of {@code c1} should include the walk time, but not + * the min-wait-time (assuming all connections have the same minimum wait time). + */ +public final class RaptorViaConnection { + + private final int fromStop; + private final int durationInSeconds; + + @Nullable + private final RaptorTransfer transfer; + + RaptorViaConnection(RaptorViaLocation parent, int fromStop, @Nullable RaptorTransfer transfer) { + this.fromStop = fromStop; + this.transfer = transfer; + this.durationInSeconds = + parent.minimumWaitTime() + + (transfer == null ? RaptorConstants.ZERO : transfer.durationInSeconds()); + } + + /** + * Stop index where the connection starts. + */ + public int fromStop() { + return fromStop; + } + + @Nullable + public RaptorTransfer transfer() { + return transfer; + } + + /** + * Stop index where the connection ends. This can be the same as the {@code fromStop}. + */ + public int toStop() { + return isSameStop() ? fromStop : transfer.stop(); + } + + /** + * The time duration to walk or travel from the {@code fromStop} to the {@code toStop}. + */ + public int durationInSeconds() { + return durationInSeconds; + } + + /** + * The generalized cost of this via-connection in centi-seconds. + *

+ * This method is called many times, so care needs to be taken that the value is stored, not + * calculated for each invocation. + */ + public int c1() { + return isSameStop() ? RaptorConstants.ZERO : transfer.c1(); + } + + public boolean isSameStop() { + return transfer == null; + } + + /** + * This method is used to check that all connections are unique/provide an optimal path. + * The method returns {@code true} if this instance is better or equals to the given other + * stop with respect to being pareto-optimal. + */ + boolean isBetterOrEqual(RaptorViaConnection other) { + if (fromStop != other.fromStop || toStop() != other.toStop()) { + return false; + } + return durationInSeconds() <= other.durationInSeconds() && c1() <= other.c1(); + } + + /** + * Only from and to stop is part of the equals/hashCode, duplicate connection between to stops + * are not allowed. + */ + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + RaptorViaConnection that = (RaptorViaConnection) o; + return fromStop == that.fromStop && Objects.equals(transfer, that.transfer); + } + + @Override + public int hashCode() { + return Objects.hash(fromStop, transfer); + } + + @Override + public String toString() { + return toString(Integer::toString); + } + + public String toString(RaptorStopNameResolver stopNameResolver) { + var buf = new StringBuilder(stopNameResolver.apply(fromStop)); + if (transfer != null) { + buf.append("~").append(stopNameResolver.apply(toStop())); + } + int d = durationInSeconds(); + if (d > RaptorConstants.ZERO) { + buf.append(" ").append(DurationUtils.durationToStr(d)); + } + return buf.toString(); + } +} diff --git a/application/src/main/java/org/opentripplanner/raptor/api/request/RaptorViaLocation.java b/application/src/main/java/org/opentripplanner/raptor/api/request/RaptorViaLocation.java new file mode 100644 index 00000000000..ae7ea19d20d --- /dev/null +++ b/application/src/main/java/org/opentripplanner/raptor/api/request/RaptorViaLocation.java @@ -0,0 +1,191 @@ +package org.opentripplanner.raptor.api.request; + +import java.time.Duration; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Nullable; +import org.opentripplanner.framework.lang.IntUtils; +import org.opentripplanner.framework.time.DurationUtils; +import org.opentripplanner.raptor.api.model.RaptorConstants; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; +import org.opentripplanner.raptor.api.model.RaptorTransfer; + +/** + * Defines a via location which Raptor will force the path through. The concrete location is + * called a connection. A location must have at least one connection, but can have more than + * on alternative. Raptor will force the path through one of the connections. So, if there + * are two connections, stop A and B, then Raptor will force the path through A or B. If the + * path goes through A, it may or may not go through B. + */ +public final class RaptorViaLocation { + + private static final int MAX_WAIT_TIME_LIMIT = (int) Duration.ofHours(24).toSeconds(); + + private final String label; + private final boolean allowPassThrough; + private final int minimumWaitTime; + private final List connections; + + private RaptorViaLocation( + String label, + boolean allowPassThrough, + Duration minimumWaitTime, + List connections + ) { + this.label = label; + this.allowPassThrough = allowPassThrough; + this.minimumWaitTime = + IntUtils.requireInRange( + (int) minimumWaitTime.toSeconds(), + RaptorConstants.ZERO, + MAX_WAIT_TIME_LIMIT, + "minimumWaitTime" + ); + this.connections = validateConnections(connections); + + if (allowPassThrough && this.minimumWaitTime > RaptorConstants.ZERO) { + throw new IllegalArgumentException("Pass-through and min-wait-time is not allowed."); + } + } + + /** + * Force the path through a set of stops, either on-board or as an alight or board stop. + */ + public static Builder allowPassThrough(@Nullable String label) { + return new Builder(label, true, Duration.ZERO); + } + + /** + * Force the path through one of the listed connections. To visit a stop, the path must board or + * alight transit at the given stop, on-board visits do not count, see + * {@link #allowPassThrough(String)}. + */ + public static Builder via(@Nullable String label) { + return new Builder(label, false, Duration.ZERO); + } + + /** + * Force the path through one of the listed connections, and wait the given minimum-wait-time + * before continuing. To visit a stop, the path must board or alight transit at the given stop, + * on-board visits do not count, see {@link #allowPassThrough(String)}. + */ + public static Builder via(@Nullable String label, Duration minimumWaitTime) { + return new Builder(label, false, minimumWaitTime); + } + + @Nullable + public String label() { + return label; + } + + public boolean allowPassThrough() { + return allowPassThrough; + } + + public int minimumWaitTime() { + return minimumWaitTime; + } + + public List connections() { + return connections; + } + + public String toString() { + return toString(Integer::toString); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + RaptorViaLocation that = (RaptorViaLocation) o; + return ( + allowPassThrough == that.allowPassThrough && + minimumWaitTime == that.minimumWaitTime && + Objects.equals(label, that.label) && + Objects.equals(connections, that.connections) + ); + } + + @Override + public int hashCode() { + return Objects.hash(label, allowPassThrough, minimumWaitTime, connections); + } + + public String toString(RaptorStopNameResolver stopNameResolver) { + var buf = new StringBuilder("Via{"); + if (label != null) { + buf.append("label: ").append(label).append(", "); + } + if (allowPassThrough) { + buf.append("allowPassThrough, "); + } + if (minimumWaitTime > RaptorConstants.ZERO) { + buf.append("minWaitTime: ").append(DurationUtils.durationToStr(minimumWaitTime)).append(", "); + } + buf + .append("connections: ") + .append(connections.stream().map(it -> it.toString(stopNameResolver)).toList()); + return buf.append("}").toString(); + } + + private List validateConnections(List connections) { + if (connections.isEmpty()) { + throw new IllegalArgumentException("At least one connection is required."); + } + var list = connections + .stream() + .map(it -> new RaptorViaConnection(this, it.fromStop, it.transfer)) + .toList(); + + // Compare all pairs to check for duplicates and non-optimal connections + for (int i = 0; i < list.size(); ++i) { + var a = list.get(i); + for (int j = i + 1; j < list.size(); ++j) { + var b = list.get(j); + if (a.isBetterOrEqual(b) || b.isBetterOrEqual(a)) { + throw new IllegalArgumentException( + "All connection need to be pareto-optimal: (" + a + ") <-> (" + b + ")" + ); + } + } + } + return list; + } + + public static final class Builder { + + private final String label; + private final boolean allowPassThrough; + private final Duration minimumWaitTime; + private final List connections = new ArrayList<>(); + + public Builder(String label, boolean allowPassThrough, Duration minimumWaitTime) { + this.label = label; + this.allowPassThrough = allowPassThrough; + this.minimumWaitTime = minimumWaitTime; + } + + public Builder addViaStop(int stop) { + this.connections.add(new StopAndTransfer(stop, null)); + return this; + } + + public Builder addViaTransfer(int fromStop, RaptorTransfer transfer) { + this.connections.add(new StopAndTransfer(fromStop, transfer)); + return this; + } + + public RaptorViaLocation build() { + return new RaptorViaLocation(label, allowPassThrough, minimumWaitTime, connections); + } + } + + /** + * Use internally to store connection data, before creating the connection objects. If is + * needed to create the bidirectional relationship between {@link RaptorViaLocation} and + * {@link RaptorViaConnection}. + */ + private record StopAndTransfer(int fromStop, @Nullable RaptorTransfer transfer) {} +} diff --git a/src/main/java/org/opentripplanner/raptor/api/request/SearchParams.java b/application/src/main/java/org/opentripplanner/raptor/api/request/SearchParams.java similarity index 91% rename from src/main/java/org/opentripplanner/raptor/api/request/SearchParams.java rename to application/src/main/java/org/opentripplanner/raptor/api/request/SearchParams.java index 9bad7cf7222..6ba51319a29 100644 --- a/src/main/java/org/opentripplanner/raptor/api/request/SearchParams.java +++ b/application/src/main/java/org/opentripplanner/raptor/api/request/SearchParams.java @@ -16,6 +16,12 @@ */ public class SearchParams { + /** + * The maximum number of via-locations is used as a check to avoid exploiting the + * search performance. Consider restricting this further in the upstream services. + */ + private static final int MAX_VIA_POINTS = 10; + private final int earliestDepartureTime; private final int latestArrivalTime; private final int searchWindowInSeconds; @@ -26,6 +32,7 @@ public class SearchParams { private final boolean constrainedTransfers; private final Collection accessPaths; private final Collection egressPaths; + private final List viaLocations; /** * Default values are defined in the default constructor. @@ -41,6 +48,7 @@ private SearchParams() { constrainedTransfers = false; accessPaths = List.of(); egressPaths = List.of(); + viaLocations = List.of(); } SearchParams(SearchParamsBuilder builder) { @@ -54,6 +62,7 @@ private SearchParams() { this.constrainedTransfers = builder.constrainedTransfers(); this.accessPaths = List.copyOf(builder.accessPaths()); this.egressPaths = List.copyOf(builder.egressPaths()); + this.viaLocations = List.copyOf(builder.viaLocations()); } /** @@ -195,6 +204,17 @@ public Collection egressPaths() { return egressPaths; } + /** + * List of all possible via locations. + */ + public List viaLocations() { + return viaLocations; + } + + public boolean hasViaLocations() { + return !viaLocations.isEmpty(); + } + /** * Get the maximum duration of any access or egress path in seconds. */ @@ -214,7 +234,8 @@ public int hashCode() { preferLateArrival, numberOfAdditionalTransfers, accessPaths, - egressPaths + egressPaths, + viaLocations ); } @@ -234,7 +255,8 @@ public boolean equals(Object o) { preferLateArrival == that.preferLateArrival && numberOfAdditionalTransfers == that.numberOfAdditionalTransfers && accessPaths.equals(that.accessPaths) && - egressPaths.equals(that.egressPaths) + egressPaths.equals(that.egressPaths) && + viaLocations.equals(viaLocations) ); } @@ -254,6 +276,7 @@ public String toString() { ) .addCollection("accessPaths", accessPaths, 5, RaptorAccessEgress::defaultToString) .addCollection("egressPaths", egressPaths, 5, RaptorAccessEgress::defaultToString) + .addCollection("via", viaLocations, 5) .toString(); } @@ -278,5 +301,9 @@ void verify() { !(preferLateArrival && timetable), "The 'departAsLateAsPossible' is not allowed together with 'timetableEnabled'." ); + assertProperty( + viaLocations.size() <= MAX_VIA_POINTS, + "The 'viaLocations' exceeds the maximum number of via-locations (" + MAX_VIA_POINTS + ")." + ); } } diff --git a/src/main/java/org/opentripplanner/raptor/api/request/SearchParamsBuilder.java b/application/src/main/java/org/opentripplanner/raptor/api/request/SearchParamsBuilder.java similarity index 90% rename from src/main/java/org/opentripplanner/raptor/api/request/SearchParamsBuilder.java rename to application/src/main/java/org/opentripplanner/raptor/api/request/SearchParamsBuilder.java index 5774a92d6e1..7db4ce5d0f7 100644 --- a/src/main/java/org/opentripplanner/raptor/api/request/SearchParamsBuilder.java +++ b/application/src/main/java/org/opentripplanner/raptor/api/request/SearchParamsBuilder.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.List; import org.opentripplanner.framework.tostring.ToStringBuilder; import org.opentripplanner.raptor.api.model.RaptorAccessEgress; import org.opentripplanner.raptor.api.model.RaptorConstants; @@ -18,9 +19,7 @@ public class SearchParamsBuilder { private final RaptorRequestBuilder parent; - private final Collection accessPaths = new ArrayList<>(); - private final Collection egressPaths = new ArrayList<>(); - // Search + private int earliestDepartureTime; private int latestArrivalTime; private int searchWindowInSeconds; @@ -29,6 +28,9 @@ public class SearchParamsBuilder { private int maxNumberOfTransfers; private boolean timetable; private boolean constrainedTransfers; + private final Collection accessPaths = new ArrayList<>(); + private final Collection egressPaths = new ArrayList<>(); + private final List viaLocations = new ArrayList<>(); public SearchParamsBuilder(RaptorRequestBuilder parent, SearchParams defaults) { this.parent = parent; @@ -42,6 +44,7 @@ public SearchParamsBuilder(RaptorRequestBuilder parent, SearchParams defaults this.constrainedTransfers = defaults.constrainedTransfers(); this.accessPaths.addAll(defaults.accessPaths()); this.egressPaths.addAll(defaults.egressPaths()); + this.viaLocations.addAll(defaults.viaLocations()); } public int earliestDepartureTime() { @@ -72,9 +75,9 @@ public SearchParamsBuilder searchWindowInSeconds(int searchWindowInSeconds) { } public SearchParamsBuilder searchWindow(Duration searchWindow) { - this.searchWindowInSeconds = - searchWindow == null ? RaptorConstants.NOT_SET : (int) searchWindow.toSeconds(); - return this; + return searchWindowInSeconds( + searchWindow == null ? RaptorConstants.NOT_SET : (int) searchWindow.toSeconds() + ); } /** @@ -160,6 +163,20 @@ public SearchParamsBuilder addEgressPaths(RaptorAccessEgress... egressPaths) return addEgressPaths(Arrays.asList(egressPaths)); } + public Collection viaLocations() { + return viaLocations; + } + + public SearchParamsBuilder addViaLocation(RaptorViaLocation location) { + viaLocations.add(location); + return this; + } + + public SearchParamsBuilder addViaLocations(Collection locations) { + viaLocations.addAll(locations); + return this; + } + public RaptorRequest build() { return parent.build(); } @@ -180,6 +197,7 @@ public String toString() { .addNum("numberOfAdditionalTransfers", numberOfAdditionalTransfers) .addCollection("accessPaths", accessPaths, 5) .addCollection("egressPaths", egressPaths, 5) + .addCollection("via", viaLocations, 10) .toString(); } } diff --git a/src/main/java/org/opentripplanner/raptor/api/response/RaptorResponse.java b/application/src/main/java/org/opentripplanner/raptor/api/response/RaptorResponse.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/response/RaptorResponse.java rename to application/src/main/java/org/opentripplanner/raptor/api/response/RaptorResponse.java diff --git a/src/main/java/org/opentripplanner/raptor/api/response/StopArrivals.java b/application/src/main/java/org/opentripplanner/raptor/api/response/StopArrivals.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/response/StopArrivals.java rename to application/src/main/java/org/opentripplanner/raptor/api/response/StopArrivals.java diff --git a/src/main/java/org/opentripplanner/raptor/api/view/AccessPathView.java b/application/src/main/java/org/opentripplanner/raptor/api/view/AccessPathView.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/view/AccessPathView.java rename to application/src/main/java/org/opentripplanner/raptor/api/view/AccessPathView.java diff --git a/src/main/java/org/opentripplanner/raptor/api/view/ArrivalView.java b/application/src/main/java/org/opentripplanner/raptor/api/view/ArrivalView.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/view/ArrivalView.java rename to application/src/main/java/org/opentripplanner/raptor/api/view/ArrivalView.java diff --git a/src/main/java/org/opentripplanner/raptor/api/view/EgressPathView.java b/application/src/main/java/org/opentripplanner/raptor/api/view/EgressPathView.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/view/EgressPathView.java rename to application/src/main/java/org/opentripplanner/raptor/api/view/EgressPathView.java diff --git a/src/main/java/org/opentripplanner/raptor/api/view/PatternRideView.java b/application/src/main/java/org/opentripplanner/raptor/api/view/PatternRideView.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/view/PatternRideView.java rename to application/src/main/java/org/opentripplanner/raptor/api/view/PatternRideView.java diff --git a/src/main/java/org/opentripplanner/raptor/api/view/TransitPathView.java b/application/src/main/java/org/opentripplanner/raptor/api/view/TransitPathView.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/api/view/TransitPathView.java rename to application/src/main/java/org/opentripplanner/raptor/api/view/TransitPathView.java diff --git a/src/main/java/org/opentripplanner/raptor/configure/RaptorConfig.java b/application/src/main/java/org/opentripplanner/raptor/configure/RaptorConfig.java similarity index 66% rename from src/main/java/org/opentripplanner/raptor/configure/RaptorConfig.java rename to application/src/main/java/org/opentripplanner/raptor/configure/RaptorConfig.java index f1477ecc9f3..cc488448304 100644 --- a/src/main/java/org/opentripplanner/raptor/configure/RaptorConfig.java +++ b/application/src/main/java/org/opentripplanner/raptor/configure/RaptorConfig.java @@ -2,20 +2,23 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import java.util.function.IntPredicate; import javax.annotation.Nullable; import org.opentripplanner.framework.concurrent.OtpRequestThreadFactory; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.request.RaptorRequest; import org.opentripplanner.raptor.api.request.RaptorTuningParameters; import org.opentripplanner.raptor.rangeraptor.DefaultRangeRaptorWorker; +import org.opentripplanner.raptor.rangeraptor.RangeRaptor; +import org.opentripplanner.raptor.rangeraptor.RangeRaptorWorkerComposite; import org.opentripplanner.raptor.rangeraptor.context.SearchContext; +import org.opentripplanner.raptor.rangeraptor.context.SearchContextViaLeg; import org.opentripplanner.raptor.rangeraptor.internalapi.Heuristics; import org.opentripplanner.raptor.rangeraptor.internalapi.PassThroughPointsService; -import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorWorker; -import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorWorkerResult; +import org.opentripplanner.raptor.rangeraptor.internalapi.RangeRaptorWorker; +import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorRouterResult; import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorWorkerState; import org.opentripplanner.raptor.rangeraptor.internalapi.RoutingStrategy; +import org.opentripplanner.raptor.rangeraptor.multicriteria.McStopArrivals; import org.opentripplanner.raptor.rangeraptor.multicriteria.configure.McRangeRaptorConfig; import org.opentripplanner.raptor.rangeraptor.standard.configure.StdRangeRaptorConfig; import org.opentripplanner.raptor.rangeraptor.transit.RaptorSearchWindowCalculator; @@ -49,44 +52,62 @@ public static RaptorConfig defaultConfigForTes public SearchContext context(RaptorTransitDataProvider transit, RaptorRequest request) { // The passThroughPointsService is needed to create the context, so we initialize it here. this.passThroughPointsService = createPassThroughPointsService(request); - return new SearchContext<>(request, tuningParameters, transit, acceptC2AtDestination()); + var acceptC2AtDestination = passThroughPointsService.isNoop() + ? null + : passThroughPointsService.acceptC2AtDestination(); + return SearchContext.of(request, tuningParameters, transit, acceptC2AtDestination).build(); } - public RaptorWorker createStdWorker( + public RangeRaptor createRangeRaptorWithStdWorker( RaptorTransitDataProvider transitData, RaptorRequest request ) { var context = context(transitData, request); var stdConfig = new StdRangeRaptorConfig<>(context); - return createWorker(context, stdConfig.state(), stdConfig.strategy()); + return createRangeRaptor( + context, + createWorker(context.legs().getFirst(), stdConfig.state(), stdConfig.strategy()) + ); } - public RaptorWorker createMcWorker( + public RangeRaptor createRangeRaptorWithMcWorker( RaptorTransitDataProvider transitData, RaptorRequest request, Heuristics heuristics ) { - final SearchContext context = context(transitData, request); - return new McRangeRaptorConfig<>(context, passThroughPointsService) - .createWorker( - heuristics, - (state, routingStrategy) -> createWorker(context, state, routingStrategy) - ); + var context = context(transitData, request); + RangeRaptorWorker worker = null; + McStopArrivals nextStopArrivals = null; + + if (request.searchParams().hasViaLocations()) { + for (SearchContextViaLeg cxLeg : context.legs().reversed()) { + var c = new McRangeRaptorConfig<>(cxLeg, passThroughPointsService) + .connectWithNextLegArrivals(nextStopArrivals); + var w = createWorker(cxLeg, c.state(), c.strategy()); + worker = RangeRaptorWorkerComposite.of(w, worker); + nextStopArrivals = c.stopArrivals(); + } + } else { + // The first leg is the only leg + var leg = context.legs().getFirst(); + var c = new McRangeRaptorConfig<>(leg, passThroughPointsService).withHeuristics(heuristics); + worker = createWorker(leg, c.state(), c.strategy()); + } + + return createRangeRaptor(context, worker); } - public RaptorWorker createHeuristicSearch( + public RangeRaptor createRangeRaptorWithHeuristicSearch( RaptorTransitDataProvider transitData, RaptorRequest request ) { - var context = context(transitData, request); - var stdConfig = new StdRangeRaptorConfig<>(context); - return createWorker(context, stdConfig.state(), stdConfig.strategy()); + return createRangeRaptorWithStdWorker(transitData, request); } public Heuristics createHeuristic( RaptorTransitDataProvider transitData, RaptorRequest request, - RaptorWorkerResult results + RaptorRouterResult results ) { var context = context(transitData, request); return new StdRangeRaptorConfig<>(context).createHeuristics(results); @@ -116,29 +137,35 @@ private static PassThroughPointsService createPassThroughPointsService(RaptorReq return McRangeRaptorConfig.passThroughPointsService(request.multiCriteria()); } - private RaptorWorker createWorker( - SearchContext ctx, + private RangeRaptorWorker createWorker( + SearchContextViaLeg ctxLeg, RaptorWorkerState workerState, RoutingStrategy routingStrategy ) { + var ctx = ctxLeg.parent(); return new DefaultRangeRaptorWorker<>( workerState, routingStrategy, ctx.transit(), ctx.slackProvider(), - ctx.accessPaths(), - ctx.roundProvider(), + ctxLeg.accessPaths(), ctx.calculator(), - ctx.createLifeCyclePublisher(), + ctx.lifeCycle(), ctx.performanceTimers(), ctx.useConstrainedTransfers() ); } - private IntPredicate acceptC2AtDestination() { - return passThroughPointsService.isNoop() - ? null - : passThroughPointsService.acceptC2AtDestination(); + private RangeRaptor createRangeRaptor(SearchContext ctx, RangeRaptorWorker worker) { + return new RangeRaptor<>( + worker, + ctx.transit(), + ctx.legs().getFirst().accessPaths(), + ctx.roundTracker(), + ctx.calculator(), + ctx.createLifeCyclePublisher(), + ctx.performanceTimers() + ); } @Nullable diff --git a/src/main/java/org/opentripplanner/raptor/package.md b/application/src/main/java/org/opentripplanner/raptor/package.md similarity index 100% rename from src/main/java/org/opentripplanner/raptor/package.md rename to application/src/main/java/org/opentripplanner/raptor/package.md diff --git a/src/main/java/org/opentripplanner/raptor/path/Path.java b/application/src/main/java/org/opentripplanner/raptor/path/Path.java similarity index 99% rename from src/main/java/org/opentripplanner/raptor/path/Path.java rename to application/src/main/java/org/opentripplanner/raptor/path/Path.java index ebade8b2690..99f226df0ef 100644 --- a/src/main/java/org/opentripplanner/raptor/path/Path.java +++ b/application/src/main/java/org/opentripplanner/raptor/path/Path.java @@ -8,6 +8,7 @@ import java.util.stream.Stream; import javax.annotation.Nullable; import org.opentripplanner.raptor.api.model.RaptorConstants; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; import org.opentripplanner.raptor.api.model.RaptorTransferConstraint; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.path.AccessPathLeg; @@ -15,7 +16,6 @@ import org.opentripplanner.raptor.api.path.PathLeg; import org.opentripplanner.raptor.api.path.PathStringBuilder; import org.opentripplanner.raptor.api.path.RaptorPath; -import org.opentripplanner.raptor.api.path.RaptorStopNameResolver; import org.opentripplanner.raptor.api.path.TransitPathLeg; /** diff --git a/src/main/java/org/opentripplanner/raptor/path/PathBuilder.java b/application/src/main/java/org/opentripplanner/raptor/path/PathBuilder.java similarity index 99% rename from src/main/java/org/opentripplanner/raptor/path/PathBuilder.java rename to application/src/main/java/org/opentripplanner/raptor/path/PathBuilder.java index 7612cc0b3ba..3d0d5e706f6 100644 --- a/src/main/java/org/opentripplanner/raptor/path/PathBuilder.java +++ b/application/src/main/java/org/opentripplanner/raptor/path/PathBuilder.java @@ -6,12 +6,12 @@ import org.opentripplanner.raptor.api.model.RaptorAccessEgress; import org.opentripplanner.raptor.api.model.RaptorConstants; import org.opentripplanner.raptor.api.model.RaptorConstrainedTransfer; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; import org.opentripplanner.raptor.api.model.RaptorTransfer; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.path.AccessPathLeg; import org.opentripplanner.raptor.api.path.PathStringBuilder; import org.opentripplanner.raptor.api.path.RaptorPath; -import org.opentripplanner.raptor.api.path.RaptorStopNameResolver; import org.opentripplanner.raptor.spi.BoardAndAlightTime; import org.opentripplanner.raptor.spi.RaptorCostCalculator; import org.opentripplanner.raptor.spi.RaptorPathConstrainedTransferSearch; diff --git a/src/main/java/org/opentripplanner/raptor/path/PathBuilderLeg.java b/application/src/main/java/org/opentripplanner/raptor/path/PathBuilderLeg.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/path/PathBuilderLeg.java rename to application/src/main/java/org/opentripplanner/raptor/path/PathBuilderLeg.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/DefaultRangeRaptorWorker.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/DefaultRangeRaptorWorker.java similarity index 64% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/DefaultRangeRaptorWorker.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/DefaultRangeRaptorWorker.java index 0f2ceb9d6e4..ca71c85af22 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/DefaultRangeRaptorWorker.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/DefaultRangeRaptorWorker.java @@ -1,21 +1,19 @@ package org.opentripplanner.raptor.rangeraptor; import java.util.Collection; -import org.opentripplanner.framework.application.OTPRequestTimeoutException; +import javax.annotation.Nullable; import org.opentripplanner.raptor.api.debug.RaptorTimers; import org.opentripplanner.raptor.api.model.RaptorAccessEgress; import org.opentripplanner.raptor.api.model.RaptorConstants; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; -import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorWorker; -import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorWorkerResult; +import org.opentripplanner.raptor.rangeraptor.internalapi.RangeRaptorWorker; +import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorRouterResult; import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorWorkerState; -import org.opentripplanner.raptor.rangeraptor.internalapi.RoundProvider; import org.opentripplanner.raptor.rangeraptor.internalapi.RoutingStrategy; import org.opentripplanner.raptor.rangeraptor.internalapi.SlackProvider; -import org.opentripplanner.raptor.rangeraptor.lifecycle.LifeCycleEventPublisher; +import org.opentripplanner.raptor.rangeraptor.internalapi.WorkerLifeCycle; import org.opentripplanner.raptor.rangeraptor.transit.AccessPaths; import org.opentripplanner.raptor.rangeraptor.transit.RaptorTransitCalculator; -import org.opentripplanner.raptor.rangeraptor.transit.RoundTracker; import org.opentripplanner.raptor.spi.IntIterator; import org.opentripplanner.raptor.spi.RaptorTransitDataProvider; @@ -50,7 +48,7 @@ */ @SuppressWarnings("Duplicates") public final class DefaultRangeRaptorWorker - implements RaptorWorker { + implements RangeRaptorWorker { private final RoutingStrategy transitWorker; @@ -65,12 +63,6 @@ public final class DefaultRangeRaptorWorker */ private final RaptorWorkerState state; - /** - * The round tracker keep track for the current Raptor round, and abort the search if the round - * max limit is reached. - */ - private final RoundTracker roundTracker; - private final RaptorTransitDataProvider transitData; private final SlackProvider slackProvider; @@ -79,25 +71,27 @@ public final class DefaultRangeRaptorWorker private final RaptorTimers timers; + @Nullable private final AccessPaths accessPaths; - private final LifeCycleEventPublisher lifeCycle; - - private final int minNumberOfRounds; - private final boolean enableTransferConstraints; private int iterationDepartureTime; + private int round; + + /** + * @param accessPaths can be null in case the worker is chained - only the first worker has + * access. + */ public DefaultRangeRaptorWorker( RaptorWorkerState state, RoutingStrategy transitWorker, RaptorTransitDataProvider transitData, SlackProvider slackProvider, - AccessPaths accessPaths, - RoundProvider roundProvider, + @Nullable AccessPaths accessPaths, RaptorTransitCalculator calculator, - LifeCycleEventPublisher lifeCyclePublisher, + WorkerLifeCycle lifeCycle, RaptorTimers timers, boolean enableTransferConstraints ) { @@ -108,92 +102,30 @@ public DefaultRangeRaptorWorker( this.calculator = calculator; this.timers = timers; this.accessPaths = accessPaths; - this.minNumberOfRounds = accessPaths.calculateMaxNumberOfRides(); this.enableTransferConstraints = enableTransferConstraints; - // We do a cast here to avoid exposing the round tracker and the life cycle publisher to - // "everyone" by providing access to it in the context. - this.roundTracker = (RoundTracker) roundProvider; - this.lifeCycle = lifeCyclePublisher; + lifeCycle.onSetupIteration(time -> this.iterationDepartureTime = time); + lifeCycle.onPrepareForNextRound(round -> this.round = round); } - /** - * For each iteration (minute), calculate the minimum travel time to each transit stop in - * seconds. - *

- * Run the scheduled search, round 0 is the street search. - */ @Override - public RaptorWorkerResult route() { - timers.route(() -> { - lifeCycle.notifyRouteSearchStart(calculator.searchForward()); - transitData.setup(); - - // The main outer loop iterates backward over all minutes in the departure times window. - // Ergo, we re-use the arrival times found in searches that have already occurred that - // depart later, because the arrival time given departure at time t is upper-bounded by - // the arrival time given departure at minute t + 1. - final IntIterator it = calculator.rangeRaptorMinutes(); - while (it.hasNext()) { - setupIteration(it.next()); - runRaptorForMinute(); - } - - // Iterate over virtual departure times - this is needed to allow access with a time-penalty - // which falls outside the search-window due to the added time-penalty. - if (!calculator.oneIterationOnly()) { - final IntIterator as = accessPaths.iterateOverPathsWithPenalty(iterationDepartureTime); - while (as.hasNext()) { - setupIteration(as.next()); - runRaptorForMinute(); - } - } - }); + public RaptorRouterResult result() { return state.results(); } - /** - * Perform one minute of a RAPTOR search. - */ - private void runRaptorForMinute() { - findAccessOnStreetForRound(); - - while (hasMoreRounds()) { - lifeCycle.prepareForNextRound(roundTracker.nextRound()); - - // NB since we have transfer limiting not bothering to cut off search when there are no - // more transfers as that will be rare and complicates the code - findTransitForRound(); - - findAccessOnBoardForRound(); - - findTransfersForRound(); - - lifeCycle.roundComplete(state.isDestinationReachedInCurrentRound()); - - findAccessOnStreetForRound(); - } - - // This state is repeatedly modified as the outer loop progresses over departure minutes. - // We have to be careful here, the next iteration will modify the state, so we need to make - // protective copies of any information we want to retain. - lifeCycle.iterationComplete(); - } - /** * Check if the RangeRaptor should continue with a new round. */ - private boolean hasMoreRounds() { - if (round() < minNumberOfRounds) { - return true; - } - return state.isNewRoundAvailable() && roundTracker.hasMoreRounds(); + @Override + public boolean hasMoreRounds() { + return state.isNewRoundAvailable(); } /** * Perform a scheduled search */ - private void findTransitForRound() { + @Override + public void findTransitForRound() { timers.findTransitForRound(() -> { IntIterator stops = state.stopsTouchedPreviousRound(); IntIterator routeIndexIterator = transitData.routeIndexIterator(stops); @@ -248,11 +180,11 @@ private void findTransitForRound() { } } } - lifeCycle.transitsForRoundComplete(); }); } - private void findTransfersForRound() { + @Override + public void findTransfersForRound() { timers.findTransfersForRound(() -> { IntIterator it = state.stopsTouchedByTransitCurrentRound(); @@ -262,30 +194,22 @@ private void findTransfersForRound() { // loop transfers are already included by virtue of those stops having been reached state.transferToStops(fromStop, calculator.getTransfers(transitData, fromStop)); } - - lifeCycle.transfersForRoundComplete(); }); } - private int round() { - return roundTracker.round(); - } - - private void findAccessOnStreetForRound() { - addAccessPaths(accessPaths.arrivedOnStreetByNumOfRides(round())); + @Override + public boolean isDestinationReachedInCurrentRound() { + return state.isDestinationReachedInCurrentRound(); } - private void findAccessOnBoardForRound() { - addAccessPaths(accessPaths.arrivedOnBoardByNumOfRides(round())); + @Override + public void findAccessOnStreetForRound() { + addAccessPaths(accessPaths.arrivedOnStreetByNumOfRides(round)); } - /** - * Run the raptor search for this particular iteration departure time - */ - private void setupIteration(int iterationDepartureTime) { - OTPRequestTimeoutException.checkForTimeout(); - this.iterationDepartureTime = iterationDepartureTime; - lifeCycle.setupIteration(this.iterationDepartureTime); + @Override + public void findAccessOnBoardForRound() { + addAccessPaths(accessPaths.arrivedOnBoardByNumOfRides(round)); } /** diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/RangeRaptor.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/RangeRaptor.java new file mode 100644 index 00000000000..02c39f9e52c --- /dev/null +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/RangeRaptor.java @@ -0,0 +1,173 @@ +package org.opentripplanner.raptor.rangeraptor; + +import static java.util.Objects.requireNonNull; + +import org.opentripplanner.framework.application.OTPRequestTimeoutException; +import org.opentripplanner.raptor.api.debug.RaptorTimers; +import org.opentripplanner.raptor.api.model.RaptorConstants; +import org.opentripplanner.raptor.api.model.RaptorTripSchedule; +import org.opentripplanner.raptor.rangeraptor.internalapi.RangeRaptorWorker; +import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorRouter; +import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorRouterResult; +import org.opentripplanner.raptor.rangeraptor.lifecycle.LifeCycleEventPublisher; +import org.opentripplanner.raptor.rangeraptor.transit.AccessPaths; +import org.opentripplanner.raptor.rangeraptor.transit.RaptorTransitCalculator; +import org.opentripplanner.raptor.rangeraptor.transit.RoundTracker; +import org.opentripplanner.raptor.spi.IntIterator; +import org.opentripplanner.raptor.spi.RaptorTransitDataProvider; + +/** + * The algorithm used herein is described in + *

+ * Conway, Matthew Wigginton, Andrew Byrd, and Marco van der Linden. “Evidence-Based Transit and + * Land Use Sketch Planning Using Interactive Accessibility Methods on Combined Schedule and + * Headway-Based Networks.” Transportation Research Record 2653 (2017). doi:10.3141/2653-06. + *

+ * + * Delling, Daniel, Thomas Pajor, and Renato Werneck. “Round-Based Public Transit Routing”, + * January 1, 2012. + * . + *

+ * This version supports the following features: + *

    + *
  • Raptor (R) + *
  • Range Raptor (RR) + *
  • Multi-criteria pareto optimal Range Raptor (McRR) + *
  • Reverse search in combination with R and RR + *
+ * This version does NOT support the following features: + *
    + *
  • Frequency routes, supported by the original code using Monte Carlo methods + * (generating randomized schedules) + *
+ *

+ * This class originated as a rewrite of Conveyals RAPTOR code: https://github.com/conveyal/r5. + * + * @param The TripSchedule type defined by the user of the raptor API. + */ +@SuppressWarnings("Duplicates") +public final class RangeRaptor implements RaptorRouter { + + private final RangeRaptorWorker worker; + + /** + * The round tracker keep track for the current Raptor round, and abort the search if the round + * max limit is reached. + */ + private final RoundTracker roundTracker; + + private final RaptorTransitDataProvider transitData; + + private final RaptorTransitCalculator calculator; + + private final RaptorTimers timers; + + private final AccessPaths accessPaths; + + private final LifeCycleEventPublisher lifeCycle; + + private final int minNumberOfRounds; + + public RangeRaptor( + RangeRaptorWorker worker, + RaptorTransitDataProvider transitData, + AccessPaths accessPaths, + RoundTracker roundTracker, + RaptorTransitCalculator calculator, + LifeCycleEventPublisher lifeCyclePublisher, + RaptorTimers timers + ) { + this.worker = requireNonNull(worker); + this.transitData = requireNonNull(transitData); + this.calculator = requireNonNull(calculator); + this.timers = requireNonNull(timers); + this.accessPaths = requireNonNull(accessPaths); + this.minNumberOfRounds = accessPaths.calculateMaxNumberOfRides(); + this.roundTracker = requireNonNull(roundTracker); + this.lifeCycle = requireNonNull(lifeCyclePublisher); + } + + public RaptorRouterResult route() { + timers.route(() -> { + int iterationDepartureTime = RaptorConstants.TIME_NOT_SET; + lifeCycle.notifyRouteSearchStart(calculator.searchForward()); + transitData.setup(); + + // The main outer loop iterates backward over all minutes in the departure times window. + // Ergo, we re-use the arrival times found in searches that have already occurred that + // depart later, because the arrival time given departure at time t is upper-bounded by + // the arrival time given departure at minute t + 1. + final IntIterator it = calculator.rangeRaptorMinutes(); + while (it.hasNext()) { + iterationDepartureTime = it.next(); + runRaptorForMinute(iterationDepartureTime); + } + + // Iterate over virtual departure times - this is needed to allow access with a time-penalty + // which falls outside the search-window due to the added time-penalty. + if (!calculator.oneIterationOnly()) { + final IntIterator as = accessPaths.iterateOverPathsWithPenalty(iterationDepartureTime); + while (as.hasNext()) { + iterationDepartureTime = as.next(); + runRaptorForMinute(iterationDepartureTime); + } + } + }); + return worker.result(); + } + + /** + * Perform one minute of a RAPTOR search. + */ + private void runRaptorForMinute(int iterationDepartureTime) { + setupIteration(iterationDepartureTime); + worker.findAccessOnStreetForRound(); + + while (hasMoreRounds()) { + lifeCycle.prepareForNextRound(roundTracker.nextRound()); + + // NB since we have transfer limiting not bothering to cut off search when there are no + // more transfers as that will be rare and complicates the code + worker.findTransitForRound(); + lifeCycle.transitsForRoundComplete(); + + worker.findAccessOnBoardForRound(); + + worker.findTransfersForRound(); + lifeCycle.transfersForRoundComplete(); + + lifeCycle.roundComplete(worker.isDestinationReachedInCurrentRound()); + + worker.findAccessOnStreetForRound(); + } + + // This state is repeatedly modified as the outer loop progresses over departure minutes. + // We have to be careful here, the next iteration will modify the state, so we need to make + // protective copies of any information we want to retain. + lifeCycle.iterationComplete(); + } + + /** + * Check if the RangeRaptor should continue with a new round. + */ + private boolean hasMoreRounds() { + if (round() < minNumberOfRounds) { + return true; + } + return worker.hasMoreRounds() && roundTracker.hasMoreRounds(); + } + + private int round() { + return roundTracker.round(); + } + + /** + * Run the raptor search for this particular iteration departure time + */ + private void setupIteration(int iterationDepartureTime) { + OTPRequestTimeoutException.checkForTimeout(); + roundTracker.setupIteration(); + lifeCycle.prepareForNextRound(round()); + lifeCycle.setupIteration(iterationDepartureTime); + } +} diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/RangeRaptorWorkerComposite.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/RangeRaptorWorkerComposite.java new file mode 100644 index 00000000000..2147101285d --- /dev/null +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/RangeRaptorWorkerComposite.java @@ -0,0 +1,88 @@ +package org.opentripplanner.raptor.rangeraptor; + +import java.util.Collection; +import java.util.List; +import javax.annotation.Nullable; +import org.opentripplanner.raptor.api.model.RaptorTripSchedule; +import org.opentripplanner.raptor.rangeraptor.internalapi.RangeRaptorWorker; +import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorRouterResult; +import org.opentripplanner.raptor.util.composite.CompositeUtil; + +/** + * Iterate over two RR workers. The head should process the access and the tail should produce the + * result. Paths from the head needs to propagate to the tail - this is NOT part of the + * responsibilities for this class. + */ +public class RangeRaptorWorkerComposite + implements RangeRaptorWorker { + + private final List> children; + + private RangeRaptorWorkerComposite(Collection> children) { + this.children = List.copyOf(children); + } + + /** + * Concatenate the two given workers, flattening any composite workers into a list. + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static RangeRaptorWorker of( + @Nullable RangeRaptorWorker a, + @Nullable RangeRaptorWorker b + ) { + return CompositeUtil.of( + RangeRaptorWorkerComposite::new, + it -> it instanceof RangeRaptorWorkerComposite, + it -> ((RangeRaptorWorkerComposite) it).children, + a, + b + ); + } + + @Override + public RaptorRouterResult result() { + return tail().result(); + } + + @Override + public boolean hasMoreRounds() { + return children.stream().anyMatch(RangeRaptorWorker::hasMoreRounds); + } + + @Override + public void findTransitForRound() { + for (RangeRaptorWorker child : children) { + child.findTransitForRound(); + } + } + + @Override + public void findTransfersForRound() { + for (RangeRaptorWorker child : children) { + child.findTransfersForRound(); + } + } + + @Override + public boolean isDestinationReachedInCurrentRound() { + return tail().isDestinationReachedInCurrentRound(); + } + + @Override + public void findAccessOnStreetForRound() { + head().findAccessOnStreetForRound(); + } + + @Override + public void findAccessOnBoardForRound() { + head().findAccessOnBoardForRound(); + } + + private RangeRaptorWorker head() { + return children.getFirst(); + } + + private RangeRaptorWorker tail() { + return children.getLast(); + } +} diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/SystemErrDebugLogger.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/SystemErrDebugLogger.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/SystemErrDebugLogger.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/SystemErrDebugLogger.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContext.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContext.java similarity index 86% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContext.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContext.java index 518d02ae3ad..e322881d786 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContext.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContext.java @@ -4,6 +4,7 @@ import static org.opentripplanner.raptor.rangeraptor.internalapi.ParetoSetTime.USE_DEPARTURE_TIME; import static org.opentripplanner.raptor.rangeraptor.internalapi.ParetoSetTime.USE_TIMETABLE; +import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; @@ -13,10 +14,10 @@ import javax.annotation.Nullable; import org.opentripplanner.raptor.api.debug.RaptorTimers; import org.opentripplanner.raptor.api.model.RaptorAccessEgress; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; import org.opentripplanner.raptor.api.model.RaptorTripPattern; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.model.SearchDirection; -import org.opentripplanner.raptor.api.path.RaptorStopNameResolver; import org.opentripplanner.raptor.api.request.DebugRequest; import org.opentripplanner.raptor.api.request.MultiCriteriaRequest; import org.opentripplanner.raptor.api.request.RaptorProfile; @@ -25,7 +26,6 @@ import org.opentripplanner.raptor.api.request.SearchParams; import org.opentripplanner.raptor.rangeraptor.debug.DebugHandlerFactory; import org.opentripplanner.raptor.rangeraptor.internalapi.ParetoSetTime; -import org.opentripplanner.raptor.rangeraptor.internalapi.RoundProvider; import org.opentripplanner.raptor.rangeraptor.internalapi.SlackProvider; import org.opentripplanner.raptor.rangeraptor.internalapi.WorkerLifeCycle; import org.opentripplanner.raptor.rangeraptor.lifecycle.LifeCycleEventPublisher; @@ -38,13 +38,14 @@ import org.opentripplanner.raptor.rangeraptor.transit.ReverseRaptorTransitCalculator; import org.opentripplanner.raptor.rangeraptor.transit.RoundTracker; import org.opentripplanner.raptor.rangeraptor.transit.SlackProviderAdapter; +import org.opentripplanner.raptor.rangeraptor.transit.ViaConnections; import org.opentripplanner.raptor.spi.RaptorCostCalculator; import org.opentripplanner.raptor.spi.RaptorSlackProvider; import org.opentripplanner.raptor.spi.RaptorTransitDataProvider; /** - * The search context is used to hold search scoped instances and to pass these to who ever need - * them. + * The search context is used to hold search scoped instances and to pass these to whom ever needs + * them. It is one search-context pr RangeRaptor * * @param The TripSchedule type defined by the user of the raptor API. */ @@ -64,31 +65,29 @@ public class SearchContext { private final RaptorTuningParameters tuningParameters; private final RoundTracker roundTracker; private final DebugHandlerFactory debugFactory; - private final EgressPaths egressPaths; - private final AccessPaths accessPaths; private final LifeCycleSubscriptions lifeCycleSubscriptions = new LifeCycleSubscriptions(); @Nullable private final IntPredicate acceptC2AtDestination; + private final List> legs; + /** Lazy initialized */ private RaptorCostCalculator costCalculator = null; - /** - * @param acceptC2AtDestination Currently only the pass-through has a constraint on the c2 value - * for accepting it at the destination, if not this is {@code null}. - */ public SearchContext( RaptorRequest request, RaptorTuningParameters tuningParameters, RaptorTransitDataProvider transit, + AccessPaths accessPaths, + List viaConnections, + EgressPaths egressPaths, @Nullable IntPredicate acceptC2AtDestination ) { this.request = request; this.tuningParameters = tuningParameters; this.transit = transit; - this.accessPaths = accessPaths(tuningParameters.iterationDepartureStepInSeconds(), request); - this.egressPaths = egressPaths(request); + this.calculator = createCalculator(request, tuningParameters); this.roundTracker = new RoundTracker( @@ -98,18 +97,24 @@ public SearchContext( ); this.debugFactory = new DebugHandlerFactory<>(debugRequest(request), lifeCycle()); this.acceptC2AtDestination = acceptC2AtDestination; + this.legs = initLegs(accessPaths, viaConnections, egressPaths); } - public AccessPaths accessPaths() { - return accessPaths; - } - - public EgressPaths egressPaths() { - return egressPaths; + /** + * @param acceptC2AtDestination Currently only the pass-through has a constraint on the c2 value + * for accepting it at the destination, if not this is {@code null}. + */ + public static SearchContextBuilder of( + RaptorRequest request, + RaptorTuningParameters tuningParameters, + RaptorTransitDataProvider transit, + @Nullable IntPredicate acceptC2AtDestination + ) { + return new SearchContextBuilder<>(request, tuningParameters, transit, acceptC2AtDestination); } - public int[] egressStops() { - return egressPaths().stops(); + public List> legs() { + return legs; } public SearchParams searchParams() { @@ -193,7 +198,7 @@ public int nRounds() { return tuningParameters.maxNumberOfTransfers() + 1; } - public RoundProvider roundProvider() { + public RoundTracker roundTracker() { return roundTracker; } @@ -224,10 +229,9 @@ public RaptorStopNameResolver stopNameResolver() { public TimeBasedBoardingSupport createTimeBasedBoardingSupport() { return new TimeBasedBoardingSupport<>( - accessPaths().hasTimeDependentAccess(), + legs.getFirst().accessPaths().hasTimeDependentAccess(), slackProvider(), calculator(), - roundProvider(), lifeCycle() ); } @@ -314,18 +318,29 @@ private static ToIntFunction createBoardSlackProvider( : p -> slackProvider.alightSlack(p.slackIndex()); } - private static AccessPaths accessPaths(int iterationStep, RaptorRequest request) { - boolean forward = request.searchDirection().isForward(); - var params = request.searchParams(); - var paths = forward ? params.accessPaths() : params.egressPaths(); - return AccessPaths.create(iterationStep, paths, request.profile(), request.searchDirection()); - } + private List> initLegs( + AccessPaths accessPaths, + List viaConnections, + EgressPaths egressPaths + ) { + if (viaConnections.isEmpty()) { + return List.of(new SearchContextViaLeg<>(this, accessPaths, null, egressPaths)); + } + var accessEmpty = accessPaths.copyEmpty(); + var list = new ArrayList>(); + for (ViaConnections c : viaConnections) { + list.add( + new SearchContextViaLeg<>( + this, + c == viaConnections.getFirst() ? accessPaths : accessEmpty, + c, + null + ) + ); + } + list.add(new SearchContextViaLeg<>(this, accessEmpty, null, egressPaths)); - private static EgressPaths egressPaths(RaptorRequest request) { - boolean forward = request.searchDirection().isForward(); - var params = request.searchParams(); - var paths = forward ? params.egressPaths() : params.accessPaths(); - return EgressPaths.create(paths, request.profile()); + return List.copyOf(list); } static ParetoSetTime paretoSetTimeConfig( diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextBuilder.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextBuilder.java new file mode 100644 index 00000000000..e0a6725c5c0 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextBuilder.java @@ -0,0 +1,82 @@ +package org.opentripplanner.raptor.rangeraptor.context; + +import java.util.List; +import java.util.function.IntPredicate; +import javax.annotation.Nullable; +import org.opentripplanner.raptor.api.model.RaptorTripSchedule; +import org.opentripplanner.raptor.api.request.RaptorRequest; +import org.opentripplanner.raptor.api.request.RaptorTuningParameters; +import org.opentripplanner.raptor.api.request.RaptorViaLocation; +import org.opentripplanner.raptor.rangeraptor.transit.AccessPaths; +import org.opentripplanner.raptor.rangeraptor.transit.EgressPaths; +import org.opentripplanner.raptor.rangeraptor.transit.ViaConnections; +import org.opentripplanner.raptor.spi.RaptorTransitDataProvider; + +public class SearchContextBuilder { + + private final RaptorRequest request; + private final RaptorTuningParameters tuningParameters; + private final RaptorTransitDataProvider transit; + + @Nullable + private final IntPredicate acceptC2AtDestination; + + public SearchContextBuilder( + RaptorRequest request, + RaptorTuningParameters tuningParameters, + RaptorTransitDataProvider transit, + @Nullable IntPredicate acceptC2AtDestination + ) { + this.request = request; + this.tuningParameters = tuningParameters; + this.transit = transit; + this.acceptC2AtDestination = acceptC2AtDestination; + } + + public SearchContext build() { + return createContext(accessPaths(), viaConnections(), egressPaths()); + } + + private SearchContext createContext( + AccessPaths accessPaths, + List viaConnections, + EgressPaths egressPaths + ) { + return new SearchContext<>( + request, + tuningParameters, + transit, + accessPaths, + viaConnections, + egressPaths, + acceptC2AtDestination + ); + } + + private AccessPaths accessPaths() { + int iterationStep = tuningParameters.iterationDepartureStepInSeconds(); + boolean forward = request.searchDirection().isForward(); + var params = request.searchParams(); + var paths = forward ? params.accessPaths() : params.egressPaths(); + return AccessPaths.create(iterationStep, paths, request.profile(), request.searchDirection()); + } + + private List viaConnections() { + return request.searchParams().hasViaLocations() + ? request + .searchParams() + .viaLocations() + .stream() + .map(RaptorViaLocation::connections) + .map(ViaConnections::new) + .toList() + : List.of(); + } + + private EgressPaths egressPaths() { + boolean forward = request.searchDirection().isForward(); + var params = request.searchParams(); + var paths = forward ? params.egressPaths() : params.accessPaths(); + return EgressPaths.create(paths, request.profile()); + } +} diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextViaLeg.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextViaLeg.java new file mode 100644 index 00000000000..9472d3b1464 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextViaLeg.java @@ -0,0 +1,64 @@ +package org.opentripplanner.raptor.rangeraptor.context; + +import javax.annotation.Nullable; +import org.opentripplanner.raptor.api.model.RaptorTripSchedule; +import org.opentripplanner.raptor.rangeraptor.transit.AccessPaths; +import org.opentripplanner.raptor.rangeraptor.transit.EgressPaths; +import org.opentripplanner.raptor.rangeraptor.transit.ViaConnections; + +/** + * A search can be split into one or more legs. The {@code parent} search context will have a list + * of legs. The first leg will have a list of {@code accessPaths} and the {@link ViaConnections} + * for transferring to the next leg. The last leg will have {@code egressPaths}. + */ +public class SearchContextViaLeg { + + private final SearchContext parent; + private final AccessPaths accessPaths; + private final ViaConnections viaConnections; + private final EgressPaths egressPaths; + + public SearchContextViaLeg( + SearchContext parent, + AccessPaths accessPaths, + ViaConnections viaConnections, + EgressPaths egressPaths + ) { + this.parent = parent; + this.accessPaths = accessPaths; + this.viaConnections = viaConnections; + this.egressPaths = egressPaths; + } + + /** + * The parent search context this leg is part of. + */ + public SearchContext parent() { + return parent; + } + + /** + * The set of access paths to be used to board this leg. This method returns an empty + * set of access-paths if the leg is not the first leg. Hence, it is null-safe. + */ + public AccessPaths accessPaths() { + return accessPaths; + } + + /** + * The via connections for the via-location this leg ends with. This is {@code null} if this + * leg is the last leg. + */ + @Nullable + public ViaConnections viaConnections() { + return viaConnections; + } + + /** + * The egress path for search. Non-null if and only if this is the last leg. + */ + @Nullable + public EgressPaths egressPaths() { + return egressPaths; + } +} diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/AbstractDebugHandlerAdapter.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/AbstractDebugHandlerAdapter.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/debug/AbstractDebugHandlerAdapter.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/AbstractDebugHandlerAdapter.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerFactory.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerFactory.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerFactory.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerPathAdapter.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerPathAdapter.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerPathAdapter.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerPathAdapter.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerPatternRideAdapter.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerPatternRideAdapter.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerPatternRideAdapter.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerPatternRideAdapter.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerStopArrivalAdapter.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerStopArrivalAdapter.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerStopArrivalAdapter.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerStopArrivalAdapter.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/ParetoSetDebugHandlerAdapter.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/ParetoSetDebugHandlerAdapter.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/debug/ParetoSetDebugHandlerAdapter.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/ParetoSetDebugHandlerAdapter.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/DebugHandler.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/DebugHandler.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/DebugHandler.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/DebugHandler.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/HeuristicAtStop.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/HeuristicAtStop.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/HeuristicAtStop.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/HeuristicAtStop.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/Heuristics.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/Heuristics.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/Heuristics.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/Heuristics.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/ParetoSetCost.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/ParetoSetCost.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/ParetoSetCost.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/ParetoSetCost.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/ParetoSetTime.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/ParetoSetTime.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/ParetoSetTime.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/ParetoSetTime.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/PassThroughPointsService.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/PassThroughPointsService.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/PassThroughPointsService.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/PassThroughPointsService.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RangeRaptorWorker.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RangeRaptorWorker.java new file mode 100644 index 00000000000..7e80ce96898 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RangeRaptorWorker.java @@ -0,0 +1,47 @@ +package org.opentripplanner.raptor.rangeraptor.internalapi; + +import org.opentripplanner.raptor.api.model.RaptorTripSchedule; + +/** + * The worker performs the travel search. There are multiple implementations, even some that do not + * return paths. + * + * @param The TripSchedule type defined by the user of the raptor API. + */ +public interface RangeRaptorWorker { + /** + * Fetch the result after the search is performed. + */ + RaptorRouterResult result(); + + /** + * Check if the RangeRaptor should continue with a new round. + */ + boolean hasMoreRounds(); + + /** + * Perform a transit search for the current round. + */ + void findTransitForRound(); + + /** + * Apply transfers for the current round. + */ + void findTransfersForRound(); + + /** + * Return {@code true} if the destination is reached in the current round. + */ + boolean isDestinationReachedInCurrentRound(); + + /** + * Apply access for the current round, including round zero - before the first transit. + * This is applied in each round because the access may include transit (FLEX). + */ + void findAccessOnStreetForRound(); + + /** + * Apply access for the current round, when the access arrives to the stop on-board (FLEX). + */ + void findAccessOnBoardForRound(); +} diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorRouter.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorRouter.java new file mode 100644 index 00000000000..3b5fb711b06 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorRouter.java @@ -0,0 +1,17 @@ +package org.opentripplanner.raptor.rangeraptor.internalapi; + +import org.opentripplanner.raptor.api.model.RaptorTripSchedule; + +/** + * Interface for Raptor Router. Allow instrumentation/wrapping the router. This is not + * currently used in the main branch of OTP, but it is used in Entur fork to extend the + * router functionality. + */ +public interface RaptorRouter { + /** + * Perform the routing request and return the result. A range-raptor request will + * iterate over the minutes in the search-window, while a plain raptor search will + * just do one iteration. + */ + RaptorRouterResult route(); +} diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorWorkerResult.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorRouterResult.java similarity index 87% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorWorkerResult.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorRouterResult.java index 59aeb48e6ab..df073b796ec 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorWorkerResult.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorRouterResult.java @@ -5,9 +5,9 @@ import org.opentripplanner.raptor.api.path.RaptorPath; /** - * This is the result of the {@link RaptorWorker#route()} call. + * This is the result of a RangeRaptor route call. */ -public interface RaptorWorkerResult { +public interface RaptorRouterResult { /** * Return all paths found. */ diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorWorkerState.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorWorkerState.java similarity index 89% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorWorkerState.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorWorkerState.java index a71b8765adb..2add95f9a79 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorWorkerState.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorWorkerState.java @@ -3,11 +3,11 @@ import java.util.Iterator; import org.opentripplanner.raptor.api.model.RaptorTransfer; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; -import org.opentripplanner.raptor.rangeraptor.DefaultRangeRaptorWorker; +import org.opentripplanner.raptor.rangeraptor.RangeRaptor; import org.opentripplanner.raptor.spi.IntIterator; /** - * The contract the state must implement for the {@link DefaultRangeRaptorWorker} to do its job. This + * The contract the state must implement for the {@link RangeRaptor} to do its job. This * allows us to mix workers and states to implement different versions of the algorithm like * Standard, Standard-reversed and multi-criteria and use this with different states keeping only * the information needed by the use-case. Some example use-cases are calculating heuristics, @@ -45,5 +45,5 @@ public interface RaptorWorkerState { */ void transferToStops(int fromStop, Iterator transfers); - RaptorWorkerResult results(); + RaptorRouterResult results(); } diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RoutingStrategy.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RoutingStrategy.java similarity index 96% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RoutingStrategy.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RoutingStrategy.java index 63be40e9e8a..df9577aaeff 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RoutingStrategy.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RoutingStrategy.java @@ -2,13 +2,13 @@ import org.opentripplanner.raptor.api.model.RaptorAccessEgress; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; -import org.opentripplanner.raptor.rangeraptor.DefaultRangeRaptorWorker; +import org.opentripplanner.raptor.rangeraptor.RangeRaptor; import org.opentripplanner.raptor.spi.RaptorConstrainedBoardingSearch; import org.opentripplanner.raptor.spi.RaptorRoute; import org.opentripplanner.raptor.spi.RaptorTimeTable; /** - * Provides alternative implementations of some logic within the {@link DefaultRangeRaptorWorker}. + * Provides alternative implementations of some logic within the {@link RangeRaptor}. * * @param The TripSchedule type defined by the user of the raptor API. */ diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/SingleCriteriaStopArrivals.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/SingleCriteriaStopArrivals.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/SingleCriteriaStopArrivals.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/SingleCriteriaStopArrivals.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/SlackProvider.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/SlackProvider.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/SlackProvider.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/SlackProvider.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/WorkerLifeCycle.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/WorkerLifeCycle.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/WorkerLifeCycle.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/WorkerLifeCycle.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/lifecycle/LifeCycleEventPublisher.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/lifecycle/LifeCycleEventPublisher.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/lifecycle/LifeCycleEventPublisher.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/lifecycle/LifeCycleEventPublisher.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/lifecycle/LifeCycleSubscriptions.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/lifecycle/LifeCycleSubscriptions.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/lifecycle/LifeCycleSubscriptions.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/lifecycle/LifeCycleSubscriptions.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/CalculateTransferToDestination.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/CalculateTransferToDestination.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/CalculateTransferToDestination.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/CalculateTransferToDestination.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/DebugStopArrivalsStatistics.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/DebugStopArrivalsStatistics.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/DebugStopArrivalsStatistics.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/DebugStopArrivalsStatistics.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McRangeRaptorWorkerState.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McRangeRaptorWorkerState.java similarity index 98% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McRangeRaptorWorkerState.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McRangeRaptorWorkerState.java index eccb009aeaa..1dcada83419 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McRangeRaptorWorkerState.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McRangeRaptorWorkerState.java @@ -6,7 +6,7 @@ import org.opentripplanner.raptor.api.model.RaptorAccessEgress; import org.opentripplanner.raptor.api.model.RaptorTransfer; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; -import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorWorkerResult; +import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorRouterResult; import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorWorkerState; import org.opentripplanner.raptor.rangeraptor.internalapi.WorkerLifeCycle; import org.opentripplanner.raptor.rangeraptor.multicriteria.arrivals.McStopArrival; @@ -110,9 +110,9 @@ public void transferToStops(int fromStop, Iterator tra } @Override - public RaptorWorkerResult results() { + public RaptorRouterResult results() { arrivals.debugStateInfo(); - return new McRaptorWorkerResult(arrivals, paths); + return new McRaptorRouterResult(arrivals, paths); } Iterable> listStopArrivalsPreviousRound(int stop) { diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McRaptorWorkerResult.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McRaptorRouterResult.java similarity index 91% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McRaptorWorkerResult.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McRaptorRouterResult.java index a664c89e0bd..2339c2a8df6 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McRaptorWorkerResult.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McRaptorRouterResult.java @@ -3,16 +3,16 @@ import java.util.Collection; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.path.RaptorPath; -import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorWorkerResult; +import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorRouterResult; import org.opentripplanner.raptor.rangeraptor.internalapi.SingleCriteriaStopArrivals; import org.opentripplanner.raptor.rangeraptor.path.DestinationArrivalPaths; -public class McRaptorWorkerResult implements RaptorWorkerResult { +public class McRaptorRouterResult implements RaptorRouterResult { private final McStopArrivals stopArrivals; private final DestinationArrivalPaths paths; - public McRaptorWorkerResult(McStopArrivals arrivals, DestinationArrivalPaths paths) { + public McRaptorRouterResult(McStopArrivals arrivals, DestinationArrivalPaths paths) { stopArrivals = arrivals; this.paths = paths; } diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McStopArrivals.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McStopArrivals.java similarity index 59% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McStopArrivals.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McStopArrivals.java index 4090890cc82..f56e35d2f82 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McStopArrivals.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McStopArrivals.java @@ -4,17 +4,21 @@ import java.util.BitSet; import java.util.Collections; +import java.util.Objects; import java.util.function.Function; import java.util.stream.Stream; +import javax.annotation.Nullable; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.rangeraptor.debug.DebugHandlerFactory; import org.opentripplanner.raptor.rangeraptor.multicriteria.arrivals.ArrivalParetoSetComparatorFactory; import org.opentripplanner.raptor.rangeraptor.multicriteria.arrivals.McStopArrival; +import org.opentripplanner.raptor.rangeraptor.multicriteria.arrivals.McStopArrivalFactory; import org.opentripplanner.raptor.rangeraptor.path.DestinationArrivalPaths; -import org.opentripplanner.raptor.rangeraptor.transit.AccessPaths; import org.opentripplanner.raptor.rangeraptor.transit.EgressPaths; +import org.opentripplanner.raptor.rangeraptor.transit.ViaConnections; import org.opentripplanner.raptor.spi.IntIterator; import org.opentripplanner.raptor.util.BitSetIterator; +import org.opentripplanner.raptor.util.paretoset.ParetoComparator; /** * This class serve as a wrapper for all stop arrival pareto set, one set for each stop. It also @@ -28,43 +32,57 @@ public final class McStopArrivals { private final StopArrivalParetoSet[] arrivals; private final BitSet touchedStops; - private final ArrivalParetoSetComparatorFactory> comparatorFactory; private final DebugHandlerFactory debugHandlerFactory; private final DebugStopArrivalsStatistics debugStats; + private final ParetoComparator> comparator; /** - * Set the time at a transit index iff it is optimal. This sets both the best time and the - * transfer time + * Set the time at a transit index if it is optimal. This sets both the best time and the + * transfer time. + * + * @param nextLeg When chaining two Raptor searches together, the next-leg is the next + * search we are copying state into. */ public McStopArrivals( int nStops, - EgressPaths egressPaths, - AccessPaths accessPaths, + @Nullable EgressPaths egressPaths, + ViaConnections viaConnections, DestinationArrivalPaths paths, + McStopArrivals nextLeg, + McStopArrivalFactory stopArrivalFactory, ArrivalParetoSetComparatorFactory> comparatorFactory, DebugHandlerFactory debugHandlerFactory ) { - this.comparatorFactory = comparatorFactory; + // Assert only-one-of next or egressPaths is set + if (nextLeg == null) { + Objects.requireNonNull(egressPaths); + } else if (egressPaths != null) { + throw new IllegalArgumentException( + "Can not delegate to next-leg and at the same have egress paths." + ); + } + //noinspection unchecked this.arrivals = (StopArrivalParetoSet[]) new StopArrivalParetoSet[nStops]; this.touchedStops = new BitSet(nStops); + this.comparator = comparatorFactory.compareArrivalTimeRoundCostAndOnBoardArrival(); this.debugHandlerFactory = debugHandlerFactory; this.debugStats = new DebugStopArrivalsStatistics(debugHandlerFactory.debugLogger()); - initAccessArrivals(accessPaths); - glueTogetherEgressStopWithDestinationArrivals(egressPaths, paths); + initViaConnections(viaConnections, stopArrivalFactory, nextLeg); + initEgressStopAndGlueItToDestinationArrivals(egressPaths, paths); } - public boolean reached(int stopIndex) { + boolean reached(int stopIndex) { return arrivals[stopIndex] != null && !arrivals[stopIndex].isEmpty(); } /** Slow! do not use during routing! */ - public int bestArrivalTime(int stopIndex) { + int bestArrivalTime(int stopIndex) { return minInt(arrivals[stopIndex].stream(), McStopArrival::arrivalTime); } - public boolean reachedByTransit(int stopIndex) { + boolean reachedByTransit(int stopIndex) { return ( arrivals[stopIndex] != null && arrivals[stopIndex].stream().anyMatch(a -> a.arrivedBy(TRANSIT)) @@ -72,12 +90,12 @@ public boolean reachedByTransit(int stopIndex) { } /** Slow! do not use during routing! */ - public int bestTransitArrivalTime(int stopIndex) { + int bestTransitArrivalTime(int stopIndex) { return transitStopArrivalsMinInt(stopIndex, McStopArrival::arrivalTime); } /** Slow! do not use during routing! */ - public int smallestNumberOfTransfers(int stopIndex) { + int smallestNumberOfTransfers(int stopIndex) { return transitStopArrivalsMinInt(stopIndex, McStopArrival::numberOfTransfers); } @@ -91,6 +109,7 @@ IntIterator stopsTouchedIterator() { void addStopArrival(McStopArrival arrival) { boolean added = findOrCreateSet(arrival.stop()).add(arrival); + if (added) { touchedStops.set(arrival.stop()); } @@ -100,22 +119,16 @@ void debugStateInfo() { debugStats.debugStatInfo(arrivals); } - public boolean hasArrivalsAfterMarker(int stop) { - StopArrivalParetoSet it = arrivals[stop]; - if (it == null) { - return false; - } - return it.hasElementsAfterMarker(); + boolean hasArrivalsAfterMarker(int stop) { + var it = arrivals[stop]; + return it != null && it.hasElementsAfterMarker(); } /** List all transits arrived this round. */ Iterable> listArrivalsAfterMarker(final int stop) { - StopArrivalParetoSet it = arrivals[stop]; - if (it == null) { - // Avoid creating new objects in a tight loop - return Collections::emptyIterator; - } - return it.elementsAfterMarker(); + var it = arrivals[stop]; + // Avoid creating new objects in a tight loop + return it == null ? Collections::emptyIterator : it.elementsAfterMarker(); } void clearTouchedStopsAndSetStopMarkers() { @@ -131,47 +144,59 @@ void clearTouchedStopsAndSetStopMarkers() { private StopArrivalParetoSet findOrCreateSet(final int stop) { if (arrivals[stop] == null) { arrivals[stop] = - StopArrivalParetoSet.createStopArrivalSet( - comparatorFactory.compareArrivalTimeRoundAndCost(), - debugHandlerFactory.paretoSetStopArrivalListener(stop) - ); + StopArrivalParetoSet + .of(comparator) + .withDebugListener(debugHandlerFactory.paretoSetStopArrivalListener(stop)) + .build(); } return arrivals[stop]; } - private void initAccessArrivals(AccessPaths accessPaths) { - int maxNRides = accessPaths.calculateMaxNumberOfRides(); - for (int nRides = 0; nRides <= maxNRides; ++nRides) { - for (var access : accessPaths.arrivedOnBoardByNumOfRides(nRides)) { - int stop = access.stop(); - arrivals[stop] = - StopArrivalParetoSet.createStopArrivalSet( - comparatorFactory.compareArrivalTimeRoundCostAndOnBoardArrival(), - debugHandlerFactory.paretoSetStopArrivalListener(stop) - ); - } + private void initViaConnections( + @Nullable ViaConnections viaConnections, + McStopArrivalFactory stopArrivalFactory, + McStopArrivals nextLeg + ) { + if (viaConnections == null) { + return; } + viaConnections + .byFromStop() + .forEachEntry((stop, connections) -> { + this.arrivals[stop] = + StopArrivalParetoSet + .of(comparator) + .withDebugListener(debugHandlerFactory.paretoSetStopArrivalListener(stop)) + .withNextLegListener( + new ViaConnectionStopArrivalEventListener<>(stopArrivalFactory, connections, nextLeg) + ) + .build(); + return true; + }); } /** * This method creates a ParetoSet for the given egress stop. When arrivals are added to the stop, * the "glue" make sure new destination arrivals are added to the destination arrivals. */ - private void glueTogetherEgressStopWithDestinationArrivals( - EgressPaths egressPaths, + private void initEgressStopAndGlueItToDestinationArrivals( + @Nullable EgressPaths egressPaths, DestinationArrivalPaths paths ) { + if (egressPaths == null) { + return; + } + egressPaths .byStop() .forEachEntry((stop, list) -> { // The factory is creating the actual "glue" this.arrivals[stop] = - StopArrivalParetoSet.createEgressStopArrivalSet( - comparatorFactory.compareArrivalTimeRoundCostAndOnBoardArrival(), - list, - paths, - debugHandlerFactory.paretoSetStopArrivalListener(stop) - ); + StopArrivalParetoSet + .of(comparator) + .withDebugListener(debugHandlerFactory.paretoSetStopArrivalListener(stop)) + .withEgressListener(list, paths) + .build(); return true; }); } diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/MultiCriteriaRoutingStrategy.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/MultiCriteriaRoutingStrategy.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/MultiCriteriaRoutingStrategy.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/MultiCriteriaRoutingStrategy.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/StopArrivalParetoSet.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/StopArrivalParetoSet.java new file mode 100644 index 00000000000..2d158c05cc1 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/StopArrivalParetoSet.java @@ -0,0 +1,86 @@ +package org.opentripplanner.raptor.rangeraptor.multicriteria; + +import java.util.List; +import org.opentripplanner.raptor.api.model.RaptorAccessEgress; +import org.opentripplanner.raptor.api.model.RaptorTripSchedule; +import org.opentripplanner.raptor.api.view.ArrivalView; +import org.opentripplanner.raptor.rangeraptor.multicriteria.arrivals.McStopArrival; +import org.opentripplanner.raptor.rangeraptor.path.DestinationArrivalPaths; +import org.opentripplanner.raptor.util.paretoset.ParetoComparator; +import org.opentripplanner.raptor.util.paretoset.ParetoSetEventListener; +import org.opentripplanner.raptor.util.paretoset.ParetoSetEventListenerComposite; +import org.opentripplanner.raptor.util.paretoset.ParetoSetWithMarker; + +/** + * A pareto optimal set of stop arrivals for a given stop. + * + * @param The TripSchedule type defined by the user of the raptor API. + */ +class StopArrivalParetoSet + extends ParetoSetWithMarker> { + + /** + * Use the factory methods in this class to create a new instance. + */ + private StopArrivalParetoSet( + ParetoComparator> comparator, + ParetoSetEventListener> listener + ) { + super(comparator, listener); + } + + public static Builder of( + ParetoComparator> comparator + ) { + return new Builder<>(comparator); + } + + static class Builder { + + private ParetoSetEventListener> debugListener = null; + private ParetoSetEventListener> egressListener = null; + private ParetoSetEventListener> nextSearchListener = null; + private final ParetoComparator> comparator; + + Builder(ParetoComparator> comparator) { + this.comparator = comparator; + } + + /** + * Attach an optional debug handler. + */ + Builder withDebugListener(ParetoSetEventListener> debugListener) { + this.debugListener = debugListener; + return this; + } + + /** + * Attach a {@link CalculateTransferToDestination} listener which will create new destination + * arrivals for each accepted egress stop arrival. + */ + Builder withEgressListener( + List egressPaths, + DestinationArrivalPaths destinationArrivals + ) { + this.egressListener = new CalculateTransferToDestination<>(egressPaths, destinationArrivals); + return this; + } + + /** + * Attach an optional listener for copy state over to the next-leg Raptor search. + */ + Builder withNextLegListener(ParetoSetEventListener> nextSearchListener) { + this.nextSearchListener = nextSearchListener; + return this; + } + + StopArrivalParetoSet build() { + // The order of the listeners is important, we want the debug event for reaching a + // stop to appear before the path is logged (in case both debuggers are enabled). + return new StopArrivalParetoSet<>( + comparator, + ParetoSetEventListenerComposite.of(debugListener, nextSearchListener, egressListener) + ); + } + } +} diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ViaConnectionStopArrivalEventListener.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ViaConnectionStopArrivalEventListener.java new file mode 100644 index 00000000000..6b0128e12e2 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ViaConnectionStopArrivalEventListener.java @@ -0,0 +1,68 @@ +package org.opentripplanner.raptor.rangeraptor.multicriteria; + +import java.util.List; +import javax.annotation.Nullable; +import org.opentripplanner.raptor.api.model.RaptorTripSchedule; +import org.opentripplanner.raptor.api.request.RaptorViaConnection; +import org.opentripplanner.raptor.api.view.ArrivalView; +import org.opentripplanner.raptor.rangeraptor.multicriteria.arrivals.McStopArrival; +import org.opentripplanner.raptor.rangeraptor.multicriteria.arrivals.McStopArrivalFactory; +import org.opentripplanner.raptor.util.paretoset.ParetoSetEventListener; + +/** + * This class is used to listen for stop arrivals in one raptor state and then copy + * over the arrival event to another state. This is used to chain the Raptor searches + * together to force the paths through the given via connections. + */ +class ViaConnectionStopArrivalEventListener + implements ParetoSetEventListener> { + + private final McStopArrivalFactory stopArrivalFactory; + private final List connections; + private final McStopArrivals next; + + public ViaConnectionStopArrivalEventListener( + McStopArrivalFactory stopArrivalFactory, + List connections, + McStopArrivals next + ) { + this.stopArrivalFactory = stopArrivalFactory; + this.connections = connections; + this.next = next; + } + + @Override + public void notifyElementAccepted(ArrivalView newElement) { + for (RaptorViaConnection c : connections) { + var e = (McStopArrival) newElement; + var n = createViaStopArrival(e, c); + if (n != null) { + next.addStopArrival(n); + } + } + } + + @Nullable + private McStopArrival createViaStopArrival( + McStopArrival previous, + RaptorViaConnection viaConnection + ) { + if (viaConnection.isSameStop()) { + if (viaConnection.durationInSeconds() == 0) { + return previous; + } else { + return previous.addSlackToArrivalTime(viaConnection.durationInSeconds()); + } + } else { + if (previous.arrivedOnBoard()) { + return stopArrivalFactory.createTransferStopArrival( + previous, + viaConnection.transfer(), + previous.arrivalTime() + viaConnection.durationInSeconds() + ); + } else { + return null; + } + } + } +} diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/ArrivalParetoSetComparatorFactory.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/ArrivalParetoSetComparatorFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/ArrivalParetoSetComparatorFactory.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/ArrivalParetoSetComparatorFactory.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrival.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrival.java similarity index 94% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrival.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrival.java index 895e6aa17e0..e4775c61508 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrival.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrival.java @@ -107,6 +107,12 @@ public McStopArrival timeShiftNewArrivalTime(int newArrivalTime) { throw new UnsupportedOperationException("No accessEgress for transfer stop arrival"); } + /** + * Add the given amount of slack to the arrival-time. This is used to add extraordinary + * wait-time to an arrival - for example, in via-search where a minimum-wait-time can be set. + */ + public abstract McStopArrival addSlackToArrivalTime(int slack); + @Override public final int hashCode() { throw new IllegalStateException("Avoid using hashCode() and equals() for this class."); diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrivalFactory.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrivalFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrivalFactory.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrivalFactory.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/AccessStopArrival.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/AccessStopArrival.java similarity index 84% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/AccessStopArrival.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/AccessStopArrival.java index e3787d41f78..cab1cde3c73 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/AccessStopArrival.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/AccessStopArrival.java @@ -1,5 +1,6 @@ package org.opentripplanner.raptor.rangeraptor.multicriteria.arrivals.c1; +import static org.opentripplanner.raptor.api.model.AbstractAccessEgressDecorator.accessEgressWithExtraSlack; import static org.opentripplanner.raptor.api.model.PathLegType.ACCESS; import org.opentripplanner.raptor.api.model.PathLegType; @@ -16,6 +17,7 @@ */ final class AccessStopArrival extends McStopArrival { + private final int departureTime; private final RaptorAccessEgress access; AccessStopArrival(int departureTime, RaptorAccessEgress access) { @@ -26,6 +28,7 @@ final class AccessStopArrival extends McStopArriva access.c1(), access.numberOfRides() ); + this.departureTime = departureTime; this.access = access; } @@ -44,6 +47,11 @@ public AccessPathView accessPath() { return () -> access; } + @Override + public boolean arrivedOnBoard() { + return access.stopReachedOnBoard(); + } + @Override public McStopArrival timeShiftNewArrivalTime(int newRequestedArrivalTime) { int newArrivalTime = access.latestArrivalTime(newRequestedArrivalTime); @@ -62,7 +70,7 @@ public McStopArrival timeShiftNewArrivalTime(int newRequestedArrivalTime) { } @Override - public boolean arrivedOnBoard() { - return access.stopReachedOnBoard(); + public McStopArrival addSlackToArrivalTime(int slack) { + return new AccessStopArrival<>(departureTime, accessEgressWithExtraSlack(access, slack)); } } diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/StopArrivalFactoryC1.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/StopArrivalFactoryC1.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/StopArrivalFactoryC1.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/StopArrivalFactoryC1.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransferStopArrival.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransferStopArrival.java similarity index 90% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransferStopArrival.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransferStopArrival.java index 05c165a158b..bca25dbf61c 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransferStopArrival.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransferStopArrival.java @@ -55,4 +55,9 @@ public RaptorTransfer transfer() { public boolean arrivedOnBoard() { return false; } + + @Override + public McStopArrival addSlackToArrivalTime(int slack) { + return new TransferStopArrival<>(previous(), transfer, arrivalTime() + slack); + } } diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransitStopArrival.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransitStopArrival.java similarity index 90% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransitStopArrival.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransitStopArrival.java index a30581512a7..ee572175b81 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransitStopArrival.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransitStopArrival.java @@ -69,4 +69,9 @@ public TransitPathView transitPath() { public boolean arrivedOnBoard() { return true; } + + @Override + public McStopArrival addSlackToArrivalTime(int slack) { + return new TransitStopArrival<>(previous(), stop(), arrivalTime() + slack, c1(), trip); + } } diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AbstractStopArrivalC2.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AbstractStopArrivalC2.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AbstractStopArrivalC2.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AbstractStopArrivalC2.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AccessStopArrivalC2.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AccessStopArrivalC2.java similarity index 81% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AccessStopArrivalC2.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AccessStopArrivalC2.java index ed4d9df1415..ecc54110feb 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AccessStopArrivalC2.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AccessStopArrivalC2.java @@ -1,5 +1,6 @@ package org.opentripplanner.raptor.rangeraptor.multicriteria.arrivals.c2; +import static org.opentripplanner.raptor.api.model.AbstractAccessEgressDecorator.accessEgressWithExtraSlack; import static org.opentripplanner.raptor.api.model.PathLegType.ACCESS; import org.opentripplanner.raptor.api.model.PathLegType; @@ -7,6 +8,7 @@ import org.opentripplanner.raptor.api.model.RaptorConstants; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.view.AccessPathView; +import org.opentripplanner.raptor.rangeraptor.multicriteria.arrivals.McStopArrival; import org.opentripplanner.raptor.spi.RaptorCostCalculator; /** @@ -16,6 +18,7 @@ */ final class AccessStopArrivalC2 extends AbstractStopArrivalC2 { + private final int departureTime; private final RaptorAccessEgress access; AccessStopArrivalC2(int departureTime, RaptorAccessEgress access) { @@ -27,6 +30,7 @@ final class AccessStopArrivalC2 extends AbstractSt access.c1(), RaptorCostCalculator.ZERO_COST ); + this.departureTime = departureTime; this.access = access; } @@ -57,6 +61,11 @@ public AbstractStopArrivalC2 timeShiftNewArrivalTime(int newRequestedArrivalT return new AccessStopArrivalC2<>(newDepartureTime, access); } + @Override + public McStopArrival addSlackToArrivalTime(int slack) { + return new AccessStopArrivalC2<>(departureTime, accessEgressWithExtraSlack(access, slack)); + } + @Override public boolean arrivedOnBoard() { return access.stopReachedOnBoard(); diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/StopArrivalFactoryC2.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/StopArrivalFactoryC2.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/StopArrivalFactoryC2.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/StopArrivalFactoryC2.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransferStopArrivalC2.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransferStopArrivalC2.java similarity index 89% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransferStopArrivalC2.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransferStopArrivalC2.java index 42ee55ff784..888346b30fe 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransferStopArrivalC2.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransferStopArrivalC2.java @@ -46,4 +46,9 @@ public RaptorTransfer transfer() { public boolean arrivedOnBoard() { return false; } + + @Override + public McStopArrival addSlackToArrivalTime(int slack) { + return new TransferStopArrivalC2<>(previous(), transfer, arrivalTime() + slack); + } } diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransitStopArrivalC2.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransitStopArrivalC2.java similarity index 88% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransitStopArrivalC2.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransitStopArrivalC2.java index c047f484609..e08dde5103a 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransitStopArrivalC2.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransitStopArrivalC2.java @@ -58,4 +58,9 @@ public TransitPathView transitPath() { public boolean arrivedOnBoard() { return true; } + + @Override + public McStopArrival addSlackToArrivalTime(int slack) { + return new TransitStopArrivalC2<>(previous(), stop(), arrivalTime() + slack, c1(), c2(), trip); + } } diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/configure/McRangeRaptorConfig.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/configure/McRangeRaptorConfig.java similarity index 73% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/configure/McRangeRaptorConfig.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/configure/McRangeRaptorConfig.java index 3673e78ee47..f30b391b929 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/configure/McRangeRaptorConfig.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/configure/McRangeRaptorConfig.java @@ -1,17 +1,16 @@ package org.opentripplanner.raptor.rangeraptor.multicriteria.configure; import java.util.Objects; -import java.util.function.BiFunction; import javax.annotation.Nullable; import org.opentripplanner.raptor.api.model.DominanceFunction; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.request.MultiCriteriaRequest; import org.opentripplanner.raptor.api.request.RaptorTransitGroupPriorityCalculator; import org.opentripplanner.raptor.rangeraptor.context.SearchContext; +import org.opentripplanner.raptor.rangeraptor.context.SearchContextViaLeg; import org.opentripplanner.raptor.rangeraptor.internalapi.Heuristics; import org.opentripplanner.raptor.rangeraptor.internalapi.ParetoSetCost; import org.opentripplanner.raptor.rangeraptor.internalapi.PassThroughPointsService; -import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorWorker; import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorWorkerState; import org.opentripplanner.raptor.rangeraptor.internalapi.RoutingStrategy; import org.opentripplanner.raptor.rangeraptor.multicriteria.McRangeRaptorWorkerState; @@ -42,18 +41,22 @@ */ public class McRangeRaptorConfig { - private final SearchContext context; + private final SearchContextViaLeg contextLeg; private final PathConfig pathConfig; + private final PassThroughPointsService passThroughPointsService; private DestinationArrivalPaths paths; - private PassThroughPointsService passThroughPointsService; + private McRangeRaptorWorkerState state; + private Heuristics heuristics; + private McStopArrivals arrivals; + private McStopArrivals nextLegArrivals = null; public McRangeRaptorConfig( - SearchContext context, + SearchContextViaLeg contextLeg, PassThroughPointsService passThroughPointsService ) { - this.context = Objects.requireNonNull(context); + this.contextLeg = Objects.requireNonNull(contextLeg); this.passThroughPointsService = Objects.requireNonNull(passThroughPointsService); - this.pathConfig = new PathConfig<>(context); + this.pathConfig = new PathConfig<>(this.contextLeg.parent()); } /** @@ -70,12 +73,51 @@ public static PassThroughPointsService passThroughPointsService( /** * Create new multi-criteria worker with optional heuristics. */ - public RaptorWorker createWorker( - Heuristics heuristics, - BiFunction, RoutingStrategy, RaptorWorker> createWorker + public McRangeRaptorConfig withHeuristics(Heuristics heuristics) { + this.heuristics = heuristics; + return this; + } + + /** + * Sets the next leg state. This is used to connect the state created by this config with the + * next leg. If this is the last leg, the next leg should be {@code null}. This is optional. + */ + public McRangeRaptorConfig connectWithNextLegArrivals( + @Nullable McStopArrivals nextLegArrivals ) { - McRangeRaptorWorkerState state = createState(heuristics); - return createWorker.apply(state, createTransitWorkerStrategy(state)); + this.nextLegArrivals = nextLegArrivals; + return this; + } + + /** + * Create new multi-criteria worker with optional heuristics. + */ + public RoutingStrategy strategy() { + return createTransitWorkerStrategy(createState(heuristics)); + } + + public RaptorWorkerState state() { + return createState(heuristics); + } + + /** + * This is used in the config to chain more than one search together. + */ + public McStopArrivals stopArrivals() { + if (arrivals == null) { + this.arrivals = + new McStopArrivals<>( + context().nStops(), + contextLeg.egressPaths(), + contextLeg.viaConnections(), + createDestinationArrivalPaths(), + nextLegArrivals, + createStopArrivalFactory(), + createFactoryParetoComparator(), + context().debugFactory() + ); + } + return arrivals; } /* private factory methods */ @@ -101,51 +143,49 @@ private > RoutingStrategy createTransitWorkerStrateg ) { return new MultiCriteriaRoutingStrategy<>( state, - context.createTimeBasedBoardingSupport(), + context().createTimeBasedBoardingSupport(), factory, passThroughPointsService, - context.costCalculator(), - context.slackProvider(), + context().costCalculator(), + context().slackProvider(), createPatternRideParetoSet(patternRideComparator) ); } private McRangeRaptorWorkerState createState(Heuristics heuristics) { - return new McRangeRaptorWorkerState<>( - createStopArrivals(), - createDestinationArrivalPaths(), - createHeuristicsProvider(heuristics), - createStopArrivalFactory(), - context.costCalculator(), - context.calculator(), - context.lifeCycle() - ); + if (state == null) { + state = + new McRangeRaptorWorkerState<>( + stopArrivals(), + createDestinationArrivalPaths(), + createHeuristicsProvider(heuristics), + createStopArrivalFactory(), + context().costCalculator(), + context().calculator(), + context().lifeCycle() + ); + } + return state; } private McStopArrivalFactory createStopArrivalFactory() { return includeC2() ? new StopArrivalFactoryC2<>() : new StopArrivalFactoryC1<>(); } - private McStopArrivals createStopArrivals() { - return new McStopArrivals<>( - context.nStops(), - context.egressPaths(), - context.accessPaths(), - createDestinationArrivalPaths(), - createFactoryParetoComparator(), - context.debugFactory() - ); + private SearchContext context() { + return contextLeg.parent(); } private HeuristicsProvider createHeuristicsProvider(Heuristics heuristics) { if (heuristics == null) { return new HeuristicsProvider<>(); } else { + var ctx = contextLeg.parent(); return new HeuristicsProvider<>( heuristics, - context.roundProvider(), createDestinationArrivalPaths(), - context.debugFactory() + ctx.lifeCycle(), + ctx.debugFactory() ); } } @@ -153,7 +193,7 @@ private HeuristicsProvider createHeuristicsProvider(Heuristics heuristics) { private > ParetoSet createPatternRideParetoSet( ParetoComparator comparator ) { - return new ParetoSet<>(comparator, context.debugFactory().paretoSetPatternRideListener()); + return new ParetoSet<>(comparator, context().debugFactory().paretoSetPatternRideListener()); } private DestinationArrivalPaths createDestinationArrivalPaths() { @@ -169,7 +209,7 @@ private ArrivalParetoSetComparatorFactory> createFactoryParetoC } private MultiCriteriaRequest mcRequest() { - return context.multiCriteria(); + return context().multiCriteria(); } /** @@ -220,7 +260,7 @@ private ParetoSetCost resolveCostConfig() { if (isPassThrough()) { return ParetoSetCost.USE_C1_AND_C2; } - if (context.multiCriteria().relaxCostAtDestination() != null) { + if (context().multiCriteria().relaxCostAtDestination() != null) { return ParetoSetCost.USE_C1_RELAX_DESTINATION; } return ParetoSetCost.USE_C1; diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/heuristic/HeuristicsProvider.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/heuristic/HeuristicsProvider.java similarity index 82% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/heuristic/HeuristicsProvider.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/heuristic/HeuristicsProvider.java index c7b1c43c991..fc4d11c33a4 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/heuristic/HeuristicsProvider.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/heuristic/HeuristicsProvider.java @@ -1,11 +1,12 @@ package org.opentripplanner.raptor.rangeraptor.multicriteria.heuristic; +import java.util.Objects; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.request.Optimization; import org.opentripplanner.raptor.rangeraptor.debug.DebugHandlerFactory; import org.opentripplanner.raptor.rangeraptor.internalapi.HeuristicAtStop; import org.opentripplanner.raptor.rangeraptor.internalapi.Heuristics; -import org.opentripplanner.raptor.rangeraptor.internalapi.RoundProvider; +import org.opentripplanner.raptor.rangeraptor.internalapi.WorkerLifeCycle; import org.opentripplanner.raptor.rangeraptor.multicriteria.arrivals.McStopArrival; import org.opentripplanner.raptor.rangeraptor.path.DestinationArrivalPaths; @@ -18,26 +19,32 @@ public final class HeuristicsProvider { private final Heuristics heuristics; - private final RoundProvider roundProvider; private final DestinationArrivalPaths paths; private final HeuristicAtStop[] stops; private final DebugHandlerFactory debugHandlerFactory; + private int round; + public HeuristicsProvider() { - this(null, null, null, null); + this.heuristics = null; + this.paths = null; + this.stops = null; + this.debugHandlerFactory = null; } public HeuristicsProvider( Heuristics heuristics, - RoundProvider roundProvider, DestinationArrivalPaths paths, + WorkerLifeCycle lifeCycle, DebugHandlerFactory debugHandlerFactory ) { - this.heuristics = heuristics; - this.roundProvider = roundProvider; - this.paths = paths; - this.stops = heuristics == null ? null : new HeuristicAtStop[heuristics.size()]; - this.debugHandlerFactory = debugHandlerFactory; + this.heuristics = Objects.requireNonNull(heuristics); + this.paths = Objects.requireNonNull(paths); + this.stops = new HeuristicAtStop[heuristics.size()]; + this.debugHandlerFactory = Objects.requireNonNull(debugHandlerFactory); + + // Use life-cycle events to inject the range-raptor round + lifeCycle.onPrepareForNextRound(r -> this.round = r); } /** @@ -89,7 +96,7 @@ private boolean qualify(int stop, int arrivalTime, int travelDuration, int cost) return false; } int minArrivalTime = arrivalTime + h.minTravelDuration(); - int minNumberOfTransfers = roundProvider.round() - 1 + h.minNumTransfers(); + int minNumberOfTransfers = round - 1 + h.minNumTransfers(); int minTravelDuration = travelDuration + h.minTravelDuration(); int minCost = cost + h.minCost(); int departureTime = minArrivalTime - minTravelDuration; diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/passthrough/BitSetPassThroughPointsService.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/passthrough/BitSetPassThroughPointsService.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/passthrough/BitSetPassThroughPointsService.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/passthrough/BitSetPassThroughPointsService.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/PatternRide.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/PatternRide.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/PatternRide.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/PatternRide.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/PatternRideFactory.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/PatternRideFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/PatternRideFactory.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/PatternRideFactory.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c1/PatternRideC1.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c1/PatternRideC1.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c1/PatternRideC1.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c1/PatternRideC1.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PassThroughRideFactory.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PassThroughRideFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PassThroughRideFactory.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PassThroughRideFactory.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PatternRideC2.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PatternRideC2.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PatternRideC2.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PatternRideC2.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/TransitGroupPriorityRideFactory.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/TransitGroupPriorityRideFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/TransitGroupPriorityRideFactory.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/TransitGroupPriorityRideFactory.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/path/BoardAndAlightTimeSearch.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/BoardAndAlightTimeSearch.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/path/BoardAndAlightTimeSearch.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/BoardAndAlightTimeSearch.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrival.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrival.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrival.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrival.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrivalPaths.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrivalPaths.java similarity index 99% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrivalPaths.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrivalPaths.java index f5e67d593ca..78dc7da4967 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrivalPaths.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrivalPaths.java @@ -9,9 +9,9 @@ import org.opentripplanner.framework.logging.Throttle; import org.opentripplanner.raptor.api.model.RaptorAccessEgress; import org.opentripplanner.raptor.api.model.RaptorConstants; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.path.RaptorPath; -import org.opentripplanner.raptor.api.path.RaptorStopNameResolver; import org.opentripplanner.raptor.api.view.ArrivalView; import org.opentripplanner.raptor.path.Path; import org.opentripplanner.raptor.rangeraptor.debug.DebugHandlerFactory; diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/path/ForwardPathMapper.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/ForwardPathMapper.java similarity index 98% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/path/ForwardPathMapper.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/ForwardPathMapper.java index 8e9b77f9cb8..6f48aacf652 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/path/ForwardPathMapper.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/ForwardPathMapper.java @@ -1,8 +1,8 @@ package org.opentripplanner.raptor.rangeraptor.path; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.path.RaptorPath; -import org.opentripplanner.raptor.api.path.RaptorStopNameResolver; import org.opentripplanner.raptor.api.view.ArrivalView; import org.opentripplanner.raptor.path.PathBuilder; import org.opentripplanner.raptor.rangeraptor.internalapi.WorkerLifeCycle; diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/path/PathMapper.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/PathMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/path/PathMapper.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/PathMapper.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/path/PathParetoSetComparators.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/PathParetoSetComparators.java similarity index 92% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/path/PathParetoSetComparators.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/PathParetoSetComparators.java index 192f957ae8f..22212517ce1 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/path/PathParetoSetComparators.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/PathParetoSetComparators.java @@ -8,7 +8,6 @@ import static org.opentripplanner.raptor.api.path.RaptorPath.compareNumberOfTransfers; import java.util.Objects; -import javax.annotation.Nonnull; import org.opentripplanner.raptor.api.model.DominanceFunction; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.model.RelaxFunction; @@ -128,9 +127,7 @@ > ParetoComparator> comparatorTimetableAndC1() { private static < T extends RaptorTripSchedule - > ParetoComparator> comparatorTimetableAndRelaxedC1( - @Nonnull final RelaxFunction relaxCost - ) { + > ParetoComparator> comparatorTimetableAndRelaxedC1(final RelaxFunction relaxCost) { return (l, r) -> compareIterationDepartureTime(l, r) || compareArrivalTime(l, r) || @@ -161,9 +158,7 @@ > ParetoComparator> comparatorDepartureTimeAndC1() { private static < T extends RaptorTripSchedule - > ParetoComparator> comparatorArrivalTimeAndRelaxedC1( - @Nonnull RelaxFunction relaxCost - ) { + > ParetoComparator> comparatorArrivalTimeAndRelaxedC1(RelaxFunction relaxCost) { return (l, r) -> compareArrivalTime(l, r) || compareNumberOfTransfers(l, r) || @@ -173,9 +168,7 @@ > ParetoComparator> comparatorArrivalTimeAndRelaxedC1( private static < T extends RaptorTripSchedule - > ParetoComparator> comparatorDepartureTimeAndRelaxedC1( - @Nonnull RelaxFunction relaxCost - ) { + > ParetoComparator> comparatorDepartureTimeAndRelaxedC1(RelaxFunction relaxCost) { return (l, r) -> compareDepartureTime(l, r) || compareNumberOfTransfers(l, r) || @@ -185,9 +178,7 @@ > ParetoComparator> comparatorDepartureTimeAndRelaxedC1( private static < T extends RaptorTripSchedule - > ParetoComparator> comparatorTimetableAndC1AndC2( - @Nonnull DominanceFunction c2Comp - ) { + > ParetoComparator> comparatorTimetableAndC1AndC2(DominanceFunction c2Comp) { return (l, r) -> compareIterationDepartureTime(l, r) || compareArrivalTime(l, r) || @@ -200,8 +191,8 @@ > ParetoComparator> comparatorTimetableAndC1AndC2( private static < T extends RaptorTripSchedule > ParetoComparator> comparatorTimetableAndRelaxedC1IfC2IsOptimal( - @Nonnull RelaxFunction relaxCost, - @Nonnull DominanceFunction c2Comp + RelaxFunction relaxCost, + DominanceFunction c2Comp ) { return (l, r) -> compareIterationDepartureTime(l, r) || @@ -213,7 +204,7 @@ > ParetoComparator> comparatorTimetableAndRelaxedC1IfC2IsOptimal( private static < T extends RaptorTripSchedule - > ParetoComparator> comparatorWithC1AndC2(@Nonnull DominanceFunction c2Comp) { + > ParetoComparator> comparatorWithC1AndC2(DominanceFunction c2Comp) { return (l, r) -> compareArrivalTime(l, r) || compareNumberOfTransfers(l, r) || @@ -224,9 +215,7 @@ > ParetoComparator> comparatorWithC1AndC2(@Nonnull DominanceFuncti private static < T extends RaptorTripSchedule - > ParetoComparator> comparatorDepartureTimeAndC1AndC2( - @Nonnull DominanceFunction c2Comp - ) { + > ParetoComparator> comparatorDepartureTimeAndC1AndC2(DominanceFunction c2Comp) { return (l, r) -> compareDepartureTime(l, r) || compareNumberOfTransfers(l, r) || @@ -238,8 +227,8 @@ > ParetoComparator> comparatorDepartureTimeAndC1AndC2( private static < T extends RaptorTripSchedule > ParetoComparator> comparatorArrivalTimeAndRelaxedC1IfC2IsOptimal( - @Nonnull RelaxFunction relaxCost, - @Nonnull DominanceFunction c2Comp + RelaxFunction relaxCost, + DominanceFunction c2Comp ) { return (l, r) -> compareArrivalTime(l, r) || @@ -251,8 +240,8 @@ > ParetoComparator> comparatorArrivalTimeAndRelaxedC1IfC2IsOptimal private static < T extends RaptorTripSchedule > ParetoComparator> comparatorDepartureTimeAndRelaxedC1IfC2IsOptimal( - @Nonnull RelaxFunction relaxCost, - @Nonnull DominanceFunction c2Comp + RelaxFunction relaxCost, + DominanceFunction c2Comp ) { return (l, r) -> compareDepartureTime(l, r) || @@ -262,10 +251,10 @@ > ParetoComparator> comparatorDepartureTimeAndRelaxedC1IfC2IsOptim } private static boolean compareC1RelaxedIfC2IsOptimal( - @Nonnull RaptorPath l, - @Nonnull RaptorPath r, - @Nonnull RelaxFunction relaxCost, - @Nonnull DominanceFunction c2Comp + RaptorPath l, + RaptorPath r, + RelaxFunction relaxCost, + DominanceFunction c2Comp ) { return c2Comp.leftDominateRight(l.c2(), r.c2()) ? compareC1(relaxCost, l, r) : compareC1(l, r); } diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/path/ReversePathMapper.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/ReversePathMapper.java similarity index 98% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/path/ReversePathMapper.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/ReversePathMapper.java index fde483b4cd8..94b68e10985 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/path/ReversePathMapper.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/ReversePathMapper.java @@ -1,8 +1,8 @@ package org.opentripplanner.raptor.rangeraptor.path; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.path.RaptorPath; -import org.opentripplanner.raptor.api.path.RaptorStopNameResolver; import org.opentripplanner.raptor.path.PathBuilder; import org.opentripplanner.raptor.rangeraptor.internalapi.WorkerLifeCycle; import org.opentripplanner.raptor.rangeraptor.transit.TripTimesSearch; diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/path/configure/PathConfig.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/configure/PathConfig.java similarity index 98% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/path/configure/PathConfig.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/configure/PathConfig.java index 673c83e6b78..43d504ced7d 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/path/configure/PathConfig.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/configure/PathConfig.java @@ -4,11 +4,11 @@ import org.opentripplanner.raptor.api.model.DominanceFunction; import org.opentripplanner.raptor.api.model.GeneralizedCostRelaxFunction; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.model.RelaxFunction; import org.opentripplanner.raptor.api.model.SearchDirection; import org.opentripplanner.raptor.api.path.RaptorPath; -import org.opentripplanner.raptor.api.path.RaptorStopNameResolver; import org.opentripplanner.raptor.api.request.RaptorProfile; import org.opentripplanner.raptor.rangeraptor.context.SearchContext; import org.opentripplanner.raptor.rangeraptor.internalapi.ParetoSetCost; diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/ArrivalTimeRoutingStrategy.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/ArrivalTimeRoutingStrategy.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/ArrivalTimeRoutingStrategy.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/ArrivalTimeRoutingStrategy.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/MinTravelDurationRoutingStrategy.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/MinTravelDurationRoutingStrategy.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/MinTravelDurationRoutingStrategy.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/MinTravelDurationRoutingStrategy.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdRangeRaptorWorkerState.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdRangeRaptorWorkerState.java similarity index 98% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdRangeRaptorWorkerState.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdRangeRaptorWorkerState.java index e3aba5c36f9..bcb2ca0f798 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdRangeRaptorWorkerState.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdRangeRaptorWorkerState.java @@ -5,7 +5,7 @@ import org.opentripplanner.raptor.api.model.RaptorTransfer; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.model.TransitArrival; -import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorWorkerResult; +import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorRouterResult; import org.opentripplanner.raptor.rangeraptor.standard.besttimes.BestTimes; import org.opentripplanner.raptor.rangeraptor.standard.internalapi.ArrivedAtDestinationCheck; import org.opentripplanner.raptor.rangeraptor.standard.internalapi.BestNumberOfTransfers; @@ -209,8 +209,8 @@ private void transferToStop(int arrivalTimeTransit, int fromStop, RaptorTransfer } @Override - public RaptorWorkerResult results() { - return new StdRaptorWorkerResult<>( + public RaptorRouterResult results() { + return new StdRaptorRouterResult<>( bestTimes, stopArrivalsState::extractPaths, bestNumberOfTransfers::extractBestNumberOfTransfers diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdRaptorWorkerResult.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdRaptorRouterResult.java similarity index 92% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdRaptorWorkerResult.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdRaptorRouterResult.java index 7a6812c9c95..1612234b185 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdRaptorWorkerResult.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdRaptorRouterResult.java @@ -4,14 +4,14 @@ import java.util.function.Supplier; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.path.RaptorPath; -import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorWorkerResult; +import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorRouterResult; import org.opentripplanner.raptor.rangeraptor.internalapi.SingleCriteriaStopArrivals; import org.opentripplanner.raptor.rangeraptor.standard.besttimes.BestTimes; /** * Result for Standard Range Raptor route call. */ -public class StdRaptorWorkerResult implements RaptorWorkerResult { +public class StdRaptorRouterResult implements RaptorRouterResult { private final BestTimes bestTimes; private final Supplier>> pathSupplier; @@ -23,7 +23,7 @@ public class StdRaptorWorkerResult implements Rapt */ private Collection> paths = null; - public StdRaptorWorkerResult( + public StdRaptorRouterResult( BestTimes bestTimes, Supplier>> pathSupplier, Supplier bestNumberOfTransfersSupplier diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdWorkerState.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdWorkerState.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdWorkerState.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdWorkerState.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/BestTimes.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/BestTimes.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/BestTimes.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/BestTimes.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/BestTimesOnlyStopArrivalsState.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/BestTimesOnlyStopArrivalsState.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/BestTimesOnlyStopArrivalsState.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/BestTimesOnlyStopArrivalsState.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleArrivedAtDestinationCheck.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleArrivedAtDestinationCheck.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleArrivedAtDestinationCheck.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleArrivedAtDestinationCheck.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleBestNumberOfTransfers.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleBestNumberOfTransfers.java similarity index 81% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleBestNumberOfTransfers.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleBestNumberOfTransfers.java index 1fb703565f6..22b0f44a579 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleBestNumberOfTransfers.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleBestNumberOfTransfers.java @@ -1,8 +1,8 @@ package org.opentripplanner.raptor.rangeraptor.standard.besttimes; import org.opentripplanner.framework.lang.IntUtils; -import org.opentripplanner.raptor.rangeraptor.internalapi.RoundProvider; import org.opentripplanner.raptor.rangeraptor.internalapi.SingleCriteriaStopArrivals; +import org.opentripplanner.raptor.rangeraptor.internalapi.WorkerLifeCycle; import org.opentripplanner.raptor.rangeraptor.standard.internalapi.BestNumberOfTransfers; import org.opentripplanner.raptor.rangeraptor.support.IntArraySingleCriteriaArrivals; @@ -13,11 +13,12 @@ public class SimpleBestNumberOfTransfers implements BestNumberOfTransfers { private final int[] bestNumOfTransfers; - private final RoundProvider roundProvider; + private int round; - public SimpleBestNumberOfTransfers(int nStops, RoundProvider roundProvider) { + public SimpleBestNumberOfTransfers(int nStops, WorkerLifeCycle lifeCycle) { this.bestNumOfTransfers = IntUtils.intArray(nStops, unreachedMinNumberOfTransfers()); - this.roundProvider = roundProvider; + + lifeCycle.onPrepareForNextRound(r -> this.round = r); } @Override @@ -29,7 +30,7 @@ public int calculateMinNumberOfTransfers(int stop) { * Call this method to notify that the given stop is reached in the current round of Raptor. */ void arriveAtStop(int stop) { - final int numOfTransfers = roundProvider.round() - 1; + final int numOfTransfers = round - 1; if (numOfTransfers < bestNumOfTransfers[stop]) { bestNumOfTransfers[stop] = numOfTransfers; } diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/UnknownPathFactory.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/UnknownPathFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/UnknownPathFactory.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/UnknownPathFactory.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/configure/StdRangeRaptorConfig.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/configure/StdRangeRaptorConfig.java similarity index 93% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/configure/StdRangeRaptorConfig.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/configure/StdRangeRaptorConfig.java index 6e0c3ee5afd..f5f689c68c4 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/configure/StdRangeRaptorConfig.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/configure/StdRangeRaptorConfig.java @@ -4,12 +4,13 @@ import static org.opentripplanner.raptor.rangeraptor.path.PathParetoSetComparators.paretoComparator; import java.util.HashSet; +import java.util.Objects; import java.util.Set; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.rangeraptor.context.SearchContext; import org.opentripplanner.raptor.rangeraptor.internalapi.Heuristics; import org.opentripplanner.raptor.rangeraptor.internalapi.ParetoSetCost; -import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorWorkerResult; +import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorRouterResult; import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorWorkerState; import org.opentripplanner.raptor.rangeraptor.internalapi.RoutingStrategy; import org.opentripplanner.raptor.rangeraptor.path.DestinationArrivalPaths; @@ -32,6 +33,7 @@ import org.opentripplanner.raptor.rangeraptor.standard.stoparrivals.StdStopArrivalsState; import org.opentripplanner.raptor.rangeraptor.standard.stoparrivals.path.EgressArrivalToPathAdapter; import org.opentripplanner.raptor.rangeraptor.standard.stoparrivals.view.StopsCursor; +import org.opentripplanner.raptor.rangeraptor.transit.EgressPaths; /** * The responsibility of this class is to wire different standard range raptor worker configurations @@ -68,11 +70,11 @@ public RoutingStrategy strategy() { return strategy; } - public Heuristics createHeuristics(RaptorWorkerResult results) { + public Heuristics createHeuristics(RaptorRouterResult results) { return oneOf( new HeuristicsAdapter( ctx.nStops(), - ctx.egressPaths(), + egressPaths(), ctx.calculator(), ctx.costCalculator(), results.extractBestOverallArrivals(), @@ -163,7 +165,7 @@ private StopArrivalsState stdStopArrivalsState() { private StopArrivalsState wrapStopArrivalsStateWithDebugger(StopArrivalsState state) { if (ctx.debugFactory().isDebugStopArrival()) { return new DebugStopArrivalsState<>( - ctx.roundProvider(), + ctx.lifeCycle(), ctx.debugFactory(), stopsCursor(), state @@ -180,7 +182,7 @@ private DestinationArrivalPaths destinationArrivalPaths() { // adapter notify the destination on each new egress stop arrival. var pathsAdapter = createEgressArrivalToPathAdapter(destinationArrivalPaths); - resolveStopArrivals().setupEgressStopStates(ctx.egressPaths(), pathsAdapter); + resolveStopArrivals().setupEgressStopStates(egressPaths(), pathsAdapter); return destinationArrivalPaths; } @@ -219,7 +221,7 @@ private StdStopArrivals resolveStopArrivals() { this.stopArrivals = withBestNumberOfTransfers( oneOf( - new StdStopArrivals(ctx.nRounds(), ctx.nStops(), ctx.roundProvider()), + new StdStopArrivals(ctx.nRounds(), ctx.nStops(), ctx.lifeCycle()), StdStopArrivals.class ) ); @@ -232,7 +234,7 @@ private StdStopArrivals resolveStopArrivals() { */ private SimpleBestNumberOfTransfers createSimpleBestNumberOfTransfers() { return withBestNumberOfTransfers( - new SimpleBestNumberOfTransfers(ctx.nStops(), ctx.roundProvider()) + new SimpleBestNumberOfTransfers(ctx.nStops(), ctx.lifeCycle()) ); } @@ -249,7 +251,7 @@ private UnknownPathFactory unknownPathFactory() { resolveBestNumberOfTransfers(), ctx.calculator(), ctx.slackProvider().transferSlack(), - ctx.egressPaths(), + egressPaths(), MIN_TRAVEL_DURATION.is(ctx.profile()), paretoComparator(ctx.paretoSetTimeConfig(), ParetoSetCost.NONE, null, null), ctx.lifeCycle() @@ -259,8 +261,15 @@ private UnknownPathFactory unknownPathFactory() { private SimpleArrivedAtDestinationCheck createSimpleArrivedAtDestinationCheck() { return new SimpleArrivedAtDestinationCheck( resolveBestTimes(), - ctx.egressPaths().egressesWitchStartByWalking(), - ctx.egressPaths().egressesWitchStartByARide() + egressPaths().egressesWitchStartByWalking(), + egressPaths().egressesWitchStartByARide() + ); + } + + private EgressPaths egressPaths() { + return Objects.requireNonNull( + ctx.legs().getLast().egressPaths(), + "Last leg must have non-null egressPaths" ); } diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/configure/VerifyRequestIsValid.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/configure/VerifyRequestIsValid.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/configure/VerifyRequestIsValid.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/configure/VerifyRequestIsValid.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/debug/DebugStopArrivalsState.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/debug/DebugStopArrivalsState.java similarity index 94% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/debug/DebugStopArrivalsState.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/debug/DebugStopArrivalsState.java index 6249764340f..2e0f3277a2a 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/debug/DebugStopArrivalsState.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/debug/DebugStopArrivalsState.java @@ -7,7 +7,7 @@ import org.opentripplanner.raptor.api.model.TransitArrival; import org.opentripplanner.raptor.api.path.RaptorPath; import org.opentripplanner.raptor.rangeraptor.debug.DebugHandlerFactory; -import org.opentripplanner.raptor.rangeraptor.internalapi.RoundProvider; +import org.opentripplanner.raptor.rangeraptor.internalapi.WorkerLifeCycle; import org.opentripplanner.raptor.rangeraptor.standard.internalapi.StopArrivalsState; import org.opentripplanner.raptor.rangeraptor.standard.stoparrivals.view.StopsCursor; @@ -28,12 +28,12 @@ public final class DebugStopArrivalsState * Create a Standard range raptor state for the given context */ public DebugStopArrivalsState( - RoundProvider roundProvider, + WorkerLifeCycle lifeCycle, DebugHandlerFactory dFactory, StopsCursor stopsCursor, StopArrivalsState delegate ) { - this.debug = new StateDebugger<>(stopsCursor, roundProvider, dFactory); + this.debug = new StateDebugger<>(stopsCursor, lifeCycle, dFactory); this.delegate = delegate; } diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/debug/StateDebugger.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/debug/StateDebugger.java similarity index 81% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/debug/StateDebugger.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/debug/StateDebugger.java index 374b4aaf17e..1aee775b920 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/debug/StateDebugger.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/debug/StateDebugger.java @@ -6,7 +6,7 @@ import org.opentripplanner.raptor.api.view.ArrivalView; import org.opentripplanner.raptor.rangeraptor.debug.DebugHandlerFactory; import org.opentripplanner.raptor.rangeraptor.internalapi.DebugHandler; -import org.opentripplanner.raptor.rangeraptor.internalapi.RoundProvider; +import org.opentripplanner.raptor.rangeraptor.internalapi.WorkerLifeCycle; import org.opentripplanner.raptor.rangeraptor.standard.stoparrivals.view.StopsCursor; /** @@ -17,28 +17,25 @@ class StateDebugger { private final StopsCursor cursor; - private final RoundProvider roundProvider; private final DebugHandler> debugHandlerStopArrivals; + private int round; - StateDebugger( - StopsCursor cursor, - RoundProvider roundProvider, - DebugHandlerFactory dFactory - ) { + StateDebugger(StopsCursor cursor, WorkerLifeCycle lifeCycle, DebugHandlerFactory dFactory) { this.cursor = cursor; - this.roundProvider = roundProvider; this.debugHandlerStopArrivals = dFactory.debugStopArrival(); + + lifeCycle.onPrepareForNextRound(r -> this.round = r); } void acceptAccessPath(int stop, RaptorAccessEgress access) { if (isDebug(stop)) { - debugHandlerStopArrivals.accept(cursor.access(round(), stop, access)); + debugHandlerStopArrivals.accept(cursor.access(round, stop, access)); } } void rejectAccessPath(RaptorAccessEgress accessPath, int arrivalTime) { if (isDebug(accessPath.stop())) { - reject(cursor.fictiveAccess(round(), accessPath, arrivalTime)); + reject(cursor.fictiveAccess(round, accessPath, arrivalTime)); } } @@ -64,13 +61,13 @@ void dropOldStateAndAcceptNewOnStreetArrival(int stop, Runnable body) { void rejectTransit(int alightStop, int alightTime, T trip, int boardStop, int boardTime) { if (isDebug(alightStop)) { - reject(cursor.fictiveTransit(round(), alightStop, alightTime, trip, boardStop, boardTime)); + reject(cursor.fictiveTransit(round, alightStop, alightTime, trip, boardStop, boardTime)); } } void rejectTransfer(int fromStop, RaptorTransfer transfer, int toStop, int arrivalTime) { if (isDebug(transfer.stop())) { - reject(cursor.fictiveTransfer(round(), fromStop, transfer, toStop, arrivalTime)); + reject(cursor.fictiveTransfer(round, fromStop, transfer, toStop, arrivalTime)); } } @@ -81,7 +78,7 @@ private boolean isDebug(int stop) { } private void accept(int stop, boolean stopReachedOnBoard) { - debugHandlerStopArrivals.accept(cursor.stop(round(), stop, stopReachedOnBoard)); + debugHandlerStopArrivals.accept(cursor.stop(round, stop, stopReachedOnBoard)); } /** @@ -94,8 +91,6 @@ private void accept(int stop, boolean stopReachedOnBoard) { * handler about arrivals that are about to be dropped. */ private void drop(int stop, boolean onBoard, boolean newBestOverall) { - final int round = round(); - // if new arrival arrived on-board, if (onBoard) { // and an existing on-board arrival exist @@ -122,8 +117,4 @@ private void reject(ArrivalView arrival) { private void dropExistingArrival(int round, int stop, boolean onBoard) { debugHandlerStopArrivals.drop(cursor.stop(round, stop, onBoard), null, null); } - - private int round() { - return roundProvider.round(); - } } diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/heuristics/HeuristicsAdapter.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/heuristics/HeuristicsAdapter.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/heuristics/HeuristicsAdapter.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/heuristics/HeuristicsAdapter.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/ArrivedAtDestinationCheck.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/ArrivedAtDestinationCheck.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/ArrivedAtDestinationCheck.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/ArrivedAtDestinationCheck.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/BestNumberOfTransfers.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/BestNumberOfTransfers.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/BestNumberOfTransfers.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/BestNumberOfTransfers.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/DestinationArrivalListener.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/DestinationArrivalListener.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/DestinationArrivalListener.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/DestinationArrivalListener.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/StopArrivalsState.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/StopArrivalsState.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/StopArrivalsState.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/StopArrivalsState.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/AccessStopArrivalState.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/AccessStopArrivalState.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/AccessStopArrivalState.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/AccessStopArrivalState.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/DefaultStopArrivalState.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/DefaultStopArrivalState.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/DefaultStopArrivalState.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/DefaultStopArrivalState.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/EgressStopArrivalState.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/EgressStopArrivalState.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/EgressStopArrivalState.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/EgressStopArrivalState.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StdStopArrivals.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StdStopArrivals.java similarity index 87% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StdStopArrivals.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StdStopArrivals.java index b3b32890ec7..a6dee126211 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StdStopArrivals.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StdStopArrivals.java @@ -4,8 +4,8 @@ import org.opentripplanner.raptor.api.model.RaptorTransfer; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.model.TransitArrival; -import org.opentripplanner.raptor.rangeraptor.internalapi.RoundProvider; import org.opentripplanner.raptor.rangeraptor.internalapi.SingleCriteriaStopArrivals; +import org.opentripplanner.raptor.rangeraptor.internalapi.WorkerLifeCycle; import org.opentripplanner.raptor.rangeraptor.standard.internalapi.BestNumberOfTransfers; import org.opentripplanner.raptor.rangeraptor.standard.internalapi.DestinationArrivalListener; import org.opentripplanner.raptor.rangeraptor.support.IntArraySingleCriteriaArrivals; @@ -18,12 +18,12 @@ public final class StdStopArrivals implements Best /** Arrivals by round and stop - [round][stop] */ private final StopArrivalState[][] arrivals; - private final RoundProvider roundProvider; + private int round; - public StdStopArrivals(int nRounds, int nStops, RoundProvider roundProvider) { - this.roundProvider = roundProvider; + public StdStopArrivals(int nRounds, int nStops, WorkerLifeCycle lifeCycle) { //noinspection unchecked this.arrivals = (StopArrivalState[][]) new StopArrivalState[nRounds][nStops]; + lifeCycle.onPrepareForNextRound(r -> this.round = r); } /** @@ -71,12 +71,12 @@ public SingleCriteriaStopArrivals extractBestNumberOfTransfers() { void setAccessTime(int time, RaptorAccessEgress access, boolean bestTime) { final int stop = access.stop(); - var existingArrival = getOrCreateStopIndex(round(), stop); + var existingArrival = getOrCreateStopIndex(round, stop); if (existingArrival instanceof AccessStopArrivalState) { ((AccessStopArrivalState) existingArrival).setAccessTime(time, access, bestTime); } else { - arrivals[round()][stop] = + arrivals[round][stop] = new AccessStopArrivalState<>( time, access, @@ -92,13 +92,13 @@ void setAccessTime(int time, RaptorAccessEgress access, boolean bestTime) { */ void transferToStop(int fromStop, RaptorTransfer transfer, int arrivalTime) { int stop = transfer.stop(); - var state = getOrCreateStopIndex(round(), stop); + var state = getOrCreateStopIndex(round, stop); state.transferToStop(fromStop, arrivalTime, transfer); } void transitToStop(int stop, int time, int boardStop, int boardTime, T trip, boolean bestTime) { - var state = getOrCreateStopIndex(round(), stop); + var state = getOrCreateStopIndex(round, stop); state.arriveByTransit(time, boardStop, boardTime, trip); @@ -108,13 +108,13 @@ void transitToStop(int stop, int time, int boardStop, int boardTime, T trip, boo } int bestTimePreviousRound(int stop) { - return get(round() - 1, stop).time(); + return get(round - 1, stop).time(); } /* private methods */ TransitArrival previousTransit(int boardStopIndex) { - final int prevRound = round() - 1; + final int prevRound = round - 1; int stopIndex = boardStopIndex; StopArrivalState state = get(prevRound, boardStopIndex); @@ -129,10 +129,6 @@ TransitArrival previousTransit(int boardStopIndex) { : null; } - private int round() { - return roundProvider.round(); - } - private StopArrivalState getOrCreateStopIndex(final int round, final int stop) { if (arrivals[round][stop] == null) { arrivals[round][stop] = StopArrivalState.create(); diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StdStopArrivalsState.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StdStopArrivalsState.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StdStopArrivalsState.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StdStopArrivalsState.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StopArrivalState.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StopArrivalState.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StopArrivalState.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StopArrivalState.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/path/EgressArrivalToPathAdapter.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/path/EgressArrivalToPathAdapter.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/path/EgressArrivalToPathAdapter.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/path/EgressArrivalToPathAdapter.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Access.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Access.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Access.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Access.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/StopArrivalViewAdapter.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/StopArrivalViewAdapter.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/StopArrivalViewAdapter.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/StopArrivalViewAdapter.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/StopsCursor.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/StopsCursor.java similarity index 98% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/StopsCursor.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/StopsCursor.java index f72047597a7..32406951eda 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/StopsCursor.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/StopsCursor.java @@ -1,7 +1,6 @@ package org.opentripplanner.raptor.rangeraptor.standard.stoparrivals.view; import java.util.function.ToIntFunction; -import javax.annotation.Nonnull; import org.opentripplanner.raptor.api.model.RaptorAccessEgress; import org.opentripplanner.raptor.api.model.RaptorConstants; import org.opentripplanner.raptor.api.model.RaptorTransfer; @@ -139,7 +138,7 @@ public ArrivalView stop(int round, int stop, boolean stopReachedOnBoard) { * Set cursor to stop followed by the give transit leg - this allows access to be time-shifted * according to the next transit boarding/departure time. */ - public ArrivalView stop(int round, int stop, @Nonnull Transit nextTransitLeg) { + public ArrivalView stop(int round, int stop, Transit nextTransitLeg) { var arrival = arrivals.get(round, stop); if (arrival.arrivedByAccessOnStreet()) { diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Transfer.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Transfer.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Transfer.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Transfer.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Transit.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Transit.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Transit.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Transit.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/support/IntArraySingleCriteriaArrivals.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/support/IntArraySingleCriteriaArrivals.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/support/IntArraySingleCriteriaArrivals.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/support/IntArraySingleCriteriaArrivals.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/support/TimeBasedBoardingSupport.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/support/TimeBasedBoardingSupport.java similarity index 95% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/support/TimeBasedBoardingSupport.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/support/TimeBasedBoardingSupport.java index 40df7000461..9ecd2bbf100 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/support/TimeBasedBoardingSupport.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/support/TimeBasedBoardingSupport.java @@ -1,10 +1,10 @@ package org.opentripplanner.raptor.rangeraptor.support; +import static org.opentripplanner.raptor.rangeraptor.transit.RoundTracker.isFirstRound; import static org.opentripplanner.raptor.spi.RaptorTripScheduleSearch.UNBOUNDED_TRIP_INDEX; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.model.TransitArrival; -import org.opentripplanner.raptor.rangeraptor.internalapi.RoundProvider; import org.opentripplanner.raptor.rangeraptor.internalapi.RoutingStrategy; import org.opentripplanner.raptor.rangeraptor.internalapi.SlackProvider; import org.opentripplanner.raptor.rangeraptor.internalapi.WorkerLifeCycle; @@ -23,25 +23,24 @@ public final class TimeBasedBoardingSupport { private final SlackProvider slackProvider; private final RaptorTransitCalculator calculator; - private final RoundProvider roundProvider; private final boolean hasTimeDependentAccess; private boolean inFirstIteration = true; private RaptorTimeTable timeTable; private RaptorTripScheduleSearch tripSearch; + private int round; public TimeBasedBoardingSupport( boolean hasTimeDependentAccess, SlackProvider slackProvider, RaptorTransitCalculator calculator, - RoundProvider roundProvider, WorkerLifeCycle subscriptions ) { this.hasTimeDependentAccess = hasTimeDependentAccess; this.slackProvider = slackProvider; this.calculator = calculator; - this.roundProvider = roundProvider; subscriptions.onIterationComplete(() -> inFirstIteration = false); + subscriptions.onPrepareForNextRound(r -> this.round = r); } public void prepareForTransitWith(RaptorTimeTable timeTable) { @@ -124,7 +123,7 @@ private int earliestBoardTime(int prevArrivalTime, int boardSlack) { * Create a trip search using {@link TripScheduleBoardSearch}. */ private RaptorTripScheduleSearch createTripSearch(RaptorTimeTable timeTable) { - if (!inFirstIteration && roundProvider.isFirstRound() && !hasTimeDependentAccess) { + if (!inFirstIteration && isFirstRound(round) && !hasTimeDependentAccess) { // For the first round of every iteration(except the first) we restrict the first // departure to happen within the time-window of the iteration. Another way to put this, // is to say that we allow for the access path to be time-shifted to a later departure, diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessEgressFunctions.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessEgressFunctions.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessEgressFunctions.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessEgressFunctions.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessPaths.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessPaths.java similarity index 92% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessPaths.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessPaths.java index 66b7227584d..7b4c3b76321 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessPaths.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessPaths.java @@ -5,6 +5,7 @@ import static org.opentripplanner.raptor.rangeraptor.transit.AccessEgressFunctions.removeNonOptimalPathsForStandardRaptor; import gnu.trove.map.TIntObjectMap; +import gnu.trove.map.hash.TIntObjectHashMap; import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -38,17 +39,14 @@ private AccessPaths( int iterationStep, IntUnaryOperator iterationOp, TIntObjectMap> arrivedOnStreetByNumOfRides, - TIntObjectMap> arrivedOnBoardByNumOfRides + TIntObjectMap> arrivedOnBoardByNumOfRides, + int maxTimePenalty ) { this.iterationStep = iterationStep; this.iterationOp = iterationOp; this.arrivedOnStreetByNumOfRides = arrivedOnStreetByNumOfRides; this.arrivedOnBoardByNumOfRides = arrivedOnBoardByNumOfRides; - this.maxTimePenalty = - Math.max( - maxTimePenalty(arrivedOnBoardByNumOfRides), - maxTimePenalty(arrivedOnStreetByNumOfRides) - ); + this.maxTimePenalty = maxTimePenalty; } /** @@ -74,12 +72,28 @@ public static AccessPaths create( } paths = decorateWithTimePenaltyLogic(paths); + var arrivedOnBoardByNumOfRides = groupByRound(paths, RaptorAccessEgress::stopReachedByWalking); + var arrivedOnStreetByNumOfRides = groupByRound(paths, RaptorAccessEgress::stopReachedOnBoard); return new AccessPaths( iterationStep, iterationOp(searchDirection), - groupByRound(paths, RaptorAccessEgress::stopReachedByWalking), - groupByRound(paths, RaptorAccessEgress::stopReachedOnBoard) + arrivedOnBoardByNumOfRides, + arrivedOnStreetByNumOfRides, + Math.max( + maxTimePenalty(arrivedOnBoardByNumOfRides), + maxTimePenalty(arrivedOnStreetByNumOfRides) + ) + ); + } + + public AccessPaths copyEmpty() { + return new AccessPaths( + iterationStep, + iterationOp, + new TIntObjectHashMap<>(), + new TIntObjectHashMap<>(), + maxTimePenalty ); } @@ -141,7 +155,17 @@ public int next() { }; } - private int maxTimePenalty(TIntObjectMap> col) { + /** Raptor uses this information to optimize boarding of the first trip */ + public boolean hasTimeDependentAccess() { + return ( + hasTimeDependentAccess(arrivedOnBoardByNumOfRides) || + hasTimeDependentAccess(arrivedOnStreetByNumOfRides) + ); + } + + /* private methods */ + + private static int maxTimePenalty(TIntObjectMap> col) { return col .valueCollection() .stream() @@ -161,14 +185,6 @@ private static List decorateWithTimePenaltyLogic( return paths.stream().map(it -> it.hasTimePenalty() ? new AccessWithPenalty(it) : it).toList(); } - /** Raptor uses this information to optimize boarding of the first trip */ - public boolean hasTimeDependentAccess() { - return ( - hasTimeDependentAccess(arrivedOnBoardByNumOfRides) || - hasTimeDependentAccess(arrivedOnStreetByNumOfRides) - ); - } - private boolean hasTimePenalty() { return maxTimePenalty != RaptorConstants.TIME_NOT_SET; } diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessWithPenalty.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessWithPenalty.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessWithPenalty.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessWithPenalty.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/EgressPaths.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/EgressPaths.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/transit/EgressPaths.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/EgressPaths.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/EgressWithPenalty.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/EgressWithPenalty.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/transit/EgressWithPenalty.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/EgressWithPenalty.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardRaptorTransitCalculator.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardRaptorTransitCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardRaptorTransitCalculator.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardRaptorTransitCalculator.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTimeCalculator.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTimeCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTimeCalculator.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTimeCalculator.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTransitCalculator.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTransitCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTransitCalculator.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTransitCalculator.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorSearchWindowCalculator.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorSearchWindowCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorSearchWindowCalculator.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorSearchWindowCalculator.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorTransitCalculator.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorTransitCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorTransitCalculator.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorTransitCalculator.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseRaptorTransitCalculator.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseRaptorTransitCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseRaptorTransitCalculator.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseRaptorTransitCalculator.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTimeCalculator.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTimeCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTimeCalculator.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTimeCalculator.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTransitCalculator.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTransitCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTransitCalculator.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTransitCalculator.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RoundTracker.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RoundTracker.java similarity index 82% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RoundTracker.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RoundTracker.java index 05159a19a1e..f65fb5bca5e 100644 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RoundTracker.java +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RoundTracker.java @@ -1,15 +1,17 @@ package org.opentripplanner.raptor.rangeraptor.transit; -import org.opentripplanner.raptor.rangeraptor.internalapi.RoundProvider; import org.opentripplanner.raptor.rangeraptor.internalapi.WorkerLifeCycle; /** * Round tracker to keep track of round index and when to stop exploring new rounds. *

- * In round 0 the access paths with one leg are added. In round 1 the first transit and transfers is - * added, ... + * In round zero(0), the access paths with one leg are added. In round one(1) the first transit and + * transfers is added, ... */ -public class RoundTracker implements RoundProvider { +public class RoundTracker { + + private static final int ROUND_ZERO = 0; + private static final int FIRST_ROUND = 1; /** * The extra number of rounds/transfers we accept compared to the trip with the fewest number of @@ -20,7 +22,7 @@ public class RoundTracker implements RoundProvider { /** * The current round in progress (round index). */ - private int round = 0; + private int round = ROUND_ZERO; /** * The round upper limit for when to abort the search. @@ -28,7 +30,7 @@ public class RoundTracker implements RoundProvider { * This is default set to the maximum number of rounds limit, but as soon as the destination is * reach the {@link #numberOfAdditionalTransfers} is used to update the limit. *

- * The limit is inclusive, indicating the the last round to process. + * The limit is inclusive, indicating the last round to process. */ private int roundMaxLimit; @@ -61,15 +63,15 @@ public int round() { * Return true if this round is the fist round, calculating the first transit path. Access is * calculated in round zero (0). */ - public boolean isFirstRound() { - return round == 1; + public static boolean isFirstRound(int round) { + return round == FIRST_ROUND; } /** * Before each iteration, initialize the round to 0. */ - private void setupIteration() { - round = 0; + public void setupIteration() { + round = ROUND_ZERO; } /** diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/SlackProviderAdapter.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/SlackProviderAdapter.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/transit/SlackProviderAdapter.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/SlackProviderAdapter.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TimeCalculator.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TimeCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TimeCalculator.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TimeCalculator.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TransitCalculator.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TransitCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TransitCalculator.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TransitCalculator.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TripScheduleExactMatchSearch.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TripScheduleExactMatchSearch.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TripScheduleExactMatchSearch.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TripScheduleExactMatchSearch.java diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TripTimesSearch.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TripTimesSearch.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TripTimesSearch.java rename to application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TripTimesSearch.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ViaConnections.java b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ViaConnections.java new file mode 100644 index 00000000000..053c1da4354 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ViaConnections.java @@ -0,0 +1,26 @@ +package org.opentripplanner.raptor.rangeraptor.transit; + +import static java.util.stream.Collectors.groupingBy; + +import gnu.trove.map.TIntObjectMap; +import gnu.trove.map.hash.TIntObjectHashMap; +import java.util.Collection; +import java.util.List; +import org.opentripplanner.raptor.api.request.RaptorViaConnection; + +public class ViaConnections { + + private final TIntObjectMap> byFromStop; + + public ViaConnections(Collection viaConnections) { + this.byFromStop = new TIntObjectHashMap<>(); + viaConnections + .stream() + .collect(groupingBy(RaptorViaConnection::fromStop)) + .forEach(byFromStop::put); + } + + public TIntObjectMap> byFromStop() { + return byFromStop; + } +} diff --git a/src/main/java/org/opentripplanner/raptor/service/DebugHeuristics.java b/application/src/main/java/org/opentripplanner/raptor/service/DebugHeuristics.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/service/DebugHeuristics.java rename to application/src/main/java/org/opentripplanner/raptor/service/DebugHeuristics.java diff --git a/src/main/java/org/opentripplanner/raptor/service/DefaultStopArrivals.java b/application/src/main/java/org/opentripplanner/raptor/service/DefaultStopArrivals.java similarity index 93% rename from src/main/java/org/opentripplanner/raptor/service/DefaultStopArrivals.java rename to application/src/main/java/org/opentripplanner/raptor/service/DefaultStopArrivals.java index 2d3e3795cd9..244dca1c81c 100644 --- a/src/main/java/org/opentripplanner/raptor/service/DefaultStopArrivals.java +++ b/application/src/main/java/org/opentripplanner/raptor/service/DefaultStopArrivals.java @@ -1,7 +1,7 @@ package org.opentripplanner.raptor.service; import org.opentripplanner.raptor.api.response.StopArrivals; -import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorWorkerResult; +import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorRouterResult; import org.opentripplanner.raptor.rangeraptor.internalapi.SingleCriteriaStopArrivals; /** @@ -13,9 +13,9 @@ public class DefaultStopArrivals implements StopArrivals { private SingleCriteriaStopArrivals bestTransitArrivalTime = null; private SingleCriteriaStopArrivals bestNumberOfTransfers = null; - private final RaptorWorkerResult results; + private final RaptorRouterResult results; - public DefaultStopArrivals(RaptorWorkerResult results) { + public DefaultStopArrivals(RaptorRouterResult results) { this.results = results; } diff --git a/src/main/java/org/opentripplanner/raptor/service/DestinationNotReachedException.java b/application/src/main/java/org/opentripplanner/raptor/service/DestinationNotReachedException.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/service/DestinationNotReachedException.java rename to application/src/main/java/org/opentripplanner/raptor/service/DestinationNotReachedException.java diff --git a/src/main/java/org/opentripplanner/raptor/service/HeuristicSearchTask.java b/application/src/main/java/org/opentripplanner/raptor/service/HeuristicSearchTask.java similarity index 88% rename from src/main/java/org/opentripplanner/raptor/service/HeuristicSearchTask.java rename to application/src/main/java/org/opentripplanner/raptor/service/HeuristicSearchTask.java index 6a8bc003dd5..7c0158d2192 100644 --- a/src/main/java/org/opentripplanner/raptor/service/HeuristicSearchTask.java +++ b/application/src/main/java/org/opentripplanner/raptor/service/HeuristicSearchTask.java @@ -8,17 +8,17 @@ import org.opentripplanner.raptor.api.model.SearchDirection; import org.opentripplanner.raptor.api.request.RaptorRequest; import org.opentripplanner.raptor.configure.RaptorConfig; +import org.opentripplanner.raptor.rangeraptor.RangeRaptor; import org.opentripplanner.raptor.rangeraptor.internalapi.Heuristics; -import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorWorker; -import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorWorkerResult; +import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorRouterResult; import org.opentripplanner.raptor.spi.RaptorTransitDataProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Thin wrapper around a {@link RaptorWorker} to allow for some small additional features. This - * is mostly to extracted some "glue" out of the {@link RangeRaptorDynamicSearch} to make that - * simpler and let it focus on the main bossiness logic. + * This is a thin wrapper around the {@link RangeRaptor} to allow for some small additional + * features. This is mostly to extract some "glue" out of the {@link RangeRaptorDynamicSearch} to + * make that simpler and let it focus on the main business logic. *

* This class is not meant for reuse, create one task for each potential heuristic search. The task * must be {@link #enable()}d before it is {@link #run()}. @@ -33,10 +33,10 @@ public class HeuristicSearchTask { private final RaptorTransitDataProvider transitData; private boolean run = false; - private RaptorWorker search = null; + private RangeRaptor search = null; private RaptorRequest originalRequest; private RaptorRequest heuristicRequest; - private RaptorWorkerResult result = null; + private RaptorRouterResult result = null; public HeuristicSearchTask( RaptorRequest request, @@ -144,7 +144,7 @@ private void createHeuristicSearchIfNotExist(RaptorRequest request) { ); heuristicRequest = builder.build(); - search = config.createHeuristicSearch(transitData, heuristicRequest); + search = config.createRangeRaptorWithHeuristicSearch(transitData, heuristicRequest); } } } diff --git a/src/main/java/org/opentripplanner/raptor/service/HeuristicToRunResolver.java b/application/src/main/java/org/opentripplanner/raptor/service/HeuristicToRunResolver.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/service/HeuristicToRunResolver.java rename to application/src/main/java/org/opentripplanner/raptor/service/HeuristicToRunResolver.java diff --git a/src/main/java/org/opentripplanner/raptor/service/RangeRaptorDynamicSearch.java b/application/src/main/java/org/opentripplanner/raptor/service/RangeRaptorDynamicSearch.java similarity index 92% rename from src/main/java/org/opentripplanner/raptor/service/RangeRaptorDynamicSearch.java rename to application/src/main/java/org/opentripplanner/raptor/service/RangeRaptorDynamicSearch.java index fb96b7a8724..5353804f414 100644 --- a/src/main/java/org/opentripplanner/raptor/service/RangeRaptorDynamicSearch.java +++ b/application/src/main/java/org/opentripplanner/raptor/service/RangeRaptorDynamicSearch.java @@ -19,8 +19,8 @@ import org.opentripplanner.raptor.api.request.SearchParamsBuilder; import org.opentripplanner.raptor.api.response.RaptorResponse; import org.opentripplanner.raptor.configure.RaptorConfig; +import org.opentripplanner.raptor.rangeraptor.RangeRaptor; import org.opentripplanner.raptor.rangeraptor.internalapi.Heuristics; -import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorWorker; import org.opentripplanner.raptor.rangeraptor.transit.RaptorSearchWindowCalculator; import org.opentripplanner.raptor.spi.RaptorTransitDataProvider; import org.slf4j.Logger; @@ -43,7 +43,7 @@ public class RangeRaptorDynamicSearch { private final RaptorConfig config; private final RaptorTransitDataProvider transitData; private final RaptorRequest originalRequest; - private final RaptorSearchWindowCalculator dynamicSearchParamsCalculator; + private final RaptorSearchWindowCalculator dynamicSearchWindowCalculator; private final HeuristicSearchTask fwdHeuristics; private final HeuristicSearchTask revHeuristics; @@ -56,7 +56,7 @@ public RangeRaptorDynamicSearch( this.config = config; this.transitData = transitData; this.originalRequest = originalRequest; - this.dynamicSearchParamsCalculator = + this.dynamicSearchWindowCalculator = config.searchWindowCalculator().withSearchParams(originalRequest.searchParams()); this.fwdHeuristics = new HeuristicSearchTask<>(FORWARD, "Forward", config, transitData); @@ -67,19 +67,18 @@ public RaptorResponse route() { try { enableHeuristicSearchBasedOnOptimizationsAndSearchParameters(); - // Run heuristics, if no destination is reached + // Run the heuristics if no destination is reached runHeuristics(); // Set search-window and other dynamic calculated parameters - RaptorRequest dynamicRequest = originalRequest; - dynamicRequest = requestWithDynamicSearchParams(dynamicRequest); + var dynamicRequest = requestWithDynamicSearchParams(originalRequest); return createAndRunDynamicRRWorker(dynamicRequest); } catch (DestinationNotReachedException e) { return new RaptorResponse<>( Collections.emptyList(), null, - // If a trip exist(forward heuristics succeed), but is outside the calculated + // If a trip exists(forward heuristics succeed), but is outside the calculated // search-window, then set the search-window params as if the request was // performed. This enables the client to page to the next window requestWithDynamicSearchParams(originalRequest), @@ -130,17 +129,18 @@ private void runHeuristics() { private RaptorResponse createAndRunDynamicRRWorker(RaptorRequest request) { LOG.debug("Main request: {}", request); - RaptorWorker raptorWorker; + RangeRaptor rangeRaptorRouter; // Create worker if (request.profile().is(MULTI_CRITERIA)) { - raptorWorker = config.createMcWorker(transitData, request, getDestinationHeuristics()); + rangeRaptorRouter = + config.createRangeRaptorWithMcWorker(transitData, request, getDestinationHeuristics()); } else { - raptorWorker = config.createStdWorker(transitData, request); + rangeRaptorRouter = config.createRangeRaptorWithStdWorker(transitData, request); } // Route - var result = raptorWorker.route(); + var result = rangeRaptorRouter.route(); // create and return response return new RaptorResponse<>( @@ -274,10 +274,10 @@ private RaptorRequest requestWithDynamicSearchParams(RaptorRequest request SearchParamsBuilder builder = request.mutate().searchParams(); if (!request.searchParams().isEarliestDepartureTimeSet()) { - builder.earliestDepartureTime(dynamicSearchParamsCalculator.getEarliestDepartureTime()); + builder.earliestDepartureTime(dynamicSearchWindowCalculator.getEarliestDepartureTime()); } if (!request.searchParams().isSearchWindowSet()) { - builder.searchWindowInSeconds(dynamicSearchParamsCalculator.getSearchWindowSeconds()); + builder.searchWindowInSeconds(dynamicSearchWindowCalculator.getSearchWindowSeconds()); } // We do not set the latest-arrival-time, because we do not want to limit the forward // multi-criteria search, it does not have much effect on the performance - we only risk @@ -287,7 +287,7 @@ private RaptorRequest requestWithDynamicSearchParams(RaptorRequest request private void calculateDynamicSearchParametersFromHeuristics(@Nullable Heuristics heuristics) { if (heuristics != null) { - dynamicSearchParamsCalculator + dynamicSearchWindowCalculator .withHeuristics( heuristics.bestOverallJourneyTravelDuration(), heuristics.minWaitTimeForJourneysReachingDestination() diff --git a/application/src/main/java/org/opentripplanner/raptor/service/ViaRangeRaptorDynamicSearch.java b/application/src/main/java/org/opentripplanner/raptor/service/ViaRangeRaptorDynamicSearch.java new file mode 100644 index 00000000000..4476e40464f --- /dev/null +++ b/application/src/main/java/org/opentripplanner/raptor/service/ViaRangeRaptorDynamicSearch.java @@ -0,0 +1,298 @@ +package org.opentripplanner.raptor.service; + +import static org.opentripplanner.raptor.api.model.SearchDirection.FORWARD; +import static org.opentripplanner.raptor.api.model.SearchDirection.REVERSE; +import static org.opentripplanner.raptor.api.request.RaptorProfile.MULTI_CRITERIA; +import static org.opentripplanner.raptor.service.HeuristicToRunResolver.resolveHeuristicToRunBasedOnOptimizationsAndSearchParameters; + +import java.util.Collections; +import java.util.List; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.stream.Collectors; +import javax.annotation.Nullable; +import org.opentripplanner.framework.application.OTPRequestTimeoutException; +import org.opentripplanner.raptor.RaptorService; +import org.opentripplanner.raptor.api.model.RaptorTripSchedule; +import org.opentripplanner.raptor.api.request.RaptorRequest; +import org.opentripplanner.raptor.api.request.SearchParams; +import org.opentripplanner.raptor.api.request.SearchParamsBuilder; +import org.opentripplanner.raptor.api.response.RaptorResponse; +import org.opentripplanner.raptor.configure.RaptorConfig; +import org.opentripplanner.raptor.rangeraptor.RangeRaptor; +import org.opentripplanner.raptor.rangeraptor.internalapi.Heuristics; +import org.opentripplanner.raptor.rangeraptor.transit.RaptorSearchWindowCalculator; +import org.opentripplanner.raptor.spi.RaptorTransitDataProvider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * This search helps the {@link RaptorService} to configure + * heuristics and set dynamic search parameters like EDT, LAT and raptor-search-window. + *

+ * If possible the forward and reverse heuristics will be run in parallel. + *

+ * Depending on which optimization is enabled and which search parameters are set a forward and/or a + * reverse "single-iteration" raptor search is performed and heuristics are collected. This is used + * to configure the "main" multi-iteration RangeRaptor search. + */ +public class ViaRangeRaptorDynamicSearch { + + private static final Logger LOG = LoggerFactory.getLogger(ViaRangeRaptorDynamicSearch.class); + + private final RaptorConfig config; + private final RaptorTransitDataProvider transitData; + private final RaptorRequest originalRequest; + private final RaptorSearchWindowCalculator dynamicSearchWindowCalculator; + + private final HeuristicSearchTask fwdHeuristics; + private final HeuristicSearchTask revHeuristics; + + public ViaRangeRaptorDynamicSearch( + RaptorConfig config, + RaptorTransitDataProvider transitData, + RaptorRequest originalRequest + ) { + this.config = config; + this.transitData = transitData; + this.originalRequest = originalRequest; + this.dynamicSearchWindowCalculator = + config.searchWindowCalculator().withSearchParams(originalRequest.searchParams()); + + this.fwdHeuristics = new HeuristicSearchTask<>(FORWARD, "Forward", config, transitData); + this.revHeuristics = new HeuristicSearchTask<>(REVERSE, "Reverse", config, transitData); + } + + public RaptorResponse route() { + try { + enableHeuristicSearchBasedOnOptimizationsAndSearchParameters(); + + // Run heuristics, if no destination is reached + runHeuristics(); + + // Set search-window and other dynamic calculated parameters + var dynamicRequest = requestWithDynamicSearchParams(originalRequest); + + return createAndRunDynamicRRWorker(dynamicRequest); + } catch (DestinationNotReachedException e) { + return new RaptorResponse<>( + Collections.emptyList(), + null, + // If a trip exists(forward heuristics succeed), but is outside the calculated + // search-window, then set the search-window params as if the request was + // performed. This enables the client to page to the next window + requestWithDynamicSearchParams(originalRequest), + false + ); + } + } + + /** + * Only exposed for testing purposes + */ + @Nullable + public Heuristics getDestinationHeuristics() { + if (!originalRequest.useDestinationPruning()) { + return null; + } + LOG.debug("RangeRaptor - Destination pruning enabled."); + return revHeuristics.result(); + } + + /** + * Create and prepare heuristic search (both FORWARD and REVERSE) based on optimizations and input + * search parameters. This is done for Standard and Multi-criteria profiles only. + */ + private void enableHeuristicSearchBasedOnOptimizationsAndSearchParameters() { + // We delegate this to a static method to be able to write unit test on this logic + resolveHeuristicToRunBasedOnOptimizationsAndSearchParameters( + originalRequest, + fwdHeuristics::enable, + revHeuristics::enable + ); + } + + /** + * Run standard "singe-iteration" raptor search to calculate heuristics - this should be really + * fast to run compared with a (multi-criteria) range-raptor search. + * + * @throws DestinationNotReachedException if destination is not reached. + */ + private void runHeuristics() { + if (isItPossibleToRunHeuristicsInParallel()) { + runHeuristicsInParallel(); + } else { + runHeuristicsSequentially(); + } + fwdHeuristics.debugCompareResult(revHeuristics); + } + + private RaptorResponse createAndRunDynamicRRWorker(RaptorRequest request) { + LOG.debug("Main request: {}", request); + RangeRaptor rangeRaptorRouter; + + // Create worker + if (request.profile().is(MULTI_CRITERIA)) { + rangeRaptorRouter = + config.createRangeRaptorWithMcWorker(transitData, request, getDestinationHeuristics()); + } else { + rangeRaptorRouter = config.createRangeRaptorWithStdWorker(transitData, request); + } + + // Route + var result = rangeRaptorRouter.route(); + + // create and return response + return new RaptorResponse<>( + result.extractPaths(), + new DefaultStopArrivals(result), + request, + // This method is not run unless the heuristic reached the destination + true + ); + } + + private boolean isItPossibleToRunHeuristicsInParallel() { + SearchParams s = originalRequest.searchParams(); + return ( + config.isMultiThreaded() && + originalRequest.runInParallel() && + s.isEarliestDepartureTimeSet() && + s.isLatestArrivalTimeSet() && + fwdHeuristics.isEnabled() && + revHeuristics.isEnabled() + ); + } + + /** + * @throws DestinationNotReachedException if destination is not reached + */ + private void runHeuristicsInParallel() { + fwdHeuristics.withRequest(originalRequest); + revHeuristics.withRequest(originalRequest); + Future asyncResult = null; + try { + asyncResult = config.threadPool().submit(fwdHeuristics::run); + revHeuristics.run(); + asyncResult.get(); + LOG.debug( + "Route using RangeRaptor - " + "REVERSE and FORWARD heuristic search performed in parallel." + ); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + // propagate interruption to the running task. + asyncResult.cancel(true); + throw new OTPRequestTimeoutException(); + } catch (ExecutionException e) { + if (e.getCause() instanceof DestinationNotReachedException) { + throw new DestinationNotReachedException(); + } + LOG.error(e.getMessage() + ". Request: " + originalRequest, e); + throw new IllegalStateException( + "Failed to run FORWARD/REVERSE heuristic search in parallel. Details: " + e.getMessage() + ); + } + } + + /** + * @throws DestinationNotReachedException if destination is not reached + */ + private void runHeuristicsSequentially() { + List> tasks = listTasksInOrder(); + + if (tasks.isEmpty()) { + return; + } + + // Run the first heuristic search + Heuristics result = runHeuristicSearchTask(tasks.get(0)); + calculateDynamicSearchParametersFromHeuristics(result); + + if (tasks.size() == 1) { + return; + } + + // Run the second heuristic search + runHeuristicSearchTask(tasks.get(1)); + } + + private Heuristics runHeuristicSearchTask(HeuristicSearchTask task) { + RaptorRequest request = task.getDirection().isForward() + ? requestForForwardHeurSearchWithDynamicSearchParams() + : requestForReverseHeurSearchWithDynamicSearchParams(); + + task.withRequest(request).run(); + + return task.result(); + } + + /** + * If the earliest-departure-time(EDT) is set, the task order should be: + *

    + *
  1. {@code FORWARD}
  2. + *
  3. {@code REVERSE}
  4. + *
+ * If no EDT is set, the latest-arrival-time is set, and the order should be the opposite, + * with {@code REVERSE} first + */ + private List> listTasksInOrder() { + boolean performForwardFirst = originalRequest.searchParams().isEarliestDepartureTimeSet(); + + List> list = performForwardFirst + ? List.of(fwdHeuristics, revHeuristics) + : List.of(revHeuristics, fwdHeuristics); + + return list.stream().filter(HeuristicSearchTask::isEnabled).collect(Collectors.toList()); + } + + private RaptorRequest requestForForwardHeurSearchWithDynamicSearchParams() { + if (originalRequest.searchParams().isEarliestDepartureTimeSet()) { + return originalRequest; + } + return originalRequest + .mutate() + .searchParams() + .earliestDepartureTime(transitData.getValidTransitDataStartTime()) + .build(); + } + + private RaptorRequest requestForReverseHeurSearchWithDynamicSearchParams() { + if (originalRequest.searchParams().isLatestArrivalTimeSet()) { + return originalRequest; + } + return originalRequest + .mutate() + .searchParams() + .latestArrivalTime( + transitData.getValidTransitDataEndTime() + + originalRequest.searchParams().accessEgressMaxDurationSeconds() + ) + .build(); + } + + private RaptorRequest requestWithDynamicSearchParams(RaptorRequest request) { + SearchParamsBuilder builder = request.mutate().searchParams(); + + if (!request.searchParams().isEarliestDepartureTimeSet()) { + builder.earliestDepartureTime(dynamicSearchWindowCalculator.getEarliestDepartureTime()); + } + if (!request.searchParams().isSearchWindowSet()) { + builder.searchWindowInSeconds(dynamicSearchWindowCalculator.getSearchWindowSeconds()); + } + // We do not set the latest-arrival-time, because we do not want to limit the forward + // multi-criteria search, it does not have much effect on the performance - we only risk + // losing optimal results. + return builder.build(); + } + + private void calculateDynamicSearchParametersFromHeuristics(@Nullable Heuristics heuristics) { + if (heuristics != null) { + dynamicSearchWindowCalculator + .withHeuristics( + heuristics.bestOverallJourneyTravelDuration(), + heuristics.minWaitTimeForJourneysReachingDestination() + ) + .calculate(); + } + } +} diff --git a/src/main/java/org/opentripplanner/raptor/spi/BoardAndAlightTime.java b/application/src/main/java/org/opentripplanner/raptor/spi/BoardAndAlightTime.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/spi/BoardAndAlightTime.java rename to application/src/main/java/org/opentripplanner/raptor/spi/BoardAndAlightTime.java diff --git a/src/main/java/org/opentripplanner/raptor/spi/DefaultSlackProvider.java b/application/src/main/java/org/opentripplanner/raptor/spi/DefaultSlackProvider.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/spi/DefaultSlackProvider.java rename to application/src/main/java/org/opentripplanner/raptor/spi/DefaultSlackProvider.java diff --git a/src/main/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEvent.java b/application/src/main/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEvent.java similarity index 96% rename from src/main/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEvent.java rename to application/src/main/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEvent.java index 9d29fc50d38..07984903f2a 100644 --- a/src/main/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEvent.java +++ b/application/src/main/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEvent.java @@ -1,7 +1,6 @@ package org.opentripplanner.raptor.spi; import java.util.function.Consumer; -import javax.annotation.Nonnull; import org.opentripplanner.raptor.api.model.RaptorConstants; import org.opentripplanner.raptor.api.model.RaptorTransferConstraint; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; @@ -28,7 +27,6 @@ public int time() { throw new UnsupportedOperationException(); } - @Nonnull @Override public RaptorTransferConstraint transferConstraint() { return RaptorTransferConstraint.REGULAR_TRANSFER; diff --git a/src/main/java/org/opentripplanner/raptor/spi/Flyweight.java b/application/src/main/java/org/opentripplanner/raptor/spi/Flyweight.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/spi/Flyweight.java rename to application/src/main/java/org/opentripplanner/raptor/spi/Flyweight.java diff --git a/src/main/java/org/opentripplanner/raptor/spi/IntIterator.java b/application/src/main/java/org/opentripplanner/raptor/spi/IntIterator.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/spi/IntIterator.java rename to application/src/main/java/org/opentripplanner/raptor/spi/IntIterator.java diff --git a/src/main/java/org/opentripplanner/raptor/spi/RaptorBoardOrAlightEvent.java b/application/src/main/java/org/opentripplanner/raptor/spi/RaptorBoardOrAlightEvent.java similarity index 98% rename from src/main/java/org/opentripplanner/raptor/spi/RaptorBoardOrAlightEvent.java rename to application/src/main/java/org/opentripplanner/raptor/spi/RaptorBoardOrAlightEvent.java index 5913f950969..bf71011a330 100644 --- a/src/main/java/org/opentripplanner/raptor/spi/RaptorBoardOrAlightEvent.java +++ b/application/src/main/java/org/opentripplanner/raptor/spi/RaptorBoardOrAlightEvent.java @@ -1,7 +1,6 @@ package org.opentripplanner.raptor.spi; import java.util.function.Consumer; -import javax.annotation.Nonnull; import org.opentripplanner.raptor.api.model.RaptorConstants; import org.opentripplanner.raptor.api.model.RaptorTransferConstraint; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; @@ -65,7 +64,6 @@ default int boardStopIndex() { * constraints assisiated with the boarding the {@link RaptorTransferConstraint#isRegularTransfer()} * is {@code true}. */ - @Nonnull RaptorTransferConstraint transferConstraint(); /** diff --git a/src/main/java/org/opentripplanner/raptor/spi/RaptorConstrainedBoardingSearch.java b/application/src/main/java/org/opentripplanner/raptor/spi/RaptorConstrainedBoardingSearch.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/spi/RaptorConstrainedBoardingSearch.java rename to application/src/main/java/org/opentripplanner/raptor/spi/RaptorConstrainedBoardingSearch.java diff --git a/src/main/java/org/opentripplanner/raptor/spi/RaptorCostCalculator.java b/application/src/main/java/org/opentripplanner/raptor/spi/RaptorCostCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/spi/RaptorCostCalculator.java rename to application/src/main/java/org/opentripplanner/raptor/spi/RaptorCostCalculator.java diff --git a/src/main/java/org/opentripplanner/raptor/spi/RaptorPathConstrainedTransferSearch.java b/application/src/main/java/org/opentripplanner/raptor/spi/RaptorPathConstrainedTransferSearch.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/spi/RaptorPathConstrainedTransferSearch.java rename to application/src/main/java/org/opentripplanner/raptor/spi/RaptorPathConstrainedTransferSearch.java diff --git a/src/main/java/org/opentripplanner/raptor/spi/RaptorRoute.java b/application/src/main/java/org/opentripplanner/raptor/spi/RaptorRoute.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/spi/RaptorRoute.java rename to application/src/main/java/org/opentripplanner/raptor/spi/RaptorRoute.java diff --git a/src/main/java/org/opentripplanner/raptor/spi/RaptorSlackProvider.java b/application/src/main/java/org/opentripplanner/raptor/spi/RaptorSlackProvider.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/spi/RaptorSlackProvider.java rename to application/src/main/java/org/opentripplanner/raptor/spi/RaptorSlackProvider.java diff --git a/src/main/java/org/opentripplanner/raptor/spi/RaptorTimeTable.java b/application/src/main/java/org/opentripplanner/raptor/spi/RaptorTimeTable.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/spi/RaptorTimeTable.java rename to application/src/main/java/org/opentripplanner/raptor/spi/RaptorTimeTable.java diff --git a/src/main/java/org/opentripplanner/raptor/spi/RaptorTransitDataProvider.java b/application/src/main/java/org/opentripplanner/raptor/spi/RaptorTransitDataProvider.java similarity index 98% rename from src/main/java/org/opentripplanner/raptor/spi/RaptorTransitDataProvider.java rename to application/src/main/java/org/opentripplanner/raptor/spi/RaptorTransitDataProvider.java index b4accdbcc2b..a442f0a3216 100644 --- a/src/main/java/org/opentripplanner/raptor/spi/RaptorTransitDataProvider.java +++ b/application/src/main/java/org/opentripplanner/raptor/spi/RaptorTransitDataProvider.java @@ -2,11 +2,11 @@ import java.util.Iterator; import javax.annotation.Nonnull; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; import org.opentripplanner.raptor.api.model.RaptorTransfer; import org.opentripplanner.raptor.api.model.RaptorTransferConstraint; import org.opentripplanner.raptor.api.model.RaptorTripPattern; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; -import org.opentripplanner.raptor.api.path.RaptorStopNameResolver; import org.opentripplanner.raptor.api.request.RaptorRequest; /** @@ -120,7 +120,6 @@ default void setup() {} * method is used by Raptor to translate from the stop index to a string which should be short and * identify the stop given the related pattern, for example the stop name would be great. */ - @Nonnull RaptorStopNameResolver stopNameResolver(); /** diff --git a/src/main/java/org/opentripplanner/raptor/spi/RaptorTripScheduleSearch.java b/application/src/main/java/org/opentripplanner/raptor/spi/RaptorTripScheduleSearch.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/spi/RaptorTripScheduleSearch.java rename to application/src/main/java/org/opentripplanner/raptor/spi/RaptorTripScheduleSearch.java diff --git a/src/main/java/org/opentripplanner/raptor/spi/UnknownPath.java b/application/src/main/java/org/opentripplanner/raptor/spi/UnknownPath.java similarity index 98% rename from src/main/java/org/opentripplanner/raptor/spi/UnknownPath.java rename to application/src/main/java/org/opentripplanner/raptor/spi/UnknownPath.java index 24eae14f997..91de7373650 100644 --- a/src/main/java/org/opentripplanner/raptor/spi/UnknownPath.java +++ b/application/src/main/java/org/opentripplanner/raptor/spi/UnknownPath.java @@ -3,13 +3,13 @@ import java.util.List; import java.util.stream.Stream; import org.opentripplanner.raptor.api.model.RaptorConstants; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.path.AccessPathLeg; import org.opentripplanner.raptor.api.path.EgressPathLeg; import org.opentripplanner.raptor.api.path.PathLeg; import org.opentripplanner.raptor.api.path.PathStringBuilder; import org.opentripplanner.raptor.api.path.RaptorPath; -import org.opentripplanner.raptor.api.path.RaptorStopNameResolver; import org.opentripplanner.raptor.api.path.TransitPathLeg; /** diff --git a/src/main/java/org/opentripplanner/raptor/util/BitSetIterator.java b/application/src/main/java/org/opentripplanner/raptor/util/BitSetIterator.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/util/BitSetIterator.java rename to application/src/main/java/org/opentripplanner/raptor/util/BitSetIterator.java diff --git a/src/main/java/org/opentripplanner/raptor/util/CompareIntArrays.java b/application/src/main/java/org/opentripplanner/raptor/util/CompareIntArrays.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/util/CompareIntArrays.java rename to application/src/main/java/org/opentripplanner/raptor/util/CompareIntArrays.java diff --git a/src/main/java/org/opentripplanner/raptor/util/IntIterators.java b/application/src/main/java/org/opentripplanner/raptor/util/IntIterators.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/util/IntIterators.java rename to application/src/main/java/org/opentripplanner/raptor/util/IntIterators.java diff --git a/application/src/main/java/org/opentripplanner/raptor/util/composite/CompositeUtil.java b/application/src/main/java/org/opentripplanner/raptor/util/composite/CompositeUtil.java new file mode 100644 index 00000000000..057e30cf7e7 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/raptor/util/composite/CompositeUtil.java @@ -0,0 +1,54 @@ +package org.opentripplanner.raptor.util.composite; + +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.stream.Stream; +import javax.annotation.Nullable; + +public class CompositeUtil { + + /** + * Take a list of children and return a composite instance. {@code null} values are skipped. If + * the result is empty {@code null} is returned. If just one listener is passed in the listener + * it-self is returned (without any composite wrapper). + * + * @param The base type which the composite inherit from. + * @param compositeFactory Factory method to create a new composite. + * @param isComposite used to test if an instance is of a composite type. + * @param listCompositeChildren is a function used to extract all children out of a composite + * instance. + * @return {@code null} if the list of children is empty - ignoring {@code null} elements. + * Returning THE element if just one element exists. And returning a composite with a + * list of children if more than one element exists. The order is kept "as is". Any + * composite children flattened, the children are inserted in it place. + */ + @Nullable + @SafeVarargs + public static T of( + Function, T> compositeFactory, + Predicate isComposite, + Function> listCompositeChildren, + T... children + ) { + Objects.requireNonNull(children); + + var list = Arrays + .stream(children) + .filter(Objects::nonNull) + .flatMap(it -> isComposite.test(it) ? listCompositeChildren.apply(it).stream() : Stream.of(it) + ) + .toList(); + + if (list.isEmpty()) { + return null; + } + if (list.size() == 1) { + return list.getFirst(); + } + return compositeFactory.apply(list); + } +} diff --git a/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoComparator.java b/application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoComparator.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoComparator.java rename to application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoComparator.java diff --git a/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSet.java b/application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSet.java similarity index 98% rename from src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSet.java rename to application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSet.java index 39656d433e9..536378e3722 100644 --- a/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSet.java +++ b/application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSet.java @@ -211,6 +211,14 @@ protected void notifyElementMoved(int fromIndex, int toIndex) { // Noop } + protected ParetoComparator getComparator() { + return comparator; + } + + protected ParetoSetEventListener getEventListener() { + return eventListener; + } + /** * Return an iterable instance. This is made to be as FAST AS POSSIBLE, sacrificing thread-safety * and modifiable protection. diff --git a/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListener.java b/application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListener.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListener.java rename to application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListener.java diff --git a/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerComposite.java b/application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerComposite.java similarity index 52% rename from src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerComposite.java rename to application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerComposite.java index 01d68af4392..a8a74f8c80e 100644 --- a/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerComposite.java +++ b/application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerComposite.java @@ -1,9 +1,9 @@ package org.opentripplanner.raptor.util.paretoset; -import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.List; +import javax.annotation.Nullable; +import org.opentripplanner.raptor.util.composite.CompositeUtil; /** * The {@link ParetoSet} do only support ONE listener, this class uses the composite pattern to @@ -14,17 +14,29 @@ */ public class ParetoSetEventListenerComposite implements ParetoSetEventListener { - private final List> listeners = new ArrayList<>(); + private final List> listeners; + /** + * Take a list of listeners and return a composite listener. Input listeners, which are {@code null}, + * are skipped. If no listeners are provided or all listeners are {@code null}, then + * {@code null} is returned. If just one listener is passed in the listener it-self is returned + * (without any wrapper). If more than one listener exists, a composite instance is returned. + */ + @Nullable @SafeVarargs - public ParetoSetEventListenerComposite(ParetoSetEventListener... listeners) { - this(Arrays.asList(listeners)); + public static ParetoSetEventListener of(ParetoSetEventListener... listeners) { + return CompositeUtil.of( + ParetoSetEventListenerComposite::new, + it -> it instanceof ParetoSetEventListenerComposite, + it -> ((ParetoSetEventListenerComposite) it).listeners, + listeners + ); } private ParetoSetEventListenerComposite( Collection> listeners ) { - this.listeners.addAll(listeners); + this.listeners = List.copyOf(listeners); } @Override @@ -47,4 +59,9 @@ public void notifyElementRejected(T element, T rejectedByElement) { it.notifyElementRejected(element, rejectedByElement); } } + + @Override + public String toString() { + return "ParetoSetEventListenerComposite{" + "listeners=" + listeners + '}'; + } } diff --git a/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetWithMarker.java b/application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetWithMarker.java similarity index 100% rename from src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetWithMarker.java rename to application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetWithMarker.java diff --git a/src/main/java/org/opentripplanner/routing/TripTimeOnDateHelper.java b/application/src/main/java/org/opentripplanner/routing/TripTimeOnDateHelper.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/TripTimeOnDateHelper.java rename to application/src/main/java/org/opentripplanner/routing/TripTimeOnDateHelper.java diff --git a/src/main/java/org/opentripplanner/routing/alertpatch/AlertCause.java b/application/src/main/java/org/opentripplanner/routing/alertpatch/AlertCause.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/alertpatch/AlertCause.java rename to application/src/main/java/org/opentripplanner/routing/alertpatch/AlertCause.java diff --git a/src/main/java/org/opentripplanner/routing/alertpatch/AlertEffect.java b/application/src/main/java/org/opentripplanner/routing/alertpatch/AlertEffect.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/alertpatch/AlertEffect.java rename to application/src/main/java/org/opentripplanner/routing/alertpatch/AlertEffect.java diff --git a/src/main/java/org/opentripplanner/routing/alertpatch/AlertSeverity.java b/application/src/main/java/org/opentripplanner/routing/alertpatch/AlertSeverity.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/alertpatch/AlertSeverity.java rename to application/src/main/java/org/opentripplanner/routing/alertpatch/AlertSeverity.java diff --git a/src/main/java/org/opentripplanner/routing/alertpatch/AlertUrl.java b/application/src/main/java/org/opentripplanner/routing/alertpatch/AlertUrl.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/alertpatch/AlertUrl.java rename to application/src/main/java/org/opentripplanner/routing/alertpatch/AlertUrl.java diff --git a/src/main/java/org/opentripplanner/routing/alertpatch/EntityKey.java b/application/src/main/java/org/opentripplanner/routing/alertpatch/EntityKey.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/alertpatch/EntityKey.java rename to application/src/main/java/org/opentripplanner/routing/alertpatch/EntityKey.java diff --git a/src/main/java/org/opentripplanner/routing/alertpatch/EntitySelector.java b/application/src/main/java/org/opentripplanner/routing/alertpatch/EntitySelector.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/alertpatch/EntitySelector.java rename to application/src/main/java/org/opentripplanner/routing/alertpatch/EntitySelector.java diff --git a/src/main/java/org/opentripplanner/routing/alertpatch/StopCondition.java b/application/src/main/java/org/opentripplanner/routing/alertpatch/StopCondition.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/alertpatch/StopCondition.java rename to application/src/main/java/org/opentripplanner/routing/alertpatch/StopCondition.java diff --git a/src/main/java/org/opentripplanner/routing/alertpatch/StopConditionsHelper.java b/application/src/main/java/org/opentripplanner/routing/alertpatch/StopConditionsHelper.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/alertpatch/StopConditionsHelper.java rename to application/src/main/java/org/opentripplanner/routing/alertpatch/StopConditionsHelper.java diff --git a/src/main/java/org/opentripplanner/routing/alertpatch/TimePeriod.java b/application/src/main/java/org/opentripplanner/routing/alertpatch/TimePeriod.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/alertpatch/TimePeriod.java rename to application/src/main/java/org/opentripplanner/routing/alertpatch/TimePeriod.java diff --git a/src/main/java/org/opentripplanner/routing/alertpatch/TransitAlert.java b/application/src/main/java/org/opentripplanner/routing/alertpatch/TransitAlert.java similarity index 98% rename from src/main/java/org/opentripplanner/routing/alertpatch/TransitAlert.java rename to application/src/main/java/org/opentripplanner/routing/alertpatch/TransitAlert.java index d7a3c93abe5..4555573c8ca 100644 --- a/src/main/java/org/opentripplanner/routing/alertpatch/TransitAlert.java +++ b/application/src/main/java/org/opentripplanner/routing/alertpatch/TransitAlert.java @@ -8,7 +8,6 @@ import java.util.Objects; import java.util.Optional; import java.util.Set; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.transit.model.framework.AbstractTransitEntity; @@ -214,7 +213,7 @@ public boolean noServiceAt(Instant instant) { } @Override - public boolean sameAs(@Nonnull TransitAlert other) { + public boolean sameAs(TransitAlert other) { return ( getId().equals(other.getId()) && Objects.equals(headerText, other.headerText) && @@ -237,7 +236,6 @@ public boolean sameAs(@Nonnull TransitAlert other) { ); } - @Nonnull @Override public TransitBuilder copy() { return new TransitAlertBuilder(this); diff --git a/src/main/java/org/opentripplanner/routing/alertpatch/TransitAlertBuilder.java b/application/src/main/java/org/opentripplanner/routing/alertpatch/TransitAlertBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/alertpatch/TransitAlertBuilder.java rename to application/src/main/java/org/opentripplanner/routing/alertpatch/TransitAlertBuilder.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/RoutingWorker.java b/application/src/main/java/org/opentripplanner/routing/algorithm/RoutingWorker.java similarity index 96% rename from src/main/java/org/opentripplanner/routing/algorithm/RoutingWorker.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/RoutingWorker.java index 7ac3dd1caf6..1e2dd3f2d4e 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/RoutingWorker.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/RoutingWorker.java @@ -230,10 +230,18 @@ private Duration searchWindowUsed() { : Duration.ofSeconds(raptorSearchParamsUsed.searchWindowInSeconds()); } - private Void routeDirectStreet( + private List routeDirectStreet( List itineraries, Collection routingErrors ) { + // TODO: Add support for via search to the direct-street search and remove this. + // The direct search is used to prune away silly transit results and it + // would be nice to also support via as a feature in the direct-street + // search. + if (request.isViaSearch()) { + return null; + } + debugTimingAggregator.startedDirectStreetRouter(); try { itineraries.addAll(DirectStreetRouter.route(serverContext, request)); diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChain.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChain.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChain.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChain.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChainBuilder.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChainBuilder.java similarity index 97% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChainBuilder.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChainBuilder.java index 071814a7abf..3ff85db467a 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChainBuilder.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChainBuilder.java @@ -25,6 +25,7 @@ import org.opentripplanner.routing.algorithm.filterchain.filters.street.RemoveNonTransitItinerariesBasedOnGeneralizedCost; import org.opentripplanner.routing.algorithm.filterchain.filters.street.RemoveParkAndRideWithMostlyWalkingFilter; import org.opentripplanner.routing.algorithm.filterchain.filters.street.RemoveWalkOnlyFilter; +import org.opentripplanner.routing.algorithm.filterchain.filters.system.FlexSearchWindowFilter; import org.opentripplanner.routing.algorithm.filterchain.filters.system.NumItinerariesFilter; import org.opentripplanner.routing.algorithm.filterchain.filters.system.OutsideSearchWindowFilter; import org.opentripplanner.routing.algorithm.filterchain.filters.system.PagingFilter; @@ -89,6 +90,7 @@ public class ItineraryListFilterChainBuilder { private boolean removeTransitIfWalkingIsBetter = true; private ItinerarySortKey itineraryPageCut; private boolean transitGroupPriorityUsed = false; + private boolean filterDirectFlexBySearchWindow = true; /** * Sandbox filters which decorate the itineraries with extra information. @@ -470,6 +472,13 @@ public ItineraryListFilterChain build() { ); } + if (earliestDepartureTime != null && filterDirectFlexBySearchWindow) { + addRemoveFilter( + filters, + new FlexSearchWindowFilter(earliestDepartureTime, searchWindow, sortOrder) + ); + } + // Remove itineraries present in the page retrieved before this page/search. if (itineraryPageCut != null) { addRemoveFilter( @@ -533,6 +542,11 @@ public ItineraryListFilterChain build() { return new ItineraryListFilterChain(filters, debugHandler); } + public ItineraryListFilterChainBuilder withFilterDirectFlexBySearchWindow(boolean b) { + this.filterDirectFlexBySearchWindow = b; + return this; + } + /** * If enabled, this adds the filter to remove itineraries which have the same stops and routes. * These are sometimes called "time-shifted duplicates" but since those terms have so many diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/api/GroupBySimilarity.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/api/GroupBySimilarity.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/api/GroupBySimilarity.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/api/GroupBySimilarity.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/api/TransitGeneralizedCostFilterParams.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/api/TransitGeneralizedCostFilterParams.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/api/TransitGeneralizedCostFilterParams.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/api/TransitGeneralizedCostFilterParams.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveBikeRentalWithMostlyWalking.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveBikeRentalWithMostlyWalking.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveBikeRentalWithMostlyWalking.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveBikeRentalWithMostlyWalking.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveNonTransitItinerariesBasedOnGeneralizedCost.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveNonTransitItinerariesBasedOnGeneralizedCost.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveNonTransitItinerariesBasedOnGeneralizedCost.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveNonTransitItinerariesBasedOnGeneralizedCost.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveParkAndRideWithMostlyWalkingFilter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveParkAndRideWithMostlyWalkingFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveParkAndRideWithMostlyWalkingFilter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveParkAndRideWithMostlyWalkingFilter.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveWalkOnlyFilter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveWalkOnlyFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveWalkOnlyFilter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveWalkOnlyFilter.java diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/FlexSearchWindowFilter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/FlexSearchWindowFilter.java new file mode 100644 index 00000000000..efbb9bf4d08 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/FlexSearchWindowFilter.java @@ -0,0 +1,65 @@ +package org.opentripplanner.routing.algorithm.filterchain.filters.system; + +import java.time.Duration; +import java.time.Instant; +import java.util.function.Predicate; +import org.opentripplanner.model.plan.Itinerary; +import org.opentripplanner.model.plan.SortOrder; +import org.opentripplanner.routing.algorithm.filterchain.framework.spi.RemoveItineraryFlagger; + +/** + * The flex router doesn't use the transit router's search-window, but nevertheless using it + * for filtering is useful when combining flex with transit. + *

+ * The flex router also searches the previous day (arrive by) or the next one (depart after). + * If you didn't filter the flex results by something you could get yesterday's or tomorrow's + * trips where you would not expect it. + */ +public class FlexSearchWindowFilter implements RemoveItineraryFlagger { + + public static final String TAG = "flex-outside-search-window"; + + private final Instant earliestDepartureTime; + private final Instant latestArrivalTime; + private final SortOrder sortOrder; + + public FlexSearchWindowFilter( + Instant earliestDepartureTime, + Duration searchWindow, + SortOrder sortOrder + ) { + this.earliestDepartureTime = earliestDepartureTime; + this.latestArrivalTime = earliestDepartureTime.plus(searchWindow); + this.sortOrder = sortOrder; + } + + @Override + public String name() { + return TAG; + } + + @Override + public Predicate shouldBeFlaggedForRemoval() { + return it -> { + if (it.isDirectFlex()) { + return switch (sortOrder) { + case STREET_AND_DEPARTURE_TIME -> { + var time = it.startTime().toInstant(); + yield time.isBefore(earliestDepartureTime); + } + case STREET_AND_ARRIVAL_TIME -> { + var time = it.startTime().toInstant(); + yield time.isAfter(latestArrivalTime); + } + }; + } else { + return false; + } + }; + } + + @Override + public boolean skipAlreadyFlaggedItineraries() { + return false; + } +} diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/NumItinerariesFilter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/NumItinerariesFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/NumItinerariesFilter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/NumItinerariesFilter.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/NumItinerariesFilterResults.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/NumItinerariesFilterResults.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/NumItinerariesFilterResults.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/NumItinerariesFilterResults.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/OutsideSearchWindowFilter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/OutsideSearchWindowFilter.java similarity index 75% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/OutsideSearchWindowFilter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/OutsideSearchWindowFilter.java index ba3ef4b04f3..5ab6834437b 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/OutsideSearchWindowFilter.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/OutsideSearchWindowFilter.java @@ -7,8 +7,10 @@ import org.opentripplanner.routing.algorithm.filterchain.framework.spi.RemoveItineraryFlagger; /** - * This filter will remove all itineraries that are outside the search-window. In some - * cases the access is time-shifted after the end of the search-window. These results + * This filter will remove all itineraries that are both search-window aware and outside the + * search-window. Only those that use transit are search-window aware, street and flex itineraries are not. + *

+ * In some cases the access is time-shifted after the end of the search-window. These results * should appear again when paging to the next page. Hence, this filter will remove * such itineraries. The same is true for when paging to the previous page for arriveBy=true. *

@@ -35,8 +37,12 @@ public String name() { @Override public Predicate shouldBeFlaggedForRemoval() { return it -> { - var time = it.startTime().toInstant(); - return time.isBefore(earliestDepartureTime) || !time.isBefore(latestDepartureTime); + if (it.isSearchWindowAware()) { + var time = it.startTime().toInstant(); + return time.isBefore(earliestDepartureTime) || !time.isBefore(latestDepartureTime); + } else { + return false; + } }; } diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/PagingFilter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/PagingFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/PagingFilter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/PagingFilter.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/SingleCriteriaComparator.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/SingleCriteriaComparator.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/SingleCriteriaComparator.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/SingleCriteriaComparator.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/Group.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/Group.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/Group.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/Group.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/Item.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/Item.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/Item.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/Item.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/McMaxLimitFilter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/McMaxLimitFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/McMaxLimitFilter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/McMaxLimitFilter.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/State.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/State.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/State.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/State.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/DecorateTransitAlert.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/DecorateTransitAlert.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/DecorateTransitAlert.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/DecorateTransitAlert.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/KeepItinerariesWithFewestTransfers.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/KeepItinerariesWithFewestTransfers.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/KeepItinerariesWithFewestTransfers.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/KeepItinerariesWithFewestTransfers.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveItinerariesWithShortStreetLeg.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveItinerariesWithShortStreetLeg.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveItinerariesWithShortStreetLeg.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveItinerariesWithShortStreetLeg.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveTransitIfStreetOnlyIsBetter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveTransitIfStreetOnlyIsBetter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveTransitIfStreetOnlyIsBetter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveTransitIfStreetOnlyIsBetter.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveTransitIfWalkingIsBetter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveTransitIfWalkingIsBetter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveTransitIfWalkingIsBetter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveTransitIfWalkingIsBetter.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/TransitGeneralizedCostFilter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/TransitGeneralizedCostFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/TransitGeneralizedCostFilter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/TransitGeneralizedCostFilter.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/group/RemoveIfFirstOrLastTripIsTheSame.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/group/RemoveIfFirstOrLastTripIsTheSame.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/group/RemoveIfFirstOrLastTripIsTheSame.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/group/RemoveIfFirstOrLastTripIsTheSame.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/group/RemoveOtherThanSameLegsMaxGeneralizedCost.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/group/RemoveOtherThanSameLegsMaxGeneralizedCost.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/group/RemoveOtherThanSameLegsMaxGeneralizedCost.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/group/RemoveOtherThanSameLegsMaxGeneralizedCost.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/DecorateFilter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/DecorateFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/DecorateFilter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/DecorateFilter.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/GroupByFilter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/GroupByFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/GroupByFilter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/GroupByFilter.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/MaxLimit.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/MaxLimit.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/MaxLimit.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/MaxLimit.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/RemoveFilter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/RemoveFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/RemoveFilter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/RemoveFilter.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/SortingFilter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/SortingFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/SortingFilter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/SortingFilter.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filterchain/DeleteResultHandler.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filterchain/DeleteResultHandler.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filterchain/DeleteResultHandler.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filterchain/DeleteResultHandler.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filterchain/RoutingErrorsAttacher.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filterchain/RoutingErrorsAttacher.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filterchain/RoutingErrorsAttacher.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/filterchain/RoutingErrorsAttacher.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupByAllSameStations.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupByAllSameStations.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupByAllSameStations.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupByAllSameStations.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupByDistance.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupByDistance.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupByDistance.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupByDistance.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupBySameFirstOrLastTrip.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupBySameFirstOrLastTrip.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupBySameFirstOrLastTrip.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupBySameFirstOrLastTrip.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupBySameRoutesAndStops.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupBySameRoutesAndStops.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupBySameRoutesAndStops.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupBySameRoutesAndStops.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/sort/SortOrderComparator.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/sort/SortOrderComparator.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/sort/SortOrderComparator.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/sort/SortOrderComparator.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/spi/GroupId.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/spi/GroupId.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/spi/GroupId.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/spi/GroupId.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/spi/ItineraryDecorator.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/spi/ItineraryDecorator.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/spi/ItineraryDecorator.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/spi/ItineraryDecorator.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/spi/ItineraryListFilter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/spi/ItineraryListFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/spi/ItineraryListFilter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/spi/ItineraryListFilter.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/spi/RemoveItineraryFlagger.java b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/spi/RemoveItineraryFlagger.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/spi/RemoveItineraryFlagger.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/framework/spi/RemoveItineraryFlagger.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/images/ItineraryListFilterChain.excalidraw b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/images/ItineraryListFilterChain.excalidraw similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/images/ItineraryListFilterChain.excalidraw rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/images/ItineraryListFilterChain.excalidraw diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/images/ItineraryListFilterChain.svg b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/images/ItineraryListFilterChain.svg similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/images/ItineraryListFilterChain.svg rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/images/ItineraryListFilterChain.svg diff --git a/src/main/java/org/opentripplanner/routing/algorithm/filterchain/package.md b/application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/package.md similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/filterchain/package.md rename to application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/package.md diff --git a/src/main/java/org/opentripplanner/routing/algorithm/mapping/AlertToLegMapper.java b/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/AlertToLegMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/mapping/AlertToLegMapper.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/mapping/AlertToLegMapper.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/mapping/GraphPathToItineraryMapper.java b/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/GraphPathToItineraryMapper.java similarity index 99% rename from src/main/java/org/opentripplanner/routing/algorithm/mapping/GraphPathToItineraryMapper.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/mapping/GraphPathToItineraryMapper.java index 11302098f25..2e7bf1b7040 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/mapping/GraphPathToItineraryMapper.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/GraphPathToItineraryMapper.java @@ -134,7 +134,7 @@ public Itinerary generateItinerary(GraphPath path) { } } - Itinerary itinerary = new Itinerary(legs); + Itinerary itinerary = Itinerary.createDirectItinerary(legs); calculateElevations(itinerary, path.edges); diff --git a/src/main/java/org/opentripplanner/routing/algorithm/mapping/ItinerariesHelper.java b/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/ItinerariesHelper.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/mapping/ItinerariesHelper.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/mapping/ItinerariesHelper.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/mapping/PagingServiceFactory.java b/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/PagingServiceFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/mapping/PagingServiceFactory.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/mapping/PagingServiceFactory.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapper.java b/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapper.java similarity index 89% rename from src/main/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapper.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapper.java index d7098c20661..a81dd4e7083 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapper.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapper.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.Objects; import org.opentripplanner.astar.model.GraphPath; +import org.opentripplanner.framework.application.OTPFeature; import org.opentripplanner.framework.geometry.GeometryUtils; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.model.GenericLocation; @@ -105,9 +106,16 @@ public Itinerary createItinerary(RaptorPath path) { Leg transitLeg = null; + PathLeg previousLeg = null; while (!pathLeg.isEgressLeg()) { // Map transit leg if (pathLeg.isTransitLeg()) { + if ( + OTPFeature.ExtraTransferLegOnSameStop.isOn() && + isPathTransferAtSameStop(previousLeg, pathLeg) + ) { + legs.add(createTransferLegAtSameStop(previousLeg, pathLeg)); + } transitLeg = mapTransitLeg(transitLeg, pathLeg.asTransitLeg()); legs.add(transitLeg); } @@ -123,6 +131,7 @@ else if (pathLeg.isTransferLeg()) { } } + previousLeg = pathLeg; pathLeg = pathLeg.nextLeg(); } @@ -131,7 +140,7 @@ else if (pathLeg.isTransferLeg()) { Itinerary mapped = mapEgressLeg(egressPathLeg); legs.addAll(mapped == null ? List.of() : mapped.getLegs()); - Itinerary itinerary = new Itinerary(legs); + Itinerary itinerary = Itinerary.createScheduledTransitItinerary(legs); // Map general itinerary fields itinerary.setArrivedAtDestinationWithRentedVehicle( @@ -164,6 +173,19 @@ else if (pathLeg.isTransferLeg()) { return itinerary; } + private static boolean isPathTransferAtSameStop( + PathLeg previousLeg, + PathLeg currentLeg + ) { + return ( + previousLeg != null && + previousLeg.isTransitLeg() && + currentLeg.isTransitLeg() && + !previousLeg.asTransitLeg().isStaySeatedOntoNextLeg() && + (previousLeg.asTransitLeg().toStop() == currentLeg.asTransitLeg().fromStop()) + ); + } + private List mapAccessLeg(AccessPathLeg accessPathLeg) { if (accessPathLeg.access().isFree()) { return List.of(); @@ -264,6 +286,27 @@ private boolean isFree(EgressPathLeg egressPathLeg) { return egressPathLeg.egress().isFree(); } + /** + * If a routing result transfers at the very same stop, RAPTOR doesn't add a path leg. However, + * sometimes we want to create a zero distance leg so a UI can show a transfer. Since it would + * be considered backwards-incompatible, this is an opt-in feature. + */ + private Leg createTransferLegAtSameStop(PathLeg previousLeg, PathLeg nextLeg) { + var transferStop = Place.forStop(transitLayer.getStopByIndex(previousLeg.toStop())); + return StreetLeg + .create() + .withMode(TraverseMode.WALK) + .withStartTime(createZonedDateTime(previousLeg.toTime())) + .withEndTime(createZonedDateTime(nextLeg.fromTime())) + .withFrom(transferStop) + .withTo(transferStop) + .withDistanceMeters(0) + .withGeneralizedCost(0) + .withGeometry(GeometryUtils.makeLineString(transferStop.coordinate, transferStop.coordinate)) + .withWalkSteps(List.of()) + .build(); + } + private List mapTransferLeg(TransferPathLeg pathLeg, TraverseMode transferMode) { var transferFromStop = transitLayer.getStopByIndex(pathLeg.fromStop()); var transferToStop = transitLayer.getStopByIndex(pathLeg.toStop()); @@ -347,7 +390,7 @@ private List mapNonTransitLeg( } private Itinerary mapDirectPath(RaptorPath path) { - return new Itinerary( + return Itinerary.createScheduledTransitItinerary( List.of( new UnknownTransitPathLeg( mapPlace(request.from()), diff --git a/src/main/java/org/opentripplanner/routing/algorithm/mapping/RouteRequestToFilterChainMapper.java b/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/RouteRequestToFilterChainMapper.java similarity index 98% rename from src/main/java/org/opentripplanner/routing/algorithm/mapping/RouteRequestToFilterChainMapper.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/mapping/RouteRequestToFilterChainMapper.java index c1fab68f999..01cba0dd47f 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/mapping/RouteRequestToFilterChainMapper.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/RouteRequestToFilterChainMapper.java @@ -92,6 +92,7 @@ public static ItineraryListFilterChain createFilterChain( .withPageCursorInputSubscriber(pageCursorInputSubscriber) .withRemoveWalkAllTheWayResults(removeWalkAllTheWayResults) .withRemoveTransitIfWalkingIsBetter(true) + .withFilterDirectFlexBySearchWindow(params.filterDirectFlexBySearchWindow()) .withDebugEnabled(params.debug()); if (!request.preferences().transit().relaxTransitGroupPriority().isNormal()) { diff --git a/src/main/java/org/opentripplanner/routing/algorithm/mapping/RoutingResponseMapper.java b/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/RoutingResponseMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/mapping/RoutingResponseMapper.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/mapping/RoutingResponseMapper.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/mapping/StatesToWalkStepsMapper.java b/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/StatesToWalkStepsMapper.java similarity index 99% rename from src/main/java/org/opentripplanner/routing/algorithm/mapping/StatesToWalkStepsMapper.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/mapping/StatesToWalkStepsMapper.java index 94905bb840a..32f5ccf533b 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/mapping/StatesToWalkStepsMapper.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/StatesToWalkStepsMapper.java @@ -7,7 +7,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.Geometry; import org.opentripplanner.framework.geometry.DirectionUtils; @@ -296,7 +295,6 @@ private void processState(State backState, State forwardState) { current.addEdge(edge); } - @Nonnull private static RelativeDirection relativeDirectionForTransitLink(StreetTransitEntranceLink link) { if (link.isExit()) { return EXIT_STATION; diff --git a/src/main/java/org/opentripplanner/routing/algorithm/mapping/TripPlanMapper.java b/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/TripPlanMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/mapping/TripPlanMapper.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/mapping/TripPlanMapper.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/api/DefaultTripPattern.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/api/DefaultTripPattern.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/api/DefaultTripPattern.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/api/DefaultTripPattern.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/api/SlackProvider.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/api/SlackProvider.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/api/SlackProvider.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/api/SlackProvider.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/path/PathDiff.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/path/PathDiff.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/path/PathDiff.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/path/PathDiff.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/AdditionalSearchDays.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/AdditionalSearchDays.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/AdditionalSearchDays.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/AdditionalSearchDays.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/FilterTransitWhenDirectModeIsEmpty.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/FilterTransitWhenDirectModeIsEmpty.java similarity index 81% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/FilterTransitWhenDirectModeIsEmpty.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/FilterTransitWhenDirectModeIsEmpty.java index 01a8c9ab112..0ed9bdb0558 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/FilterTransitWhenDirectModeIsEmpty.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/FilterTransitWhenDirectModeIsEmpty.java @@ -5,13 +5,13 @@ /** *

- * In OTP the street search and transit search is done as to separate searches. The results is then - * merged and filtered to remove none optimal itineraries. But, when the client do NOT provide a - * ´directMode´, OTP do not do the streetSearch. And, the removal of none optimal results is not - * done, there is not street results to use to prune bad transit results with. In other words OTP is + * In OTP, the street search and transit search are done separately. The results are then + * merged and filtered to remove non-optimal itineraries. But, when the client does NOT provide a + * ´directMode´, OTP does not do the streetSearch. And, the removal of non-optimal results is not + * done, there are no street results to use to prune bad transit results with. In other words, OTP is * forced to return at least one itinerary with at least one transit leg. So, instead of walking - * maybe 100 meters, the OTP suggest you need to walk to the closest buss stop, take the bus one - * stop and walk back, oten with more walking than just those 100 meters. + * maybe 100 meters, OTP suggests you need to walk to the closest bus stop, take the bus for one + * stop and walk back, often with more walking than just those 100 meters. *

* Let say OTP produces these internal results: *

    @@ -31,7 +31,7 @@ *

    * If no directMode is set, the responsibility of this class it to always filter away itineraries * with a generalized-cost that is higher than the WALK-ALL-THE-WAY. We achieve this by setting the - * directMode before searching. This trigger the direct street search, and later the result is + * directMode before searching. This triggers the direct street search, and later the result is * passed into the filter chain where none optimal results are removed. Finally the street itinerary * is removed and the request street mode rest to the original state. *

    @@ -55,7 +55,7 @@ public class FilterTransitWhenDirectModeIsEmpty { private final StreetMode originalDirectMode; public FilterTransitWhenDirectModeIsEmpty(RequestModes modes) { - this.originalDirectMode = modes.directMode; + this(modes.directMode); } public FilterTransitWhenDirectModeIsEmpty(StreetMode originalDirectMode) { diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/TransitRouter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/TransitRouter.java similarity index 92% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/TransitRouter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/TransitRouter.java index 37bb7270902..e72d8ee1427 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/TransitRouter.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/TransitRouter.java @@ -11,6 +11,7 @@ import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; +import java.util.stream.IntStream; import org.opentripplanner.ext.ridehailing.RideHailingAccessShifter; import org.opentripplanner.framework.application.OTPFeature; import org.opentripplanner.model.plan.Itinerary; @@ -41,7 +42,10 @@ import org.opentripplanner.routing.framework.DebugTimingAggregator; import org.opentripplanner.standalone.api.OtpServerRequestContext; import org.opentripplanner.street.search.TemporaryVerticesContainer; +import org.opentripplanner.transit.model.framework.EntityNotFoundException; +import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.grouppriority.TransitGroupPriorityService; +import org.opentripplanner.transit.model.site.StopLocation; public class TransitRouter { @@ -133,7 +137,8 @@ private TransitRouterResult route() { serverContext.raptorConfig().isMultiThreaded(), accessEgresses.getAccesses(), accessEgresses.getEgresses(), - serverContext.meterRegistry() + serverContext.meterRegistry(), + this::listStopIndexes ); // Route transit @@ -250,20 +255,19 @@ private Collection fetchAccessEgresses(AccessEgre .valueOf(streetRequest.mode()); int stopCountLimit = accessRequest.preferences().street().accessEgress().maxStopCount(); - var nearbyStops = AccessEgressRouter.streetSearch( + var nearbyStops = AccessEgressRouter.findAccessEgresses( accessRequest, temporaryVerticesContainer, streetRequest, serverContext.dataOverlayContext(accessRequest), - type.isEgress(), + type, durationLimit, stopCountLimit ); + var accessEgresses = AccessEgressMapper.mapNearbyStops(nearbyStops, type); + accessEgresses = timeshiftRideHailing(streetRequest, type, accessEgresses); - List results = new ArrayList<>( - AccessEgressMapper.mapNearbyStops(nearbyStops, type.isEgress()) - ); - results = timeshiftRideHailing(streetRequest, type, results); + var results = new ArrayList<>(accessEgresses); // Special handling of flex accesses if (OTPFeature.FlexRouting.isOn() && streetRequest.mode() == StreetMode.FLEXIBLE) { @@ -274,10 +278,10 @@ private Collection fetchAccessEgresses(AccessEgre additionalSearchDays, serverContext.flexParameters(), serverContext.dataOverlayContext(accessRequest), - type.isEgress() + type ); - results.addAll(AccessEgressMapper.mapFlexAccessEgresses(flexAccessList, type.isEgress())); + results.addAll(AccessEgressMapper.mapFlexAccessEgresses(flexAccessList, type)); } return results; @@ -363,9 +367,24 @@ private TemporaryVerticesContainer createTemporaryVerticesContainer( ) { return new TemporaryVerticesContainer( serverContext.graph(), - request, + request.from(), + request.to(), request.journey().access().mode(), request.journey().egress().mode() ); } + + private IntStream listStopIndexes(FeedScopedId stopLocationId) { + Collection stops = serverContext + .transitService() + .getStopOrChildStops(stopLocationId); + + if (stops.isEmpty()) { + throw new EntityNotFoundException( + "Stop, station, multimodal station or group of stations", + stopLocationId + ); + } + return stops.stream().mapToInt(StopLocation::getIndex); + } } diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/TransitRouterResult.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/TransitRouterResult.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/TransitRouterResult.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/TransitRouterResult.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/performance/PerformanceTimersForRaptor.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/performance/PerformanceTimersForRaptor.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/performance/PerformanceTimersForRaptor.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/performance/PerformanceTimersForRaptor.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressPenaltyDecorator.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressPenaltyDecorator.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressPenaltyDecorator.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressPenaltyDecorator.java diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressRouter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressRouter.java new file mode 100644 index 00000000000..9b592fad3aa --- /dev/null +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressRouter.java @@ -0,0 +1,95 @@ +package org.opentripplanner.routing.algorithm.raptoradapter.router.street; + +import java.time.Duration; +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; +import javax.annotation.Nullable; +import org.opentripplanner.ext.dataoverlay.routing.DataOverlayContext; +import org.opentripplanner.framework.application.OTPRequestTimeoutException; +import org.opentripplanner.framework.collection.ListUtils; +import org.opentripplanner.graph_builder.module.nearbystops.StreetNearbyStopFinder; +import org.opentripplanner.routing.api.request.RouteRequest; +import org.opentripplanner.routing.api.request.request.StreetRequest; +import org.opentripplanner.routing.graphfinder.NearbyStop; +import org.opentripplanner.street.search.TemporaryVerticesContainer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * This uses a street search to find paths to all the access/egress stop within range + */ +public class AccessEgressRouter { + + private static final Logger LOG = LoggerFactory.getLogger(AccessEgressRouter.class); + + private AccessEgressRouter() {} + + /** + * Find accesses or egresses. + */ + public static Collection findAccessEgresses( + RouteRequest request, + TemporaryVerticesContainer verticesContainer, + StreetRequest streetRequest, + @Nullable DataOverlayContext dataOverlayContext, + AccessEgressType accessOrEgress, + Duration durationLimit, + int maxStopCount + ) { + OTPRequestTimeoutException.checkForTimeout(); + + // Note: We calculate access/egresses in two parts. First we fetch the stops with zero distance. + // Then we do street search. This is because some stations might use the centroid for street + // routing, but should still give zero distance access/egresses to its child-stops. + var zeroDistanceAccessEgress = findAccessEgressWithZeroDistance( + verticesContainer, + request, + streetRequest, + accessOrEgress + ); + + // When looking for street accesses/egresses we ignore the already found direct accesses/egresses + var ignoreVertices = zeroDistanceAccessEgress + .stream() + .map(nearbyStop -> nearbyStop.state.getVertex()) + .collect(Collectors.toSet()); + + var originVertices = accessOrEgress.isAccess() + ? verticesContainer.getFromVertices() + : verticesContainer.getToVertices(); + var streetAccessEgress = new StreetNearbyStopFinder( + durationLimit, + maxStopCount, + dataOverlayContext, + ignoreVertices + ) + .findNearbyStops(originVertices, request, streetRequest, accessOrEgress.isEgress()); + + var results = ListUtils.combine(zeroDistanceAccessEgress, streetAccessEgress); + LOG.debug("Found {} {} stops", results.size(), accessOrEgress); + return results; + } + + /** + * Return a list of direct accesses/egresses that do not require any street search. This will + * return an empty list if the source/destination is not a stopId. + */ + private static List findAccessEgressWithZeroDistance( + TemporaryVerticesContainer verticesContainer, + RouteRequest routeRequest, + StreetRequest streetRequest, + AccessEgressType accessOrEgress + ) { + var transitStopVertices = accessOrEgress.isAccess() + ? verticesContainer.getFromStopVertices() + : verticesContainer.getToStopVertices(); + + return NearbyStop.nearbyStopsForTransitStopVerticesFiltered( + transitStopVertices, + accessOrEgress.isEgress(), + routeRequest, + streetRequest + ); + } +} diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressType.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressType.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressType.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressType.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgresses.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgresses.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgresses.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgresses.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/DirectFlexRouter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/DirectFlexRouter.java similarity index 89% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/DirectFlexRouter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/DirectFlexRouter.java index 8e4cf1b222f..6d54973bff9 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/DirectFlexRouter.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/DirectFlexRouter.java @@ -28,27 +28,28 @@ public static List route( try ( var temporaryVertices = new TemporaryVerticesContainer( serverContext.graph(), - request, + request.from(), + request.to(), request.journey().direct().mode(), request.journey().direct().mode() ) ) { // Prepare access/egress transfers - Collection accessStops = AccessEgressRouter.streetSearch( + Collection accessStops = AccessEgressRouter.findAccessEgresses( request, temporaryVertices, request.journey().direct(), serverContext.dataOverlayContext(request), - false, + AccessEgressType.ACCESS, serverContext.flexParameters().maxAccessWalkDuration(), 0 ); - Collection egressStops = AccessEgressRouter.streetSearch( + Collection egressStops = AccessEgressRouter.findAccessEgresses( request, temporaryVertices, request.journey().direct(), serverContext.dataOverlayContext(request), - true, + AccessEgressType.EGRESS, serverContext.flexParameters().maxEgressWalkDuration(), 0 ); diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/DirectStreetRouter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/DirectStreetRouter.java similarity index 95% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/DirectStreetRouter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/DirectStreetRouter.java index 11463902dcd..7d73d705dfe 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/DirectStreetRouter.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/DirectStreetRouter.java @@ -18,6 +18,12 @@ import org.opentripplanner.street.search.TemporaryVerticesContainer; import org.opentripplanner.street.search.state.State; +/** + * Generates "direct" street routes, i.e. those that do not use transit and are on the street + * network for the entire itinerary. + * + * @see DirectFlexRouter + */ public class DirectStreetRouter { public static List route(OtpServerRequestContext serverContext, RouteRequest request) { @@ -30,7 +36,8 @@ public static List route(OtpServerRequestContext serverContext, Route try ( var temporaryVertices = new TemporaryVerticesContainer( serverContext.graph(), - directRequest, + directRequest.from(), + directRequest.to(), request.journey().direct().mode(), request.journey().direct().mode() ) diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/FlexAccessEgressRouter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/FlexAccessEgressRouter.java similarity index 83% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/FlexAccessEgressRouter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/FlexAccessEgressRouter.java index 68dda38211a..f5aa9142fac 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/FlexAccessEgressRouter.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/FlexAccessEgressRouter.java @@ -27,31 +27,31 @@ public static Collection routeAccessEgress( AdditionalSearchDays searchDays, FlexParameters config, DataOverlayContext dataOverlayContext, - boolean isEgress + AccessEgressType accessOrEgress ) { OTPRequestTimeoutException.checkForTimeout(); TransitService transitService = serverContext.transitService(); - Collection accessStops = !isEgress - ? AccessEgressRouter.streetSearch( + Collection accessStops = accessOrEgress.isAccess() + ? AccessEgressRouter.findAccessEgresses( request, verticesContainer, new StreetRequest(StreetMode.WALK), dataOverlayContext, - false, + AccessEgressType.ACCESS, serverContext.flexParameters().maxAccessWalkDuration(), 0 ) : List.of(); - Collection egressStops = isEgress - ? AccessEgressRouter.streetSearch( + Collection egressStops = accessOrEgress.isEgress() + ? AccessEgressRouter.findAccessEgresses( request, verticesContainer, new StreetRequest(StreetMode.WALK), dataOverlayContext, - true, + AccessEgressType.EGRESS, serverContext.flexParameters().maxEgressWalkDuration(), 0 ) @@ -69,6 +69,8 @@ public static Collection routeAccessEgress( egressStops ); - return isEgress ? flexRouter.createFlexEgresses() : flexRouter.createFlexAccesses(); + return accessOrEgress.isEgress() + ? flexRouter.createFlexEgresses() + : flexRouter.createFlexAccesses(); } } diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/DefaultAccessEgress.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/DefaultAccessEgress.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/DefaultAccessEgress.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/DefaultAccessEgress.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/DefaultRaptorTransfer.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/DefaultRaptorTransfer.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/DefaultRaptorTransfer.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/DefaultRaptorTransfer.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/FlexAccessEgressAdapter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/FlexAccessEgressAdapter.java similarity index 85% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/FlexAccessEgressAdapter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/FlexAccessEgressAdapter.java index 04f51e76681..64650ab9e92 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/FlexAccessEgressAdapter.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/FlexAccessEgressAdapter.java @@ -4,6 +4,7 @@ import org.opentripplanner.framework.model.TimeAndCost; import org.opentripplanner.model.StopTime; import org.opentripplanner.raptor.api.model.RaptorConstants; +import org.opentripplanner.routing.algorithm.raptoradapter.router.street.AccessEgressType; /** * This class is used to adapt the FlexAccessEgress into a time-dependent multi-leg DefaultAccessEgress. @@ -12,10 +13,15 @@ public class FlexAccessEgressAdapter extends DefaultAccessEgress { private final FlexAccessEgress flexAccessEgress; - public FlexAccessEgressAdapter(FlexAccessEgress flexAccessEgress, boolean isEgress) { + public FlexAccessEgressAdapter( + FlexAccessEgress flexAccessEgress, + AccessEgressType accessOrEgress + ) { super( flexAccessEgress.stop().getIndex(), - isEgress ? flexAccessEgress.lastState().reverse() : flexAccessEgress.lastState() + accessOrEgress.isEgress() + ? flexAccessEgress.lastState().reverse() + : flexAccessEgress.lastState() ); this.flexAccessEgress = flexAccessEgress; } diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/RaptorTransferIndex.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/RaptorTransferIndex.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/RaptorTransferIndex.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/RaptorTransferIndex.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/RoutingAccessEgress.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/RoutingAccessEgress.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/RoutingAccessEgress.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/RoutingAccessEgress.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/SlackProvider.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/SlackProvider.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/SlackProvider.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/SlackProvider.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/Transfer.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/Transfer.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/Transfer.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/Transfer.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitLayer.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitLayer.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitLayer.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitLayer.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitTuningParameters.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitTuningParameters.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitTuningParameters.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitTuningParameters.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TripPatternForDate.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TripPatternForDate.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TripPatternForDate.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TripPatternForDate.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TripSchedule.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TripSchedule.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TripSchedule.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TripSchedule.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearch.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearch.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearch.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearch.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearchForward.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearchForward.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearchForward.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearchForward.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearchReverse.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearchReverse.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearchReverse.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearchReverse.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearchStrategy.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearchStrategy.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearchStrategy.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearchStrategy.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedTransferBoarding.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedTransferBoarding.java similarity index 94% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedTransferBoarding.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedTransferBoarding.java index 63a0d50aa03..bf5de51e2c8 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedTransferBoarding.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedTransferBoarding.java @@ -1,7 +1,6 @@ package org.opentripplanner.routing.algorithm.raptoradapter.transit.constrainedtransfer; import java.util.function.Consumer; -import javax.annotation.Nonnull; import org.opentripplanner.raptor.api.model.RaptorTransferConstraint; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.spi.RaptorBoardOrAlightEvent; @@ -20,7 +19,7 @@ public class ConstrainedTransferBoarding private final int earliestBoardTime; public ConstrainedTransferBoarding( - @Nonnull RaptorTransferConstraint constraint, + RaptorTransferConstraint constraint, int tripIndex, T trip, int stopPositionInPattern, @@ -41,7 +40,6 @@ public int tripIndex() { } @Override - @Nonnull public T trip() { return trip; } @@ -62,7 +60,6 @@ public int earliestBoardTime() { } @Override - @Nonnull public RaptorTransferConstraint transferConstraint() { return constraint; } diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedTransfersForPatterns.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedTransfersForPatterns.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedTransfersForPatterns.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedTransfersForPatterns.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/TransferForPattern.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/TransferForPattern.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/TransferForPattern.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/TransferForPattern.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/TransferForPatternByStopPos.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/TransferForPatternByStopPos.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/TransferForPatternByStopPos.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/TransferForPatternByStopPos.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/TransferIndexGenerator.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/TransferIndexGenerator.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/TransferIndexGenerator.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/TransferIndexGenerator.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/TransferPointForPatternFactory.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/TransferPointForPatternFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/TransferPointForPatternFactory.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/TransferPointForPatternFactory.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/TransferPointMatcher.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/TransferPointMatcher.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/TransferPointMatcher.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/TransferPointMatcher.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/CostCalculatorFactory.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/CostCalculatorFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/CostCalculatorFactory.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/CostCalculatorFactory.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/DefaultCostCalculator.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/DefaultCostCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/DefaultCostCalculator.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/DefaultCostCalculator.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/DefaultTripSchedule.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/DefaultTripSchedule.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/DefaultTripSchedule.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/DefaultTripSchedule.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/FactorStrategy.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/FactorStrategy.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/FactorStrategy.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/FactorStrategy.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/GeneralizedCostParameters.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/GeneralizedCostParameters.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/GeneralizedCostParameters.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/GeneralizedCostParameters.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/GeneralizedCostParametersBuilder.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/GeneralizedCostParametersBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/GeneralizedCostParametersBuilder.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/GeneralizedCostParametersBuilder.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/IndexBasedFactorStrategy.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/IndexBasedFactorStrategy.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/IndexBasedFactorStrategy.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/IndexBasedFactorStrategy.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/PatternCostCalculator.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/PatternCostCalculator.java similarity index 92% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/PatternCostCalculator.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/PatternCostCalculator.java index 734355f0ac5..d611c73b7ad 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/PatternCostCalculator.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/PatternCostCalculator.java @@ -1,7 +1,6 @@ package org.opentripplanner.routing.algorithm.raptoradapter.transit.cost; import java.util.BitSet; -import javax.annotation.Nonnull; import org.opentripplanner.raptor.api.model.RaptorAccessEgress; import org.opentripplanner.raptor.api.model.RaptorTransferConstraint; import org.opentripplanner.raptor.spi.RaptorCostCalculator; @@ -13,9 +12,9 @@ class PatternCostCalculator implements RaptorCost private final RaptorCostLinearFunction unpreferredCost; PatternCostCalculator( - @Nonnull RaptorCostCalculator delegate, - @Nonnull BitSet unpreferredPatterns, - @Nonnull RaptorCostLinearFunction unpreferredCost + RaptorCostCalculator delegate, + BitSet unpreferredPatterns, + RaptorCostLinearFunction unpreferredCost ) { this.unpreferredPatterns = unpreferredPatterns; this.delegate = delegate; diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostConverter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostConverter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostConverter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostConverter.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostLinearFunction.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostLinearFunction.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostLinearFunction.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostLinearFunction.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/SingleValueFactorStrategy.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/SingleValueFactorStrategy.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/SingleValueFactorStrategy.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/SingleValueFactorStrategy.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/WheelchairCostCalculator.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/WheelchairCostCalculator.java similarity index 95% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/WheelchairCostCalculator.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/WheelchairCostCalculator.java index d0697f78692..d68d2230a5c 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/WheelchairCostCalculator.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/WheelchairCostCalculator.java @@ -1,6 +1,5 @@ package org.opentripplanner.routing.algorithm.raptoradapter.transit.cost; -import javax.annotation.Nonnull; import org.opentripplanner.raptor.api.model.RaptorAccessEgress; import org.opentripplanner.raptor.api.model.RaptorTransferConstraint; import org.opentripplanner.raptor.spi.RaptorCostCalculator; @@ -14,8 +13,8 @@ public class WheelchairCostCalculator private final int[] wheelchairBoardingCost; public WheelchairCostCalculator( - @Nonnull RaptorCostCalculator delegate, - @Nonnull AccessibilityPreferences wheelchairAccessibility + RaptorCostCalculator delegate, + AccessibilityPreferences wheelchairAccessibility ) { this.delegate = delegate; this.wheelchairBoardingCost = createWheelchairCost(wheelchairAccessibility); diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/FrequencyAlightEvent.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/FrequencyAlightEvent.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/FrequencyAlightEvent.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/FrequencyAlightEvent.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/FrequencyBoardOrAlightEvent.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/FrequencyBoardOrAlightEvent.java similarity index 99% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/FrequencyBoardOrAlightEvent.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/FrequencyBoardOrAlightEvent.java index 927b1d966ed..b2cbb51fb00 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/FrequencyBoardOrAlightEvent.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/FrequencyBoardOrAlightEvent.java @@ -1,7 +1,6 @@ package org.opentripplanner.routing.algorithm.raptoradapter.transit.frequency; import java.time.LocalDate; -import javax.annotation.Nonnull; import org.opentripplanner.raptor.api.model.RaptorTransferConstraint; import org.opentripplanner.raptor.api.model.RaptorTripPattern; import org.opentripplanner.raptor.spi.RaptorBoardOrAlightEvent; @@ -90,7 +89,6 @@ public int earliestBoardTime() { } @Override - @Nonnull public RaptorTransferConstraint transferConstraint() { return RaptorTransferConstraint.REGULAR_TRANSFER; } diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/FrequencyBoardingEvent.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/FrequencyBoardingEvent.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/FrequencyBoardingEvent.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/FrequencyBoardingEvent.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/TripFrequencyAlightSearch.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/TripFrequencyAlightSearch.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/TripFrequencyAlightSearch.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/TripFrequencyAlightSearch.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/TripFrequencyBoardSearch.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/TripFrequencyBoardSearch.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/TripFrequencyBoardSearch.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/frequency/TripFrequencyBoardSearch.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/AccessEgressMapper.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/AccessEgressMapper.java similarity index 74% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/AccessEgressMapper.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/AccessEgressMapper.java index fd7619ac297..2205a2feb7b 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/AccessEgressMapper.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/AccessEgressMapper.java @@ -5,6 +5,7 @@ import java.util.Objects; import java.util.stream.Collectors; import org.opentripplanner.ext.flex.FlexAccessEgress; +import org.opentripplanner.routing.algorithm.raptoradapter.router.street.AccessEgressType; import org.opentripplanner.routing.algorithm.raptoradapter.transit.DefaultAccessEgress; import org.opentripplanner.routing.algorithm.raptoradapter.transit.FlexAccessEgressAdapter; import org.opentripplanner.routing.algorithm.raptoradapter.transit.RoutingAccessEgress; @@ -15,33 +16,36 @@ public class AccessEgressMapper { public static List mapNearbyStops( Collection accessStops, - boolean isEgress + AccessEgressType accessOrEgress ) { return accessStops .stream() - .map(stopAtDistance -> mapNearbyStop(stopAtDistance, isEgress)) + .map(nearbyStop -> mapNearbyStop(nearbyStop, accessOrEgress)) .filter(Objects::nonNull) .collect(Collectors.toList()); } public static Collection mapFlexAccessEgresses( Collection flexAccessEgresses, - boolean isEgress + AccessEgressType accessOrEgress ) { return flexAccessEgresses .stream() - .map(flexAccessEgress -> new FlexAccessEgressAdapter(flexAccessEgress, isEgress)) + .map(flexAccessEgress -> new FlexAccessEgressAdapter(flexAccessEgress, accessOrEgress)) .collect(Collectors.toList()); } - private static RoutingAccessEgress mapNearbyStop(NearbyStop nearbyStop, boolean isEgress) { + private static RoutingAccessEgress mapNearbyStop( + NearbyStop nearbyStop, + AccessEgressType accessOrEgress + ) { if (!(nearbyStop.stop instanceof RegularStop)) { return null; } return new DefaultAccessEgress( nearbyStop.stop.getIndex(), - isEgress ? nearbyStop.state.reverse() : nearbyStop.state + accessOrEgress.isEgress() ? nearbyStop.state.reverse() : nearbyStop.state ); } } diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/GeneralizedCostParametersMapper.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/GeneralizedCostParametersMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/GeneralizedCostParametersMapper.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/GeneralizedCostParametersMapper.java diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/LookupStopIndexCallback.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/LookupStopIndexCallback.java new file mode 100644 index 00000000000..91946ab07e9 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/LookupStopIndexCallback.java @@ -0,0 +1,35 @@ +package org.opentripplanner.routing.algorithm.raptoradapter.transit.mappers; + +import java.util.Collection; +import java.util.stream.IntStream; +import org.opentripplanner.transit.model.framework.FeedScopedId; + +/** + * The raptor mapper does not have access to the transit layer, so it needs help to + * lookup stop-location indexes (Stop index used by Raptor). There is a one-to-one + * mapping between stops and stop-index, but a station, multimodal-station or group-of-stations + * will most likely contain more than one stop. + */ +@FunctionalInterface +public interface LookupStopIndexCallback { + /** + * The implementation of this method should list all stop indexes part of the entity referenced + * by the given id. + * @return a stream of stop indexes. We return a stream here because we need to merge this with + * the indexes of other stops. + */ + IntStream lookupStopLocationIndexes(FeedScopedId stopLocationId); + + /** + * Take a set of stop location ids and convert them into a sorted distinct list of + * stop indexes. + */ + default int[] lookupStopLocationIndexes(Collection stopLocationIds) { + return stopLocationIds + .stream() + .flatMapToInt(this::lookupStopLocationIndexes) + .sorted() + .distinct() + .toArray(); + } +} diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapper.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapper.java similarity index 74% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapper.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapper.java index 948b132e408..1074724a90c 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapper.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapper.java @@ -7,6 +7,7 @@ import java.time.ZonedDateTime; import java.util.Collection; import java.util.List; +import java.util.function.Predicate; import org.opentripplanner.framework.application.OTPFeature; import org.opentripplanner.raptor.api.model.GeneralizedCostRelaxFunction; import org.opentripplanner.raptor.api.model.RaptorAccessEgress; @@ -18,14 +19,15 @@ import org.opentripplanner.raptor.api.request.PassThroughPoint; import org.opentripplanner.raptor.api.request.RaptorRequest; import org.opentripplanner.raptor.api.request.RaptorRequestBuilder; +import org.opentripplanner.raptor.api.request.RaptorViaLocation; import org.opentripplanner.raptor.rangeraptor.SystemErrDebugLogger; import org.opentripplanner.routing.algorithm.raptoradapter.router.performance.PerformanceTimersForRaptor; import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter; import org.opentripplanner.routing.api.request.DebugEventType; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.api.request.framework.CostLinearFunction; +import org.opentripplanner.routing.api.request.via.ViaLocation; import org.opentripplanner.transit.model.network.grouppriority.DefaultTransitGroupPriorityCalculator; -import org.opentripplanner.transit.model.site.StopLocation; public class RaptorRequestMapper { @@ -35,6 +37,7 @@ public class RaptorRequestMapper { private final long transitSearchTimeZeroEpocSecond; private final boolean isMultiThreadedEnbled; private final MeterRegistry meterRegistry; + private final LookupStopIndexCallback lookUpStopIndex; private RaptorRequestMapper( RouteRequest request, @@ -42,7 +45,8 @@ private RaptorRequestMapper( Collection accessPaths, Collection egressPaths, long transitSearchTimeZeroEpocSecond, - MeterRegistry meterRegistry + MeterRegistry meterRegistry, + LookupStopIndexCallback lookUpStopIndex ) { this.request = request; this.isMultiThreadedEnbled = isMultiThreaded; @@ -50,6 +54,7 @@ private RaptorRequestMapper( this.egressPaths = egressPaths; this.transitSearchTimeZeroEpocSecond = transitSearchTimeZeroEpocSecond; this.meterRegistry = meterRegistry; + this.lookUpStopIndex = lookUpStopIndex; } public static RaptorRequest mapRequest( @@ -58,7 +63,8 @@ public static RaptorRequest mapRequest( boolean isMultiThreaded, Collection accessPaths, Collection egressPaths, - MeterRegistry meterRegistry + MeterRegistry meterRegistry, + LookupStopIndexCallback lookUpStopIndex ) { return new RaptorRequestMapper( request, @@ -66,7 +72,8 @@ public static RaptorRequest mapRequest( accessPaths, egressPaths, transitSearchTimeZero.toEpochSecond(), - meterRegistry + meterRegistry, + lookUpStopIndex ) .doMap(); } @@ -77,6 +84,13 @@ private RaptorRequest doMap() { var preferences = request.preferences(); + // TODO Fix the Raptor search so pass-through and via search can be used together. + if (hasViaLocationsAndPassThroughLocations()) { + throw new IllegalArgumentException( + "A mix of via-locations and pass-through is not allowed in this version." + ); + } + if (request.pageCursor() == null) { int time = relativeTime(request.dateTime()); @@ -115,7 +129,9 @@ private RaptorRequest doMap() { var r = pt.raptor(); // Note! If a pass-through-point exists, then the transit-group-priority feature is disabled - if (!request.getPassThroughPoints().isEmpty()) { + + // TODO - We need to handle via locations that are not pass-through-points here + if (hasPassThroughOnly()) { mcBuilder.withPassThroughPoints(mapPassThroughPoints()); r.relaxGeneralizedCostAtDestination().ifPresent(mcBuilder::withRelaxCostAtDestination); } else if (!pt.relaxTransitGroupPriority().isNormal()) { @@ -144,6 +160,10 @@ private RaptorRequest doMap() { .addAccessPaths(accessPaths) .addEgressPaths(egressPaths); + if (hasViaLocationsOnly()) { + builder.searchParams().addViaLocations(mapViaLocations()); + } + var raptorDebugging = request.journey().transit().raptorDebugging(); if (raptorDebugging.isEnabled()) { @@ -175,19 +195,57 @@ private RaptorRequest doMap() { ) ); } - return builder.build(); } + private boolean hasPassThroughOnly() { + return request.getViaLocations().stream().allMatch(ViaLocation::isPassThroughLocation); + } + + private boolean hasViaLocationsOnly() { + return request.getViaLocations().stream().noneMatch(ViaLocation::isPassThroughLocation); + } + + private boolean hasViaLocationsAndPassThroughLocations() { + var c = request.getViaLocations(); + return ( + request.isViaSearch() && + c.stream().anyMatch(ViaLocation::isPassThroughLocation) && + c.stream().anyMatch(Predicate.not(ViaLocation::isPassThroughLocation)) + ); + } + + private List mapViaLocations() { + return request.getViaLocations().stream().map(this::mapViaLocation).toList(); + } + + private RaptorViaLocation mapViaLocation(ViaLocation input) { + if (input.isPassThroughLocation()) { + var builder = RaptorViaLocation.allowPassThrough(input.label()); + for (int stopIndex : lookUpStopIndex.lookupStopLocationIndexes(input.stopLocationIds())) { + builder.addViaStop(stopIndex); + } + return builder.build(); + } + // Visit Via location + else { + var builder = RaptorViaLocation.via(input.label(), input.minimumWaitTime()); + for (int stopIndex : lookUpStopIndex.lookupStopLocationIndexes(input.stopLocationIds())) { + builder.addViaStop(stopIndex); + } + return builder.build(); + } + } + private List mapPassThroughPoints() { - return request - .getPassThroughPoints() - .stream() - .map(p -> { - final int[] stops = p.stopLocations().stream().mapToInt(StopLocation::getIndex).toArray(); - return new PassThroughPoint(p.name(), stops); - }) - .toList(); + return request.getViaLocations().stream().map(this::mapPassThroughPoints).toList(); + } + + private PassThroughPoint mapPassThroughPoints(ViaLocation location) { + return new PassThroughPoint( + location.label(), + lookUpStopIndex.lookupStopLocationIndexes(location.stopLocationIds()) + ); } static RelaxFunction mapRelaxCost(CostLinearFunction relax) { diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransfersMapper.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransfersMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransfersMapper.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransfersMapper.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapper.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapper.java similarity index 93% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapper.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapper.java index d375b4c546c..13f8facef3d 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapper.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapper.java @@ -7,15 +7,12 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.stream.Collectors; import javax.annotation.Nullable; import org.opentripplanner.framework.application.OTPFeature; -import org.opentripplanner.model.Timetable; import org.opentripplanner.routing.algorithm.raptoradapter.transit.Transfer; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TransitLayer; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TransitTuningParameters; @@ -26,7 +23,6 @@ import org.opentripplanner.routing.algorithm.raptoradapter.transit.request.RaptorRequestTransferCache; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.site.StopTransferPriority; -import org.opentripplanner.transit.model.timetable.TripTimes; import org.opentripplanner.transit.service.DefaultTransitService; import org.opentripplanner.transit.service.StopModel; import org.opentripplanner.transit.service.TransitModel; @@ -64,16 +60,6 @@ public static TransitLayer map( return new TransitLayerMapper(transitModel).map(tuningParameters); } - // TODO We could save time by either pre-sorting these, or by using a sorting algorithm that is - // optimized for sorting nearly-sorted lists. - static List getSortedTripTimes(Timetable timetable) { - return timetable - .getTripTimes() - .stream() - .sorted(Comparator.comparing(TripTimes::sortIndex)) - .collect(Collectors.toList()); - } - private TransitLayer map(TransitTuningParameters tuningParameters) { HashMap> tripPatternsByStopByDate; List> transferByStopIndex; diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerUpdater.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerUpdater.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerUpdater.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerUpdater.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TripPatternForDateMapper.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TripPatternForDateMapper.java similarity index 77% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TripPatternForDateMapper.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TripPatternForDateMapper.java index cd00b9356dc..256a268e2c7 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TripPatternForDateMapper.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TripPatternForDateMapper.java @@ -3,12 +3,9 @@ import gnu.trove.set.TIntSet; import java.time.LocalDate; import java.util.ArrayList; -import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; import java.util.stream.Collectors; import javax.annotation.Nullable; import org.opentripplanner.model.Timetable; @@ -33,8 +30,6 @@ public class TripPatternForDateMapper { private static final Logger LOG = LoggerFactory.getLogger(TripPatternForDateMapper.class); - private final ConcurrentMap> sortedTripTimesForTimetable = new ConcurrentHashMap<>(); - private final Map serviceCodesRunningForDate; /** @@ -69,19 +64,7 @@ public TripPatternForDate map(Timetable timetable, LocalDate serviceDate) { List times = new ArrayList<>(); - // The TripTimes are not sorted by departure time in the source timetable because - // OTP1 performs a simple/ linear search. Raptor results depend on trips being - // sorted. We reuse the same timetables many times on different days, so cache the - // sorted versions to avoid repeated compute-intensive sorting. Anecdotally this - // reduces mapping time by more than half, but it is still rather slow. NL Mapping - // takes 32 seconds sorting every timetable, 9 seconds with cached sorting, and 6 - // seconds with no timetable sorting at all. - List sortedTripTimes = sortedTripTimesForTimetable.computeIfAbsent( - timetable, - TransitLayerMapper::getSortedTripTimes - ); - - for (TripTimes tripTimes : sortedTripTimes) { + for (TripTimes tripTimes : timetable.getTripTimes()) { if (!serviceCodesRunning.contains(tripTimes.getServiceCode())) { continue; } diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/BoardAlight.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/BoardAlight.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/BoardAlight.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/BoardAlight.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRequestTransferCache.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRequestTransferCache.java similarity index 98% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRequestTransferCache.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRequestTransferCache.java index 99ad83d3f4d..5e274c4120f 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRequestTransferCache.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRequestTransferCache.java @@ -6,7 +6,6 @@ import java.util.List; import java.util.Objects; import java.util.concurrent.ExecutionException; -import javax.annotation.Nonnull; import org.opentripplanner.framework.tostring.ToStringBuilder; import org.opentripplanner.routing.algorithm.raptoradapter.transit.RaptorTransferIndex; import org.opentripplanner.routing.algorithm.raptoradapter.transit.Transfer; @@ -57,8 +56,7 @@ public RaptorTransferIndex get(List> transfersByStopIndex, RouteR private CacheLoader cacheLoader() { return new CacheLoader<>() { @Override - @Nonnull - public RaptorTransferIndex load(@Nonnull CacheKey cacheKey) { + public RaptorTransferIndex load(CacheKey cacheKey) { LOG.info("Adding runtime request to cache: {}", cacheKey.options); return RaptorTransferIndex.create(cacheKey.transfersByStopIndex, cacheKey.request); } diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRoutingRequestTransitData.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRoutingRequestTransitData.java similarity index 98% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRoutingRequestTransitData.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRoutingRequestTransitData.java index 5b9d81fa6c3..0182598ca35 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRoutingRequestTransitData.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRoutingRequestTransitData.java @@ -4,14 +4,13 @@ import java.util.BitSet; import java.util.Iterator; import java.util.List; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.framework.application.OTPFeature; import org.opentripplanner.framework.time.ServiceDateUtils; import org.opentripplanner.model.transfer.TransferService; import org.opentripplanner.raptor.api.model.RaptorConstrainedTransfer; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; import org.opentripplanner.raptor.api.model.RaptorTransfer; -import org.opentripplanner.raptor.api.path.RaptorStopNameResolver; import org.opentripplanner.raptor.spi.IntIterator; import org.opentripplanner.raptor.spi.RaptorConstrainedBoardingSearch; import org.opentripplanner.raptor.spi.RaptorCostCalculator; @@ -200,7 +199,6 @@ public RaptorConstrainedTransfer findConstrainedTransfer( }; } - @Nonnull @Override public RaptorStopNameResolver stopNameResolver() { return (int stopIndex) -> { diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRoutingRequestTransitDataCreator.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRoutingRequestTransitDataCreator.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRoutingRequestTransitDataCreator.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRoutingRequestTransitDataCreator.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RouteRequestTransitDataProviderFilter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RouteRequestTransitDataProviderFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RouteRequestTransitDataProviderFilter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RouteRequestTransitDataProviderFilter.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TransitDataProviderFilter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TransitDataProviderFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TransitDataProviderFilter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TransitDataProviderFilter.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripPatternForDates.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripPatternForDates.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripPatternForDates.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripPatternForDates.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleAlightSearch.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleAlightSearch.java similarity index 99% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleAlightSearch.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleAlightSearch.java index 7be4f1eecf9..5ece76aedb5 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleAlightSearch.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleAlightSearch.java @@ -1,7 +1,6 @@ package org.opentripplanner.routing.algorithm.raptoradapter.transit.request; import java.util.function.IntUnaryOperator; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.framework.tostring.ToStringBuilder; import org.opentripplanner.raptor.api.model.RaptorConstants; @@ -76,7 +75,6 @@ public int stopPositionInPattern() { } @Override - @Nonnull public RaptorTransferConstraint transferConstraint() { return RaptorTransferConstraint.REGULAR_TRANSFER; } diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleBoardSearch.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleBoardSearch.java similarity index 99% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleBoardSearch.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleBoardSearch.java index 78bc2101775..db08dd2dada 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleBoardSearch.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleBoardSearch.java @@ -1,7 +1,6 @@ package org.opentripplanner.routing.algorithm.raptoradapter.transit.request; import java.util.function.IntUnaryOperator; -import javax.annotation.Nonnull; import org.opentripplanner.framework.tostring.ToStringBuilder; import org.opentripplanner.raptor.api.model.RaptorConstants; import org.opentripplanner.raptor.api.model.RaptorTransferConstraint; @@ -74,7 +73,6 @@ public int stopPositionInPattern() { } @Override - @Nonnull public RaptorTransferConstraint transferConstraint() { return RaptorTransferConstraint.REGULAR_TRANSFER; } diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleSearchFactory.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleSearchFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleSearchFactory.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleSearchFactory.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleWithOffset.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleWithOffset.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleWithOffset.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleWithOffset.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripSearchTimetable.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripSearchTimetable.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripSearchTimetable.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripSearchTimetable.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/OptimizeMinSafeTransferCost.png b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/OptimizeMinSafeTransferCost.png similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/OptimizeMinSafeTransferCost.png rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/OptimizeMinSafeTransferCost.png diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/OptimizeTransferService.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/OptimizeTransferService.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/OptimizeTransferService.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/OptimizeTransferService.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/TransferOptimizationObjCol.svg b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/TransferOptimizationObjCol.svg similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/TransferOptimizationObjCol.svg rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/TransferOptimizationObjCol.svg diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/api/OptimizedPath.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/api/OptimizedPath.java similarity index 98% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/api/OptimizedPath.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/api/OptimizedPath.java index ad4df23a42c..f2a36e1678c 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/api/OptimizedPath.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/api/OptimizedPath.java @@ -3,12 +3,12 @@ import java.util.function.Supplier; import org.opentripplanner.model.transfer.TransferConstraint; import org.opentripplanner.raptor.api.model.RaptorConstrainedTransfer; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.path.AccessPathLeg; import org.opentripplanner.raptor.api.path.PathLeg; import org.opentripplanner.raptor.api.path.PathStringBuilder; import org.opentripplanner.raptor.api.path.RaptorPath; -import org.opentripplanner.raptor.api.path.RaptorStopNameResolver; import org.opentripplanner.raptor.path.Path; /** diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/api/TransferOptimizationParameters.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/api/TransferOptimizationParameters.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/api/TransferOptimizationParameters.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/api/TransferOptimizationParameters.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/api/TransferOptimized.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/api/TransferOptimized.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/api/TransferOptimized.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/api/TransferOptimized.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/configure/TransferOptimizationServiceConfigurator.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/configure/TransferOptimizationServiceConfigurator.java similarity index 98% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/configure/TransferOptimizationServiceConfigurator.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/configure/TransferOptimizationServiceConfigurator.java index cb5f3d7fdab..214e79216e5 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/configure/TransferOptimizationServiceConfigurator.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/configure/TransferOptimizationServiceConfigurator.java @@ -3,8 +3,8 @@ import java.util.function.IntFunction; import javax.annotation.Nullable; import org.opentripplanner.model.transfer.TransferService; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; -import org.opentripplanner.raptor.api.path.RaptorStopNameResolver; import org.opentripplanner.raptor.api.request.MultiCriteriaRequest; import org.opentripplanner.raptor.spi.RaptorCostCalculator; import org.opentripplanner.raptor.spi.RaptorTransitDataProvider; diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/BasicStopTime.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/BasicStopTime.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/BasicStopTime.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/BasicStopTime.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/MinSafeTransferTimeCalculator.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/MinSafeTransferTimeCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/MinSafeTransferTimeCalculator.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/MinSafeTransferTimeCalculator.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/OptimizedPathTail.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/OptimizedPathTail.java similarity index 99% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/OptimizedPathTail.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/OptimizedPathTail.java index 8d18c461101..b36a7d6ebfd 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/OptimizedPathTail.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/OptimizedPathTail.java @@ -4,10 +4,10 @@ import org.opentripplanner.framework.tostring.ValueObjectToStringBuilder; import org.opentripplanner.model.transfer.TransferConstraint; import org.opentripplanner.raptor.api.model.RaptorConstants; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; import org.opentripplanner.raptor.api.model.RaptorTransfer; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.model.RaptorValueFormatter; -import org.opentripplanner.raptor.api.path.RaptorStopNameResolver; import org.opentripplanner.raptor.api.path.TransitPathLeg; import org.opentripplanner.raptor.path.PathBuilder; import org.opentripplanner.raptor.path.PathBuilderLeg; diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/PathTailFilter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/PathTailFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/PathTailFilter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/PathTailFilter.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/StopPriorityCostCalculator.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/StopPriorityCostCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/StopPriorityCostCalculator.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/StopPriorityCostCalculator.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/StopTime.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/StopTime.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/StopTime.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/StopTime.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TransferWaitTimeCostCalculator.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TransferWaitTimeCostCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TransferWaitTimeCostCalculator.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TransferWaitTimeCostCalculator.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TripStopTime.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TripStopTime.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TripStopTime.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TripStopTime.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TripToTripTransfer.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TripToTripTransfer.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TripToTripTransfer.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TripToTripTransfer.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/costfilter/MinCostPathTailFilter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/costfilter/MinCostPathTailFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/costfilter/MinCostPathTailFilter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/costfilter/MinCostPathTailFilter.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/costfilter/MinCostPathTailFilterFactory.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/costfilter/MinCostPathTailFilterFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/costfilter/MinCostPathTailFilterFactory.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/costfilter/MinCostPathTailFilterFactory.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughPathTailFilter.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughPathTailFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughPathTailFilter.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughPathTailFilter.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughPointsIterator.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughPointsIterator.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughPointsIterator.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughPointsIterator.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PathTailC2Calculator.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PathTailC2Calculator.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PathTailC2Calculator.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PathTailC2Calculator.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/package-info.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/package-info.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/package-info.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/package-info.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/package.md b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/package.md similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/package.md rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/package.md diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainService.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainService.java similarity index 99% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainService.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainService.java index ca8f953ced5..ebfbf6d76b9 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainService.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainService.java @@ -8,9 +8,9 @@ import java.util.Set; import java.util.stream.Collectors; import javax.annotation.Nullable; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.path.RaptorPath; -import org.opentripplanner.raptor.api.path.RaptorStopNameResolver; import org.opentripplanner.raptor.api.path.TransferPathLeg; import org.opentripplanner.raptor.api.path.TransitPathLeg; import org.opentripplanner.raptor.spi.RaptorCostCalculator; diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGenerator.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGenerator.java similarity index 99% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGenerator.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGenerator.java index f06e2142073..0e5e5ebd8e0 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGenerator.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGenerator.java @@ -5,7 +5,6 @@ import java.util.Comparator; import java.util.Iterator; import java.util.List; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.model.transfer.ConstrainedTransfer; import org.opentripplanner.raptor.api.model.RaptorTransfer; @@ -229,12 +228,10 @@ private int calcRegularTransferEarliestBoardTime( return from.time() + transferDuration; } - @Nonnull private StopTime getFromStopTime(final TransitPathLeg leg) { return StopTime.stopTime(leg.fromStop(), leg.fromTime()); } - @Nonnull private TripStopTime findMinimumToStopTime(List> transfers) { return transfers .stream() diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferServiceAdaptor.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferServiceAdaptor.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferServiceAdaptor.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferServiceAdaptor.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransitPathLegSelector.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransitPathLegSelector.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransitPathLegSelector.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransitPathLegSelector.java diff --git a/src/main/java/org/opentripplanner/routing/algorithm/via/ViaRoutingWorker.java b/application/src/main/java/org/opentripplanner/routing/algorithm/via/ViaRoutingWorker.java similarity index 97% rename from src/main/java/org/opentripplanner/routing/algorithm/via/ViaRoutingWorker.java rename to application/src/main/java/org/opentripplanner/routing/algorithm/via/ViaRoutingWorker.java index 94dff22547b..a4ff6753d5a 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/via/ViaRoutingWorker.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/via/ViaRoutingWorker.java @@ -12,7 +12,7 @@ import org.opentripplanner.model.plan.Itinerary; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.api.request.RouteViaRequest; -import org.opentripplanner.routing.api.request.ViaLocation; +import org.opentripplanner.routing.api.request.ViaLocationDeprecated; import org.opentripplanner.routing.api.response.InputField; import org.opentripplanner.routing.api.response.RoutingError; import org.opentripplanner.routing.api.response.RoutingErrorCode; @@ -121,7 +121,7 @@ private ViaRoutingResponse combineRoutingResponse(List routingR private List filterTransits( Itinerary i, List itineraries, - ViaLocation viaLocation + ViaLocationDeprecated viaLocation ) { return itineraries.stream().filter(withinSlackTest(i, viaLocation)).toList(); } @@ -129,7 +129,7 @@ private List filterTransits( /** * Only allow departures within min/max slack time. */ - private Predicate withinSlackTest(Itinerary i, ViaLocation v) { + private Predicate withinSlackTest(Itinerary i, ViaLocationDeprecated v) { var earliestDeparturetime = i.endTime().plus(v.minSlack()); var latestDeparturetime = i.endTime().plus(v.maxSlack()); diff --git a/src/main/java/org/opentripplanner/routing/alternativelegs/AlternativeLegs.java b/application/src/main/java/org/opentripplanner/routing/alternativelegs/AlternativeLegs.java similarity index 99% rename from src/main/java/org/opentripplanner/routing/alternativelegs/AlternativeLegs.java rename to application/src/main/java/org/opentripplanner/routing/alternativelegs/AlternativeLegs.java index 6b51c0b1282..465ed230884 100644 --- a/src/main/java/org/opentripplanner/routing/alternativelegs/AlternativeLegs.java +++ b/application/src/main/java/org/opentripplanner/routing/alternativelegs/AlternativeLegs.java @@ -16,7 +16,6 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; import java.util.stream.Stream; -import javax.annotation.Nonnull; import org.opentripplanner.framework.time.ServiceDateUtils; import org.opentripplanner.model.Timetable; import org.opentripplanner.model.TripTimeOnDate; @@ -138,7 +137,6 @@ public static List getAlternativeLegs( * This has been copied and slightly modified from StopTimesHelper. * TODO: Adapt after new transit model is in place */ - @Nonnull private static Stream generateLegs( TransitService transitService, TripPatternBetweenStops tripPatternBetweenStops, @@ -224,7 +222,6 @@ private static Stream generateLegs( return res.stream(); } - @Nonnull private static ScheduledTransitLeg mapToLeg( ZoneId timeZone, TripPattern pattern, @@ -264,7 +261,6 @@ private static ScheduledTransitLeg mapToLeg( .build(); } - @Nonnull private static Stream withBoardingAlightingPositions( Collection origins, Collection destinations, diff --git a/src/main/java/org/opentripplanner/routing/alternativelegs/AlternativeLegsFilter.java b/application/src/main/java/org/opentripplanner/routing/alternativelegs/AlternativeLegsFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/alternativelegs/AlternativeLegsFilter.java rename to application/src/main/java/org/opentripplanner/routing/alternativelegs/AlternativeLegsFilter.java diff --git a/src/main/java/org/opentripplanner/routing/api/RoutingService.java b/application/src/main/java/org/opentripplanner/routing/api/RoutingService.java similarity index 74% rename from src/main/java/org/opentripplanner/routing/api/RoutingService.java rename to application/src/main/java/org/opentripplanner/routing/api/RoutingService.java index f840ac27524..fcea16e3991 100644 --- a/src/main/java/org/opentripplanner/routing/api/RoutingService.java +++ b/application/src/main/java/org/opentripplanner/routing/api/RoutingService.java @@ -8,5 +8,10 @@ public interface RoutingService { RoutingResponse route(RouteRequest request); + /** + * @deprecated We will replace the complex via-search with a simpler version part of the + * existing trip search. + */ + @Deprecated ViaRoutingResponse route(RouteViaRequest request); } diff --git a/src/main/java/org/opentripplanner/routing/api/request/DebugEventType.java b/application/src/main/java/org/opentripplanner/routing/api/request/DebugEventType.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/DebugEventType.java rename to application/src/main/java/org/opentripplanner/routing/api/request/DebugEventType.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/DebugRaptor.java b/application/src/main/java/org/opentripplanner/routing/api/request/DebugRaptor.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/DebugRaptor.java rename to application/src/main/java/org/opentripplanner/routing/api/request/DebugRaptor.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/RequestModes.java b/application/src/main/java/org/opentripplanner/routing/api/request/RequestModes.java similarity index 97% rename from src/main/java/org/opentripplanner/routing/api/request/RequestModes.java rename to application/src/main/java/org/opentripplanner/routing/api/request/RequestModes.java index 72b06f62979..8afb3082e1b 100644 --- a/src/main/java/org/opentripplanner/routing/api/request/RequestModes.java +++ b/application/src/main/java/org/opentripplanner/routing/api/request/RequestModes.java @@ -3,7 +3,6 @@ import static org.opentripplanner.routing.api.request.StreetMode.NOT_SET; import java.util.Objects; -import javax.annotation.Nonnull; import org.opentripplanner.framework.tostring.ToStringBuilder; public class RequestModes { @@ -18,16 +17,12 @@ public class RequestModes { StreetMode.WALK ); - @Nonnull public final StreetMode accessMode; - @Nonnull public final StreetMode egressMode; - @Nonnull public final StreetMode directMode; - @Nonnull public final StreetMode transferMode; private RequestModes( diff --git a/src/main/java/org/opentripplanner/routing/api/request/RequestModesBuilder.java b/application/src/main/java/org/opentripplanner/routing/api/request/RequestModesBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/RequestModesBuilder.java rename to application/src/main/java/org/opentripplanner/routing/api/request/RequestModesBuilder.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/RouteRequest.java b/application/src/main/java/org/opentripplanner/routing/api/request/RouteRequest.java similarity index 91% rename from src/main/java/org/opentripplanner/routing/api/request/RouteRequest.java rename to application/src/main/java/org/opentripplanner/routing/api/request/RouteRequest.java index 76e5dcc558a..56ba39d8431 100644 --- a/src/main/java/org/opentripplanner/routing/api/request/RouteRequest.java +++ b/application/src/main/java/org/opentripplanner/routing/api/request/RouteRequest.java @@ -21,6 +21,7 @@ import org.opentripplanner.model.plan.paging.cursor.PageCursor; import org.opentripplanner.routing.api.request.preference.RoutingPreferences; import org.opentripplanner.routing.api.request.request.JourneyRequest; +import org.opentripplanner.routing.api.request.via.ViaLocation; import org.opentripplanner.routing.api.response.InputField; import org.opentripplanner.routing.api.response.RoutingError; import org.opentripplanner.routing.api.response.RoutingErrorCode; @@ -35,14 +36,6 @@ * All defaults should be specified here in the RouteRequest, NOT as annotations on query parameters * in web services that create RouteRequests. This establishes a priority chain for default values: * RouteRequest field initializers, then JSON router config, then query parameters. - * - * @Deprecated tag is added to all parameters that are not currently functional in either the Raptor - * router or other non-transit routing (walk, bike, car etc.) - *

    - * TODO OTP2 Many fields are deprecated in this class, the reason is documented in the - * RoutingResource class, not here. Eventually the field will be removed from this - * class, but we want to keep it in the RoutingResource as long as we support the - * REST API. */ public class RouteRequest implements Cloneable, Serializable { @@ -56,7 +49,7 @@ public class RouteRequest implements Cloneable, Serializable { private GenericLocation to; - private List passThroughPoints = Collections.emptyList(); + private List via = Collections.emptyList(); private Instant dateTime = Instant.now(); @@ -110,14 +103,15 @@ public RoutingPreferences preferences() { return preferences; } - public void withPreferences(Consumer body) { + public RouteRequest withPreferences(Consumer body) { this.preferences = preferences.copyOf().apply(body).build(); + return this; } /** * The booking time is used to exclude services which are not bookable at the * requested booking time. If a service is bookable at this time or later, the service - * is included. This apply to FLEX access, egress and direct services. + * is included. This applies to FLEX access, egress and direct services. */ public Instant bookingTime() { return bookingTime; @@ -182,6 +176,12 @@ public SortOrder itinerariesSortOrder() { * Adjust the 'dateTime' if the page cursor is set to "goto next/previous page". The date-time is * used for many things, for example finding the days to search, but the transit search is using * the cursor[if exist], not the date-time. + *

    + * The direct mode is also unset when there is a page cursor because for anything other than the + * initial page we don't want to see direct results. + *

    + * See also {@link org.opentripplanner.routing.algorithm.raptoradapter.router.FilterTransitWhenDirectModeIsEmpty}, + * it uses a direct search to prune transit. */ public void applyPageCursor() { if (pageCursor != null) { @@ -278,32 +278,39 @@ public void setTo(GenericLocation to) { this.to = to; } - public List getPassThroughPoints() { - return passThroughPoints; + /** + * Return {@code true} if at least one via location is set! + */ + public boolean isViaSearch() { + return !via.isEmpty(); + } + + public List getViaLocations() { + return via; } - public void setPassThroughPoints(final List passThroughPoints) { - this.passThroughPoints = passThroughPoints; + public void setViaLocations(final List via) { + this.via = via; } /** * This is the time/duration in seconds from the earliest-departure-time(EDT) to - * latest-departure-time(LDT). In case of a reverse search it will be the time from earliest to + * latest-departure-time(LDT). In case of a reverse search, it will be the time from earliest to * latest arrival time (LAT - EAT). *

    - * All optimal travels that depart within the search window is guaranteed to be found. + * All optimal itineraries that depart within the search window are guaranteed to be found. *

    * This is sometimes referred to as the Range Raptor Search Window - but could be used in a none * Transit search as well; Hence this is named search-window and not raptor-search-window. Do not * confuse this with the travel-window, which is the time between EDT to LAT. *

    * Use {@code null} to unset, and {@link Duration#ZERO} to do one Raptor iteration. The value is - * dynamically assigned a suitable value, if not set. In a small to medium size operation you may - * use a fixed value, like 60 minutes. If you have a mixture of high frequency cities routes and + * dynamically assigned a suitable value, if not set. In a small-to-medium size operation, you may + * use a fixed value, like 60 minutes. If you have a mixture of high-frequency city routes and * infrequent long distant journeys, the best option is normally to use the dynamic auto * assignment. *

    - * There is no need to set this when going to the next/previous page any more. + * There is no need to set this when going to the next/previous page anymore. */ public Duration searchWindow() { return searchWindow; diff --git a/src/main/java/org/opentripplanner/routing/api/request/RouteViaRequest.java b/application/src/main/java/org/opentripplanner/routing/api/request/RouteViaRequest.java similarity index 93% rename from src/main/java/org/opentripplanner/routing/api/request/RouteViaRequest.java rename to application/src/main/java/org/opentripplanner/routing/api/request/RouteViaRequest.java index 97e492ffd98..7d91558cf77 100644 --- a/src/main/java/org/opentripplanner/routing/api/request/RouteViaRequest.java +++ b/application/src/main/java/org/opentripplanner/routing/api/request/RouteViaRequest.java @@ -14,7 +14,11 @@ /** * Trip planning request with a list of via points. + * + * @deprecated We will replace the complex via-search with a simpler version part of the + * existing trip search. */ +@Deprecated public class RouteViaRequest implements Serializable { private final GenericLocation from; @@ -27,7 +31,10 @@ public class RouteViaRequest implements Serializable { private final Locale locale; private final Integer numItineraries; - private RouteViaRequest(List viaLocations, List viaJourneys) { + private RouteViaRequest( + List viaLocations, + List viaJourneys + ) { if (viaLocations == null || viaLocations.isEmpty()) { throw new IllegalArgumentException("viaLocations must not be empty"); } @@ -67,7 +74,10 @@ private RouteViaRequest(Builder builder) { this.numItineraries = builder.numItineraries; } - public static Builder of(List viaLocations, List viaJourneys) { + public static Builder of( + List viaLocations, + List viaJourneys + ) { return new Builder(new RouteViaRequest(viaLocations, viaJourneys)); } @@ -230,8 +240,8 @@ public Builder withNumItineraries(Integer numItineraries) { } /** - * ViaSegments contains the {@link JourneyRequest} to the next {@link ViaLocation}. The last + * ViaSegments contains the {@link JourneyRequest} to the next {@link ViaLocationDeprecated}. The last * segment has null viaLocation, as `to` is the destination of that segment. */ - public record ViaSegment(JourneyRequest journeyRequest, ViaLocation viaLocation) {} + public record ViaSegment(JourneyRequest journeyRequest, ViaLocationDeprecated viaLocation) {} } diff --git a/src/main/java/org/opentripplanner/routing/api/request/RoutingTag.java b/application/src/main/java/org/opentripplanner/routing/api/request/RoutingTag.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/RoutingTag.java rename to application/src/main/java/org/opentripplanner/routing/api/request/RoutingTag.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/StreetMode.java b/application/src/main/java/org/opentripplanner/routing/api/request/StreetMode.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/StreetMode.java rename to application/src/main/java/org/opentripplanner/routing/api/request/StreetMode.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/ViaLocation.java b/application/src/main/java/org/opentripplanner/routing/api/request/ViaLocationDeprecated.java similarity index 82% rename from src/main/java/org/opentripplanner/routing/api/request/ViaLocation.java rename to application/src/main/java/org/opentripplanner/routing/api/request/ViaLocationDeprecated.java index 9701095a382..7d864dddb16 100644 --- a/src/main/java/org/opentripplanner/routing/api/request/ViaLocation.java +++ b/application/src/main/java/org/opentripplanner/routing/api/request/ViaLocationDeprecated.java @@ -11,8 +11,12 @@ * @param passThroughPoint Does the via point represent a pass through * @param minSlack Minimum time that is allowed to wait for interchange. * @param maxSlack Maximum time to wait for next departure. + * + * @deprecated We will replace the complex via-search with a simpler version part of the + * existing trip search. */ -public record ViaLocation( +@Deprecated +public record ViaLocationDeprecated( GenericLocation point, boolean passThroughPoint, Duration minSlack, @@ -21,7 +25,7 @@ public record ViaLocation( public static final Duration DEFAULT_MAX_SLACK = Duration.ofHours(1); public static final Duration DEFAULT_MIN_SLACK = Duration.ofMinutes(5); - public ViaLocation { + public ViaLocationDeprecated { Objects.requireNonNull(minSlack); Objects.requireNonNull(maxSlack); Objects.requireNonNull(point); diff --git a/src/main/java/org/opentripplanner/routing/api/request/framework/AbstractLinearFunction.java b/application/src/main/java/org/opentripplanner/routing/api/request/framework/AbstractLinearFunction.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/framework/AbstractLinearFunction.java rename to application/src/main/java/org/opentripplanner/routing/api/request/framework/AbstractLinearFunction.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/framework/CostLinearFunction.java b/application/src/main/java/org/opentripplanner/routing/api/request/framework/CostLinearFunction.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/framework/CostLinearFunction.java rename to application/src/main/java/org/opentripplanner/routing/api/request/framework/CostLinearFunction.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/framework/DurationForEnum.java b/application/src/main/java/org/opentripplanner/routing/api/request/framework/DurationForEnum.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/framework/DurationForEnum.java rename to application/src/main/java/org/opentripplanner/routing/api/request/framework/DurationForEnum.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/framework/LinearFunctionSerialization.java b/application/src/main/java/org/opentripplanner/routing/api/request/framework/LinearFunctionSerialization.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/framework/LinearFunctionSerialization.java rename to application/src/main/java/org/opentripplanner/routing/api/request/framework/LinearFunctionSerialization.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/framework/TimeAndCostPenalty.java b/application/src/main/java/org/opentripplanner/routing/api/request/framework/TimeAndCostPenalty.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/framework/TimeAndCostPenalty.java rename to application/src/main/java/org/opentripplanner/routing/api/request/framework/TimeAndCostPenalty.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/framework/TimeAndCostPenaltyForEnum.java b/application/src/main/java/org/opentripplanner/routing/api/request/framework/TimeAndCostPenaltyForEnum.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/framework/TimeAndCostPenaltyForEnum.java rename to application/src/main/java/org/opentripplanner/routing/api/request/framework/TimeAndCostPenaltyForEnum.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/framework/TimePenalty.java b/application/src/main/java/org/opentripplanner/routing/api/request/framework/TimePenalty.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/framework/TimePenalty.java rename to application/src/main/java/org/opentripplanner/routing/api/request/framework/TimePenalty.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/AccessEgressPreferences.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/AccessEgressPreferences.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/preference/AccessEgressPreferences.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/AccessEgressPreferences.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/AccessibilityPreferences.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/AccessibilityPreferences.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/preference/AccessibilityPreferences.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/AccessibilityPreferences.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/BikePreferences.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/BikePreferences.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/preference/BikePreferences.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/BikePreferences.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/CarPreferences.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/CarPreferences.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/preference/CarPreferences.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/CarPreferences.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/ElevatorPreferences.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/ElevatorPreferences.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/preference/ElevatorPreferences.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/ElevatorPreferences.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/ItineraryFilterDebugProfile.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/ItineraryFilterDebugProfile.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/preference/ItineraryFilterDebugProfile.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/ItineraryFilterDebugProfile.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/ItineraryFilterPreferences.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/ItineraryFilterPreferences.java similarity index 94% rename from src/main/java/org/opentripplanner/routing/api/request/preference/ItineraryFilterPreferences.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/ItineraryFilterPreferences.java index 91f3071d4ed..31fa7edd139 100644 --- a/src/main/java/org/opentripplanner/routing/api/request/preference/ItineraryFilterPreferences.java +++ b/application/src/main/java/org/opentripplanner/routing/api/request/preference/ItineraryFilterPreferences.java @@ -31,7 +31,7 @@ public final class ItineraryFilterPreferences { private final boolean removeItinerariesWithSameRoutesAndStops; private final TransitGeneralizedCostFilterParams transitGeneralizedCostLimit; private final CostLinearFunction removeTransitWithHigherCostThanBestOnStreetOnly; - private final boolean removeTransitIfWalkingIsBetter; + private final boolean filterDirectFlexBySearchWindow; private ItineraryFilterPreferences() { this.accessibilityScore = false; @@ -52,7 +52,7 @@ private ItineraryFilterPreferences() { ); this.removeTransitWithHigherCostThanBestOnStreetOnly = CostLinearFunction.of(Duration.ofMinutes(1), 1.3); - this.removeTransitIfWalkingIsBetter = false; + this.filterDirectFlexBySearchWindow = true; } private ItineraryFilterPreferences(Builder builder) { @@ -73,7 +73,7 @@ private ItineraryFilterPreferences(Builder builder) { this.transitGeneralizedCostLimit = Objects.requireNonNull(builder.transitGeneralizedCostLimit); this.removeTransitWithHigherCostThanBestOnStreetOnly = Objects.requireNonNull(builder.removeTransitWithHigherCostThanBestOnStreetOnly); - this.removeTransitIfWalkingIsBetter = builder.removeTransitIfWalkingIsBetter; + this.filterDirectFlexBySearchWindow = builder.filterDirectFlexBySearchWindow; } public static Builder of() { @@ -136,8 +136,8 @@ public CostLinearFunction removeTransitWithHigherCostThanBestOnStreetOnly() { return removeTransitWithHigherCostThanBestOnStreetOnly; } - public boolean removeTransitIfWalkingIsBetter() { - return removeTransitIfWalkingIsBetter; + public boolean filterDirectFlexBySearchWindow() { + return filterDirectFlexBySearchWindow; } @Override @@ -187,7 +187,7 @@ public String toString() { "removeItinerariesWithSameRoutesAndStops", removeItinerariesWithSameRoutesAndStops ) - .addBoolIfTrue("removeTransitIfWalkingIsBetter", removeTransitIfWalkingIsBetter) + .addBoolIfTrue("filterDirectFlexBySearchWindow", filterDirectFlexBySearchWindow) .toString(); } @@ -200,7 +200,6 @@ public boolean equals(Object o) { accessibilityScore == that.accessibilityScore && Double.compare(that.bikeRentalDistanceRatio, bikeRentalDistanceRatio) == 0 && debug == that.debug && - removeTransitIfWalkingIsBetter == that.removeTransitIfWalkingIsBetter && filterItinerariesWithSameFirstOrLastTrip == that.filterItinerariesWithSameFirstOrLastTrip && Double.compare( that.groupedOtherThanSameLegsMaxCostMultiplier, @@ -217,7 +216,8 @@ public boolean equals(Object o) { removeTransitWithHigherCostThanBestOnStreetOnly, that.removeTransitWithHigherCostThanBestOnStreetOnly ) && - Objects.equals(transitGeneralizedCostLimit, that.transitGeneralizedCostLimit) + Objects.equals(transitGeneralizedCostLimit, that.transitGeneralizedCostLimit) && + filterDirectFlexBySearchWindow == that.filterDirectFlexBySearchWindow ); } @@ -237,7 +237,7 @@ public int hashCode() { removeItinerariesWithSameRoutesAndStops, transitGeneralizedCostLimit, removeTransitWithHigherCostThanBestOnStreetOnly, - removeTransitIfWalkingIsBetter + filterDirectFlexBySearchWindow ); } @@ -257,7 +257,7 @@ public static class Builder { private boolean removeItinerariesWithSameRoutesAndStops; private TransitGeneralizedCostFilterParams transitGeneralizedCostLimit; private CostLinearFunction removeTransitWithHigherCostThanBestOnStreetOnly; - private boolean removeTransitIfWalkingIsBetter; + private boolean filterDirectFlexBySearchWindow; public ItineraryFilterPreferences original() { return original; @@ -341,11 +341,6 @@ public Builder withRemoveTransitWithHigherCostThanBestOnStreetOnly( return this; } - public Builder withRemoveTransitIfWalkingIsBetter(boolean removeTransitIfWalkingIsBetter) { - this.removeTransitIfWalkingIsBetter = removeTransitIfWalkingIsBetter; - return this; - } - public Builder(ItineraryFilterPreferences original) { this.original = original; this.accessibilityScore = original.accessibilityScore; @@ -365,7 +360,7 @@ public Builder(ItineraryFilterPreferences original) { this.transitGeneralizedCostLimit = original.transitGeneralizedCostLimit; this.removeTransitWithHigherCostThanBestOnStreetOnly = original.removeTransitWithHigherCostThanBestOnStreetOnly; - this.removeTransitIfWalkingIsBetter = original.removeTransitIfWalkingIsBetter; + this.filterDirectFlexBySearchWindow = original.filterDirectFlexBySearchWindow; } public Builder apply(Consumer body) { @@ -377,5 +372,10 @@ public ItineraryFilterPreferences build() { var value = new ItineraryFilterPreferences(this); return original.equals(value) ? original : value; } + + public Builder withFilterDirectFlexBySearchWindow(boolean filterDirectFlexBySearchWindow) { + this.filterDirectFlexBySearchWindow = filterDirectFlexBySearchWindow; + return this; + } } } diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/RaptorPreferences.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/RaptorPreferences.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/preference/RaptorPreferences.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/RaptorPreferences.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/Relax.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/Relax.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/preference/Relax.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/Relax.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/RoutingPreferences.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/RoutingPreferences.java similarity index 99% rename from src/main/java/org/opentripplanner/routing/api/request/preference/RoutingPreferences.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/RoutingPreferences.java index 58ca5b180bf..5e5475d12ac 100644 --- a/src/main/java/org/opentripplanner/routing/api/request/preference/RoutingPreferences.java +++ b/application/src/main/java/org/opentripplanner/routing/api/request/preference/RoutingPreferences.java @@ -6,7 +6,6 @@ import java.io.Serializable; import java.util.Objects; import java.util.function.Consumer; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.routing.api.request.StreetMode; import org.opentripplanner.street.search.TraverseMode; @@ -81,7 +80,6 @@ public StreetPreferences street() { /** * Preferences for how strict wheel-accessibility settings are */ - @Nonnull public WheelchairPreferences wheelchair() { return wheelchair; } @@ -108,7 +106,6 @@ public VehicleParkingPreferences parking(TraverseMode mode) { /** * Get rental preferences for the traverse mode. Note, only car, scooter and bike are supported. */ - @Nonnull public VehicleRentalPreferences rental(TraverseMode mode) { return switch (mode) { case BICYCLE -> bike.rental(); @@ -131,7 +128,6 @@ public VehicleRentalPreferences rental(StreetMode mode) { }; } - @Nonnull public ItineraryFilterPreferences itineraryFilter() { return itineraryFilter; } diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/ScooterPreferences.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/ScooterPreferences.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/preference/ScooterPreferences.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/ScooterPreferences.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/StreetPreferences.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/StreetPreferences.java similarity index 99% rename from src/main/java/org/opentripplanner/routing/api/request/preference/StreetPreferences.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/StreetPreferences.java index 6ea6ee1fc3a..166c950a0e7 100644 --- a/src/main/java/org/opentripplanner/routing/api/request/preference/StreetPreferences.java +++ b/application/src/main/java/org/opentripplanner/routing/api/request/preference/StreetPreferences.java @@ -9,7 +9,6 @@ import java.util.Map; import java.util.Objects; import java.util.function.Consumer; -import javax.annotation.Nonnull; import org.opentripplanner.framework.lang.DoubleUtils; import org.opentripplanner.framework.model.Units; import org.opentripplanner.framework.tostring.ToStringBuilder; @@ -100,7 +99,6 @@ public DurationForEnum maxDirectDuration() { * CAR). So the default timeout for a street search is set quite high. This is used to abort the * search if the max distance is not reached within the timeout. */ - @Nonnull public Duration routingTimeout() { return routingTimeout; } diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/SystemPreferences.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/SystemPreferences.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/preference/SystemPreferences.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/SystemPreferences.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/TimeSlopeSafetyTriangle.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/TimeSlopeSafetyTriangle.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/preference/TimeSlopeSafetyTriangle.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/TimeSlopeSafetyTriangle.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/TransferOptimizationPreferences.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/TransferOptimizationPreferences.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/preference/TransferOptimizationPreferences.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/TransferOptimizationPreferences.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/TransferPreferences.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/TransferPreferences.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/preference/TransferPreferences.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/TransferPreferences.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/TransitPreferences.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/TransitPreferences.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/preference/TransitPreferences.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/TransitPreferences.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/VehicleParkingPreferences.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/VehicleParkingPreferences.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/preference/VehicleParkingPreferences.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/VehicleParkingPreferences.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/VehicleRentalPreferences.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/VehicleRentalPreferences.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/preference/VehicleRentalPreferences.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/VehicleRentalPreferences.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/VehicleWalkingPreferences.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/VehicleWalkingPreferences.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/preference/VehicleWalkingPreferences.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/VehicleWalkingPreferences.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/WalkPreferences.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/WalkPreferences.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/preference/WalkPreferences.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/WalkPreferences.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/WheelchairPreferences.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/WheelchairPreferences.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/preference/WheelchairPreferences.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/WheelchairPreferences.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/filter/VehicleParkingFilter.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/filter/VehicleParkingFilter.java similarity index 98% rename from src/main/java/org/opentripplanner/routing/api/request/preference/filter/VehicleParkingFilter.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/filter/VehicleParkingFilter.java index c4f5cee422f..3fb6d6b0a62 100644 --- a/src/main/java/org/opentripplanner/routing/api/request/preference/filter/VehicleParkingFilter.java +++ b/application/src/main/java/org/opentripplanner/routing/api/request/preference/filter/VehicleParkingFilter.java @@ -4,7 +4,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; -import javax.annotation.Nonnull; import org.opentripplanner.framework.tostring.ToStringBuilder; import org.opentripplanner.routing.vehicle_parking.VehicleParking; @@ -87,7 +86,6 @@ public int hashCode() { return Arrays.hashCode(not) + Arrays.hashCode(select); } - @Nonnull private static VehicleParkingSelect[] makeFilter(Collection select) { return select.stream().filter(f -> !f.isEmpty()).toArray(VehicleParkingSelect[]::new); } diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/filter/VehicleParkingSelect.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/filter/VehicleParkingSelect.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/preference/filter/VehicleParkingSelect.java rename to application/src/main/java/org/opentripplanner/routing/api/request/preference/filter/VehicleParkingSelect.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/request/JourneyRequest.java b/application/src/main/java/org/opentripplanner/routing/api/request/request/JourneyRequest.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/request/JourneyRequest.java rename to application/src/main/java/org/opentripplanner/routing/api/request/request/JourneyRequest.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/request/StreetRequest.java b/application/src/main/java/org/opentripplanner/routing/api/request/request/StreetRequest.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/request/StreetRequest.java rename to application/src/main/java/org/opentripplanner/routing/api/request/request/StreetRequest.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/request/TransitRequest.java b/application/src/main/java/org/opentripplanner/routing/api/request/request/TransitRequest.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/request/TransitRequest.java rename to application/src/main/java/org/opentripplanner/routing/api/request/request/TransitRequest.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/request/filter/AllowAllTransitFilter.java b/application/src/main/java/org/opentripplanner/routing/api/request/request/filter/AllowAllTransitFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/request/filter/AllowAllTransitFilter.java rename to application/src/main/java/org/opentripplanner/routing/api/request/request/filter/AllowAllTransitFilter.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/request/filter/SelectRequest.java b/application/src/main/java/org/opentripplanner/routing/api/request/request/filter/SelectRequest.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/request/filter/SelectRequest.java rename to application/src/main/java/org/opentripplanner/routing/api/request/request/filter/SelectRequest.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/request/filter/TransitFilter.java b/application/src/main/java/org/opentripplanner/routing/api/request/request/filter/TransitFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/request/filter/TransitFilter.java rename to application/src/main/java/org/opentripplanner/routing/api/request/request/filter/TransitFilter.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/request/filter/TransitFilterRequest.java b/application/src/main/java/org/opentripplanner/routing/api/request/request/filter/TransitFilterRequest.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/request/filter/TransitFilterRequest.java rename to application/src/main/java/org/opentripplanner/routing/api/request/request/filter/TransitFilterRequest.java diff --git a/src/main/java/org/opentripplanner/routing/api/request/request/filter/TransitGroupSelect.java b/application/src/main/java/org/opentripplanner/routing/api/request/request/filter/TransitGroupSelect.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/request/request/filter/TransitGroupSelect.java rename to application/src/main/java/org/opentripplanner/routing/api/request/request/filter/TransitGroupSelect.java diff --git a/application/src/main/java/org/opentripplanner/routing/api/request/via/AbstractViaLocation.java b/application/src/main/java/org/opentripplanner/routing/api/request/via/AbstractViaLocation.java new file mode 100644 index 00000000000..2f694df53cb --- /dev/null +++ b/application/src/main/java/org/opentripplanner/routing/api/request/via/AbstractViaLocation.java @@ -0,0 +1,44 @@ +package org.opentripplanner.routing.api.request.via; + +import java.util.Collection; +import java.util.List; +import java.util.Objects; +import javax.annotation.Nullable; +import org.opentripplanner.transit.model.framework.FeedScopedId; + +public abstract class AbstractViaLocation implements ViaLocation { + + private final String label; + private final List stopLocationIds; + + public AbstractViaLocation(String label, Collection stopLocationIds) { + this.label = label; + this.stopLocationIds = List.copyOf(stopLocationIds); + } + + @Nullable + @Override + public String label() { + return label; + } + + @Override + public List stopLocationIds() { + return stopLocationIds; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + AbstractViaLocation that = (AbstractViaLocation) o; + return ( + Objects.equals(label, that.label) && Objects.equals(stopLocationIds, that.stopLocationIds) + ); + } + + @Override + public int hashCode() { + return Objects.hash(label, stopLocationIds); + } +} diff --git a/application/src/main/java/org/opentripplanner/routing/api/request/via/PassThroughViaLocation.java b/application/src/main/java/org/opentripplanner/routing/api/request/via/PassThroughViaLocation.java new file mode 100644 index 00000000000..1116031cec6 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/routing/api/request/via/PassThroughViaLocation.java @@ -0,0 +1,37 @@ +package org.opentripplanner.routing.api.request.via; + +import java.util.Collection; +import javax.annotation.Nullable; +import org.opentripplanner.framework.tostring.ToStringBuilder; +import org.opentripplanner.transit.model.framework.FeedScopedId; + +/** + * One of the listed stop locations or one of its children must be visited. An on-board + * intermediate stop visit is ok, as well as boarding or alighting at one of the stops. + */ +public class PassThroughViaLocation extends AbstractViaLocation { + + @SuppressWarnings("DataFlowIssue") + public PassThroughViaLocation(@Nullable String label, Collection stopLocationIds) { + super(label, stopLocationIds); + if (stopLocationIds.isEmpty()) { + throw new IllegalArgumentException( + "A pass through via location must have at least one stop location. Label: " + label + ); + } + } + + @Override + public boolean isPassThroughLocation() { + return true; + } + + @Override + public String toString() { + return ToStringBuilder + .of(PassThroughViaLocation.class) + .addObj("label", label()) + .addCol("stopLocationIds", stopLocationIds()) + .toString(); + } +} diff --git a/application/src/main/java/org/opentripplanner/routing/api/request/via/ViaLocation.java b/application/src/main/java/org/opentripplanner/routing/api/request/via/ViaLocation.java new file mode 100644 index 00000000000..4a3476954c8 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/routing/api/request/via/ViaLocation.java @@ -0,0 +1,56 @@ +package org.opentripplanner.routing.api.request.via; + +import java.time.Duration; +import java.util.List; +import javax.annotation.Nullable; +import org.opentripplanner.framework.geometry.WgsCoordinate; +import org.opentripplanner.transit.model.framework.FeedScopedId; + +/** + * Defines a via location which the journey must route through. At least one stop location or + * coordinate must exist. When routing, the via-location is visited if at least one of the stops + * or coordinates is visited, before the journey continues. There is no need to visit any other + * stop location or coordinate. + *

    + * The stop locations and coordinates are distinct locations. In earlier versions of OTP the + * coordinates were used as a fallback for when a stop was not found. But in this version, a + * {@link org.opentripplanner.transit.model.framework.EntityNotFoundException} is thrown if + * one of the stops does not exist. The search does NOT try to be smart and recover from an + * entity not found exception. + */ +public interface ViaLocation { + /** + * Get an optional name/label of for debugging and logging. Not used in business logic. + */ + @Nullable + String label(); + + /** + * The minimum wait time is used to force the trip to stay the given duration at the via location + * before the trip is continued. This cannot be used together with allow-pass-through, since a + * pass-through stop is visited on-board. + */ + default Duration minimumWaitTime() { + return Duration.ZERO; + } + + /** + * Returns {@code true} if this location is a pass-through-point. Only stops can be visited and + * the {@code minimumWaitTime} must be zero. + */ + boolean isPassThroughLocation(); + + /** + * A list of stops which can be used as via location together with the {@code coordinates}. A stop + * location can be a stop, a station, a multimodal station or a group of stations. + */ + List stopLocationIds(); + + /** + * A list of coordinates used together with the {@code stopLocationIds} as the via location. + * This is optional, an empty list is returned if no coordinates are available. + */ + default List coordinates() { + return List.of(); + } +} diff --git a/application/src/main/java/org/opentripplanner/routing/api/request/via/VisitViaLocation.java b/application/src/main/java/org/opentripplanner/routing/api/request/via/VisitViaLocation.java new file mode 100644 index 00000000000..2b59a749a1d --- /dev/null +++ b/application/src/main/java/org/opentripplanner/routing/api/request/via/VisitViaLocation.java @@ -0,0 +1,102 @@ +package org.opentripplanner.routing.api.request.via; + +import java.time.Duration; +import java.util.List; +import java.util.Objects; +import javax.annotation.Nullable; +import org.opentripplanner.framework.geometry.WgsCoordinate; +import org.opentripplanner.framework.time.DurationUtils; +import org.opentripplanner.framework.tostring.ToStringBuilder; +import org.opentripplanner.transit.model.framework.FeedScopedId; + +/** + * A visit-via-location is a physical visit to one of the stops or coordinates listed. An on-board + * visit does not count. The traveler must alight or board at the given stop for it to to be + * accepted. To visit a coordinate, the traveler must walk(bike or drive) to the closest point in + * the street network from a stop and back to another stop to join the transit network. + *

    + * TODO: NOTE! Coordinates are NOT supported yet. + */ +public class VisitViaLocation extends AbstractViaLocation { + + private static final Duration MINIMUM_WAIT_TIME_MAX_LIMIT = Duration.ofHours(24); + + private final Duration minimumWaitTime; + private final List coordinates; + + public VisitViaLocation( + @Nullable String label, + @Nullable Duration minimumWaitTime, + List stopLocationIds, + List coordinates + ) { + super(label, stopLocationIds); + this.minimumWaitTime = + DurationUtils.requireNonNegative( + minimumWaitTime == null ? Duration.ZERO : minimumWaitTime, + MINIMUM_WAIT_TIME_MAX_LIMIT, + "minimumWaitTime" + ); + this.coordinates = List.copyOf(coordinates); + + if (stopLocationIds().isEmpty() && coordinates().isEmpty()) { + throw new IllegalArgumentException( + "A via location must have at least one stop location or a coordinate. Label: " + label + ); + } + } + + /** + * The minimum wait time is used to force the trip to stay the given duration at the via location + * before the trip is continued. This cannot be used together with allow-pass-through, since a + * pass-through stop is visited on-board. + */ + @Override + public Duration minimumWaitTime() { + return minimumWaitTime; + } + + @Override + public boolean isPassThroughLocation() { + return false; + } + + @Override + public List coordinates() { + return coordinates; + } + + @Override + public String toString() { + return ToStringBuilder + .of(VisitViaLocation.class) + .addObj("label", label()) + .addDuration("minimumWaitTime", minimumWaitTime, Duration.ZERO) + .addCol("stopLocationIds", stopLocationIds()) + .addObj("coordinates", coordinates) + .toString(); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + if (!super.equals(o)) { + return false; + } + VisitViaLocation that = (VisitViaLocation) o; + return ( + Objects.equals(minimumWaitTime, that.minimumWaitTime) && + Objects.equals(coordinates, that.coordinates) + ); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), minimumWaitTime, coordinates); + } +} diff --git a/src/main/java/org/opentripplanner/routing/api/response/InputField.java b/application/src/main/java/org/opentripplanner/routing/api/response/InputField.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/response/InputField.java rename to application/src/main/java/org/opentripplanner/routing/api/response/InputField.java diff --git a/src/main/java/org/opentripplanner/routing/api/response/RoutingError.java b/application/src/main/java/org/opentripplanner/routing/api/response/RoutingError.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/response/RoutingError.java rename to application/src/main/java/org/opentripplanner/routing/api/response/RoutingError.java diff --git a/src/main/java/org/opentripplanner/routing/api/response/RoutingErrorCode.java b/application/src/main/java/org/opentripplanner/routing/api/response/RoutingErrorCode.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/response/RoutingErrorCode.java rename to application/src/main/java/org/opentripplanner/routing/api/response/RoutingErrorCode.java diff --git a/src/main/java/org/opentripplanner/routing/api/response/RoutingResponse.java b/application/src/main/java/org/opentripplanner/routing/api/response/RoutingResponse.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/response/RoutingResponse.java rename to application/src/main/java/org/opentripplanner/routing/api/response/RoutingResponse.java diff --git a/src/main/java/org/opentripplanner/routing/api/response/TripSearchMetadata.java b/application/src/main/java/org/opentripplanner/routing/api/response/TripSearchMetadata.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/response/TripSearchMetadata.java rename to application/src/main/java/org/opentripplanner/routing/api/response/TripSearchMetadata.java diff --git a/src/main/java/org/opentripplanner/routing/api/response/ViaRoutingResponse.java b/application/src/main/java/org/opentripplanner/routing/api/response/ViaRoutingResponse.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/response/ViaRoutingResponse.java rename to application/src/main/java/org/opentripplanner/routing/api/response/ViaRoutingResponse.java diff --git a/src/main/java/org/opentripplanner/routing/api/response/ViaRoutingResponseConnection.java b/application/src/main/java/org/opentripplanner/routing/api/response/ViaRoutingResponseConnection.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/api/response/ViaRoutingResponseConnection.java rename to application/src/main/java/org/opentripplanner/routing/api/response/ViaRoutingResponseConnection.java diff --git a/src/main/java/org/opentripplanner/routing/core/FareType.java b/application/src/main/java/org/opentripplanner/routing/core/FareType.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/core/FareType.java rename to application/src/main/java/org/opentripplanner/routing/core/FareType.java diff --git a/src/main/java/org/opentripplanner/routing/core/VehicleRoutingOptimizeType.java b/application/src/main/java/org/opentripplanner/routing/core/VehicleRoutingOptimizeType.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/core/VehicleRoutingOptimizeType.java rename to application/src/main/java/org/opentripplanner/routing/core/VehicleRoutingOptimizeType.java diff --git a/src/main/java/org/opentripplanner/routing/error/GraphNotFoundException.java b/application/src/main/java/org/opentripplanner/routing/error/GraphNotFoundException.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/error/GraphNotFoundException.java rename to application/src/main/java/org/opentripplanner/routing/error/GraphNotFoundException.java diff --git a/src/main/java/org/opentripplanner/routing/error/PathNotFoundException.java b/application/src/main/java/org/opentripplanner/routing/error/PathNotFoundException.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/error/PathNotFoundException.java rename to application/src/main/java/org/opentripplanner/routing/error/PathNotFoundException.java diff --git a/src/main/java/org/opentripplanner/routing/error/RoutingValidationException.java b/application/src/main/java/org/opentripplanner/routing/error/RoutingValidationException.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/error/RoutingValidationException.java rename to application/src/main/java/org/opentripplanner/routing/error/RoutingValidationException.java diff --git a/src/main/java/org/opentripplanner/routing/fares/FareService.java b/application/src/main/java/org/opentripplanner/routing/fares/FareService.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/fares/FareService.java rename to application/src/main/java/org/opentripplanner/routing/fares/FareService.java diff --git a/src/main/java/org/opentripplanner/routing/fares/FareServiceFactory.java b/application/src/main/java/org/opentripplanner/routing/fares/FareServiceFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/fares/FareServiceFactory.java rename to application/src/main/java/org/opentripplanner/routing/fares/FareServiceFactory.java diff --git a/src/main/java/org/opentripplanner/routing/framework/DebugTimingAggregator.java b/application/src/main/java/org/opentripplanner/routing/framework/DebugTimingAggregator.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/framework/DebugTimingAggregator.java rename to application/src/main/java/org/opentripplanner/routing/framework/DebugTimingAggregator.java diff --git a/src/main/java/org/opentripplanner/routing/framework/MicrometerUtils.java b/application/src/main/java/org/opentripplanner/routing/framework/MicrometerUtils.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/framework/MicrometerUtils.java rename to application/src/main/java/org/opentripplanner/routing/framework/MicrometerUtils.java diff --git a/src/main/java/org/opentripplanner/routing/graph/Graph.java b/application/src/main/java/org/opentripplanner/routing/graph/Graph.java similarity index 99% rename from src/main/java/org/opentripplanner/routing/graph/Graph.java rename to application/src/main/java/org/opentripplanner/routing/graph/Graph.java index fa3d12b92f7..1fbea77e759 100644 --- a/src/main/java/org/opentripplanner/routing/graph/Graph.java +++ b/application/src/main/java/org/opentripplanner/routing/graph/Graph.java @@ -12,7 +12,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.prefs.Preferences; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.locationtech.jts.geom.Geometry; import org.opentripplanner.ext.dataoverlay.configuration.DataOverlayParameterBindings; @@ -363,7 +362,6 @@ public void setDistanceBetweenElevationSamples(double distanceBetweenElevationSa CompactElevationProfile.setDistanceBetweenSamplesM(distanceBetweenElevationSamples); } - @Nonnull public VehicleParkingService getVehicleParkingService() { return vehicleParkingService; } diff --git a/src/main/java/org/opentripplanner/routing/graph/SerializedGraphObject.java b/application/src/main/java/org/opentripplanner/routing/graph/SerializedGraphObject.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/graph/SerializedGraphObject.java rename to application/src/main/java/org/opentripplanner/routing/graph/SerializedGraphObject.java diff --git a/src/main/java/org/opentripplanner/routing/graph/index/EdgeSpatialIndex.java b/application/src/main/java/org/opentripplanner/routing/graph/index/EdgeSpatialIndex.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/graph/index/EdgeSpatialIndex.java rename to application/src/main/java/org/opentripplanner/routing/graph/index/EdgeSpatialIndex.java diff --git a/src/main/java/org/opentripplanner/routing/graph/index/StreetIndex.java b/application/src/main/java/org/opentripplanner/routing/graph/index/StreetIndex.java similarity index 85% rename from src/main/java/org/opentripplanner/routing/graph/index/StreetIndex.java rename to application/src/main/java/org/opentripplanner/routing/graph/index/StreetIndex.java index 93e333076b0..362c87bff7d 100644 --- a/src/main/java/org/opentripplanner/routing/graph/index/StreetIndex.java +++ b/application/src/main/java/org/opentripplanner/routing/graph/index/StreetIndex.java @@ -1,6 +1,7 @@ package org.opentripplanner.routing.graph.index; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -31,6 +32,7 @@ import org.opentripplanner.street.model.edge.TemporaryFreeEdge; import org.opentripplanner.street.model.edge.TemporaryPartialStreetEdge; import org.opentripplanner.street.model.edge.TemporaryPartialStreetEdgeBuilder; +import org.opentripplanner.street.model.vertex.StationCentroidVertex; import org.opentripplanner.street.model.vertex.StreetVertex; import org.opentripplanner.street.model.vertex.TemporaryStreetLocation; import org.opentripplanner.street.model.vertex.TransitStopVertex; @@ -61,6 +63,11 @@ public class StreetIndex { private final Map transitStopVertices; + /** + * This list contains transitStationVertices for the stations that are configured to route to centroid + */ + private final Map stationCentroidVertices; + private final EdgeSpatialIndex edgeSpatialIndex; private final HashGridSpatialIndex verticesTree; @@ -73,6 +80,7 @@ public StreetIndex(Graph graph, StopModel stopModel) { this.verticesTree = new HashGridSpatialIndex<>(); this.vertexLinker = new VertexLinker(graph, stopModel, edgeSpatialIndex); this.transitStopVertices = toImmutableMap(graph.getVerticesOfType(TransitStopVertex.class)); + this.stationCentroidVertices = createStationCentroidVertexMap(graph); postSetup(graph.getVertices()); } @@ -174,7 +182,8 @@ public Collection getEdgesForEnvelope(Envelope envelope) { * * @param endVertex: whether this is a start vertex (if it's false) or end vertex (if it's true) */ - public Set getVerticesForLocation( + @Nullable + public Set getStreetVerticesForLocation( GenericLocation location, StreetMode streetMode, boolean endVertex, @@ -200,16 +209,24 @@ public Set getVerticesForLocation( } else { // Check if Stop/StopCollection is found by FeedScopeId if (location.stopId != null) { - Set transitStopVertices = getStopVerticesById(location.stopId); - if (transitStopVertices != null && !transitStopVertices.isEmpty()) { - return transitStopVertices; + var streetVertices = getStreetVerticesById(location.stopId); + if (!streetVertices.isEmpty()) { + return streetVertices; } } } // Check if coordinate is provided and connect it to graph if (location.getCoordinate() != null) { - return Set.of(createVertexFromLocation(location, streetMode, endVertex, tempEdges)); + return Set.of( + createVertexFromCoordinate( + location.getCoordinate(), + location.label, + streetMode, + endVertex, + tempEdges + ) + ); } return null; @@ -227,28 +244,24 @@ public String toString() { } /** - * Finds the appropriate vertex for this location. + * Create the appropriate vertex for this coordinate. * * @param endVertex: whether this is a start vertex (if it's false) or end vertex (if it's true) */ - public Vertex getVertexForLocationForTest( - GenericLocation location, + public Vertex createVertexForCoordinateForTest( + Coordinate location, StreetMode streetMode, boolean endVertex, Set tempEdges ) { - // Check if coordinate is provided and connect it to graph - if (location.getCoordinate() == null) { - return null; - } - return createVertexFromLocation(location, streetMode, endVertex, tempEdges); + return createVertexFromCoordinate(location, null, streetMode, endVertex, tempEdges); } /** * @param id Id of Stop, Station, MultiModalStation or GroupOfStations * @return The associated TransitStopVertex or all underlying TransitStopVertices */ - private Set getStopVerticesById(FeedScopedId id) { + public Set getStopOrChildStopsVertices(FeedScopedId id) { return stopModel .findStopOrChildStops(id) .stream() @@ -258,6 +271,20 @@ private Set getStopVerticesById(FeedScopedId id) { .collect(Collectors.toSet()); } + /** + * Get the street vertices for an id. If the id corresponds to a regular stop we will return the + * coordinate for the stop. + * If the id corresponds to a station we will either return the coordinates of the child stops or + * the station centroid if the station is configured to route to centroid. + */ + public Set getStreetVerticesById(FeedScopedId id) { + var stationVertex = stationCentroidVertices.get(id); + if (stationVertex != null) { + return Set.of(stationVertex); + } + return Collections.unmodifiableSet(getStopOrChildStopsVertices(id)); + } + private static void createHalfLocationForTest( TemporaryStreetLocation base, I18NString name, @@ -326,32 +353,33 @@ private static LineString edgeGeometryOrStraightLine(Edge e) { return geometry; } - private Vertex createVertexFromLocation( - GenericLocation location, + private Vertex createVertexFromCoordinate( + Coordinate coordinate, + @Nullable String label, StreetMode streetMode, boolean endVertex, Set tempEdges ) { if (endVertex) { - LOG.debug("Finding end vertex for {}", location); + LOG.debug("Creating end vertex for {}", coordinate); } else { - LOG.debug("Finding start vertex for {}", location); + LOG.debug("Creating start vertex for {}", coordinate); } I18NString name; - if (location.label == null || location.label.isEmpty()) { + if (label == null || label.isEmpty()) { if (endVertex) { name = new LocalizedString("destination"); } else { name = new LocalizedString("origin"); } } else { - name = new NonLocalizedString(location.label); + name = new NonLocalizedString(label); } TemporaryStreetLocation temporaryStreetLocation = new TemporaryStreetLocation( UUID.randomUUID().toString(), - location.getCoordinate(), + coordinate, name, endVertex ); @@ -385,7 +413,7 @@ private Vertex createVertexFromLocation( temporaryStreetLocation.getIncoming().isEmpty() && temporaryStreetLocation.getOutgoing().isEmpty() ) { - LOG.warn("Couldn't link {}", location); + LOG.warn("Couldn't link {}", coordinate); } temporaryStreetLocation.setWheelchairAccessible(true); @@ -435,4 +463,14 @@ private static Map toImmutableMap( } return Map.copyOf(map); } + + private static Map createStationCentroidVertexMap( + Graph graph + ) { + return graph + .getVerticesOfType(StationCentroidVertex.class) + .stream() + .filter(vertex -> vertex.getStation().shouldRouteToCentroid()) + .collect(Collectors.toUnmodifiableMap(v -> v.getStation().getId(), v -> v)); + } } diff --git a/src/main/java/org/opentripplanner/routing/graph/kryosupport/AtomicIntegerSerializer.java b/application/src/main/java/org/opentripplanner/routing/graph/kryosupport/AtomicIntegerSerializer.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/graph/kryosupport/AtomicIntegerSerializer.java rename to application/src/main/java/org/opentripplanner/routing/graph/kryosupport/AtomicIntegerSerializer.java diff --git a/src/main/java/org/opentripplanner/routing/graph/kryosupport/JavaImmutableListSerializer.java b/application/src/main/java/org/opentripplanner/routing/graph/kryosupport/JavaImmutableListSerializer.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/graph/kryosupport/JavaImmutableListSerializer.java rename to application/src/main/java/org/opentripplanner/routing/graph/kryosupport/JavaImmutableListSerializer.java diff --git a/src/main/java/org/opentripplanner/routing/graph/kryosupport/JavaImmutableMapSerializer.java b/application/src/main/java/org/opentripplanner/routing/graph/kryosupport/JavaImmutableMapSerializer.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/graph/kryosupport/JavaImmutableMapSerializer.java rename to application/src/main/java/org/opentripplanner/routing/graph/kryosupport/JavaImmutableMapSerializer.java diff --git a/src/main/java/org/opentripplanner/routing/graph/kryosupport/JavaImmutableSetSerializer.java b/application/src/main/java/org/opentripplanner/routing/graph/kryosupport/JavaImmutableSetSerializer.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/graph/kryosupport/JavaImmutableSetSerializer.java rename to application/src/main/java/org/opentripplanner/routing/graph/kryosupport/JavaImmutableSetSerializer.java diff --git a/src/main/java/org/opentripplanner/routing/graph/kryosupport/KryoBuilder.java b/application/src/main/java/org/opentripplanner/routing/graph/kryosupport/KryoBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/graph/kryosupport/KryoBuilder.java rename to application/src/main/java/org/opentripplanner/routing/graph/kryosupport/KryoBuilder.java diff --git a/src/main/java/org/opentripplanner/routing/graphfinder/DirectGraphFinder.java b/application/src/main/java/org/opentripplanner/routing/graphfinder/DirectGraphFinder.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/graphfinder/DirectGraphFinder.java rename to application/src/main/java/org/opentripplanner/routing/graphfinder/DirectGraphFinder.java diff --git a/src/main/java/org/opentripplanner/routing/graphfinder/GraphFinder.java b/application/src/main/java/org/opentripplanner/routing/graphfinder/GraphFinder.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/graphfinder/GraphFinder.java rename to application/src/main/java/org/opentripplanner/routing/graphfinder/GraphFinder.java diff --git a/src/main/java/org/opentripplanner/routing/graphfinder/NearbyStop.java b/application/src/main/java/org/opentripplanner/routing/graphfinder/NearbyStop.java similarity index 60% rename from src/main/java/org/opentripplanner/routing/graphfinder/NearbyStop.java rename to application/src/main/java/org/opentripplanner/routing/graphfinder/NearbyStop.java index ada17120c6b..a6581812ee4 100644 --- a/src/main/java/org/opentripplanner/routing/graphfinder/NearbyStop.java +++ b/application/src/main/java/org/opentripplanner/routing/graphfinder/NearbyStop.java @@ -1,11 +1,20 @@ package org.opentripplanner.routing.graphfinder; import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; import java.util.List; import java.util.Locale; import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; import org.opentripplanner.astar.model.GraphPath; +import org.opentripplanner.routing.api.request.RouteRequest; +import org.opentripplanner.routing.api.request.request.StreetRequest; import org.opentripplanner.street.model.edge.Edge; +import org.opentripplanner.street.model.vertex.TransitStopVertex; +import org.opentripplanner.street.model.vertex.Vertex; +import org.opentripplanner.street.search.request.StreetSearchRequestMapper; import org.opentripplanner.street.search.state.State; import org.opentripplanner.transit.model.site.StopLocation; @@ -43,6 +52,62 @@ public static NearbyStop nearbyStopForState(State state, StopLocation stop) { return new NearbyStop(stop, effectiveWalkDistance, edges, state); } + /** + * Create a NearbyStop with zero distance and no edges. + */ + public static NearbyStop ofZeroDistance(StopLocation stop, State state) { + return new NearbyStop(stop, 0d, Collections.emptyList(), state); + } + + /** + * Create zero distance NearbyStops given a list of TransitStopVertices + */ + public static List nearbyStopsForTransitStopVertices( + Set stopVertices, + boolean reverseDirection, + RouteRequest routeRequest, + StreetRequest streetRequest + ) { + if (stopVertices.isEmpty()) { + return List.of(); + } + + var streetSearchRequest = StreetSearchRequestMapper + .mapToTransferRequest(routeRequest) + .withArriveBy(reverseDirection) + .withMode(streetRequest.mode()) + .build(); + + return stopVertices + .stream() + .map(s -> ofZeroDistance(s.getStop(), new State(s, streetSearchRequest))) + .toList(); + } + + /** + * Given a list of Vertices, find the TransitStopVertices and create zero distance NearbyStops + * for them. + */ + public static List nearbyStopsForTransitStopVerticesFiltered( + Collection vertices, + boolean reverseDirection, + RouteRequest routeRequest, + StreetRequest streetRequest + ) { + var transitStops = vertices + .stream() + .filter(v -> v instanceof TransitStopVertex) + .map(v -> (TransitStopVertex) v) + .collect(Collectors.toSet()); + + return nearbyStopsForTransitStopVertices( + transitStops, + reverseDirection, + routeRequest, + streetRequest + ); + } + /** * Return {@code true} if this instance has a lower weight/cost than the given {@code other}. * If the state is not set, the distance is used for comparison instead. If the diff --git a/src/main/java/org/opentripplanner/routing/graphfinder/PatternAtStop.java b/application/src/main/java/org/opentripplanner/routing/graphfinder/PatternAtStop.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/graphfinder/PatternAtStop.java rename to application/src/main/java/org/opentripplanner/routing/graphfinder/PatternAtStop.java diff --git a/src/main/java/org/opentripplanner/routing/graphfinder/PlaceAtDistance.java b/application/src/main/java/org/opentripplanner/routing/graphfinder/PlaceAtDistance.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/graphfinder/PlaceAtDistance.java rename to application/src/main/java/org/opentripplanner/routing/graphfinder/PlaceAtDistance.java diff --git a/src/main/java/org/opentripplanner/routing/graphfinder/PlaceFinderTraverseVisitor.java b/application/src/main/java/org/opentripplanner/routing/graphfinder/PlaceFinderTraverseVisitor.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/graphfinder/PlaceFinderTraverseVisitor.java rename to application/src/main/java/org/opentripplanner/routing/graphfinder/PlaceFinderTraverseVisitor.java diff --git a/src/main/java/org/opentripplanner/routing/graphfinder/PlaceType.java b/application/src/main/java/org/opentripplanner/routing/graphfinder/PlaceType.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/graphfinder/PlaceType.java rename to application/src/main/java/org/opentripplanner/routing/graphfinder/PlaceType.java diff --git a/src/main/java/org/opentripplanner/routing/graphfinder/StopFinderTraverseVisitor.java b/application/src/main/java/org/opentripplanner/routing/graphfinder/StopFinderTraverseVisitor.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/graphfinder/StopFinderTraverseVisitor.java rename to application/src/main/java/org/opentripplanner/routing/graphfinder/StopFinderTraverseVisitor.java diff --git a/src/main/java/org/opentripplanner/routing/graphfinder/StreetGraphFinder.java b/application/src/main/java/org/opentripplanner/routing/graphfinder/StreetGraphFinder.java similarity index 99% rename from src/main/java/org/opentripplanner/routing/graphfinder/StreetGraphFinder.java rename to application/src/main/java/org/opentripplanner/routing/graphfinder/StreetGraphFinder.java index 71f65209ddf..061e692fa3f 100644 --- a/src/main/java/org/opentripplanner/routing/graphfinder/StreetGraphFinder.java +++ b/application/src/main/java/org/opentripplanner/routing/graphfinder/StreetGraphFinder.java @@ -95,7 +95,8 @@ private void findClosestUsingStreets( try ( var temporaryVertices = new TemporaryVerticesContainer( graph, - rr, + rr.from(), + rr.to(), StreetMode.WALK, StreetMode.WALK ) diff --git a/src/main/java/org/opentripplanner/routing/impl/DelegatingTransitAlertServiceImpl.java b/application/src/main/java/org/opentripplanner/routing/impl/DelegatingTransitAlertServiceImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/impl/DelegatingTransitAlertServiceImpl.java rename to application/src/main/java/org/opentripplanner/routing/impl/DelegatingTransitAlertServiceImpl.java diff --git a/src/main/java/org/opentripplanner/routing/impl/GraphPathFinder.java b/application/src/main/java/org/opentripplanner/routing/impl/GraphPathFinder.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/impl/GraphPathFinder.java rename to application/src/main/java/org/opentripplanner/routing/impl/GraphPathFinder.java diff --git a/src/main/java/org/opentripplanner/routing/impl/TransitAlertServiceImpl.java b/application/src/main/java/org/opentripplanner/routing/impl/TransitAlertServiceImpl.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/impl/TransitAlertServiceImpl.java rename to application/src/main/java/org/opentripplanner/routing/impl/TransitAlertServiceImpl.java diff --git a/src/main/java/org/opentripplanner/routing/linking/DisposableEdgeCollection.java b/application/src/main/java/org/opentripplanner/routing/linking/DisposableEdgeCollection.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/linking/DisposableEdgeCollection.java rename to application/src/main/java/org/opentripplanner/routing/linking/DisposableEdgeCollection.java diff --git a/src/main/java/org/opentripplanner/routing/linking/FlexLocationAdder.java b/application/src/main/java/org/opentripplanner/routing/linking/FlexLocationAdder.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/linking/FlexLocationAdder.java rename to application/src/main/java/org/opentripplanner/routing/linking/FlexLocationAdder.java diff --git a/src/main/java/org/opentripplanner/routing/linking/LinkingDirection.java b/application/src/main/java/org/opentripplanner/routing/linking/LinkingDirection.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/linking/LinkingDirection.java rename to application/src/main/java/org/opentripplanner/routing/linking/LinkingDirection.java diff --git a/src/main/java/org/opentripplanner/routing/linking/SameEdgeAdjuster.java b/application/src/main/java/org/opentripplanner/routing/linking/SameEdgeAdjuster.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/linking/SameEdgeAdjuster.java rename to application/src/main/java/org/opentripplanner/routing/linking/SameEdgeAdjuster.java diff --git a/src/main/java/org/opentripplanner/routing/linking/Scope.java b/application/src/main/java/org/opentripplanner/routing/linking/Scope.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/linking/Scope.java rename to application/src/main/java/org/opentripplanner/routing/linking/Scope.java diff --git a/src/main/java/org/opentripplanner/routing/linking/VertexLinker.java b/application/src/main/java/org/opentripplanner/routing/linking/VertexLinker.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/linking/VertexLinker.java rename to application/src/main/java/org/opentripplanner/routing/linking/VertexLinker.java diff --git a/src/main/java/org/opentripplanner/routing/service/DefaultRoutingService.java b/application/src/main/java/org/opentripplanner/routing/service/DefaultRoutingService.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/service/DefaultRoutingService.java rename to application/src/main/java/org/opentripplanner/routing/service/DefaultRoutingService.java diff --git a/src/main/java/org/opentripplanner/routing/services/TransitAlertService.java b/application/src/main/java/org/opentripplanner/routing/services/TransitAlertService.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/services/TransitAlertService.java rename to application/src/main/java/org/opentripplanner/routing/services/TransitAlertService.java diff --git a/src/main/java/org/opentripplanner/routing/services/notes/StreetNoteModel.java b/application/src/main/java/org/opentripplanner/routing/services/notes/StreetNoteModel.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/services/notes/StreetNoteModel.java rename to application/src/main/java/org/opentripplanner/routing/services/notes/StreetNoteModel.java diff --git a/src/main/java/org/opentripplanner/routing/services/notes/StreetNotesService.java b/application/src/main/java/org/opentripplanner/routing/services/notes/StreetNotesService.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/services/notes/StreetNotesService.java rename to application/src/main/java/org/opentripplanner/routing/services/notes/StreetNotesService.java diff --git a/src/main/java/org/opentripplanner/routing/stoptimes/ArrivalDeparture.java b/application/src/main/java/org/opentripplanner/routing/stoptimes/ArrivalDeparture.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/stoptimes/ArrivalDeparture.java rename to application/src/main/java/org/opentripplanner/routing/stoptimes/ArrivalDeparture.java diff --git a/src/main/java/org/opentripplanner/routing/stoptimes/StopTimesHelper.java b/application/src/main/java/org/opentripplanner/routing/stoptimes/StopTimesHelper.java similarity index 99% rename from src/main/java/org/opentripplanner/routing/stoptimes/StopTimesHelper.java rename to application/src/main/java/org/opentripplanner/routing/stoptimes/StopTimesHelper.java index 4d4abf577db..f11d92465a7 100644 --- a/src/main/java/org/opentripplanner/routing/stoptimes/StopTimesHelper.java +++ b/application/src/main/java/org/opentripplanner/routing/stoptimes/StopTimesHelper.java @@ -291,7 +291,7 @@ private static boolean isReplacedByAnotherPattern( TripPattern pattern, TransitService transitService ) { - final TripPattern replacement = transitService.getRealtimeAddedTripPattern( + final TripPattern replacement = transitService.getNewTripPatternForModifiedTrip( trip.getId(), serviceDate ); diff --git a/src/main/java/org/opentripplanner/routing/util/ConcurrentPublished.java b/application/src/main/java/org/opentripplanner/routing/util/ConcurrentPublished.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/util/ConcurrentPublished.java rename to application/src/main/java/org/opentripplanner/routing/util/ConcurrentPublished.java diff --git a/src/main/java/org/opentripplanner/routing/util/DiffEntry.java b/application/src/main/java/org/opentripplanner/routing/util/DiffEntry.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/util/DiffEntry.java rename to application/src/main/java/org/opentripplanner/routing/util/DiffEntry.java diff --git a/src/main/java/org/opentripplanner/routing/util/DiffList.java b/application/src/main/java/org/opentripplanner/routing/util/DiffList.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/util/DiffList.java rename to application/src/main/java/org/opentripplanner/routing/util/DiffList.java diff --git a/src/main/java/org/opentripplanner/routing/util/DiffTool.java b/application/src/main/java/org/opentripplanner/routing/util/DiffTool.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/util/DiffTool.java rename to application/src/main/java/org/opentripplanner/routing/util/DiffTool.java diff --git a/src/main/java/org/opentripplanner/routing/util/ElevationUtils.java b/application/src/main/java/org/opentripplanner/routing/util/ElevationUtils.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/util/ElevationUtils.java rename to application/src/main/java/org/opentripplanner/routing/util/ElevationUtils.java diff --git a/src/main/java/org/opentripplanner/routing/util/SlopeCosts.java b/application/src/main/java/org/opentripplanner/routing/util/SlopeCosts.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/util/SlopeCosts.java rename to application/src/main/java/org/opentripplanner/routing/util/SlopeCosts.java diff --git a/src/main/java/org/opentripplanner/routing/util/elevation/ToblersHikingFunction.java b/application/src/main/java/org/opentripplanner/routing/util/elevation/ToblersHikingFunction.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/util/elevation/ToblersHikingFunction.java rename to application/src/main/java/org/opentripplanner/routing/util/elevation/ToblersHikingFunction.java diff --git a/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParking.java b/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParking.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParking.java rename to application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParking.java diff --git a/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingEntrance.java b/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingEntrance.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingEntrance.java rename to application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingEntrance.java diff --git a/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingGroup.java b/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingGroup.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingGroup.java rename to application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingGroup.java diff --git a/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingGroupBuilder.java b/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingGroupBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingGroupBuilder.java rename to application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingGroupBuilder.java diff --git a/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingHelper.java b/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingHelper.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingHelper.java rename to application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingHelper.java diff --git a/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingService.java b/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingService.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingService.java rename to application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingService.java diff --git a/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingSpaces.java b/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingSpaces.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingSpaces.java rename to application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingSpaces.java diff --git a/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingState.java b/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingState.java similarity index 100% rename from src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingState.java rename to application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingState.java diff --git a/src/main/java/org/opentripplanner/service/package.md b/application/src/main/java/org/opentripplanner/service/package.md similarity index 100% rename from src/main/java/org/opentripplanner/service/package.md rename to application/src/main/java/org/opentripplanner/service/package.md diff --git a/src/main/java/org/opentripplanner/service/paging/PagingService.java b/application/src/main/java/org/opentripplanner/service/paging/PagingService.java similarity index 100% rename from src/main/java/org/opentripplanner/service/paging/PagingService.java rename to application/src/main/java/org/opentripplanner/service/paging/PagingService.java diff --git a/src/main/java/org/opentripplanner/service/realtimevehicles/RealtimeVehicleRepository.java b/application/src/main/java/org/opentripplanner/service/realtimevehicles/RealtimeVehicleRepository.java similarity index 100% rename from src/main/java/org/opentripplanner/service/realtimevehicles/RealtimeVehicleRepository.java rename to application/src/main/java/org/opentripplanner/service/realtimevehicles/RealtimeVehicleRepository.java diff --git a/src/main/java/org/opentripplanner/service/realtimevehicles/RealtimeVehicleService.java b/application/src/main/java/org/opentripplanner/service/realtimevehicles/RealtimeVehicleService.java similarity index 80% rename from src/main/java/org/opentripplanner/service/realtimevehicles/RealtimeVehicleService.java rename to application/src/main/java/org/opentripplanner/service/realtimevehicles/RealtimeVehicleService.java index 949b196faeb..d697853880d 100644 --- a/src/main/java/org/opentripplanner/service/realtimevehicles/RealtimeVehicleService.java +++ b/application/src/main/java/org/opentripplanner/service/realtimevehicles/RealtimeVehicleService.java @@ -1,7 +1,6 @@ package org.opentripplanner.service.realtimevehicles; import java.util.List; -import javax.annotation.Nonnull; import org.opentripplanner.service.realtimevehicles.model.RealtimeVehicle; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.timetable.OccupancyStatus; @@ -12,11 +11,11 @@ public interface RealtimeVehicleService { * Get the realtime vehicles for a certain trip pattern. Service contains all the vehicles that * exist in input feeds but doesn't store any historical data. */ - List getRealtimeVehicles(@Nonnull TripPattern pattern); + List getRealtimeVehicles(TripPattern pattern); /** * Get the latest occupancy status for a certain trip. Service contains all the vehicles that * exist in input feeds but doesn't store any historical data. */ - OccupancyStatus getVehicleOccupancyStatus(@Nonnull Trip trip); + OccupancyStatus getVehicleOccupancyStatus(Trip trip); } diff --git a/src/main/java/org/opentripplanner/service/realtimevehicles/configure/RealtimeVehicleRepositoryModule.java b/application/src/main/java/org/opentripplanner/service/realtimevehicles/configure/RealtimeVehicleRepositoryModule.java similarity index 100% rename from src/main/java/org/opentripplanner/service/realtimevehicles/configure/RealtimeVehicleRepositoryModule.java rename to application/src/main/java/org/opentripplanner/service/realtimevehicles/configure/RealtimeVehicleRepositoryModule.java diff --git a/src/main/java/org/opentripplanner/service/realtimevehicles/configure/RealtimeVehicleServiceModule.java b/application/src/main/java/org/opentripplanner/service/realtimevehicles/configure/RealtimeVehicleServiceModule.java similarity index 100% rename from src/main/java/org/opentripplanner/service/realtimevehicles/configure/RealtimeVehicleServiceModule.java rename to application/src/main/java/org/opentripplanner/service/realtimevehicles/configure/RealtimeVehicleServiceModule.java diff --git a/src/main/java/org/opentripplanner/service/realtimevehicles/internal/DefaultRealtimeVehicleService.java b/application/src/main/java/org/opentripplanner/service/realtimevehicles/internal/DefaultRealtimeVehicleService.java similarity index 94% rename from src/main/java/org/opentripplanner/service/realtimevehicles/internal/DefaultRealtimeVehicleService.java rename to application/src/main/java/org/opentripplanner/service/realtimevehicles/internal/DefaultRealtimeVehicleService.java index 0058cdd9e15..17a4d22e60c 100644 --- a/src/main/java/org/opentripplanner/service/realtimevehicles/internal/DefaultRealtimeVehicleService.java +++ b/application/src/main/java/org/opentripplanner/service/realtimevehicles/internal/DefaultRealtimeVehicleService.java @@ -9,7 +9,6 @@ import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import javax.annotation.Nonnull; import org.opentripplanner.service.realtimevehicles.RealtimeVehicleRepository; import org.opentripplanner.service.realtimevehicles.RealtimeVehicleService; import org.opentripplanner.service.realtimevehicles.model.RealtimeVehicle; @@ -58,7 +57,7 @@ public void clearRealtimeVehicles(TripPattern pattern) { * @see DefaultRealtimeVehicleService#setRealtimeVehicles(TripPattern, List) */ @Override - public List getRealtimeVehicles(@Nonnull TripPattern pattern) { + public List getRealtimeVehicles(TripPattern pattern) { if (pattern.getOriginalTripPattern() != null) { pattern = pattern.getOriginalTripPattern(); } @@ -66,9 +65,8 @@ public List getRealtimeVehicles(@Nonnull TripPattern pattern) { return vehicles.getOrDefault(pattern, List.of()); } - @Nonnull @Override - public OccupancyStatus getVehicleOccupancyStatus(@Nonnull Trip trip) { + public OccupancyStatus getVehicleOccupancyStatus(Trip trip) { return getOccupancyStatus(trip.getId(), transitService.getPatternForTrip(trip)); } diff --git a/src/main/java/org/opentripplanner/service/realtimevehicles/model/RealtimeVehicle.java b/application/src/main/java/org/opentripplanner/service/realtimevehicles/model/RealtimeVehicle.java similarity index 98% rename from src/main/java/org/opentripplanner/service/realtimevehicles/model/RealtimeVehicle.java rename to application/src/main/java/org/opentripplanner/service/realtimevehicles/model/RealtimeVehicle.java index e06ae5ebaa7..fb0cbb28dbe 100644 --- a/src/main/java/org/opentripplanner/service/realtimevehicles/model/RealtimeVehicle.java +++ b/application/src/main/java/org/opentripplanner/service/realtimevehicles/model/RealtimeVehicle.java @@ -2,7 +2,6 @@ import java.time.Instant; import java.util.Optional; -import javax.annotation.Nonnull; import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.site.StopLocation; @@ -91,7 +90,6 @@ public Optional stop() { return Optional.ofNullable(stop); } - @Nonnull public Trip trip() { return trip; } diff --git a/src/main/java/org/opentripplanner/service/realtimevehicles/model/RealtimeVehicleBuilder.java b/application/src/main/java/org/opentripplanner/service/realtimevehicles/model/RealtimeVehicleBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/service/realtimevehicles/model/RealtimeVehicleBuilder.java rename to application/src/main/java/org/opentripplanner/service/realtimevehicles/model/RealtimeVehicleBuilder.java diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/VehicleRentalRepository.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/VehicleRentalRepository.java similarity index 100% rename from src/main/java/org/opentripplanner/service/vehiclerental/VehicleRentalRepository.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/VehicleRentalRepository.java diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/VehicleRentalService.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/VehicleRentalService.java similarity index 100% rename from src/main/java/org/opentripplanner/service/vehiclerental/VehicleRentalService.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/VehicleRentalService.java diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/configure/VehicleRentalRepositoryModule.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/configure/VehicleRentalRepositoryModule.java similarity index 100% rename from src/main/java/org/opentripplanner/service/vehiclerental/configure/VehicleRentalRepositoryModule.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/configure/VehicleRentalRepositoryModule.java diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/configure/VehicleRentalServiceModule.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/configure/VehicleRentalServiceModule.java similarity index 100% rename from src/main/java/org/opentripplanner/service/vehiclerental/configure/VehicleRentalServiceModule.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/configure/VehicleRentalServiceModule.java diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/internal/DefaultVehicleRentalService.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/internal/DefaultVehicleRentalService.java similarity index 100% rename from src/main/java/org/opentripplanner/service/vehiclerental/internal/DefaultVehicleRentalService.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/internal/DefaultVehicleRentalService.java diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/model/GeofencingZone.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/model/GeofencingZone.java similarity index 100% rename from src/main/java/org/opentripplanner/service/vehiclerental/model/GeofencingZone.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/model/GeofencingZone.java diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/model/RentalVehicleEntityCounts.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/model/RentalVehicleEntityCounts.java similarity index 100% rename from src/main/java/org/opentripplanner/service/vehiclerental/model/RentalVehicleEntityCounts.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/model/RentalVehicleEntityCounts.java diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/model/RentalVehicleType.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/model/RentalVehicleType.java similarity index 100% rename from src/main/java/org/opentripplanner/service/vehiclerental/model/RentalVehicleType.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/model/RentalVehicleType.java diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/model/RentalVehicleTypeCount.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/model/RentalVehicleTypeCount.java similarity index 100% rename from src/main/java/org/opentripplanner/service/vehiclerental/model/RentalVehicleTypeCount.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/model/RentalVehicleTypeCount.java diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalPlace.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalPlace.java similarity index 100% rename from src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalPlace.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalPlace.java diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalStation.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalStation.java similarity index 100% rename from src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalStation.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalStation.java diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalStationUris.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalStationUris.java similarity index 100% rename from src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalStationUris.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalStationUris.java diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalSystem.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalSystem.java similarity index 100% rename from src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalSystem.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalSystem.java diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalSystemAppInformation.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalSystemAppInformation.java similarity index 100% rename from src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalSystemAppInformation.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalSystemAppInformation.java diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalVehicle.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalVehicle.java similarity index 100% rename from src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalVehicle.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/model/VehicleRentalVehicle.java diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/street/BusinessAreaBorder.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/street/BusinessAreaBorder.java similarity index 100% rename from src/main/java/org/opentripplanner/service/vehiclerental/street/BusinessAreaBorder.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/street/BusinessAreaBorder.java diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/street/CompositeRentalRestrictionExtension.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/street/CompositeRentalRestrictionExtension.java similarity index 100% rename from src/main/java/org/opentripplanner/service/vehiclerental/street/CompositeRentalRestrictionExtension.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/street/CompositeRentalRestrictionExtension.java diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/street/GeofencingZoneExtension.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/street/GeofencingZoneExtension.java similarity index 100% rename from src/main/java/org/opentripplanner/service/vehiclerental/street/GeofencingZoneExtension.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/street/GeofencingZoneExtension.java diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/street/NoRestriction.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/street/NoRestriction.java similarity index 100% rename from src/main/java/org/opentripplanner/service/vehiclerental/street/NoRestriction.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/street/NoRestriction.java diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/street/StreetVehicleRentalLink.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/street/StreetVehicleRentalLink.java similarity index 93% rename from src/main/java/org/opentripplanner/service/vehiclerental/street/StreetVehicleRentalLink.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/street/StreetVehicleRentalLink.java index 385b347d24a..99775b6112d 100644 --- a/src/main/java/org/opentripplanner/service/vehiclerental/street/StreetVehicleRentalLink.java +++ b/application/src/main/java/org/opentripplanner/service/vehiclerental/street/StreetVehicleRentalLink.java @@ -1,6 +1,5 @@ package org.opentripplanner.service.vehiclerental.street; -import javax.annotation.Nonnull; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.street.model.edge.Edge; import org.opentripplanner.street.model.vertex.StreetVertex; @@ -38,12 +37,7 @@ public static StreetVehicleRentalLink createStreetVehicleRentalLink( return connectToGraph(new StreetVehicleRentalLink(fromv, tov)); } - public String toString() { - return "StreetVehicleRentalLink(" + fromv + " -> " + tov + ")"; - } - @Override - @Nonnull public State[] traverse(State s0) { // Disallow traversing two StreetBikeRentalLinks in a row. // This prevents the router from using bike rental stations as shortcuts to get around diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/street/VehicleRentalEdge.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/street/VehicleRentalEdge.java similarity index 99% rename from src/main/java/org/opentripplanner/service/vehiclerental/street/VehicleRentalEdge.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/street/VehicleRentalEdge.java index dc9fed8b9a3..0935909e0c7 100644 --- a/src/main/java/org/opentripplanner/service/vehiclerental/street/VehicleRentalEdge.java +++ b/application/src/main/java/org/opentripplanner/service/vehiclerental/street/VehicleRentalEdge.java @@ -2,7 +2,6 @@ import java.util.Collections; import java.util.Set; -import javax.annotation.Nonnull; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.routing.api.request.StreetMode; import org.opentripplanner.service.vehiclerental.model.VehicleRentalPlace; @@ -33,7 +32,6 @@ public static VehicleRentalEdge createVehicleRentalEdge( } @Override - @Nonnull public State[] traverse(State s0) { if (!s0.getRequest().mode().includesRenting()) { return State.empty(); diff --git a/src/main/java/org/opentripplanner/service/vehiclerental/street/VehicleRentalPlaceVertex.java b/application/src/main/java/org/opentripplanner/service/vehiclerental/street/VehicleRentalPlaceVertex.java similarity index 96% rename from src/main/java/org/opentripplanner/service/vehiclerental/street/VehicleRentalPlaceVertex.java rename to application/src/main/java/org/opentripplanner/service/vehiclerental/street/VehicleRentalPlaceVertex.java index 5a04d56d60c..903747b0206 100644 --- a/src/main/java/org/opentripplanner/service/vehiclerental/street/VehicleRentalPlaceVertex.java +++ b/application/src/main/java/org/opentripplanner/service/vehiclerental/street/VehicleRentalPlaceVertex.java @@ -1,6 +1,5 @@ package org.opentripplanner.service.vehiclerental.street; -import javax.annotation.Nonnull; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.service.vehiclerental.model.VehicleRentalPlace; import org.opentripplanner.street.model.vertex.Vertex; @@ -20,7 +19,6 @@ public VehicleRentalPlaceVertex(VehicleRentalPlace station) { this.station = station; } - @Nonnull @Override public I18NString getName() { return station.getName(); diff --git a/src/main/java/org/opentripplanner/service/worldenvelope/WorldEnvelopeRepository.java b/application/src/main/java/org/opentripplanner/service/worldenvelope/WorldEnvelopeRepository.java similarity index 93% rename from src/main/java/org/opentripplanner/service/worldenvelope/WorldEnvelopeRepository.java rename to application/src/main/java/org/opentripplanner/service/worldenvelope/WorldEnvelopeRepository.java index 5aba781f79c..bdf9df4f8d3 100644 --- a/src/main/java/org/opentripplanner/service/worldenvelope/WorldEnvelopeRepository.java +++ b/application/src/main/java/org/opentripplanner/service/worldenvelope/WorldEnvelopeRepository.java @@ -2,7 +2,6 @@ import java.io.Serializable; import java.util.Optional; -import javax.annotation.Nonnull; import org.opentripplanner.service.worldenvelope.model.WorldEnvelope; /** @@ -27,5 +26,5 @@ public interface WorldEnvelopeRepository extends Serializable { Optional retrieveEnvelope(); - void saveEnvelope(@Nonnull WorldEnvelope envelope); + void saveEnvelope(WorldEnvelope envelope); } diff --git a/src/main/java/org/opentripplanner/service/worldenvelope/WorldEnvelopeService.java b/application/src/main/java/org/opentripplanner/service/worldenvelope/WorldEnvelopeService.java similarity index 100% rename from src/main/java/org/opentripplanner/service/worldenvelope/WorldEnvelopeService.java rename to application/src/main/java/org/opentripplanner/service/worldenvelope/WorldEnvelopeService.java diff --git a/src/main/java/org/opentripplanner/service/worldenvelope/configure/WorldEnvelopeRepositoryModule.java b/application/src/main/java/org/opentripplanner/service/worldenvelope/configure/WorldEnvelopeRepositoryModule.java similarity index 100% rename from src/main/java/org/opentripplanner/service/worldenvelope/configure/WorldEnvelopeRepositoryModule.java rename to application/src/main/java/org/opentripplanner/service/worldenvelope/configure/WorldEnvelopeRepositoryModule.java diff --git a/src/main/java/org/opentripplanner/service/worldenvelope/configure/WorldEnvelopeServiceModule.java b/application/src/main/java/org/opentripplanner/service/worldenvelope/configure/WorldEnvelopeServiceModule.java similarity index 100% rename from src/main/java/org/opentripplanner/service/worldenvelope/configure/WorldEnvelopeServiceModule.java rename to application/src/main/java/org/opentripplanner/service/worldenvelope/configure/WorldEnvelopeServiceModule.java diff --git a/src/main/java/org/opentripplanner/service/worldenvelope/internal/DefaultWorldEnvelopeRepository.java b/application/src/main/java/org/opentripplanner/service/worldenvelope/internal/DefaultWorldEnvelopeRepository.java similarity index 90% rename from src/main/java/org/opentripplanner/service/worldenvelope/internal/DefaultWorldEnvelopeRepository.java rename to application/src/main/java/org/opentripplanner/service/worldenvelope/internal/DefaultWorldEnvelopeRepository.java index 1fea3c4aeda..226122c803b 100644 --- a/src/main/java/org/opentripplanner/service/worldenvelope/internal/DefaultWorldEnvelopeRepository.java +++ b/application/src/main/java/org/opentripplanner/service/worldenvelope/internal/DefaultWorldEnvelopeRepository.java @@ -4,7 +4,6 @@ import jakarta.inject.Singleton; import java.io.Serializable; import java.util.Optional; -import javax.annotation.Nonnull; import org.opentripplanner.service.worldenvelope.WorldEnvelopeRepository; import org.opentripplanner.service.worldenvelope.model.WorldEnvelope; @@ -26,7 +25,7 @@ public Optional retrieveEnvelope() { } @Override - public void saveEnvelope(@Nonnull WorldEnvelope envelope) { + public void saveEnvelope(WorldEnvelope envelope) { this.envelope = envelope; } } diff --git a/src/main/java/org/opentripplanner/service/worldenvelope/internal/DefaultWorldEnvelopeService.java b/application/src/main/java/org/opentripplanner/service/worldenvelope/internal/DefaultWorldEnvelopeService.java similarity index 100% rename from src/main/java/org/opentripplanner/service/worldenvelope/internal/DefaultWorldEnvelopeService.java rename to application/src/main/java/org/opentripplanner/service/worldenvelope/internal/DefaultWorldEnvelopeService.java diff --git a/src/main/java/org/opentripplanner/service/worldenvelope/model/MedianCalcForDoubles.java b/application/src/main/java/org/opentripplanner/service/worldenvelope/model/MedianCalcForDoubles.java similarity index 100% rename from src/main/java/org/opentripplanner/service/worldenvelope/model/MedianCalcForDoubles.java rename to application/src/main/java/org/opentripplanner/service/worldenvelope/model/MedianCalcForDoubles.java diff --git a/src/main/java/org/opentripplanner/service/worldenvelope/model/WorldEnvelope.java b/application/src/main/java/org/opentripplanner/service/worldenvelope/model/WorldEnvelope.java similarity index 100% rename from src/main/java/org/opentripplanner/service/worldenvelope/model/WorldEnvelope.java rename to application/src/main/java/org/opentripplanner/service/worldenvelope/model/WorldEnvelope.java diff --git a/src/main/java/org/opentripplanner/service/worldenvelope/model/WorldEnvelopeBuilder.java b/application/src/main/java/org/opentripplanner/service/worldenvelope/model/WorldEnvelopeBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/service/worldenvelope/model/WorldEnvelopeBuilder.java rename to application/src/main/java/org/opentripplanner/service/worldenvelope/model/WorldEnvelopeBuilder.java diff --git a/src/main/java/org/opentripplanner/standalone/OTPMain.java b/application/src/main/java/org/opentripplanner/standalone/OTPMain.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/OTPMain.java rename to application/src/main/java/org/opentripplanner/standalone/OTPMain.java diff --git a/src/main/java/org/opentripplanner/standalone/OtpStartupInfo.java b/application/src/main/java/org/opentripplanner/standalone/OtpStartupInfo.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/OtpStartupInfo.java rename to application/src/main/java/org/opentripplanner/standalone/OtpStartupInfo.java diff --git a/src/main/java/org/opentripplanner/standalone/api/HttpRequestScoped.java b/application/src/main/java/org/opentripplanner/standalone/api/HttpRequestScoped.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/api/HttpRequestScoped.java rename to application/src/main/java/org/opentripplanner/standalone/api/HttpRequestScoped.java diff --git a/src/main/java/org/opentripplanner/standalone/api/OtpServerRequestContext.java b/application/src/main/java/org/opentripplanner/standalone/api/OtpServerRequestContext.java similarity index 99% rename from src/main/java/org/opentripplanner/standalone/api/OtpServerRequestContext.java rename to application/src/main/java/org/opentripplanner/standalone/api/OtpServerRequestContext.java index 3a577611617..7ec71e589c7 100644 --- a/src/main/java/org/opentripplanner/standalone/api/OtpServerRequestContext.java +++ b/application/src/main/java/org/opentripplanner/standalone/api/OtpServerRequestContext.java @@ -129,6 +129,7 @@ default GraphFinder graphFinder() { VectorTileConfig vectorTileConfig(); + @Nullable default DataOverlayContext dataOverlayContext(RouteRequest request) { return OTPFeature.DataOverlay.isOnElseNull(() -> new DataOverlayContext( diff --git a/src/main/java/org/opentripplanner/standalone/config/BuildConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/BuildConfig.java similarity index 95% rename from src/main/java/org/opentripplanner/standalone/config/BuildConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/BuildConfig.java index a3c6f313799..ef2931b987e 100644 --- a/src/main/java/org/opentripplanner/standalone/config/BuildConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/BuildConfig.java @@ -6,6 +6,7 @@ import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_1; import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_2; import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_5; +import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_7; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.MissingNode; @@ -16,7 +17,6 @@ import java.util.List; import java.util.Set; import java.util.regex.Pattern; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.datastore.api.OtpDataStoreConfig; import org.opentripplanner.ext.dataoverlay.configuration.DataOverlayConfig; @@ -45,6 +45,7 @@ import org.opentripplanner.standalone.config.buildconfig.TransitFeeds; import org.opentripplanner.standalone.config.framework.json.NodeAdapter; import org.opentripplanner.standalone.config.sandbox.DataOverlayConfigMapper; +import org.opentripplanner.transit.model.framework.FeedScopedId; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -173,16 +174,12 @@ public class BuildConfig implements OtpDataStoreConfig { public final double maxElevationPropagationMeters; public final boolean readCachedElevations; public final boolean writeCachedElevations; - public final boolean includeEllipsoidToGeoidDifference; - public final boolean multiThreadElevationCalculations; - public final LocalDate transitServiceStart; - public final LocalDate transitServiceEnd; public final ZoneId transitModelTimeZone; - + private final List transitRouteToStationCentroid; public final URI stopConsolidation; /** @@ -438,6 +435,28 @@ to check in to a flight (2-3 hours for international flights) than to alight and .asDateOrRelativePeriod("P3Y", confZone); } + transitRouteToStationCentroid = + root + .of("transitRouteToStationCentroid") + .since(V2_7) + .summary("List stations that should route to centroid.") + .description( + """ +This field contains a list of station ids for which street legs will start/end at the station +centroid instead of the child stops. + +When searching from/to a station the default behaviour is to route from/to any of the stations child +stops. This can cause strange results for stations that have stops spread over a large area. + +For some stations you might instead wish to use the centroid of the station as the +origin/destination. In this case the centroid will be used both for direct street search and for +access/egress street search where the station is used as the start/end of the access/egress. But +transit that starts/ends at the station will work as usual without any additional street leg from/to +the centroid. +""" + ) + .asFeedScopedIds(List.of()); + writeCachedElevations = root .of("writeCachedElevations") @@ -655,13 +674,11 @@ public List demFiles() { return dem.demFiles(); } - @Nonnull @Override public List gtfsFiles() { return transitFeeds.gtfsFiles(); } - @Nonnull @Override public List netexFiles() { return transitFeeds.netexFiles(); @@ -718,6 +735,10 @@ public ServiceDateInterval getTransitServicePeriod() { return new ServiceDateInterval(transitServiceStart, transitServiceEnd); } + public List transitRouteToStationCentroid() { + return transitRouteToStationCentroid; + } + public int getSubwayAccessTimeSeconds() { // Convert access time in minutes to seconds return (int) (subwayAccessTime * 60.0); diff --git a/src/main/java/org/opentripplanner/standalone/config/CommandLineParameters.java b/application/src/main/java/org/opentripplanner/standalone/config/CommandLineParameters.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/CommandLineParameters.java rename to application/src/main/java/org/opentripplanner/standalone/config/CommandLineParameters.java diff --git a/src/main/java/org/opentripplanner/standalone/config/ConfigModel.java b/application/src/main/java/org/opentripplanner/standalone/config/ConfigModel.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/ConfigModel.java rename to application/src/main/java/org/opentripplanner/standalone/config/ConfigModel.java diff --git a/src/main/java/org/opentripplanner/standalone/config/OtpConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/OtpConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/OtpConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/OtpConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/OtpConfigLoader.java b/application/src/main/java/org/opentripplanner/standalone/config/OtpConfigLoader.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/OtpConfigLoader.java rename to application/src/main/java/org/opentripplanner/standalone/config/OtpConfigLoader.java diff --git a/src/main/java/org/opentripplanner/standalone/config/RouterConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/RouterConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/RouterConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/RouterConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/api/TransitServicePeriod.java b/application/src/main/java/org/opentripplanner/standalone/config/api/TransitServicePeriod.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/api/TransitServicePeriod.java rename to application/src/main/java/org/opentripplanner/standalone/config/api/TransitServicePeriod.java diff --git a/src/main/java/org/opentripplanner/standalone/config/buildconfig/DemConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/buildconfig/DemConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/buildconfig/DemConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/buildconfig/DemConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/buildconfig/GtfsConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/buildconfig/GtfsConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/buildconfig/GtfsConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/buildconfig/GtfsConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/buildconfig/IslandPruningConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/buildconfig/IslandPruningConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/buildconfig/IslandPruningConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/buildconfig/IslandPruningConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/buildconfig/NetexConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/buildconfig/NetexConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/buildconfig/NetexConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/buildconfig/NetexConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/buildconfig/OsmConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/buildconfig/OsmConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/buildconfig/OsmConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/buildconfig/OsmConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/buildconfig/S3BucketConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/buildconfig/S3BucketConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/buildconfig/S3BucketConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/buildconfig/S3BucketConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/buildconfig/TransferRequestConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/buildconfig/TransferRequestConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/buildconfig/TransferRequestConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/buildconfig/TransferRequestConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/buildconfig/TransitFeedConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/buildconfig/TransitFeedConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/buildconfig/TransitFeedConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/buildconfig/TransitFeedConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/buildconfig/TransitFeeds.java b/application/src/main/java/org/opentripplanner/standalone/config/buildconfig/TransitFeeds.java similarity index 84% rename from src/main/java/org/opentripplanner/standalone/config/buildconfig/TransitFeeds.java rename to application/src/main/java/org/opentripplanner/standalone/config/buildconfig/TransitFeeds.java index 91485f09e05..c4a57213afa 100644 --- a/src/main/java/org/opentripplanner/standalone/config/buildconfig/TransitFeeds.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/buildconfig/TransitFeeds.java @@ -2,14 +2,13 @@ import java.net.URI; import java.util.List; -import javax.annotation.Nonnull; import org.opentripplanner.graph_builder.model.DataSourceConfig; import org.opentripplanner.gtfs.graphbuilder.GtfsFeedParameters; import org.opentripplanner.netex.config.NetexFeedParameters; public record TransitFeeds( - @Nonnull List gtfsFeeds, - @Nonnull List netexFeeds + List gtfsFeeds, + List netexFeeds ) { public TransitFeeds(List gtfsFeeds, List netexFeeds) { this.netexFeeds = netexFeeds; diff --git a/src/main/java/org/opentripplanner/standalone/config/configure/ConfigModule.java b/application/src/main/java/org/opentripplanner/standalone/config/configure/ConfigModule.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/configure/ConfigModule.java rename to application/src/main/java/org/opentripplanner/standalone/config/configure/ConfigModule.java diff --git a/src/main/java/org/opentripplanner/standalone/config/configure/LoadConfigModule.java b/application/src/main/java/org/opentripplanner/standalone/config/configure/LoadConfigModule.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/configure/LoadConfigModule.java rename to application/src/main/java/org/opentripplanner/standalone/config/configure/LoadConfigModule.java diff --git a/src/main/java/org/opentripplanner/standalone/config/framework/file/ConfigFileLoader.java b/application/src/main/java/org/opentripplanner/standalone/config/framework/file/ConfigFileLoader.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/framework/file/ConfigFileLoader.java rename to application/src/main/java/org/opentripplanner/standalone/config/framework/file/ConfigFileLoader.java diff --git a/src/main/java/org/opentripplanner/standalone/config/framework/file/IncludeFileDirective.java b/application/src/main/java/org/opentripplanner/standalone/config/framework/file/IncludeFileDirective.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/framework/file/IncludeFileDirective.java rename to application/src/main/java/org/opentripplanner/standalone/config/framework/file/IncludeFileDirective.java diff --git a/src/main/java/org/opentripplanner/standalone/config/framework/json/ConfigType.java b/application/src/main/java/org/opentripplanner/standalone/config/framework/json/ConfigType.java similarity index 98% rename from src/main/java/org/opentripplanner/standalone/config/framework/json/ConfigType.java rename to application/src/main/java/org/opentripplanner/standalone/config/framework/json/ConfigType.java index f62ec56dbfc..fec5cb05a51 100644 --- a/src/main/java/org/opentripplanner/standalone/config/framework/json/ConfigType.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/framework/json/ConfigType.java @@ -5,7 +5,6 @@ import java.util.Arrays; import java.util.EnumSet; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.framework.lang.StringUtils; import org.opentripplanner.framework.text.MarkdownFormatter; @@ -157,7 +156,7 @@ public String docName() { /** * Quote the given {@code value} is the JSON type is a {@code string}. */ - public String quote(@Nonnull Object value) { + public String quote(Object value) { return type == JsonType.string ? quoteText(value) : value.toString(); } diff --git a/src/main/java/org/opentripplanner/standalone/config/framework/json/EnumMapper.java b/application/src/main/java/org/opentripplanner/standalone/config/framework/json/EnumMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/framework/json/EnumMapper.java rename to application/src/main/java/org/opentripplanner/standalone/config/framework/json/EnumMapper.java diff --git a/src/main/java/org/opentripplanner/standalone/config/framework/json/NodeAdapter.java b/application/src/main/java/org/opentripplanner/standalone/config/framework/json/NodeAdapter.java similarity index 97% rename from src/main/java/org/opentripplanner/standalone/config/framework/json/NodeAdapter.java rename to application/src/main/java/org/opentripplanner/standalone/config/framework/json/NodeAdapter.java index 51303ea4fc5..273c630d2bf 100644 --- a/src/main/java/org/opentripplanner/standalone/config/framework/json/NodeAdapter.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/framework/json/NodeAdapter.java @@ -12,7 +12,6 @@ import java.util.Set; import java.util.function.Consumer; import java.util.stream.Stream; -import javax.annotation.Nonnull; import org.opentripplanner.framework.application.OtpAppException; /** @@ -63,21 +62,21 @@ public class NodeAdapter { private final int level; - private NodeAdapter(@Nonnull JsonNode node, String source, String contextPath, int level) { + private NodeAdapter(JsonNode node, String source, String contextPath, int level) { this.json = node; this.source = source; this.contextPath = contextPath; this.level = level; } - public NodeAdapter(@Nonnull JsonNode node, String source) { + public NodeAdapter(JsonNode node, String source) { this(node, source, null, 0); } /** * Constructor for nested configuration nodes. */ - private NodeAdapter(@Nonnull JsonNode node, @Nonnull NodeAdapter parent, String paramName) { + private NodeAdapter(JsonNode node, NodeAdapter parent, String paramName) { this(node, parent.source, parent.fullPath(paramName), parent.level + 1); parent.childrenByName.put(paramName, this); } diff --git a/src/main/java/org/opentripplanner/standalone/config/framework/json/NodeInfo.java b/application/src/main/java/org/opentripplanner/standalone/config/framework/json/NodeInfo.java similarity index 98% rename from src/main/java/org/opentripplanner/standalone/config/framework/json/NodeInfo.java rename to application/src/main/java/org/opentripplanner/standalone/config/framework/json/NodeInfo.java index 06675475fd1..ce29639b924 100644 --- a/src/main/java/org/opentripplanner/standalone/config/framework/json/NodeInfo.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/framework/json/NodeInfo.java @@ -5,7 +5,6 @@ import java.util.Arrays; import java.util.List; import java.util.Objects; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.framework.lang.StringUtils; import org.opentripplanner.framework.tostring.ValueObjectToStringBuilder; @@ -187,7 +186,7 @@ public String toString() { * */ @Override - public int compareTo(@Nonnull NodeInfo other) { + public int compareTo(NodeInfo other) { // Put type qualifier first if (isTypeQualifier()) { return -1; diff --git a/src/main/java/org/opentripplanner/standalone/config/framework/json/NodeInfoBuilder.java b/application/src/main/java/org/opentripplanner/standalone/config/framework/json/NodeInfoBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/framework/json/NodeInfoBuilder.java rename to application/src/main/java/org/opentripplanner/standalone/config/framework/json/NodeInfoBuilder.java diff --git a/src/main/java/org/opentripplanner/standalone/config/framework/json/OtpVersion.java b/application/src/main/java/org/opentripplanner/standalone/config/framework/json/OtpVersion.java similarity index 93% rename from src/main/java/org/opentripplanner/standalone/config/framework/json/OtpVersion.java rename to application/src/main/java/org/opentripplanner/standalone/config/framework/json/OtpVersion.java index 70b8e261ee4..ea9dbb4d6ba 100644 --- a/src/main/java/org/opentripplanner/standalone/config/framework/json/OtpVersion.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/framework/json/OtpVersion.java @@ -11,7 +11,8 @@ public enum OtpVersion { V2_3("2.3"), V2_4("2.4"), V2_5("2.5"), - V2_6("2.6"); + V2_6("2.6"), + V2_7("2.7"); private final String text; diff --git a/src/main/java/org/opentripplanner/standalone/config/framework/json/ParameterBuilder.java b/application/src/main/java/org/opentripplanner/standalone/config/framework/json/ParameterBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/framework/json/ParameterBuilder.java rename to application/src/main/java/org/opentripplanner/standalone/config/framework/json/ParameterBuilder.java diff --git a/src/main/java/org/opentripplanner/standalone/config/framework/project/EnvironmentVariableReplacer.java b/application/src/main/java/org/opentripplanner/standalone/config/framework/project/EnvironmentVariableReplacer.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/framework/project/EnvironmentVariableReplacer.java rename to application/src/main/java/org/opentripplanner/standalone/config/framework/project/EnvironmentVariableReplacer.java diff --git a/src/main/java/org/opentripplanner/standalone/config/package.md b/application/src/main/java/org/opentripplanner/standalone/config/package.md similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/package.md rename to application/src/main/java/org/opentripplanner/standalone/config/package.md diff --git a/src/main/java/org/opentripplanner/standalone/config/routerconfig/RideHailingServicesConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/RideHailingServicesConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/routerconfig/RideHailingServicesConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/RideHailingServicesConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/routerconfig/ServerConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/ServerConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/routerconfig/ServerConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/ServerConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/routerconfig/TransitRoutingConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/TransitRoutingConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/routerconfig/TransitRoutingConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/TransitRoutingConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java similarity index 97% rename from src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java index b60b389f788..ac69b43e275 100644 --- a/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java @@ -21,11 +21,8 @@ import java.util.List; import java.util.function.BiFunction; import javax.annotation.Nullable; -import org.opentripplanner.ext.siri.updater.SiriETUpdaterParameters; -import org.opentripplanner.ext.siri.updater.SiriSXUpdaterParameters; import org.opentripplanner.ext.siri.updater.azure.SiriAzureETUpdaterParameters; import org.opentripplanner.ext.siri.updater.azure.SiriAzureSXUpdaterParameters; -import org.opentripplanner.ext.siri.updater.google.SiriETGooglePubsubUpdaterParameters; import org.opentripplanner.ext.vehiclerentalservicedirectory.VehicleRentalServiceDirectoryFetcher; import org.opentripplanner.ext.vehiclerentalservicedirectory.api.VehicleRentalServiceDirectoryFetcherParameters; import org.opentripplanner.standalone.config.framework.json.NodeAdapter; @@ -44,6 +41,9 @@ import org.opentripplanner.updater.TimetableSnapshotSourceParameters; import org.opentripplanner.updater.UpdatersParameters; import org.opentripplanner.updater.alert.GtfsRealtimeAlertsUpdaterParameters; +import org.opentripplanner.updater.siri.updater.SiriETUpdaterParameters; +import org.opentripplanner.updater.siri.updater.SiriSXUpdaterParameters; +import org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdaterParameters; import org.opentripplanner.updater.trip.MqttGtfsRealtimeUpdaterParameters; import org.opentripplanner.updater.trip.PollingTripUpdaterParameters; import org.opentripplanner.updater.vehicle_parking.VehicleParkingUpdaterParameters; diff --git a/src/main/java/org/opentripplanner/standalone/config/routerconfig/VectorTileConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/VectorTileConfig.java similarity index 85% rename from src/main/java/org/opentripplanner/standalone/config/routerconfig/VectorTileConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/VectorTileConfig.java index 96cd49b72bb..26d56dc0dba 100644 --- a/src/main/java/org/opentripplanner/standalone/config/routerconfig/VectorTileConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/VectorTileConfig.java @@ -6,20 +6,22 @@ import static org.opentripplanner.inspector.vector.LayerParameters.MIN_ZOOM; import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_0; import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_5; +import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_6; import java.util.Collection; import java.util.List; import java.util.Optional; import javax.annotation.Nullable; import org.opentripplanner.ext.vectortiles.VectorTilesResource; +import org.opentripplanner.ext.vectortiles.VectorTilesResource.LayerType; +import org.opentripplanner.ext.vectortiles.layers.LayerFilters; import org.opentripplanner.inspector.vector.LayerParameters; import org.opentripplanner.standalone.config.framework.json.NodeAdapter; -public class VectorTileConfig - implements VectorTilesResource.LayersParameters { +public class VectorTileConfig implements VectorTilesResource.LayersParameters { public static final VectorTileConfig DEFAULT = new VectorTileConfig(List.of(), null, null); - private final List> layers; + private final List> layers; @Nullable private final String basePath; @@ -28,7 +30,7 @@ public class VectorTileConfig private final String attribution; VectorTileConfig( - Collection> layers, + Collection> layers, @Nullable String basePath, @Nullable String attribution ) { @@ -38,7 +40,7 @@ public class VectorTileConfig } @Override - public List> layers() { + public List> layers() { return layers; } @@ -144,7 +146,18 @@ public static Layer mapLayer(NodeAdapter node) { "The value is a fraction of the tile size. If you are having problem with icons and " + "shapes being clipped at tile edges, then increase this number." ) - .asDouble(EXPANSION_FACTOR) + .asDouble(EXPANSION_FACTOR), + node + .of("filter") + .since(V2_6) + .summary("Reduce the result set of a layer further by a specific filter.") + .description( + """ + This is useful for when the schema of a layer, say stops, should remain unchanged but some + elements should not be included in the result. + """ + ) + .asEnum(LayerFilters.FilterType.NONE) ); } @@ -155,7 +168,8 @@ record Layer( int maxZoom, int minZoom, int cacheMaxSeconds, - double expansionFactor + double expansionFactor, + LayerFilters.FilterType filterType ) implements LayerParameters {} } diff --git a/src/main/java/org/opentripplanner/standalone/config/routerconfig/services/UberConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/services/UberConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/routerconfig/services/UberConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/services/UberConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/GtfsRealtimeAlertsUpdaterConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/GtfsRealtimeAlertsUpdaterConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/GtfsRealtimeAlertsUpdaterConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/GtfsRealtimeAlertsUpdaterConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/HttpHeadersConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/HttpHeadersConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/HttpHeadersConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/HttpHeadersConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/MqttGtfsRealtimeUpdaterConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/MqttGtfsRealtimeUpdaterConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/MqttGtfsRealtimeUpdaterConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/MqttGtfsRealtimeUpdaterConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/PollingTripUpdaterConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/PollingTripUpdaterConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/PollingTripUpdaterConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/PollingTripUpdaterConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETGooglePubsubUpdaterConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETGooglePubsubUpdaterConfig.java similarity index 90% rename from src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETGooglePubsubUpdaterConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETGooglePubsubUpdaterConfig.java index 75ade008070..65fb7bb2c11 100644 --- a/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETGooglePubsubUpdaterConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETGooglePubsubUpdaterConfig.java @@ -1,11 +1,11 @@ package org.opentripplanner.standalone.config.routerconfig.updaters; -import static org.opentripplanner.ext.siri.updater.google.SiriETGooglePubsubUpdaterParameters.INITIAL_GET_DATA_TIMEOUT; -import static org.opentripplanner.ext.siri.updater.google.SiriETGooglePubsubUpdaterParameters.RECONNECT_PERIOD; import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_1; +import static org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdaterParameters.INITIAL_GET_DATA_TIMEOUT; +import static org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdaterParameters.RECONNECT_PERIOD; -import org.opentripplanner.ext.siri.updater.google.SiriETGooglePubsubUpdaterParameters; import org.opentripplanner.standalone.config.framework.json.NodeAdapter; +import org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdaterParameters; public class SiriETGooglePubsubUpdaterConfig { diff --git a/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETUpdaterConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETUpdaterConfig.java similarity index 96% rename from src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETUpdaterConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETUpdaterConfig.java index 5d04dd9c2a0..4402ba83b7e 100644 --- a/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETUpdaterConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETUpdaterConfig.java @@ -4,8 +4,8 @@ import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_3; import java.time.Duration; -import org.opentripplanner.ext.siri.updater.SiriETUpdaterParameters; import org.opentripplanner.standalone.config.framework.json.NodeAdapter; +import org.opentripplanner.updater.siri.updater.SiriETUpdaterParameters; public class SiriETUpdaterConfig { diff --git a/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriSXUpdaterConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriSXUpdaterConfig.java similarity index 97% rename from src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriSXUpdaterConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriSXUpdaterConfig.java index dd0be8bc449..984ef4625e6 100644 --- a/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriSXUpdaterConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriSXUpdaterConfig.java @@ -4,8 +4,8 @@ import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_3; import java.time.Duration; -import org.opentripplanner.ext.siri.updater.SiriSXUpdaterParameters; import org.opentripplanner.standalone.config.framework.json.NodeAdapter; +import org.opentripplanner.updater.siri.updater.SiriSXUpdaterParameters; public class SiriSXUpdaterConfig { diff --git a/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/VehicleParkingUpdaterConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/VehicleParkingUpdaterConfig.java similarity index 91% rename from src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/VehicleParkingUpdaterConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/VehicleParkingUpdaterConfig.java index 88b47aac4eb..cbfae0c061b 100644 --- a/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/VehicleParkingUpdaterConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/VehicleParkingUpdaterConfig.java @@ -11,7 +11,6 @@ import org.opentripplanner.ext.vehicleparking.bikeep.BikeepUpdaterParameters; import org.opentripplanner.ext.vehicleparking.bikely.BikelyUpdaterParameters; import org.opentripplanner.ext.vehicleparking.hslpark.HslParkUpdaterParameters; -import org.opentripplanner.ext.vehicleparking.noi.NoiUpdaterParameters; import org.opentripplanner.ext.vehicleparking.parkapi.ParkAPIUpdaterParameters; import org.opentripplanner.ext.vehicleparking.sirifm.SiriFmUpdaterParameters; import org.opentripplanner.standalone.config.framework.json.NodeAdapter; @@ -79,17 +78,6 @@ public static VehicleParkingUpdaterParameters create(String updaterRef, NodeAdap .asDuration(Duration.ofMinutes(1)), HttpHeadersConfig.headers(c, V2_3) ); - case NOI_OPEN_DATA_HUB -> new NoiUpdaterParameters( - updaterRef, - c.of("url").since(V2_6).summary("URL of the locations endpoint.").asUri(), - feedId, - c - .of("frequency") - .since(V2_6) - .summary("How often to update the source.") - .asDuration(Duration.ofMinutes(1)), - HttpHeadersConfig.headers(c, V2_6) - ); case BIKEEP -> new BikeepUpdaterParameters( updaterRef, c.of("url").since(V2_6).summary("URL of the locations endpoint.").asUri(), diff --git a/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/VehiclePositionsUpdaterConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/VehiclePositionsUpdaterConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/VehiclePositionsUpdaterConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/VehiclePositionsUpdaterConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/VehicleRentalUpdaterConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/VehicleRentalUpdaterConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/VehicleRentalUpdaterConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/VehicleRentalUpdaterConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/azure/SiriAzureETUpdaterConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/azure/SiriAzureETUpdaterConfig.java similarity index 95% rename from src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/azure/SiriAzureETUpdaterConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/azure/SiriAzureETUpdaterConfig.java index 791f9a9dadc..61c5d93b902 100644 --- a/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/azure/SiriAzureETUpdaterConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/azure/SiriAzureETUpdaterConfig.java @@ -1,6 +1,5 @@ package org.opentripplanner.standalone.config.routerconfig.updaters.azure; -import static org.opentripplanner.standalone.config.framework.json.OtpVersion.NA; import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_2; import org.opentripplanner.ext.siri.updater.azure.SiriAzureETUpdaterParameters; diff --git a/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/azure/SiriAzureSXUpdaterConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/azure/SiriAzureSXUpdaterConfig.java similarity index 95% rename from src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/azure/SiriAzureSXUpdaterConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/azure/SiriAzureSXUpdaterConfig.java index cf5dacb5976..c1b3b0351a3 100644 --- a/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/azure/SiriAzureSXUpdaterConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/azure/SiriAzureSXUpdaterConfig.java @@ -1,6 +1,5 @@ package org.opentripplanner.standalone.config.routerconfig.updaters.azure; -import static org.opentripplanner.standalone.config.framework.json.OtpVersion.NA; import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_2; import org.opentripplanner.ext.siri.updater.azure.SiriAzureSXUpdaterParameters; diff --git a/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/azure/SiriAzureUpdaterConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/azure/SiriAzureUpdaterConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/azure/SiriAzureUpdaterConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/azure/SiriAzureUpdaterConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/sources/VehicleRentalSourceFactory.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/sources/VehicleRentalSourceFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/sources/VehicleRentalSourceFactory.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/sources/VehicleRentalSourceFactory.java diff --git a/src/main/java/org/opentripplanner/standalone/config/routerequest/ItineraryFiltersConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerequest/ItineraryFiltersConfig.java similarity index 93% rename from src/main/java/org/opentripplanner/standalone/config/routerequest/ItineraryFiltersConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerequest/ItineraryFiltersConfig.java index 82e2c0839f9..c021de88a8e 100644 --- a/src/main/java/org/opentripplanner/standalone/config/routerequest/ItineraryFiltersConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerequest/ItineraryFiltersConfig.java @@ -6,18 +6,15 @@ import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_2; import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_3; import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_4; +import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_7; import org.opentripplanner.routing.algorithm.filterchain.api.TransitGeneralizedCostFilterParams; import org.opentripplanner.routing.api.request.preference.ItineraryFilterDebugProfile; import org.opentripplanner.routing.api.request.preference.ItineraryFilterPreferences; import org.opentripplanner.standalone.config.framework.json.NodeAdapter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class ItineraryFiltersConfig { - private static final Logger LOG = LoggerFactory.getLogger(ItineraryFiltersConfig.class); - public static void mapItineraryFilterParams( String parameterName, NodeAdapter root, @@ -265,6 +262,28 @@ public static void mapItineraryFilterParams( ) .asDouble(dft.minBikeParkingDistance()) ) + .withFilterDirectFlexBySearchWindow( + c + .of("filterDirectFlexBySearchWindow") + .since(V2_7) + .summary( + """ + Filter direct flex results by the search window. The search-window is not used + during flex routing, but we use one end to align it with transit results.""" + ) + .description( + """ + When direct flex is mixed with a transit search in the same request, then the direct + flex results are filtered by the search window of the transit results. + + Depart-at searches are filtered by latest-arrival-time and arrive-by searches are + filtered by earliest-departure-time. + + Use this configuration to turn this feature off. + """ + ) + .asBoolean(true) + ) .build(); } diff --git a/src/main/java/org/opentripplanner/standalone/config/routerequest/RouteRequestConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerequest/RouteRequestConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/routerequest/RouteRequestConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerequest/RouteRequestConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/routerequest/TimeAndCostPenaltyMapper.java b/application/src/main/java/org/opentripplanner/standalone/config/routerequest/TimeAndCostPenaltyMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/routerequest/TimeAndCostPenaltyMapper.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerequest/TimeAndCostPenaltyMapper.java diff --git a/src/main/java/org/opentripplanner/standalone/config/routerequest/TransferConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerequest/TransferConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/routerequest/TransferConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerequest/TransferConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/routerequest/TransitGroupPriorityConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerequest/TransitGroupPriorityConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/routerequest/TransitGroupPriorityConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerequest/TransitGroupPriorityConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/routerequest/TriangleOptimizationConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerequest/TriangleOptimizationConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/routerequest/TriangleOptimizationConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerequest/TriangleOptimizationConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/routerequest/VehicleParkingConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerequest/VehicleParkingConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/routerequest/VehicleParkingConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerequest/VehicleParkingConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/routerequest/VehicleRentalConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerequest/VehicleRentalConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/routerequest/VehicleRentalConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerequest/VehicleRentalConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/routerequest/VehicleWalkingConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerequest/VehicleWalkingConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/routerequest/VehicleWalkingConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerequest/VehicleWalkingConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/routerequest/WheelchairConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerequest/WheelchairConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/routerequest/WheelchairConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerequest/WheelchairConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/sandbox/DataOverlayConfigMapper.java b/application/src/main/java/org/opentripplanner/standalone/config/sandbox/DataOverlayConfigMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/sandbox/DataOverlayConfigMapper.java rename to application/src/main/java/org/opentripplanner/standalone/config/sandbox/DataOverlayConfigMapper.java diff --git a/src/main/java/org/opentripplanner/standalone/config/sandbox/DataOverlayParametersMapper.java b/application/src/main/java/org/opentripplanner/standalone/config/sandbox/DataOverlayParametersMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/sandbox/DataOverlayParametersMapper.java rename to application/src/main/java/org/opentripplanner/standalone/config/sandbox/DataOverlayParametersMapper.java diff --git a/src/main/java/org/opentripplanner/standalone/config/sandbox/FlexConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/sandbox/FlexConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/sandbox/FlexConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/sandbox/FlexConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/sandbox/TransmodelAPIConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/sandbox/TransmodelAPIConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/sandbox/TransmodelAPIConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/sandbox/TransmodelAPIConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/config/sandbox/VehicleRentalServiceDirectoryFetcherConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/sandbox/VehicleRentalServiceDirectoryFetcherConfig.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/config/sandbox/VehicleRentalServiceDirectoryFetcherConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/sandbox/VehicleRentalServiceDirectoryFetcherConfig.java diff --git a/src/main/java/org/opentripplanner/standalone/configure/ConstructApplication.java b/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplication.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/configure/ConstructApplication.java rename to application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplication.java diff --git a/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationFactory.java b/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationFactory.java rename to application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationFactory.java diff --git a/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationModule.java b/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationModule.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationModule.java rename to application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationModule.java diff --git a/src/main/java/org/opentripplanner/standalone/configure/LoadApplication.java b/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplication.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/configure/LoadApplication.java rename to application/src/main/java/org/opentripplanner/standalone/configure/LoadApplication.java diff --git a/src/main/java/org/opentripplanner/standalone/configure/LoadApplicationFactory.java b/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplicationFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/configure/LoadApplicationFactory.java rename to application/src/main/java/org/opentripplanner/standalone/configure/LoadApplicationFactory.java diff --git a/src/main/java/org/opentripplanner/standalone/server/CorsFilter.java b/application/src/main/java/org/opentripplanner/standalone/server/CorsFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/server/CorsFilter.java rename to application/src/main/java/org/opentripplanner/standalone/server/CorsFilter.java diff --git a/src/main/java/org/opentripplanner/standalone/server/DefaultServerRequestContext.java b/application/src/main/java/org/opentripplanner/standalone/server/DefaultServerRequestContext.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/server/DefaultServerRequestContext.java rename to application/src/main/java/org/opentripplanner/standalone/server/DefaultServerRequestContext.java diff --git a/src/main/java/org/opentripplanner/standalone/server/EtagRequestFilter.java b/application/src/main/java/org/opentripplanner/standalone/server/EtagRequestFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/server/EtagRequestFilter.java rename to application/src/main/java/org/opentripplanner/standalone/server/EtagRequestFilter.java diff --git a/src/main/java/org/opentripplanner/standalone/server/GrizzlyServer.java b/application/src/main/java/org/opentripplanner/standalone/server/GrizzlyServer.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/server/GrizzlyServer.java rename to application/src/main/java/org/opentripplanner/standalone/server/GrizzlyServer.java diff --git a/src/main/java/org/opentripplanner/standalone/server/MetricsLogging.java b/application/src/main/java/org/opentripplanner/standalone/server/MetricsLogging.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/server/MetricsLogging.java rename to application/src/main/java/org/opentripplanner/standalone/server/MetricsLogging.java diff --git a/src/main/java/org/opentripplanner/standalone/server/OTPWebApplication.java b/application/src/main/java/org/opentripplanner/standalone/server/OTPWebApplication.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/server/OTPWebApplication.java rename to application/src/main/java/org/opentripplanner/standalone/server/OTPWebApplication.java diff --git a/src/main/java/org/opentripplanner/standalone/server/OTPWebApplicationParameters.java b/application/src/main/java/org/opentripplanner/standalone/server/OTPWebApplicationParameters.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/server/OTPWebApplicationParameters.java rename to application/src/main/java/org/opentripplanner/standalone/server/OTPWebApplicationParameters.java diff --git a/src/main/java/org/opentripplanner/standalone/server/RequestTraceFilter.java b/application/src/main/java/org/opentripplanner/standalone/server/RequestTraceFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/server/RequestTraceFilter.java rename to application/src/main/java/org/opentripplanner/standalone/server/RequestTraceFilter.java diff --git a/src/main/java/org/opentripplanner/standalone/server/RequestTraceParameter.java b/application/src/main/java/org/opentripplanner/standalone/server/RequestTraceParameter.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/server/RequestTraceParameter.java rename to application/src/main/java/org/opentripplanner/standalone/server/RequestTraceParameter.java diff --git a/src/main/java/org/opentripplanner/standalone/server/VaryRequestFilter.java b/application/src/main/java/org/opentripplanner/standalone/server/VaryRequestFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/standalone/server/VaryRequestFilter.java rename to application/src/main/java/org/opentripplanner/standalone/server/VaryRequestFilter.java diff --git a/src/main/java/org/opentripplanner/street/model/RentalFormFactor.java b/application/src/main/java/org/opentripplanner/street/model/RentalFormFactor.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/RentalFormFactor.java rename to application/src/main/java/org/opentripplanner/street/model/RentalFormFactor.java diff --git a/src/main/java/org/opentripplanner/street/model/RentalRestrictionExtension.java b/application/src/main/java/org/opentripplanner/street/model/RentalRestrictionExtension.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/RentalRestrictionExtension.java rename to application/src/main/java/org/opentripplanner/street/model/RentalRestrictionExtension.java diff --git a/src/main/java/org/opentripplanner/street/model/RepeatingTimePeriod.java b/application/src/main/java/org/opentripplanner/street/model/RepeatingTimePeriod.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/RepeatingTimePeriod.java rename to application/src/main/java/org/opentripplanner/street/model/RepeatingTimePeriod.java diff --git a/src/main/java/org/opentripplanner/street/model/StreetConstants.java b/application/src/main/java/org/opentripplanner/street/model/StreetConstants.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/StreetConstants.java rename to application/src/main/java/org/opentripplanner/street/model/StreetConstants.java diff --git a/src/main/java/org/opentripplanner/street/model/StreetLimitationParameters.java b/application/src/main/java/org/opentripplanner/street/model/StreetLimitationParameters.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/StreetLimitationParameters.java rename to application/src/main/java/org/opentripplanner/street/model/StreetLimitationParameters.java diff --git a/src/main/java/org/opentripplanner/street/model/StreetTraversalPermission.java b/application/src/main/java/org/opentripplanner/street/model/StreetTraversalPermission.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/StreetTraversalPermission.java rename to application/src/main/java/org/opentripplanner/street/model/StreetTraversalPermission.java diff --git a/src/main/java/org/opentripplanner/street/model/TurnRestriction.java b/application/src/main/java/org/opentripplanner/street/model/TurnRestriction.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/TurnRestriction.java rename to application/src/main/java/org/opentripplanner/street/model/TurnRestriction.java diff --git a/src/main/java/org/opentripplanner/street/model/TurnRestrictionType.java b/application/src/main/java/org/opentripplanner/street/model/TurnRestrictionType.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/TurnRestrictionType.java rename to application/src/main/java/org/opentripplanner/street/model/TurnRestrictionType.java diff --git a/src/main/java/org/opentripplanner/street/model/edge/AreaEdge.java b/application/src/main/java/org/opentripplanner/street/model/edge/AreaEdge.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/edge/AreaEdge.java rename to application/src/main/java/org/opentripplanner/street/model/edge/AreaEdge.java diff --git a/src/main/java/org/opentripplanner/street/model/edge/AreaEdgeBuilder.java b/application/src/main/java/org/opentripplanner/street/model/edge/AreaEdgeBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/edge/AreaEdgeBuilder.java rename to application/src/main/java/org/opentripplanner/street/model/edge/AreaEdgeBuilder.java diff --git a/src/main/java/org/opentripplanner/street/model/edge/AreaEdgeList.java b/application/src/main/java/org/opentripplanner/street/model/edge/AreaEdgeList.java similarity index 94% rename from src/main/java/org/opentripplanner/street/model/edge/AreaEdgeList.java rename to application/src/main/java/org/opentripplanner/street/model/edge/AreaEdgeList.java index 09eb347ac5d..1f8d286995b 100644 --- a/src/main/java/org/opentripplanner/street/model/edge/AreaEdgeList.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/AreaEdgeList.java @@ -7,7 +7,6 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.Polygon; import org.opentripplanner.street.model.vertex.IntersectionVertex; @@ -60,7 +59,6 @@ public Geometry getGeometry() { /** * Returns the list of visibility vertices. */ - @Nonnull public Set visibilityVertices() { return visibilityVertices; } @@ -68,7 +66,7 @@ public Set visibilityVertices() { /** * Add a visibility vertex to this edge. */ - public void addVisibilityVertex(@Nonnull IntersectionVertex toBeAdded) { + public void addVisibilityVertex(IntersectionVertex toBeAdded) { Objects.requireNonNull(toBeAdded); synchronized (this) { if (visibilityVertices == EMPTY_SET) { diff --git a/src/main/java/org/opentripplanner/street/model/edge/BikeWalkableEdge.java b/application/src/main/java/org/opentripplanner/street/model/edge/BikeWalkableEdge.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/edge/BikeWalkableEdge.java rename to application/src/main/java/org/opentripplanner/street/model/edge/BikeWalkableEdge.java diff --git a/src/main/java/org/opentripplanner/street/model/edge/BoardingLocationToStopLink.java b/application/src/main/java/org/opentripplanner/street/model/edge/BoardingLocationToStopLink.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/edge/BoardingLocationToStopLink.java rename to application/src/main/java/org/opentripplanner/street/model/edge/BoardingLocationToStopLink.java diff --git a/src/main/java/org/opentripplanner/street/model/edge/CarPickupableEdge.java b/application/src/main/java/org/opentripplanner/street/model/edge/CarPickupableEdge.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/edge/CarPickupableEdge.java rename to application/src/main/java/org/opentripplanner/street/model/edge/CarPickupableEdge.java diff --git a/src/main/java/org/opentripplanner/street/model/edge/Edge.java b/application/src/main/java/org/opentripplanner/street/model/edge/Edge.java similarity index 87% rename from src/main/java/org/opentripplanner/street/model/edge/Edge.java rename to application/src/main/java/org/opentripplanner/street/model/edge/Edge.java index 00130265cf4..31bff5b1e15 100644 --- a/src/main/java/org/opentripplanner/street/model/edge/Edge.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/Edge.java @@ -5,6 +5,8 @@ import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.Objects; +import java.util.function.Consumer; +import javax.annotation.Nullable; import org.locationtech.jts.geom.LineString; import org.opentripplanner.astar.spi.AStarEdge; import org.opentripplanner.framework.i18n.I18NString; @@ -99,8 +101,28 @@ public int hashCode() { return Objects.hash(fromv, tov); } + @Override public String toString() { - return String.format("%s (%s -> %s)", getClass().getName(), fromv, tov); + return buildToString(null, b -> {}); + } + + /** + * Use this to construct a {@code toString()} in derived classes. The result will be: + * {@code "%simple-class-name%(%name%, %fromv% -> %tov%" + body + ")"}. Note! There is no space + * between {@code tov} and {@code body}. Both name and body are optional. + * + * @param name Will add name to the string if not null. + * @param body Use this callback to add local content. + */ + protected String buildToString(@Nullable String name, Consumer body) { + var buf = new StringBuilder(); + buf.append(getClass().getSimpleName()).append("("); + if (name != null) { + buf.append(name).append(", "); + } + buf.append(fromv).append(" -> ").append(tov); + body.accept(buf); + return buf.append(')').toString(); } /** diff --git a/src/main/java/org/opentripplanner/street/model/edge/ElevatorAlightEdge.java b/application/src/main/java/org/opentripplanner/street/model/edge/ElevatorAlightEdge.java similarity index 94% rename from src/main/java/org/opentripplanner/street/model/edge/ElevatorAlightEdge.java rename to application/src/main/java/org/opentripplanner/street/model/edge/ElevatorAlightEdge.java index 26b2fc622ba..ca3b0b4b0f7 100644 --- a/src/main/java/org/opentripplanner/street/model/edge/ElevatorAlightEdge.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/ElevatorAlightEdge.java @@ -1,6 +1,5 @@ package org.opentripplanner.street.model.edge; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.LineString; import org.opentripplanner.framework.geometry.GeometryUtils; @@ -56,12 +55,7 @@ public static ElevatorAlightEdge createElevatorAlightEdge( return connectToGraph(new ElevatorAlightEdge(from, to, level)); } - public String toString() { - return "ElevatorAlightEdge(" + fromv + " -> " + tov + ")"; - } - @Override - @Nonnull public State[] traverse(State s0) { StateEditor s1 = createEditorForDrivingOrWalking(s0, this); s1.incrementWeight(1); diff --git a/src/main/java/org/opentripplanner/street/model/edge/ElevatorBoardEdge.java b/application/src/main/java/org/opentripplanner/street/model/edge/ElevatorBoardEdge.java similarity index 92% rename from src/main/java/org/opentripplanner/street/model/edge/ElevatorBoardEdge.java rename to application/src/main/java/org/opentripplanner/street/model/edge/ElevatorBoardEdge.java index 624867fa4eb..81856476f2e 100644 --- a/src/main/java/org/opentripplanner/street/model/edge/ElevatorBoardEdge.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/ElevatorBoardEdge.java @@ -1,7 +1,6 @@ package org.opentripplanner.street.model.edge; import java.util.List; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.LineString; import org.opentripplanner.framework.geometry.GeometryUtils; @@ -42,12 +41,6 @@ public static ElevatorBoardEdge createElevatorBoardEdge( } @Override - public String toString() { - return ToStringBuilder.of(this.getClass()).addObj("from", fromv).addObj("to", tov).toString(); - } - - @Override - @Nonnull public State[] traverse(State s0) { StateEditor s1 = createEditorForDrivingOrWalking(s0, this); if (s1 == null) { diff --git a/src/main/java/org/opentripplanner/street/model/edge/ElevatorEdge.java b/application/src/main/java/org/opentripplanner/street/model/edge/ElevatorEdge.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/edge/ElevatorEdge.java rename to application/src/main/java/org/opentripplanner/street/model/edge/ElevatorEdge.java diff --git a/src/main/java/org/opentripplanner/street/model/edge/ElevatorHopEdge.java b/application/src/main/java/org/opentripplanner/street/model/edge/ElevatorHopEdge.java similarity index 96% rename from src/main/java/org/opentripplanner/street/model/edge/ElevatorHopEdge.java rename to application/src/main/java/org/opentripplanner/street/model/edge/ElevatorHopEdge.java index 0029b31f117..4acecd05a64 100644 --- a/src/main/java/org/opentripplanner/street/model/edge/ElevatorHopEdge.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/ElevatorHopEdge.java @@ -1,6 +1,5 @@ package org.opentripplanner.street.model.edge; -import javax.annotation.Nonnull; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.tostring.ToStringBuilder; import org.opentripplanner.routing.api.request.preference.RoutingPreferences; @@ -101,12 +100,6 @@ public StreetTraversalPermission getPermission() { } @Override - public String toString() { - return ToStringBuilder.of(this.getClass()).addObj("from", fromv).addObj("to", tov).toString(); - } - - @Override - @Nonnull public State[] traverse(State s0) { RoutingPreferences preferences = s0.getPreferences(); diff --git a/src/main/java/org/opentripplanner/street/model/edge/EscalatorEdge.java b/application/src/main/java/org/opentripplanner/street/model/edge/EscalatorEdge.java similarity index 87% rename from src/main/java/org/opentripplanner/street/model/edge/EscalatorEdge.java rename to application/src/main/java/org/opentripplanner/street/model/edge/EscalatorEdge.java index 11a31aeb86d..20fae657c78 100644 --- a/src/main/java/org/opentripplanner/street/model/edge/EscalatorEdge.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/EscalatorEdge.java @@ -1,6 +1,7 @@ package org.opentripplanner.street.model.edge; -import javax.annotation.Nonnull; +import org.locationtech.jts.geom.LineString; +import org.opentripplanner.framework.geometry.GeometryUtils; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.LocalizedString; import org.opentripplanner.street.model.vertex.Vertex; @@ -22,7 +23,6 @@ private EscalatorEdge(Vertex v1, Vertex v2, double length) { this.length = length; } - @Nonnull @Override public State[] traverse(State s0) { // Only allow traversal by walking @@ -36,6 +36,11 @@ public State[] traverse(State s0) { } else return State.empty(); } + @Override + public LineString getGeometry() { + return GeometryUtils.makeLineString(fromv.getCoordinate(), tov.getCoordinate()); + } + @Override public double getDistanceMeters() { return length; diff --git a/src/main/java/org/opentripplanner/street/model/edge/FreeEdge.java b/application/src/main/java/org/opentripplanner/street/model/edge/FreeEdge.java similarity index 87% rename from src/main/java/org/opentripplanner/street/model/edge/FreeEdge.java rename to application/src/main/java/org/opentripplanner/street/model/edge/FreeEdge.java index 9fbc69af126..3b1631211ff 100644 --- a/src/main/java/org/opentripplanner/street/model/edge/FreeEdge.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/FreeEdge.java @@ -1,6 +1,5 @@ package org.opentripplanner.street.model.edge; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.LineString; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.street.model.vertex.Vertex; @@ -23,12 +22,7 @@ public static FreeEdge createFreeEdge(Vertex from, Vertex to) { return connectToGraph(new FreeEdge(from, to)); } - public String toString() { - return "FreeEdge(" + fromv + " -> " + tov + ")"; - } - @Override - @Nonnull public State[] traverse(State s0) { StateEditor s1 = s0.edit(this); s1.incrementWeight(1); diff --git a/src/main/java/org/opentripplanner/street/model/edge/NamedArea.java b/application/src/main/java/org/opentripplanner/street/model/edge/NamedArea.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/edge/NamedArea.java rename to application/src/main/java/org/opentripplanner/street/model/edge/NamedArea.java diff --git a/src/main/java/org/opentripplanner/street/model/edge/PathwayEdge.java b/application/src/main/java/org/opentripplanner/street/model/edge/PathwayEdge.java similarity index 99% rename from src/main/java/org/opentripplanner/street/model/edge/PathwayEdge.java rename to application/src/main/java/org/opentripplanner/street/model/edge/PathwayEdge.java index 587b25a6704..703658fdda4 100644 --- a/src/main/java/org/opentripplanner/street/model/edge/PathwayEdge.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/PathwayEdge.java @@ -2,7 +2,6 @@ import java.util.Objects; import java.util.Optional; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.LineString; @@ -103,7 +102,6 @@ public static PathwayEdge createPathwayEdge( } @Override - @Nonnull public State[] traverse(State s0) { StateEditor s1 = createEditorForWalking(s0, this); if (s1 == null) { diff --git a/src/main/java/org/opentripplanner/street/model/edge/SplitStreetEdge.java b/application/src/main/java/org/opentripplanner/street/model/edge/SplitStreetEdge.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/edge/SplitStreetEdge.java rename to application/src/main/java/org/opentripplanner/street/model/edge/SplitStreetEdge.java diff --git a/src/main/java/org/opentripplanner/street/model/edge/StreetEdge.java b/application/src/main/java/org/opentripplanner/street/model/edge/StreetEdge.java similarity index 99% rename from src/main/java/org/opentripplanner/street/model/edge/StreetEdge.java rename to application/src/main/java/org/opentripplanner/street/model/edge/StreetEdge.java index ca33396b0a3..92244fe2af2 100644 --- a/src/main/java/org/opentripplanner/street/model/edge/StreetEdge.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/StreetEdge.java @@ -9,7 +9,6 @@ import java.util.Objects; import java.util.Optional; import java.util.stream.Stream; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.LineString; import org.locationtech.jts.geom.impl.PackedCoordinateSequence; import org.opentripplanner.framework.geometry.CompactLineStringUtils; @@ -308,20 +307,17 @@ public double getEffectiveWalkSafetyDistance() { } public String toString() { - return ( - "StreetEdge(" + - name + - ", " + - fromv + - " -> " + - tov + - " length=" + - this.getDistanceMeters() + - " carSpeed=" + - this.getCarSpeed() + - " permission=" + - this.getPermission() + - ")" + var nameString = name != null ? name.toString() : null; + return buildToString( + nameString, + b -> + b + .append(", length=") + .append(this.getDistanceMeters()) + .append(", carSpeed=") + .append(this.getCarSpeed()) + .append(", permission=") + .append(this.getPermission()) ); } @@ -330,7 +326,6 @@ public boolean isRoundabout() { } @Override - @Nonnull public State[] traverse(State s0) { final StateEditor editor; @@ -858,7 +853,6 @@ public void removeTurnRestrictionsTo(Edge other) { * This method is thread-safe, even if {@link StreetEdge#addTurnRestriction} or * {@link StreetEdge#removeTurnRestriction} is called concurrently. */ - @Nonnull public List getTurnRestrictions() { // this can be safely returned as it's unmodifiable return turnRestrictions; @@ -992,7 +986,6 @@ static int defaultMillimeterLength(LineString geometry) { * When we then leave the no drop off zone on foot we generate a state for each network that the * zone applies to where we pick up a vehicle with a specific network. */ - @Nonnull private State[] splitStatesAfterHavingExitedNoDropOffZoneWhenReverseSearching(State s0) { var networks = Stream.concat( // null is a special rental network that speculatively assumes that you can take any vehicle @@ -1194,7 +1187,6 @@ private StateEditor doTraverse(State s0, TraverseMode traverseMode, boolean walk return s1; } - @Nonnull private TraversalCosts otherTraversalCosts( RoutingPreferences preferences, TraverseMode traverseMode, @@ -1213,7 +1205,6 @@ private TraversalCosts otherTraversalCosts( return new TraversalCosts(time, weight); } - @Nonnull private TraversalCosts bicycleOrScooterTraversalCost( RoutingPreferences pref, TraverseMode mode, @@ -1258,7 +1249,6 @@ private TraversalCosts bicycleOrScooterTraversalCost( return new TraversalCosts(time, weight); } - @Nonnull private TraversalCosts walkingTraversalCosts( RoutingPreferences preferences, TraverseMode traverseMode, diff --git a/src/main/java/org/opentripplanner/street/model/edge/StreetEdgeBuilder.java b/application/src/main/java/org/opentripplanner/street/model/edge/StreetEdgeBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/edge/StreetEdgeBuilder.java rename to application/src/main/java/org/opentripplanner/street/model/edge/StreetEdgeBuilder.java diff --git a/src/main/java/org/opentripplanner/street/model/edge/StreetEdgeCostExtension.java b/application/src/main/java/org/opentripplanner/street/model/edge/StreetEdgeCostExtension.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/edge/StreetEdgeCostExtension.java rename to application/src/main/java/org/opentripplanner/street/model/edge/StreetEdgeCostExtension.java diff --git a/src/main/java/org/opentripplanner/street/model/edge/StreetEdgeReluctanceCalculator.java b/application/src/main/java/org/opentripplanner/street/model/edge/StreetEdgeReluctanceCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/edge/StreetEdgeReluctanceCalculator.java rename to application/src/main/java/org/opentripplanner/street/model/edge/StreetEdgeReluctanceCalculator.java diff --git a/src/main/java/org/opentripplanner/street/model/edge/StreetElevationExtension.java b/application/src/main/java/org/opentripplanner/street/model/edge/StreetElevationExtension.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/edge/StreetElevationExtension.java rename to application/src/main/java/org/opentripplanner/street/model/edge/StreetElevationExtension.java diff --git a/src/main/java/org/opentripplanner/street/model/edge/StreetElevationExtensionBuilder.java b/application/src/main/java/org/opentripplanner/street/model/edge/StreetElevationExtensionBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/edge/StreetElevationExtensionBuilder.java rename to application/src/main/java/org/opentripplanner/street/model/edge/StreetElevationExtensionBuilder.java diff --git a/application/src/main/java/org/opentripplanner/street/model/edge/StreetStationCentroidLink.java b/application/src/main/java/org/opentripplanner/street/model/edge/StreetStationCentroidLink.java new file mode 100644 index 00000000000..6b336907db5 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/street/model/edge/StreetStationCentroidLink.java @@ -0,0 +1,32 @@ +package org.opentripplanner.street.model.edge; + +import org.opentripplanner.street.model.vertex.StationCentroidVertex; +import org.opentripplanner.street.model.vertex.StreetVertex; + +/** + * This represents the connection between a street vertex and a transit station centroid vertex + */ +public class StreetStationCentroidLink extends FreeEdge { + + private StreetStationCentroidLink(StreetVertex fromv, StationCentroidVertex tov) { + super(fromv, tov); + } + + private StreetStationCentroidLink(StationCentroidVertex fromv, StreetVertex tov) { + super(fromv, tov); + } + + public static StreetStationCentroidLink createStreetStationLink( + StreetVertex fromv, + StationCentroidVertex tov + ) { + return connectToGraph(new StreetStationCentroidLink(fromv, tov)); + } + + public static StreetStationCentroidLink createStreetStationLink( + StationCentroidVertex fromv, + StreetVertex tov + ) { + return connectToGraph(new StreetStationCentroidLink(fromv, tov)); + } +} diff --git a/src/main/java/org/opentripplanner/street/model/edge/StreetTransitEntityLink.java b/application/src/main/java/org/opentripplanner/street/model/edge/StreetTransitEntityLink.java similarity index 97% rename from src/main/java/org/opentripplanner/street/model/edge/StreetTransitEntityLink.java rename to application/src/main/java/org/opentripplanner/street/model/edge/StreetTransitEntityLink.java index dabd70bf28d..92897232700 100644 --- a/src/main/java/org/opentripplanner/street/model/edge/StreetTransitEntityLink.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/StreetTransitEntityLink.java @@ -1,6 +1,5 @@ package org.opentripplanner.street.model.edge; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.LineString; import org.opentripplanner.framework.geometry.GeometryUtils; @@ -46,12 +45,7 @@ protected StreetTransitEntityLink( this.wheelchairAccessibility = wheelchairAccessibility; } - public String toString() { - return ToStringBuilder.of(this.getClass()).addObj("from", fromv).addObj("to", tov).toString(); - } - @Override - @Nonnull public State[] traverse(State s0) { // Forbid taking shortcuts composed of two street-transit links associated with the same stop in a row. Also // avoids spurious leg transitions. As noted in https://github.com/opentripplanner/OpenTripPlanner/issues/2815, @@ -135,7 +129,6 @@ else if ( }; } - @Nonnull private State[] buildState(State s0, StateEditor s1, RoutingPreferences pref) { if (s0.isRentingVehicleFromStation() && s0.mayKeepRentedVehicleAtDestination()) { var rentalPreferences = s0.getRequest().preferences().rental(s0.getRequest().mode()); diff --git a/src/main/java/org/opentripplanner/street/model/edge/StreetTransitEntranceLink.java b/application/src/main/java/org/opentripplanner/street/model/edge/StreetTransitEntranceLink.java similarity index 92% rename from src/main/java/org/opentripplanner/street/model/edge/StreetTransitEntranceLink.java rename to application/src/main/java/org/opentripplanner/street/model/edge/StreetTransitEntranceLink.java index 07b918159a7..7145f6183e4 100644 --- a/src/main/java/org/opentripplanner/street/model/edge/StreetTransitEntranceLink.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/StreetTransitEntranceLink.java @@ -43,10 +43,6 @@ public boolean isExit() { return !isEntrance; } - public String toString() { - return "StreetTransitEntranceLink(" + fromv + " -> " + tov + ")"; - } - protected int getStreetToStopTime() { return 0; } diff --git a/src/main/java/org/opentripplanner/street/model/edge/StreetTransitStopLink.java b/application/src/main/java/org/opentripplanner/street/model/edge/StreetTransitStopLink.java similarity index 92% rename from src/main/java/org/opentripplanner/street/model/edge/StreetTransitStopLink.java rename to application/src/main/java/org/opentripplanner/street/model/edge/StreetTransitStopLink.java index 41605be4ccc..a7ce1c0e2df 100644 --- a/src/main/java/org/opentripplanner/street/model/edge/StreetTransitStopLink.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/StreetTransitStopLink.java @@ -36,8 +36,4 @@ protected int getStreetToStopTime() { ? 0 : getTransitEntityVertex().getStreetToStopTime(); } - - public String toString() { - return "StreetTransitStopLink(" + fromv + " -> " + tov + ")"; - } } diff --git a/src/main/java/org/opentripplanner/street/model/edge/StreetVehicleParkingLink.java b/application/src/main/java/org/opentripplanner/street/model/edge/StreetVehicleParkingLink.java similarity index 94% rename from src/main/java/org/opentripplanner/street/model/edge/StreetVehicleParkingLink.java rename to application/src/main/java/org/opentripplanner/street/model/edge/StreetVehicleParkingLink.java index 2ad9d0f39c4..e8fbae31b5f 100644 --- a/src/main/java/org/opentripplanner/street/model/edge/StreetVehicleParkingLink.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/StreetVehicleParkingLink.java @@ -1,6 +1,5 @@ package org.opentripplanner.street.model.edge; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.LineString; import org.opentripplanner.framework.geometry.GeometryUtils; import org.opentripplanner.framework.i18n.I18NString; @@ -45,12 +44,6 @@ public static StreetVehicleParkingLink createStreetVehicleParkingLink( } @Override - public String toString() { - return ToStringBuilder.of(this.getClass()).addObj("fromv", fromv).addObj("tov", tov).toString(); - } - - @Override - @Nonnull public State[] traverse(State s0) { // Disallow traversing two StreetBikeParkLinks in a row. // Prevents router using bike rental stations as shortcuts to get around diff --git a/src/main/java/org/opentripplanner/street/model/edge/TemporaryEdge.java b/application/src/main/java/org/opentripplanner/street/model/edge/TemporaryEdge.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/edge/TemporaryEdge.java rename to application/src/main/java/org/opentripplanner/street/model/edge/TemporaryEdge.java diff --git a/src/main/java/org/opentripplanner/street/model/edge/TemporaryFreeEdge.java b/application/src/main/java/org/opentripplanner/street/model/edge/TemporaryFreeEdge.java similarity index 92% rename from src/main/java/org/opentripplanner/street/model/edge/TemporaryFreeEdge.java rename to application/src/main/java/org/opentripplanner/street/model/edge/TemporaryFreeEdge.java index e93c6523d89..7b114cfeade 100644 --- a/src/main/java/org/opentripplanner/street/model/edge/TemporaryFreeEdge.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/TemporaryFreeEdge.java @@ -1,6 +1,5 @@ package org.opentripplanner.street.model.edge; -import javax.annotation.Nonnull; import org.opentripplanner.street.model.vertex.TemporaryVertex; import org.opentripplanner.street.model.vertex.Vertex; import org.opentripplanner.street.search.state.State; @@ -31,12 +30,6 @@ public static TemporaryFreeEdge createTemporaryFreeEdge(Vertex from, TemporaryVe } @Override - public String toString() { - return "Temporary" + super.toString(); - } - - @Override - @Nonnull public State[] traverse(State s0) { StateEditor s1 = s0.edit(this); s1.incrementWeight(1); diff --git a/src/main/java/org/opentripplanner/street/model/edge/TemporaryPartialStreetEdge.java b/application/src/main/java/org/opentripplanner/street/model/edge/TemporaryPartialStreetEdge.java similarity index 87% rename from src/main/java/org/opentripplanner/street/model/edge/TemporaryPartialStreetEdge.java rename to application/src/main/java/org/opentripplanner/street/model/edge/TemporaryPartialStreetEdge.java index 8c797f1f492..31792614cde 100644 --- a/src/main/java/org/opentripplanner/street/model/edge/TemporaryPartialStreetEdge.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/TemporaryPartialStreetEdge.java @@ -55,20 +55,10 @@ public StreetEdge getParentEdge() { @Override public String toString() { - return ( - "TemporaryPartialStreetEdge(" + - this.getDefaultName() + - ", " + - this.getFromVertex() + - " -> " + - this.getToVertex() + - " length=" + - this.getDistanceMeters() + - " carSpeed=" + - this.getCarSpeed() + - " parentEdge=" + - parentEdge + - ")" + return buildToString( + this.getDefaultName(), + b -> + b.append(", length=").append(this.getCarSpeed()).append(", parentEdge=").append(parentEdge) ); } diff --git a/src/main/java/org/opentripplanner/street/model/edge/TemporaryPartialStreetEdgeBuilder.java b/application/src/main/java/org/opentripplanner/street/model/edge/TemporaryPartialStreetEdgeBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/edge/TemporaryPartialStreetEdgeBuilder.java rename to application/src/main/java/org/opentripplanner/street/model/edge/TemporaryPartialStreetEdgeBuilder.java diff --git a/src/main/java/org/opentripplanner/street/model/edge/VehicleParkingEdge.java b/application/src/main/java/org/opentripplanner/street/model/edge/VehicleParkingEdge.java similarity index 97% rename from src/main/java/org/opentripplanner/street/model/edge/VehicleParkingEdge.java rename to application/src/main/java/org/opentripplanner/street/model/edge/VehicleParkingEdge.java index d32f13d6ea4..95d9ea5507d 100644 --- a/src/main/java/org/opentripplanner/street/model/edge/VehicleParkingEdge.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/VehicleParkingEdge.java @@ -1,7 +1,6 @@ package org.opentripplanner.street.model.edge; import java.time.Duration; -import javax.annotation.Nonnull; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.model.Cost; import org.opentripplanner.routing.api.request.StreetMode; @@ -62,12 +61,7 @@ public boolean equals(Object o) { return false; } - public String toString() { - return "VehicleParkingEdge(" + fromv + " -> " + tov + ")"; - } - @Override - @Nonnull public State[] traverse(State s0) { if (!s0.getRequest().mode().includesParking()) { return State.empty(); diff --git a/src/main/java/org/opentripplanner/street/model/edge/WheelchairTraversalInformation.java b/application/src/main/java/org/opentripplanner/street/model/edge/WheelchairTraversalInformation.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/edge/WheelchairTraversalInformation.java rename to application/src/main/java/org/opentripplanner/street/model/edge/WheelchairTraversalInformation.java diff --git a/src/main/java/org/opentripplanner/street/model/elevation/ElevationUtils.java b/application/src/main/java/org/opentripplanner/street/model/elevation/ElevationUtils.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/elevation/ElevationUtils.java rename to application/src/main/java/org/opentripplanner/street/model/elevation/ElevationUtils.java diff --git a/src/main/java/org/opentripplanner/street/model/note/StreetNote.java b/application/src/main/java/org/opentripplanner/street/model/note/StreetNote.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/note/StreetNote.java rename to application/src/main/java/org/opentripplanner/street/model/note/StreetNote.java diff --git a/src/main/java/org/opentripplanner/street/model/note/StreetNoteAndMatcher.java b/application/src/main/java/org/opentripplanner/street/model/note/StreetNoteAndMatcher.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/note/StreetNoteAndMatcher.java rename to application/src/main/java/org/opentripplanner/street/model/note/StreetNoteAndMatcher.java diff --git a/src/main/java/org/opentripplanner/street/model/note/StreetNoteMatcher.java b/application/src/main/java/org/opentripplanner/street/model/note/StreetNoteMatcher.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/note/StreetNoteMatcher.java rename to application/src/main/java/org/opentripplanner/street/model/note/StreetNoteMatcher.java diff --git a/src/main/java/org/opentripplanner/street/model/vertex/BarrierVertex.java b/application/src/main/java/org/opentripplanner/street/model/vertex/BarrierVertex.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/vertex/BarrierVertex.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/BarrierVertex.java diff --git a/src/main/java/org/opentripplanner/street/model/vertex/ElevatorOffboardVertex.java b/application/src/main/java/org/opentripplanner/street/model/vertex/ElevatorOffboardVertex.java similarity index 94% rename from src/main/java/org/opentripplanner/street/model/vertex/ElevatorOffboardVertex.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/ElevatorOffboardVertex.java index 7fd66d8a759..89148bc6ace 100644 --- a/src/main/java/org/opentripplanner/street/model/vertex/ElevatorOffboardVertex.java +++ b/application/src/main/java/org/opentripplanner/street/model/vertex/ElevatorOffboardVertex.java @@ -1,6 +1,5 @@ package org.opentripplanner.street.model.vertex; -import javax.annotation.Nonnull; import org.opentripplanner.framework.i18n.I18NString; public class ElevatorOffboardVertex extends StreetVertex { @@ -20,7 +19,6 @@ public VertexLabel getLabel() { return VertexLabel.string(LABEL_TEMPLATE.formatted(label, level)); } - @Nonnull @Override public I18NString getName() { return I18NString.of(label); diff --git a/src/main/java/org/opentripplanner/street/model/vertex/ElevatorOnboardVertex.java b/application/src/main/java/org/opentripplanner/street/model/vertex/ElevatorOnboardVertex.java similarity index 94% rename from src/main/java/org/opentripplanner/street/model/vertex/ElevatorOnboardVertex.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/ElevatorOnboardVertex.java index 5999b293ce7..5f6f19e2dab 100644 --- a/src/main/java/org/opentripplanner/street/model/vertex/ElevatorOnboardVertex.java +++ b/application/src/main/java/org/opentripplanner/street/model/vertex/ElevatorOnboardVertex.java @@ -1,6 +1,5 @@ package org.opentripplanner.street.model.vertex; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.framework.i18n.I18NString; @@ -21,7 +20,6 @@ public VertexLabel getLabel() { return VertexLabel.string(LABEL_TEMPLATE.formatted(label, level)); } - @Nonnull @Override public I18NString getName() { return I18NString.of(label); diff --git a/src/main/java/org/opentripplanner/street/model/vertex/ExitVertex.java b/application/src/main/java/org/opentripplanner/street/model/vertex/ExitVertex.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/vertex/ExitVertex.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/ExitVertex.java diff --git a/src/main/java/org/opentripplanner/street/model/vertex/IntersectionVertex.java b/application/src/main/java/org/opentripplanner/street/model/vertex/IntersectionVertex.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/vertex/IntersectionVertex.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/IntersectionVertex.java diff --git a/src/main/java/org/opentripplanner/street/model/vertex/LabelledIntersectionVertex.java b/application/src/main/java/org/opentripplanner/street/model/vertex/LabelledIntersectionVertex.java similarity index 91% rename from src/main/java/org/opentripplanner/street/model/vertex/LabelledIntersectionVertex.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/LabelledIntersectionVertex.java index c32ac19fd89..ecb82b43008 100644 --- a/src/main/java/org/opentripplanner/street/model/vertex/LabelledIntersectionVertex.java +++ b/application/src/main/java/org/opentripplanner/street/model/vertex/LabelledIntersectionVertex.java @@ -1,6 +1,5 @@ package org.opentripplanner.street.model.vertex; -import javax.annotation.Nonnull; import org.opentripplanner.framework.i18n.I18NString; /** @@ -12,7 +11,7 @@ public class LabelledIntersectionVertex extends IntersectionVertex { private final String label; public LabelledIntersectionVertex( - @Nonnull String label, + String label, double x, double y, boolean hasHighwayTrafficLight, @@ -27,7 +26,6 @@ public VertexLabel getLabel() { return VertexLabel.string(label); } - @Nonnull @Override public I18NString getName() { return I18NString.of(label); diff --git a/src/main/java/org/opentripplanner/street/model/vertex/OsmBoardingLocationVertex.java b/application/src/main/java/org/opentripplanner/street/model/vertex/OsmBoardingLocationVertex.java similarity index 97% rename from src/main/java/org/opentripplanner/street/model/vertex/OsmBoardingLocationVertex.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/OsmBoardingLocationVertex.java index 606c27ef4b2..8ba8b25c2b2 100644 --- a/src/main/java/org/opentripplanner/street/model/vertex/OsmBoardingLocationVertex.java +++ b/application/src/main/java/org/opentripplanner/street/model/vertex/OsmBoardingLocationVertex.java @@ -3,7 +3,6 @@ import java.util.Collection; import java.util.Objects; import java.util.Set; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.tostring.ToStringBuilder; @@ -44,7 +43,6 @@ public boolean isConnectedToStreetNetwork() { return (getOutgoing().size() + getIncoming().size()) > 0; } - @Nonnull @Override public I18NString getName() { return name; diff --git a/src/main/java/org/opentripplanner/street/model/vertex/OsmVertex.java b/application/src/main/java/org/opentripplanner/street/model/vertex/OsmVertex.java similarity index 95% rename from src/main/java/org/opentripplanner/street/model/vertex/OsmVertex.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/OsmVertex.java index e4784e6edb9..39d195f695e 100644 --- a/src/main/java/org/opentripplanner/street/model/vertex/OsmVertex.java +++ b/application/src/main/java/org/opentripplanner/street/model/vertex/OsmVertex.java @@ -1,6 +1,5 @@ package org.opentripplanner.street.model.vertex; -import javax.annotation.Nonnull; import org.opentripplanner.framework.i18n.I18NString; /** @@ -29,7 +28,6 @@ public OsmVertex( this.nodeId = nodeId; } - @Nonnull @Override public I18NString getName() { return NO_NAME; diff --git a/src/main/java/org/opentripplanner/street/model/vertex/OsmVertexOnLevel.java b/application/src/main/java/org/opentripplanner/street/model/vertex/OsmVertexOnLevel.java similarity index 83% rename from src/main/java/org/opentripplanner/street/model/vertex/OsmVertexOnLevel.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/OsmVertexOnLevel.java index 35457c4eb04..c96878e228a 100644 --- a/src/main/java/org/opentripplanner/street/model/vertex/OsmVertexOnLevel.java +++ b/application/src/main/java/org/opentripplanner/street/model/vertex/OsmVertexOnLevel.java @@ -1,6 +1,6 @@ package org.opentripplanner.street.model.vertex; -import org.opentripplanner.openstreetmap.model.OSMNode; +import org.opentripplanner.osm.model.OsmNode; /** * A vertex that represents an OSM node in conjunction with its level tag like both ends of an @@ -12,7 +12,7 @@ public class OsmVertexOnLevel extends OsmVertex { private final String level; - public OsmVertexOnLevel(OSMNode node, String level) { + public OsmVertexOnLevel(OsmNode node, String level) { super(node.getCoordinate().x, node.getCoordinate().y, node.getId()); this.level = level; } diff --git a/src/main/java/org/opentripplanner/street/model/vertex/SplitterVertex.java b/application/src/main/java/org/opentripplanner/street/model/vertex/SplitterVertex.java similarity index 95% rename from src/main/java/org/opentripplanner/street/model/vertex/SplitterVertex.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/SplitterVertex.java index 0362f6e1766..c1fc60983e4 100644 --- a/src/main/java/org/opentripplanner/street/model/vertex/SplitterVertex.java +++ b/application/src/main/java/org/opentripplanner/street/model/vertex/SplitterVertex.java @@ -1,6 +1,5 @@ package org.opentripplanner.street.model.vertex; -import javax.annotation.Nonnull; import org.opentripplanner.framework.i18n.I18NString; /** @@ -31,7 +30,6 @@ public boolean inferredFreeFlowing() { return true; } - @Nonnull @Override public I18NString getName() { return name; diff --git a/application/src/main/java/org/opentripplanner/street/model/vertex/StationCentroidVertex.java b/application/src/main/java/org/opentripplanner/street/model/vertex/StationCentroidVertex.java new file mode 100644 index 00000000000..f6f3b00191d --- /dev/null +++ b/application/src/main/java/org/opentripplanner/street/model/vertex/StationCentroidVertex.java @@ -0,0 +1,33 @@ +package org.opentripplanner.street.model.vertex; + +import javax.annotation.Nonnull; +import org.opentripplanner.framework.i18n.I18NString; +import org.opentripplanner.transit.model.site.Station; + +/** + * A vertex representing a station centroid. This can be used as a source/destination for routing. + */ +public class StationCentroidVertex extends Vertex { + + private final Station station; + + public StationCentroidVertex(Station station) { + super(station.getLon(), station.getLat()); + this.station = station; + } + + public Station getStation() { + return this.station; + } + + @Nonnull + @Override + public I18NString getName() { + return station.getName(); + } + + @Override + public VertexLabel getLabel() { + return VertexLabel.feedScopedId(station.getId()); + } +} diff --git a/src/main/java/org/opentripplanner/street/model/vertex/StationElementVertex.java b/application/src/main/java/org/opentripplanner/street/model/vertex/StationElementVertex.java similarity index 93% rename from src/main/java/org/opentripplanner/street/model/vertex/StationElementVertex.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/StationElementVertex.java index 0873ca64fc5..63595803300 100644 --- a/src/main/java/org/opentripplanner/street/model/vertex/StationElementVertex.java +++ b/application/src/main/java/org/opentripplanner/street/model/vertex/StationElementVertex.java @@ -1,6 +1,5 @@ package org.opentripplanner.street.model.vertex; -import javax.annotation.Nonnull; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.site.StationElement; @@ -22,12 +21,14 @@ public final VertexLabel getLabel() { } /** Get the corresponding StationElement */ - @Nonnull public abstract StationElement getStationElement(); - @Nonnull @Override public I18NString getName() { return name; } + + public FeedScopedId getId() { + return id; + } } diff --git a/src/main/java/org/opentripplanner/street/model/vertex/StreetLocation.java b/application/src/main/java/org/opentripplanner/street/model/vertex/StreetLocation.java similarity index 97% rename from src/main/java/org/opentripplanner/street/model/vertex/StreetLocation.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/StreetLocation.java index 31b25ec7b7d..44ca1f4db32 100644 --- a/src/main/java/org/opentripplanner/street/model/vertex/StreetLocation.java +++ b/application/src/main/java/org/opentripplanner/street/model/vertex/StreetLocation.java @@ -1,6 +1,5 @@ package org.opentripplanner.street.model.vertex; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.Coordinate; import org.opentripplanner.framework.i18n.I18NString; @@ -42,7 +41,6 @@ public I18NString getIntersectionName() { return getName(); } - @Nonnull @Override public I18NString getName() { return name; diff --git a/src/main/java/org/opentripplanner/street/model/vertex/StreetVertex.java b/application/src/main/java/org/opentripplanner/street/model/vertex/StreetVertex.java similarity index 96% rename from src/main/java/org/opentripplanner/street/model/vertex/StreetVertex.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/StreetVertex.java index 64438667af8..8b58466a33c 100644 --- a/src/main/java/org/opentripplanner/street/model/vertex/StreetVertex.java +++ b/application/src/main/java/org/opentripplanner/street/model/vertex/StreetVertex.java @@ -8,7 +8,6 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.LocalizedString; import org.opentripplanner.street.model.edge.Edge; @@ -84,7 +83,6 @@ public boolean isEligibleForCarPickupDropoff() { /** * Returns the list of area stops that this vertex is inside of. */ - @Nonnull public Set areaStops() { return areaStops; } @@ -92,7 +90,7 @@ public Set areaStops() { /** * Add a collection of area stops to this vertex. */ - public void addAreaStops(@Nonnull Collection toBeAdded) { + public void addAreaStops(Collection toBeAdded) { Objects.requireNonNull(toBeAdded); synchronized (this) { if (areaStops == EMPTY_SET) { diff --git a/src/main/java/org/opentripplanner/street/model/vertex/TemporarySplitterVertex.java b/application/src/main/java/org/opentripplanner/street/model/vertex/TemporarySplitterVertex.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/vertex/TemporarySplitterVertex.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/TemporarySplitterVertex.java diff --git a/src/main/java/org/opentripplanner/street/model/vertex/TemporaryStreetLocation.java b/application/src/main/java/org/opentripplanner/street/model/vertex/TemporaryStreetLocation.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/vertex/TemporaryStreetLocation.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/TemporaryStreetLocation.java diff --git a/src/main/java/org/opentripplanner/street/model/vertex/TemporaryVertex.java b/application/src/main/java/org/opentripplanner/street/model/vertex/TemporaryVertex.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/vertex/TemporaryVertex.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/TemporaryVertex.java diff --git a/src/main/java/org/opentripplanner/street/model/vertex/TemporaryVertexDispose.java b/application/src/main/java/org/opentripplanner/street/model/vertex/TemporaryVertexDispose.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/vertex/TemporaryVertexDispose.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/TemporaryVertexDispose.java diff --git a/src/main/java/org/opentripplanner/street/model/vertex/TransitBoardingAreaVertex.java b/application/src/main/java/org/opentripplanner/street/model/vertex/TransitBoardingAreaVertex.java similarity index 95% rename from src/main/java/org/opentripplanner/street/model/vertex/TransitBoardingAreaVertex.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/TransitBoardingAreaVertex.java index 3221934c2f6..5654185440a 100644 --- a/src/main/java/org/opentripplanner/street/model/vertex/TransitBoardingAreaVertex.java +++ b/application/src/main/java/org/opentripplanner/street/model/vertex/TransitBoardingAreaVertex.java @@ -1,6 +1,5 @@ package org.opentripplanner.street.model.vertex; -import javax.annotation.Nonnull; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.site.BoardingArea; import org.opentripplanner.transit.model.site.StationElement; @@ -30,7 +29,6 @@ public boolean isWheelchairAccessible() { return wheelchairAccessible; } - @Nonnull @Override public StationElement getStationElement() { return this.boardingArea; diff --git a/src/main/java/org/opentripplanner/street/model/vertex/TransitEntranceVertex.java b/application/src/main/java/org/opentripplanner/street/model/vertex/TransitEntranceVertex.java similarity index 95% rename from src/main/java/org/opentripplanner/street/model/vertex/TransitEntranceVertex.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/TransitEntranceVertex.java index 54de400dedb..81b89ad3dfb 100644 --- a/src/main/java/org/opentripplanner/street/model/vertex/TransitEntranceVertex.java +++ b/application/src/main/java/org/opentripplanner/street/model/vertex/TransitEntranceVertex.java @@ -1,6 +1,5 @@ package org.opentripplanner.street.model.vertex; -import javax.annotation.Nonnull; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.site.Entrance; import org.opentripplanner.transit.model.site.StationElement; @@ -33,7 +32,6 @@ public Entrance getEntrance() { return this.entrance; } - @Nonnull @Override public StationElement getStationElement() { return this.entrance; diff --git a/src/main/java/org/opentripplanner/street/model/vertex/TransitPathwayNodeVertex.java b/application/src/main/java/org/opentripplanner/street/model/vertex/TransitPathwayNodeVertex.java similarity index 95% rename from src/main/java/org/opentripplanner/street/model/vertex/TransitPathwayNodeVertex.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/TransitPathwayNodeVertex.java index b8cec0ec37c..645ec96b5ea 100644 --- a/src/main/java/org/opentripplanner/street/model/vertex/TransitPathwayNodeVertex.java +++ b/application/src/main/java/org/opentripplanner/street/model/vertex/TransitPathwayNodeVertex.java @@ -1,6 +1,5 @@ package org.opentripplanner.street.model.vertex; -import javax.annotation.Nonnull; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.site.PathwayNode; import org.opentripplanner.transit.model.site.StationElement; @@ -33,7 +32,6 @@ public PathwayNode getNode() { return this.node; } - @Nonnull @Override public StationElement getStationElement() { return this.node; diff --git a/src/main/java/org/opentripplanner/street/model/vertex/TransitStopVertex.java b/application/src/main/java/org/opentripplanner/street/model/vertex/TransitStopVertex.java similarity index 98% rename from src/main/java/org/opentripplanner/street/model/vertex/TransitStopVertex.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/TransitStopVertex.java index a9d7d221d44..82c977902b0 100644 --- a/src/main/java/org/opentripplanner/street/model/vertex/TransitStopVertex.java +++ b/application/src/main/java/org/opentripplanner/street/model/vertex/TransitStopVertex.java @@ -2,7 +2,6 @@ import java.util.HashSet; import java.util.Set; -import javax.annotation.Nonnull; import org.opentripplanner.street.model.edge.Edge; import org.opentripplanner.street.model.edge.PathwayEdge; import org.opentripplanner.transit.model.basic.Accessibility; @@ -84,7 +83,6 @@ public RegularStop getStop() { return this.stop; } - @Nonnull @Override public StationElement getStationElement() { return this.stop; diff --git a/src/main/java/org/opentripplanner/street/model/vertex/TransitStopVertexBuilder.java b/application/src/main/java/org/opentripplanner/street/model/vertex/TransitStopVertexBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/vertex/TransitStopVertexBuilder.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/TransitStopVertexBuilder.java diff --git a/src/main/java/org/opentripplanner/street/model/vertex/VehicleParkingEntranceVertex.java b/application/src/main/java/org/opentripplanner/street/model/vertex/VehicleParkingEntranceVertex.java similarity index 97% rename from src/main/java/org/opentripplanner/street/model/vertex/VehicleParkingEntranceVertex.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/VehicleParkingEntranceVertex.java index ba7a1540715..591f71f1869 100644 --- a/src/main/java/org/opentripplanner/street/model/vertex/VehicleParkingEntranceVertex.java +++ b/application/src/main/java/org/opentripplanner/street/model/vertex/VehicleParkingEntranceVertex.java @@ -2,7 +2,6 @@ import java.util.Collection; import java.util.Objects; -import javax.annotation.Nonnull; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.routing.vehicle_parking.VehicleParking; import org.opentripplanner.routing.vehicle_parking.VehicleParkingEntrance; @@ -25,7 +24,6 @@ public VehicleParkingEntranceVertex(VehicleParkingEntrance parkingEntrance) { this.parkingEntrance = parkingEntrance; } - @Nonnull @Override public I18NString getName() { return Objects.requireNonNullElse(parkingEntrance.getName(), NO_NAME); diff --git a/src/main/java/org/opentripplanner/street/model/vertex/Vertex.java b/application/src/main/java/org/opentripplanner/street/model/vertex/Vertex.java similarity index 98% rename from src/main/java/org/opentripplanner/street/model/vertex/Vertex.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/Vertex.java index 59407f93ea9..75fd5b7218e 100644 --- a/src/main/java/org/opentripplanner/street/model/vertex/Vertex.java +++ b/application/src/main/java/org/opentripplanner/street/model/vertex/Vertex.java @@ -8,7 +8,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.Coordinate; import org.opentripplanner.astar.spi.AStarVertex; import org.opentripplanner.framework.geometry.WgsCoordinate; @@ -137,7 +136,6 @@ public final double getLat() { /** * Longer human-readable name for the client */ - @Nonnull public abstract I18NString getName(); /** @@ -163,6 +161,13 @@ public String getLabelString() { return getLabel().toString(); } + /** + * Return the position of the vertex as a WgsCoordinate. + */ + public WgsCoordinate toWgsCoordinate() { + return new WgsCoordinate(y, x); + } + public Coordinate getCoordinate() { return new Coordinate(getX(), getY()); } diff --git a/src/main/java/org/opentripplanner/street/model/vertex/VertexFactory.java b/application/src/main/java/org/opentripplanner/street/model/vertex/VertexFactory.java similarity index 93% rename from src/main/java/org/opentripplanner/street/model/vertex/VertexFactory.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/VertexFactory.java index c7e38ca0032..80bd8021309 100644 --- a/src/main/java/org/opentripplanner/street/model/vertex/VertexFactory.java +++ b/application/src/main/java/org/opentripplanner/street/model/vertex/VertexFactory.java @@ -1,11 +1,10 @@ package org.opentripplanner.street.model.vertex; import java.util.Set; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.locationtech.jts.geom.Coordinate; import org.opentripplanner.framework.i18n.I18NString; -import org.opentripplanner.openstreetmap.model.OSMNode; +import org.opentripplanner.osm.model.OsmNode; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.routing.vehicle_parking.VehicleParking; import org.opentripplanner.routing.vehicle_parking.VehicleParkingEntrance; @@ -15,6 +14,7 @@ import org.opentripplanner.transit.model.site.BoardingArea; import org.opentripplanner.transit.model.site.Entrance; import org.opentripplanner.transit.model.site.PathwayNode; +import org.opentripplanner.transit.model.site.Station; /** * This class is the central point where all vertices that are supposed to be permanently part @@ -32,12 +32,10 @@ public VertexFactory(Graph graph) { this.graph = graph; } - @Nonnull public TransitBoardingAreaVertex transitBoardingArea(BoardingArea boardingArea) { return addToGraph(new TransitBoardingAreaVertex(boardingArea)); } - @Nonnull public ElevatorOnboardVertex elevatorOnboard( Vertex sourceVertex, String label, @@ -46,7 +44,6 @@ public ElevatorOnboardVertex elevatorOnboard( return addToGraph(new ElevatorOnboardVertex(sourceVertex, label, levelName)); } - @Nonnull public ElevatorOffboardVertex elevatorOffboard( Vertex sourceVertex, String label, @@ -55,7 +52,6 @@ public ElevatorOffboardVertex elevatorOffboard( return addToGraph(new ElevatorOffboardVertex(sourceVertex, label, levelName)); } - @Nonnull public IntersectionVertex intersection(Coordinate edgeCoordinate) { return addToGraph( new LabelledIntersectionVertex( @@ -68,12 +64,10 @@ public IntersectionVertex intersection(Coordinate edgeCoordinate) { ); } - @Nonnull public IntersectionVertex intersection(String label, double longitude, double latitude) { return addToGraph(new LabelledIntersectionVertex(label, longitude, latitude, false, false)); } - @Nonnull public OsmBoardingLocationVertex osmBoardingLocation( Coordinate coordinate, String label, @@ -83,7 +77,6 @@ public OsmBoardingLocationVertex osmBoardingLocation( return addToGraph(new OsmBoardingLocationVertex(label, coordinate.x, coordinate.y, name, refs)); } - @Nonnull public SplitterVertex splitter( StreetEdge originalEdge, double x, @@ -93,20 +86,17 @@ public SplitterVertex splitter( return addToGraph(new SplitterVertex(uniqueSplitLabel, x, y, originalEdge.getName())); } - @Nonnull public BarrierVertex barrier(long nid, Coordinate coordinate) { return addToGraph(new BarrierVertex(coordinate.x, coordinate.y, nid)); } - @Nonnull public ExitVertex exit(long nid, Coordinate coordinate, String exitName) { return addToGraph(new ExitVertex(coordinate.x, coordinate.y, nid, exitName)); } - @Nonnull public OsmVertex osm( Coordinate coordinate, - OSMNode node, + OsmNode node, boolean highwayTrafficLight, boolean crossingTrafficLight ) { @@ -121,12 +111,14 @@ public OsmVertex osm( ); } - @Nonnull public TransitStopVertex transitStop(TransitStopVertexBuilder transitStopVertexBuilder) { return addToGraph(transitStopVertexBuilder.build()); } - @Nonnull + public StationCentroidVertex stationCentroid(Station station) { + return addToGraph(new StationCentroidVertex(station)); + } + public VehicleParkingEntranceVertex vehicleParkingEntrance(VehicleParking vehicleParking) { return vehicleParkingEntrance(vehicleParking.getEntrances().get(0)); } @@ -135,22 +127,19 @@ public VehicleParkingEntranceVertex vehicleParkingEntrance(VehicleParkingEntranc return addToGraph(new VehicleParkingEntranceVertex(entrance)); } - @Nonnull public VehicleRentalPlaceVertex vehicleRentalPlace(VehicleRentalPlace station) { return addToGraph(new VehicleRentalPlaceVertex(station)); } - @Nonnull public TransitPathwayNodeVertex transitPathwayNode(PathwayNode node) { return addToGraph(new TransitPathwayNodeVertex(node)); } - @Nonnull public TransitEntranceVertex transitEntrance(Entrance entrance) { return addToGraph(new TransitEntranceVertex(entrance)); } - public OsmVertex levelledOsm(OSMNode node, String level) { + public OsmVertex levelledOsm(OsmNode node, String level) { return addToGraph(new OsmVertexOnLevel(node, level)); } diff --git a/src/main/java/org/opentripplanner/street/model/vertex/VertexLabel.java b/application/src/main/java/org/opentripplanner/street/model/vertex/VertexLabel.java similarity index 100% rename from src/main/java/org/opentripplanner/street/model/vertex/VertexLabel.java rename to application/src/main/java/org/opentripplanner/street/model/vertex/VertexLabel.java diff --git a/src/main/java/org/opentripplanner/street/search/StreetSearchBuilder.java b/application/src/main/java/org/opentripplanner/street/search/StreetSearchBuilder.java similarity index 99% rename from src/main/java/org/opentripplanner/street/search/StreetSearchBuilder.java rename to application/src/main/java/org/opentripplanner/street/search/StreetSearchBuilder.java index 079cd29706f..68a71aef0a7 100644 --- a/src/main/java/org/opentripplanner/street/search/StreetSearchBuilder.java +++ b/application/src/main/java/org/opentripplanner/street/search/StreetSearchBuilder.java @@ -3,7 +3,6 @@ import java.time.Duration; import java.util.Collection; import java.util.Set; -import javax.annotation.Nonnull; import org.opentripplanner.astar.AStarBuilder; import org.opentripplanner.astar.spi.DominanceFunction; import org.opentripplanner.astar.spi.RemainingWeightHeuristic; @@ -65,7 +64,6 @@ public StreetSearchBuilder setDataOverlayContext(DataOverlayContext dataOverlayC return this; } - @Nonnull @Override protected Duration streetRoutingTimeout() { return routeRequest.preferences().street().routingTimeout(); diff --git a/src/main/java/org/opentripplanner/street/search/TemporaryVerticesContainer.java b/application/src/main/java/org/opentripplanner/street/search/TemporaryVerticesContainer.java similarity index 74% rename from src/main/java/org/opentripplanner/street/search/TemporaryVerticesContainer.java rename to application/src/main/java/org/opentripplanner/street/search/TemporaryVerticesContainer.java index 3e7ecd2c237..1c6394bfd2f 100644 --- a/src/main/java/org/opentripplanner/street/search/TemporaryVerticesContainer.java +++ b/application/src/main/java/org/opentripplanner/street/search/TemporaryVerticesContainer.java @@ -10,7 +10,6 @@ import org.locationtech.jts.geom.GeometryFactory; import org.opentripplanner.framework.geometry.GeometryUtils; import org.opentripplanner.model.GenericLocation; -import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.api.request.StreetMode; import org.opentripplanner.routing.api.response.InputField; import org.opentripplanner.routing.api.response.RoutingError; @@ -32,14 +31,16 @@ public class TemporaryVerticesContainer implements AutoCloseable { private final Graph graph; - private final RouteRequest opt; private final Set tempEdges; private final Set fromVertices; private final Set toVertices; + private final GenericLocation from; + private final GenericLocation to; public TemporaryVerticesContainer( Graph graph, - RouteRequest opt, + GenericLocation from, + GenericLocation to, StreetMode accessMode, StreetMode egressMode ) { @@ -47,9 +48,10 @@ public TemporaryVerticesContainer( this.graph = graph; StreetIndex index = this.graph.getStreetIndex(); - this.opt = opt; - fromVertices = index.getVerticesForLocation(opt.from(), accessMode, false, tempEdges); - toVertices = index.getVerticesForLocation(opt.to(), egressMode, true, tempEdges); + this.from = from; + this.to = to; + fromVertices = index.getStreetVerticesForLocation(from, accessMode, false, tempEdges); + toVertices = index.getStreetVerticesForLocation(to, egressMode, true, tempEdges); checkIfVerticesFound(); @@ -80,22 +82,48 @@ public Set getToVertices() { return toVertices; } + /** + * Get the stop vertices that corresponds to the from location. If the from location only contains + * coordinates, this will return an empty set. If the from location is a station id this will + * return the child stops of that station. + */ + public Set getFromStopVertices() { + StreetIndex index = this.graph.getStreetIndex(); + if (from.stopId == null) { + return Set.of(); + } + return index.getStopOrChildStopsVertices(from.stopId); + } + + /** + * Get the stop vertices that corresponds to the to location. If the to location only contains + * coordinates, this will return an empty set. If the to location is a station id this will + * return the child stops of that station. + */ + public Set getToStopVertices() { + StreetIndex index = this.graph.getStreetIndex(); + if (to.stopId == null) { + return Set.of(); + } + return index.getStopOrChildStopsVertices(to.stopId); + } + /* PRIVATE METHODS */ private void checkIfVerticesFound() { List routingErrors = new ArrayList<>(); // check that vertices where found if from-location was specified - if (opt.from().isSpecified() && isDisconnected(fromVertices, true)) { + if (from.isSpecified() && isDisconnected(fromVertices, true)) { routingErrors.add( - new RoutingError(getRoutingErrorCodeForDisconnected(opt.from()), InputField.FROM_PLACE) + new RoutingError(getRoutingErrorCodeForDisconnected(from), InputField.FROM_PLACE) ); } // check that vertices where found if to-location was specified - if (opt.to().isSpecified() && isDisconnected(toVertices, false)) { + if (to.isSpecified() && isDisconnected(toVertices, false)) { routingErrors.add( - new RoutingError(getRoutingErrorCodeForDisconnected(opt.to()), InputField.TO_PLACE) + new RoutingError(getRoutingErrorCodeForDisconnected(to), InputField.TO_PLACE) ); } diff --git a/src/main/java/org/opentripplanner/street/search/TraverseMode.java b/application/src/main/java/org/opentripplanner/street/search/TraverseMode.java similarity index 100% rename from src/main/java/org/opentripplanner/street/search/TraverseMode.java rename to application/src/main/java/org/opentripplanner/street/search/TraverseMode.java diff --git a/src/main/java/org/opentripplanner/street/search/TraverseModeSet.java b/application/src/main/java/org/opentripplanner/street/search/TraverseModeSet.java similarity index 100% rename from src/main/java/org/opentripplanner/street/search/TraverseModeSet.java rename to application/src/main/java/org/opentripplanner/street/search/TraverseModeSet.java diff --git a/src/main/java/org/opentripplanner/street/search/intersection_model/AbstractIntersectionTraversalCalculator.java b/application/src/main/java/org/opentripplanner/street/search/intersection_model/AbstractIntersectionTraversalCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/street/search/intersection_model/AbstractIntersectionTraversalCalculator.java rename to application/src/main/java/org/opentripplanner/street/search/intersection_model/AbstractIntersectionTraversalCalculator.java diff --git a/src/main/java/org/opentripplanner/street/search/intersection_model/ConstantIntersectionTraversalCalculator.java b/application/src/main/java/org/opentripplanner/street/search/intersection_model/ConstantIntersectionTraversalCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/street/search/intersection_model/ConstantIntersectionTraversalCalculator.java rename to application/src/main/java/org/opentripplanner/street/search/intersection_model/ConstantIntersectionTraversalCalculator.java diff --git a/src/main/java/org/opentripplanner/street/search/intersection_model/DrivingDirection.java b/application/src/main/java/org/opentripplanner/street/search/intersection_model/DrivingDirection.java similarity index 100% rename from src/main/java/org/opentripplanner/street/search/intersection_model/DrivingDirection.java rename to application/src/main/java/org/opentripplanner/street/search/intersection_model/DrivingDirection.java diff --git a/src/main/java/org/opentripplanner/street/search/intersection_model/IntersectionTraversalCalculator.java b/application/src/main/java/org/opentripplanner/street/search/intersection_model/IntersectionTraversalCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/street/search/intersection_model/IntersectionTraversalCalculator.java rename to application/src/main/java/org/opentripplanner/street/search/intersection_model/IntersectionTraversalCalculator.java diff --git a/src/main/java/org/opentripplanner/street/search/intersection_model/IntersectionTraversalModel.java b/application/src/main/java/org/opentripplanner/street/search/intersection_model/IntersectionTraversalModel.java similarity index 100% rename from src/main/java/org/opentripplanner/street/search/intersection_model/IntersectionTraversalModel.java rename to application/src/main/java/org/opentripplanner/street/search/intersection_model/IntersectionTraversalModel.java diff --git a/src/main/java/org/opentripplanner/street/search/intersection_model/SimpleIntersectionTraversalCalculator.java b/application/src/main/java/org/opentripplanner/street/search/intersection_model/SimpleIntersectionTraversalCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/street/search/intersection_model/SimpleIntersectionTraversalCalculator.java rename to application/src/main/java/org/opentripplanner/street/search/intersection_model/SimpleIntersectionTraversalCalculator.java diff --git a/src/main/java/org/opentripplanner/street/search/request/StreetSearchRequest.java b/application/src/main/java/org/opentripplanner/street/search/request/StreetSearchRequest.java similarity index 99% rename from src/main/java/org/opentripplanner/street/search/request/StreetSearchRequest.java rename to application/src/main/java/org/opentripplanner/street/search/request/StreetSearchRequest.java index c33ed6a35e9..c93ea598256 100644 --- a/src/main/java/org/opentripplanner/street/search/request/StreetSearchRequest.java +++ b/application/src/main/java/org/opentripplanner/street/search/request/StreetSearchRequest.java @@ -1,7 +1,6 @@ package org.opentripplanner.street.search.request; import java.time.Instant; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.Envelope; @@ -76,12 +75,10 @@ private StreetSearchRequest() { this.toEnvelope = createEnvelope(to); } - @Nonnull public static StreetSearchRequestBuilder of() { return new StreetSearchRequestBuilder(DEFAULT).withStartTime(Instant.now()); } - @Nonnull public static StreetSearchRequestBuilder copyOf(StreetSearchRequest original) { return new StreetSearchRequestBuilder(original); } diff --git a/src/main/java/org/opentripplanner/street/search/request/StreetSearchRequestBuilder.java b/application/src/main/java/org/opentripplanner/street/search/request/StreetSearchRequestBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/street/search/request/StreetSearchRequestBuilder.java rename to application/src/main/java/org/opentripplanner/street/search/request/StreetSearchRequestBuilder.java diff --git a/src/main/java/org/opentripplanner/street/search/request/StreetSearchRequestMapper.java b/application/src/main/java/org/opentripplanner/street/search/request/StreetSearchRequestMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/street/search/request/StreetSearchRequestMapper.java rename to application/src/main/java/org/opentripplanner/street/search/request/StreetSearchRequestMapper.java diff --git a/src/main/java/org/opentripplanner/street/search/state/CarPickupState.java b/application/src/main/java/org/opentripplanner/street/search/state/CarPickupState.java similarity index 100% rename from src/main/java/org/opentripplanner/street/search/state/CarPickupState.java rename to application/src/main/java/org/opentripplanner/street/search/state/CarPickupState.java diff --git a/src/main/java/org/opentripplanner/street/search/state/EdgeTraverser.java b/application/src/main/java/org/opentripplanner/street/search/state/EdgeTraverser.java similarity index 100% rename from src/main/java/org/opentripplanner/street/search/state/EdgeTraverser.java rename to application/src/main/java/org/opentripplanner/street/search/state/EdgeTraverser.java diff --git a/src/main/java/org/opentripplanner/street/search/state/State.java b/application/src/main/java/org/opentripplanner/street/search/state/State.java similarity index 98% rename from src/main/java/org/opentripplanner/street/search/state/State.java rename to application/src/main/java/org/opentripplanner/street/search/state/State.java index deef516a674..6c7f342cad6 100644 --- a/src/main/java/org/opentripplanner/street/search/state/State.java +++ b/application/src/main/java/org/opentripplanner/street/search/state/State.java @@ -8,7 +8,6 @@ import java.util.Objects; import java.util.Set; import java.util.stream.Stream; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.astar.spi.AStarState; import org.opentripplanner.ext.dataoverlay.routing.DataOverlayContext; @@ -57,7 +56,7 @@ public class State implements AStarState, Cloneable { /** * Create an initial state, forcing vertex to the specified value. Useful for tests, etc. */ - public State(@Nonnull Vertex vertex, @Nonnull StreetSearchRequest streetSearchRequest) { + public State(Vertex vertex, StreetSearchRequest streetSearchRequest) { this( vertex, streetSearchRequest.startTime(), @@ -66,12 +65,7 @@ public State(@Nonnull Vertex vertex, @Nonnull StreetSearchRequest streetSearchRe ); } - public State( - @Nonnull Vertex vertex, - @Nonnull Instant startTime, - @Nonnull StateData stateData, - @Nonnull StreetSearchRequest request - ) { + public State(Vertex vertex, Instant startTime, StateData stateData, StreetSearchRequest request) { this.request = request; this.weight = 0; this.vertex = vertex; diff --git a/src/main/java/org/opentripplanner/street/search/state/StateData.java b/application/src/main/java/org/opentripplanner/street/search/state/StateData.java similarity index 100% rename from src/main/java/org/opentripplanner/street/search/state/StateData.java rename to application/src/main/java/org/opentripplanner/street/search/state/StateData.java diff --git a/src/main/java/org/opentripplanner/street/search/state/StateEditor.java b/application/src/main/java/org/opentripplanner/street/search/state/StateEditor.java similarity index 99% rename from src/main/java/org/opentripplanner/street/search/state/StateEditor.java rename to application/src/main/java/org/opentripplanner/street/search/state/StateEditor.java index 40c44a16488..271b6e78030 100644 --- a/src/main/java/org/opentripplanner/street/search/state/StateEditor.java +++ b/application/src/main/java/org/opentripplanner/street/search/state/StateEditor.java @@ -1,7 +1,6 @@ package org.opentripplanner.street.search.state; import java.util.Set; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.street.model.RentalFormFactor; import org.opentripplanner.street.model.edge.Edge; @@ -135,7 +134,6 @@ public State makeState() { * Calls {@link StateEditor#makeState()} and wraps the result in an array of {@link State}. * If the state is null, then a zero-length array is returned. */ - @Nonnull public State[] makeStateArray() { return State.ofNullable(makeState()); } diff --git a/src/main/java/org/opentripplanner/street/search/state/VehicleRentalState.java b/application/src/main/java/org/opentripplanner/street/search/state/VehicleRentalState.java similarity index 100% rename from src/main/java/org/opentripplanner/street/search/state/VehicleRentalState.java rename to application/src/main/java/org/opentripplanner/street/search/state/VehicleRentalState.java diff --git a/src/main/java/org/opentripplanner/street/search/strategy/DominanceFunctions.java b/application/src/main/java/org/opentripplanner/street/search/strategy/DominanceFunctions.java similarity index 100% rename from src/main/java/org/opentripplanner/street/search/strategy/DominanceFunctions.java rename to application/src/main/java/org/opentripplanner/street/search/strategy/DominanceFunctions.java diff --git a/src/main/java/org/opentripplanner/street/search/strategy/EuclideanRemainingWeightHeuristic.java b/application/src/main/java/org/opentripplanner/street/search/strategy/EuclideanRemainingWeightHeuristic.java similarity index 100% rename from src/main/java/org/opentripplanner/street/search/strategy/EuclideanRemainingWeightHeuristic.java rename to application/src/main/java/org/opentripplanner/street/search/strategy/EuclideanRemainingWeightHeuristic.java diff --git a/src/main/java/org/opentripplanner/street/service/DefaultStreetLimitationParametersService.java b/application/src/main/java/org/opentripplanner/street/service/DefaultStreetLimitationParametersService.java similarity index 100% rename from src/main/java/org/opentripplanner/street/service/DefaultStreetLimitationParametersService.java rename to application/src/main/java/org/opentripplanner/street/service/DefaultStreetLimitationParametersService.java diff --git a/src/main/java/org/opentripplanner/street/service/StreetLimitationParametersService.java b/application/src/main/java/org/opentripplanner/street/service/StreetLimitationParametersService.java similarity index 100% rename from src/main/java/org/opentripplanner/street/service/StreetLimitationParametersService.java rename to application/src/main/java/org/opentripplanner/street/service/StreetLimitationParametersService.java diff --git a/src/main/java/org/opentripplanner/street/service/StreetLimitationParametersServiceModule.java b/application/src/main/java/org/opentripplanner/street/service/StreetLimitationParametersServiceModule.java similarity index 100% rename from src/main/java/org/opentripplanner/street/service/StreetLimitationParametersServiceModule.java rename to application/src/main/java/org/opentripplanner/street/service/StreetLimitationParametersServiceModule.java diff --git a/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequest.java b/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequest.java new file mode 100644 index 00000000000..6735dc1db29 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequest.java @@ -0,0 +1,77 @@ +package org.opentripplanner.transit.api.request; + +import java.time.LocalDate; +import java.util.List; +import org.opentripplanner.framework.collection.ListUtils; +import org.opentripplanner.transit.model.framework.FeedScopedId; +import org.opentripplanner.transit.model.timetable.TripAlteration; + +/* + * A request for trips on a specific service date. + * + * This request is used to retrieve TripsOnServiceDates that match the provided criteria. + * At least one operatingDay must be provided. + */ +public class TripOnServiceDateRequest { + + private final List operatingDays; + private final List authorities; + private final List lines; + private final List serviceJourneys; + private final List replacementFor; + private final List privateCodes; + private final List alterations; + + protected TripOnServiceDateRequest( + List operatingDays, + List authorities, + List lines, + List serviceJourneys, + List replacementFor, + List privateCodes, + List alterations + ) { + if (operatingDays == null || operatingDays.isEmpty()) { + throw new IllegalArgumentException("operatingDays must have at least one date"); + } + this.operatingDays = ListUtils.nullSafeImmutableList(operatingDays); + this.authorities = ListUtils.nullSafeImmutableList(authorities); + this.lines = ListUtils.nullSafeImmutableList(lines); + this.serviceJourneys = ListUtils.nullSafeImmutableList(serviceJourneys); + this.replacementFor = ListUtils.nullSafeImmutableList(replacementFor); + this.privateCodes = ListUtils.nullSafeImmutableList(privateCodes); + this.alterations = ListUtils.nullSafeImmutableList(alterations); + } + + public static TripOnServiceDateRequestBuilder of() { + return new TripOnServiceDateRequestBuilder(); + } + + public List authorities() { + return authorities; + } + + public List lines() { + return lines; + } + + public List serviceJourneys() { + return serviceJourneys; + } + + public List replacementFor() { + return replacementFor; + } + + public List privateCodes() { + return privateCodes; + } + + public List alterations() { + return alterations; + } + + public List operatingDays() { + return operatingDays; + } +} diff --git a/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequestBuilder.java b/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequestBuilder.java new file mode 100644 index 00000000000..7aa2644fdc9 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequestBuilder.java @@ -0,0 +1,66 @@ +package org.opentripplanner.transit.api.request; + +import java.time.LocalDate; +import java.util.List; +import org.opentripplanner.transit.model.framework.FeedScopedId; +import org.opentripplanner.transit.model.timetable.TripAlteration; + +public class TripOnServiceDateRequestBuilder { + + private List authorities; + private List lines; + private List serviceJourneys; + private List replacementFor; + private List privateCodes; + private List alterations; + private List operatingDays; + + protected TripOnServiceDateRequestBuilder() {} + + public TripOnServiceDateRequestBuilder withOperatingDays(List operatingDays) { + this.operatingDays = operatingDays; + return this; + } + + public TripOnServiceDateRequestBuilder withAuthorities(List authorities) { + this.authorities = authorities; + return this; + } + + public TripOnServiceDateRequestBuilder withLines(List lines) { + this.lines = lines; + return this; + } + + public TripOnServiceDateRequestBuilder withServiceJourneys(List serviceJourneys) { + this.serviceJourneys = serviceJourneys; + return this; + } + + public TripOnServiceDateRequestBuilder withReplacementFor(List replacementFor) { + this.replacementFor = replacementFor; + return this; + } + + public TripOnServiceDateRequestBuilder withPrivateCodes(List privateCodes) { + this.privateCodes = privateCodes; + return this; + } + + public TripOnServiceDateRequestBuilder withAlterations(List alterations) { + this.alterations = alterations; + return this; + } + + public TripOnServiceDateRequest build() { + return new TripOnServiceDateRequest( + operatingDays, + authorities, + lines, + serviceJourneys, + replacementFor, + privateCodes, + alterations + ); + } +} diff --git a/src/main/java/org/opentripplanner/transit/configure/TransitModule.java b/application/src/main/java/org/opentripplanner/transit/configure/TransitModule.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/configure/TransitModule.java rename to application/src/main/java/org/opentripplanner/transit/configure/TransitModule.java diff --git a/src/main/java/org/opentripplanner/transit/model/basic/Accessibility.java b/application/src/main/java/org/opentripplanner/transit/model/basic/Accessibility.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/basic/Accessibility.java rename to application/src/main/java/org/opentripplanner/transit/model/basic/Accessibility.java diff --git a/src/main/java/org/opentripplanner/transit/model/basic/Locales.java b/application/src/main/java/org/opentripplanner/transit/model/basic/Locales.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/basic/Locales.java rename to application/src/main/java/org/opentripplanner/transit/model/basic/Locales.java diff --git a/src/main/java/org/opentripplanner/transit/model/basic/LocalizedMoney.java b/application/src/main/java/org/opentripplanner/transit/model/basic/LocalizedMoney.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/basic/LocalizedMoney.java rename to application/src/main/java/org/opentripplanner/transit/model/basic/LocalizedMoney.java diff --git a/src/main/java/org/opentripplanner/transit/model/basic/MainAndSubMode.java b/application/src/main/java/org/opentripplanner/transit/model/basic/MainAndSubMode.java similarity index 93% rename from src/main/java/org/opentripplanner/transit/model/basic/MainAndSubMode.java rename to application/src/main/java/org/opentripplanner/transit/model/basic/MainAndSubMode.java index 571584700e9..030e5b5ac63 100644 --- a/src/main/java/org/opentripplanner/transit/model/basic/MainAndSubMode.java +++ b/application/src/main/java/org/opentripplanner/transit/model/basic/MainAndSubMode.java @@ -4,13 +4,12 @@ import java.util.List; import java.util.function.Predicate; import java.util.stream.Stream; -import javax.annotation.Nonnull; import javax.annotation.Nullable; /** * Tupple of main- and sub-mode. */ -public record MainAndSubMode(@Nonnull TransitMode mainMode, @Nullable SubMode subMode) { +public record MainAndSubMode(TransitMode mainMode, @Nullable SubMode subMode) { private static final List ALL = Stream .of(TransitMode.values()) .map(MainAndSubMode::new) diff --git a/src/main/java/org/opentripplanner/transit/model/basic/Money.java b/application/src/main/java/org/opentripplanner/transit/model/basic/Money.java similarity index 96% rename from src/main/java/org/opentripplanner/transit/model/basic/Money.java rename to application/src/main/java/org/opentripplanner/transit/model/basic/Money.java index 35278d8fbd8..de1c6647b6b 100644 --- a/src/main/java/org/opentripplanner/transit/model/basic/Money.java +++ b/application/src/main/java/org/opentripplanner/transit/model/basic/Money.java @@ -8,7 +8,6 @@ import java.util.Locale; import java.util.Objects; import java.util.function.Function; -import javax.annotation.Nonnull; import org.opentripplanner.framework.lang.IntUtils; /** @@ -26,7 +25,7 @@ public class Money implements Comparable, Serializable { * @param currency The currency of the money amount * @param minorUnitAmount The amount in the smaller currency unit, so for 1.50 EUR pass 150. */ - private Money(@Nonnull Currency currency, int minorUnitAmount) { + private Money(Currency currency, int minorUnitAmount) { this.currency = Objects.requireNonNull(currency); this.amount = minorUnitAmount; } @@ -65,7 +64,7 @@ public static Money max(Money first, Money second) { * Take a fractional amount of money, ie 1.5 and convert it to amount using the number of default * fraction digits of the currency. */ - public static Money ofFractionalAmount(@Nonnull Currency currency, float fractionalAmount) { + public static Money ofFractionalAmount(Currency currency, float fractionalAmount) { Objects.requireNonNull(currency); var fractionDigits = currency.getDefaultFractionDigits(); int amount = IntUtils.round(fractionalAmount * Math.pow(10, fractionDigits)); @@ -181,7 +180,6 @@ private boolean booleanOp(Money other, boolean result) { return result; } - @Nonnull private Money op(Money other, Function op) { checkCurrencyOrThrow(other); return op.apply(other); diff --git a/src/main/java/org/opentripplanner/transit/model/basic/Notice.java b/application/src/main/java/org/opentripplanner/transit/model/basic/Notice.java similarity index 92% rename from src/main/java/org/opentripplanner/transit/model/basic/Notice.java rename to application/src/main/java/org/opentripplanner/transit/model/basic/Notice.java index f9713417805..660a44c680f 100644 --- a/src/main/java/org/opentripplanner/transit/model/basic/Notice.java +++ b/application/src/main/java/org/opentripplanner/transit/model/basic/Notice.java @@ -1,7 +1,6 @@ package org.opentripplanner.transit.model.basic; import java.util.Objects; -import javax.annotation.Nonnull; import org.opentripplanner.transit.model.framework.AbstractTransitEntity; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -34,7 +33,7 @@ public String publicCode() { } @Override - public boolean sameAs(@Nonnull Notice other) { + public boolean sameAs(Notice other) { return ( getId().equals(other.getId()) && Objects.equals(publicCode, other.publicCode) && @@ -43,7 +42,6 @@ public boolean sameAs(@Nonnull Notice other) { } @Override - @Nonnull public NoticeBuilder copy() { return new NoticeBuilder(this); } diff --git a/src/main/java/org/opentripplanner/transit/model/basic/NoticeBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/basic/NoticeBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/basic/NoticeBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/basic/NoticeBuilder.java diff --git a/src/main/java/org/opentripplanner/transit/model/basic/SubMode.java b/application/src/main/java/org/opentripplanner/transit/model/basic/SubMode.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/basic/SubMode.java rename to application/src/main/java/org/opentripplanner/transit/model/basic/SubMode.java diff --git a/src/main/java/org/opentripplanner/transit/model/basic/TransitMode.java b/application/src/main/java/org/opentripplanner/transit/model/basic/TransitMode.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/basic/TransitMode.java rename to application/src/main/java/org/opentripplanner/transit/model/basic/TransitMode.java diff --git a/application/src/main/java/org/opentripplanner/transit/model/filter/expr/AndMatcher.java b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/AndMatcher.java new file mode 100644 index 00000000000..74f38efa8b7 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/AndMatcher.java @@ -0,0 +1,43 @@ +package org.opentripplanner.transit.model.filter.expr; + +import static org.opentripplanner.transit.model.filter.expr.BinaryOperator.AND; + +import java.util.List; + +/** + * Takes a list of matchers and provides a single interface. All matchers in the list must match for + * the composite matcher to return a match. + * + * @param The entity type the AndMatcher matches. + */ +public final class AndMatcher implements Matcher { + + private final Matcher[] matchers; + + private AndMatcher(List> matchers) { + this.matchers = matchers.toArray(Matcher[]::new); + } + + public static Matcher of(List> matchers) { + // simplify a list of one element + if (matchers.size() == 1) { + return matchers.get(0); + } + return new AndMatcher<>(matchers); + } + + @Override + public boolean match(T entity) { + for (var m : matchers) { + if (!m.match(entity)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + return "(" + AND.arrayToString(matchers) + ')'; + } +} diff --git a/application/src/main/java/org/opentripplanner/transit/model/filter/expr/BinaryOperator.java b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/BinaryOperator.java new file mode 100644 index 00000000000..62f3fa30f27 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/BinaryOperator.java @@ -0,0 +1,37 @@ +package org.opentripplanner.transit.model.filter.expr; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Used to concatenate matches with either the logical "AND" or "OR" operator. + */ +enum BinaryOperator { + AND("&"), + OR("|"); + + private final String token; + + BinaryOperator(String token) { + this.token = token; + } + + @Override + public String toString() { + return token; + } + + String arrayToString(T[] values) { + return colToString(Arrays.asList(values)); + } + + String colToString(Collection values) { + return values.stream().map(Objects::toString).collect(Collectors.joining(" " + token + " ")); + } + + String toString(T a, T b) { + return a.toString() + " " + token + " " + b.toString(); + } +} diff --git a/application/src/main/java/org/opentripplanner/transit/model/filter/expr/ContainsMatcher.java b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/ContainsMatcher.java new file mode 100644 index 00000000000..ed3731897ec --- /dev/null +++ b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/ContainsMatcher.java @@ -0,0 +1,55 @@ +package org.opentripplanner.transit.model.filter.expr; + +import java.util.function.Function; + +/** + * A matcher that applies a provided matcher to an iterable of child entities returned from the main + * entity that this matcher is for. + *

    + * If any of the iterable entities match the valueMatcher, then the match method returns true. In + * this way it is similar to an OR. + *

    + * @param The main entity type this matcher is applied to. + * @param The type of the child entities, for which there is a mapping from S to T. + */ +public class ContainsMatcher implements Matcher { + + private final String relationshipName; + private final Function> valuesProvider; + private final Matcher valueMatcher; + + /** + * @param relationshipName The name of the type of relationship between the main entity and the + * entity matched by the valueMatcher. + * @param valuesProvider The function that maps the entity being matched by this matcher (S) to + * the iterable of items being matched by valueMatcher. + * @param valueMatcher The matcher that is applied each of the iterable entities returned from the + * valuesProvider function. + */ + public ContainsMatcher( + String relationshipName, + Function> valuesProvider, + Matcher valueMatcher + ) { + this.relationshipName = relationshipName; + this.valuesProvider = valuesProvider; + this.valueMatcher = valueMatcher; + } + + public boolean match(S entity) { + if (valuesProvider.apply(entity) == null) { + return false; + } + for (T it : valuesProvider.apply(entity)) { + if (valueMatcher.match(it)) { + return true; + } + } + return false; + } + + @Override + public String toString() { + return "ContainsMatcher: " + relationshipName + ": " + valueMatcher.toString(); + } +} diff --git a/application/src/main/java/org/opentripplanner/transit/model/filter/expr/EqualityMatcher.java b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/EqualityMatcher.java new file mode 100644 index 00000000000..1380131e07a --- /dev/null +++ b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/EqualityMatcher.java @@ -0,0 +1,40 @@ +package org.opentripplanner.transit.model.filter.expr; + +import java.util.function.Function; + +/** + * A matcher that checks if a value is equal to another value derived from the matched entities. + *

    + * The derived entity value is provided by a function that takes the entity being matched as an argument. + *

    + * @param The type of the entity being matched. + * @param The type of the value that the matcher will test equality for. + */ +public class EqualityMatcher implements Matcher { + + private final String typeName; + private final V value; + private final Function valueProvider; + + /** + * @param typeName The typeName appears in the toString for easier debugging. + * @param value The value that this matcher will check equality for. + * @param valueProvider The function that maps the entity being matched by this matcher (T) to + * the value being matched by this matcher. + */ + public EqualityMatcher(String typeName, V value, Function valueProvider) { + this.typeName = typeName; + this.value = value; + this.valueProvider = valueProvider; + } + + @Override + public boolean match(T entity) { + return value.equals(valueProvider.apply(entity)); + } + + @Override + public String toString() { + return typeName + "==" + value; + } +} diff --git a/application/src/main/java/org/opentripplanner/transit/model/filter/expr/ExpressionBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/ExpressionBuilder.java new file mode 100644 index 00000000000..b1b4d5be322 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/ExpressionBuilder.java @@ -0,0 +1,37 @@ +package org.opentripplanner.transit.model.filter.expr; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.function.Function; + +/** + * A builder for creating complex matchers composed of other matchers. + *

    + * This builder contains convenience methods for creating complex matchers from simpler ones. The + * resulting matcher "ands" together all the matchers it has built up. This supports the common + * pattern of narrowing results with multiple filters. + * + * @param The type of entity to match in the expression. + */ +public class ExpressionBuilder { + + private final List> matchers = new ArrayList<>(); + + public static ExpressionBuilder of() { + return new ExpressionBuilder<>(); + } + + public ExpressionBuilder or(Collection values, Function> valueProvider) { + if (values.isEmpty()) { + return this; + } + + matchers.add(OrMatcher.of(values.stream().map(valueProvider).toList())); + return this; + } + + public Matcher build() { + return AndMatcher.of(matchers); + } +} diff --git a/application/src/main/java/org/opentripplanner/transit/model/filter/expr/Matcher.java b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/Matcher.java new file mode 100644 index 00000000000..db3c02296b9 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/Matcher.java @@ -0,0 +1,19 @@ +package org.opentripplanner.transit.model.filter.expr; + +/** + * Generic matcher interface - this is the root of the matcher type hierarchy. + *

    + * @param Domain type to match. + */ +@FunctionalInterface +public interface Matcher { + boolean match(T entity); + + static Matcher everything() { + return e -> true; + } + + static Matcher nothing() { + return e -> false; + } +} diff --git a/application/src/main/java/org/opentripplanner/transit/model/filter/expr/OrMatcher.java b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/OrMatcher.java new file mode 100644 index 00000000000..62da7af63f4 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/OrMatcher.java @@ -0,0 +1,58 @@ +package org.opentripplanner.transit.model.filter.expr; + +import static org.opentripplanner.transit.model.filter.expr.BinaryOperator.OR; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * Takes a list of matchers and provides a single interface. At least one of the matchers in the + * list must match for the composite matcher to return a match. + *

    + * @param The entity type the OrMatcher matches. + */ +public final class OrMatcher implements Matcher { + + private final Matcher[] matchers; + + private OrMatcher(List> matchers) { + this.matchers = matchers.toArray(Matcher[]::new); + } + + public static Matcher of(Matcher a, Matcher b) { + return of(List.of(a, b)); + } + + public static Matcher of(List> matchers) { + // Simplify if there is just one matcher in the list + if (matchers.size() == 1) { + return matchers.get(0); + } + // Collapse nested or matchers + var expr = new ArrayList>(); + for (Matcher it : matchers) { + if (it instanceof OrMatcher orMatcher) { + expr.addAll(Arrays.asList(orMatcher.matchers)); + } else { + expr.add(it); + } + } + return new OrMatcher<>(expr); + } + + @Override + public boolean match(T entity) { + for (var m : matchers) { + if (m.match(entity)) { + return true; + } + } + return false; + } + + @Override + public String toString() { + return "(" + OR.arrayToString(matchers) + ')'; + } +} diff --git a/application/src/main/java/org/opentripplanner/transit/model/filter/transit/TripOnServiceDateMatcherFactory.java b/application/src/main/java/org/opentripplanner/transit/model/filter/transit/TripOnServiceDateMatcherFactory.java new file mode 100644 index 00000000000..f86e7a1ff77 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/transit/model/filter/transit/TripOnServiceDateMatcherFactory.java @@ -0,0 +1,70 @@ +package org.opentripplanner.transit.model.filter.transit; + +import java.time.LocalDate; +import org.opentripplanner.transit.api.request.TripOnServiceDateRequest; +import org.opentripplanner.transit.model.filter.expr.ContainsMatcher; +import org.opentripplanner.transit.model.filter.expr.EqualityMatcher; +import org.opentripplanner.transit.model.filter.expr.ExpressionBuilder; +import org.opentripplanner.transit.model.filter.expr.Matcher; +import org.opentripplanner.transit.model.framework.AbstractTransitEntity; +import org.opentripplanner.transit.model.framework.FeedScopedId; +import org.opentripplanner.transit.model.timetable.TripAlteration; +import org.opentripplanner.transit.model.timetable.TripOnServiceDate; + +/** + * A factory for creating matchers for TripOnServiceDate objects. + *

    + * This factory is used to create matchers for TripOnServiceDate objects based on a request. The + * resulting matcher can be used to filter a list of TripOnServiceDate objects. + */ +public class TripOnServiceDateMatcherFactory { + + public static Matcher of(TripOnServiceDateRequest request) { + ExpressionBuilder expr = ExpressionBuilder.of(); + + expr.or(request.operatingDays(), TripOnServiceDateMatcherFactory::operatingDay); + expr.or(request.authorities(), TripOnServiceDateMatcherFactory::authorityId); + expr.or(request.lines(), TripOnServiceDateMatcherFactory::routeId); + expr.or(request.serviceJourneys(), TripOnServiceDateMatcherFactory::serviceJourneyId); + expr.or(request.replacementFor(), TripOnServiceDateMatcherFactory::replacementFor); + expr.or(request.privateCodes(), TripOnServiceDateMatcherFactory::privateCode); + expr.or(request.alterations(), TripOnServiceDateMatcherFactory::alteration); + return expr.build(); + } + + static Matcher authorityId(FeedScopedId id) { + return new EqualityMatcher<>("agency", id, t -> t.getTrip().getRoute().getAgency().getId()); + } + + static Matcher routeId(FeedScopedId id) { + return new EqualityMatcher<>("route", id, t -> t.getTrip().getRoute().getId()); + } + + static Matcher serviceJourneyId(FeedScopedId id) { + return new EqualityMatcher<>("serviceJourney", id, t -> t.getTrip().getId()); + } + + static Matcher replacementFor(FeedScopedId id) { + return new ContainsMatcher<>( + "replacementForContains", + t -> t.getReplacementFor().stream().map(AbstractTransitEntity::getId).toList(), + new EqualityMatcher<>("replacementForIdEquals", id, (idToMatch -> idToMatch)) + ); + } + + static Matcher privateCode(String code) { + return new EqualityMatcher<>( + "privateCode", + code, + t -> t.getTrip().getNetexInternalPlanningCode() + ); + } + + static Matcher operatingDay(LocalDate date) { + return new EqualityMatcher<>("operatingDay", date, TripOnServiceDate::getServiceDate); + } + + static Matcher alteration(TripAlteration alteration) { + return new EqualityMatcher<>("alteration", alteration, TripOnServiceDate::getTripAlteration); + } +} diff --git a/src/main/java/org/opentripplanner/transit/model/framework/AbstractBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/framework/AbstractBuilder.java similarity index 93% rename from src/main/java/org/opentripplanner/transit/model/framework/AbstractBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/framework/AbstractBuilder.java index de20445a7ba..60a970a0521 100644 --- a/src/main/java/org/opentripplanner/transit/model/framework/AbstractBuilder.java +++ b/application/src/main/java/org/opentripplanner/transit/model/framework/AbstractBuilder.java @@ -1,6 +1,5 @@ package org.opentripplanner.transit.model.framework; -import javax.annotation.Nonnull; import javax.annotation.Nullable; public abstract class AbstractBuilder< @@ -29,7 +28,7 @@ E original() { protected abstract E buildFromValues(); @Override - public final @Nonnull E build() { + public final E build() { var b = buildFromValues(); if (original == null) { diff --git a/src/main/java/org/opentripplanner/transit/model/framework/AbstractEntityBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/framework/AbstractEntityBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/framework/AbstractEntityBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/framework/AbstractEntityBuilder.java diff --git a/src/main/java/org/opentripplanner/transit/model/framework/AbstractTransitEntity.java b/application/src/main/java/org/opentripplanner/transit/model/framework/AbstractTransitEntity.java similarity index 96% rename from src/main/java/org/opentripplanner/transit/model/framework/AbstractTransitEntity.java rename to application/src/main/java/org/opentripplanner/transit/model/framework/AbstractTransitEntity.java index 4053a4860f2..258d505b53c 100644 --- a/src/main/java/org/opentripplanner/transit/model/framework/AbstractTransitEntity.java +++ b/application/src/main/java/org/opentripplanner/transit/model/framework/AbstractTransitEntity.java @@ -5,7 +5,6 @@ import java.util.List; import java.util.Objects; import java.util.Set; -import javax.annotation.Nonnull; /** * All OTP Transit entities should extend this class. The purpose of the class is to enforce a @@ -30,7 +29,7 @@ public abstract class AbstractTransitEntity< private final FeedScopedId id; - public AbstractTransitEntity(@Nonnull FeedScopedId id) { + public AbstractTransitEntity(FeedScopedId id) { this.id = Objects.requireNonNull(id); } diff --git a/src/main/java/org/opentripplanner/transit/model/framework/DataValidationException.java b/application/src/main/java/org/opentripplanner/transit/model/framework/DataValidationException.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/framework/DataValidationException.java rename to application/src/main/java/org/opentripplanner/transit/model/framework/DataValidationException.java diff --git a/src/main/java/org/opentripplanner/transit/model/framework/Deduplicator.java b/application/src/main/java/org/opentripplanner/transit/model/framework/Deduplicator.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/framework/Deduplicator.java rename to application/src/main/java/org/opentripplanner/transit/model/framework/Deduplicator.java diff --git a/src/main/java/org/opentripplanner/transit/model/framework/DeduplicatorNoop.java b/application/src/main/java/org/opentripplanner/transit/model/framework/DeduplicatorNoop.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/framework/DeduplicatorNoop.java rename to application/src/main/java/org/opentripplanner/transit/model/framework/DeduplicatorNoop.java diff --git a/src/main/java/org/opentripplanner/transit/model/framework/DeduplicatorService.java b/application/src/main/java/org/opentripplanner/transit/model/framework/DeduplicatorService.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/framework/DeduplicatorService.java rename to application/src/main/java/org/opentripplanner/transit/model/framework/DeduplicatorService.java diff --git a/src/main/java/org/opentripplanner/transit/model/framework/DefaultEntityById.java b/application/src/main/java/org/opentripplanner/transit/model/framework/DefaultEntityById.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/framework/DefaultEntityById.java rename to application/src/main/java/org/opentripplanner/transit/model/framework/DefaultEntityById.java diff --git a/src/main/java/org/opentripplanner/transit/model/framework/DefaultEntityContext.java b/application/src/main/java/org/opentripplanner/transit/model/framework/DefaultEntityContext.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/framework/DefaultEntityContext.java rename to application/src/main/java/org/opentripplanner/transit/model/framework/DefaultEntityContext.java diff --git a/src/main/java/org/opentripplanner/transit/model/framework/EntityById.java b/application/src/main/java/org/opentripplanner/transit/model/framework/EntityById.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/framework/EntityById.java rename to application/src/main/java/org/opentripplanner/transit/model/framework/EntityById.java diff --git a/src/main/java/org/opentripplanner/transit/model/framework/EntityContext.java b/application/src/main/java/org/opentripplanner/transit/model/framework/EntityContext.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/framework/EntityContext.java rename to application/src/main/java/org/opentripplanner/transit/model/framework/EntityContext.java diff --git a/application/src/main/java/org/opentripplanner/transit/model/framework/EntityNotFoundException.java b/application/src/main/java/org/opentripplanner/transit/model/framework/EntityNotFoundException.java new file mode 100644 index 00000000000..362dad1b80b --- /dev/null +++ b/application/src/main/java/org/opentripplanner/transit/model/framework/EntityNotFoundException.java @@ -0,0 +1,34 @@ +package org.opentripplanner.transit.model.framework; + +/** + * This exception is used by the main OTP business logic to signal that one of the + * ids passed in is not found. This exception should be handled in a generic way in each + * API. + *

    + * When an entity is not found, it indicates that there is a system integration error. This + * should not be used if the user type in the id, then the client should validate the id + * before it is passed into OTP. + */ +public class EntityNotFoundException extends RuntimeException { + + private final String entityName; + private final FeedScopedId id; + + /** + * Use this if the id can be of more than one type, or you would like to provide an + * alternative name. + */ + public EntityNotFoundException(String entityName, FeedScopedId id) { + this.entityName = entityName; + this.id = id; + } + + public EntityNotFoundException(Class entityType, FeedScopedId id) { + this(entityType.getSimpleName(), id); + } + + @Override + public String getMessage() { + return entityName + " entity not found: " + id; + } +} diff --git a/src/main/java/org/opentripplanner/transit/model/framework/FeedScopedId.java b/application/src/main/java/org/opentripplanner/transit/model/framework/FeedScopedId.java similarity index 94% rename from src/main/java/org/opentripplanner/transit/model/framework/FeedScopedId.java rename to application/src/main/java/org/opentripplanner/transit/model/framework/FeedScopedId.java index b48ff040c28..bdb09cb0db8 100644 --- a/src/main/java/org/opentripplanner/transit/model/framework/FeedScopedId.java +++ b/application/src/main/java/org/opentripplanner/transit/model/framework/FeedScopedId.java @@ -5,7 +5,6 @@ import java.io.Serializable; import java.util.Arrays; import java.util.List; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.framework.lang.StringUtils; @@ -22,7 +21,7 @@ public final class FeedScopedId implements Serializable, Comparable { private Result() {} - public static Result failure(@Nonnull E failure) { + public static Result failure(E failure) { return new Failure<>(failure); } - public static Result success(@Nonnull T success) { + public static Result success(T success) { return new Success<>(success); } diff --git a/src/main/java/org/opentripplanner/transit/model/framework/TransitBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/framework/TransitBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/framework/TransitBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/framework/TransitBuilder.java diff --git a/src/main/java/org/opentripplanner/transit/model/framework/TransitEntity.java b/application/src/main/java/org/opentripplanner/transit/model/framework/TransitEntity.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/framework/TransitEntity.java rename to application/src/main/java/org/opentripplanner/transit/model/framework/TransitEntity.java diff --git a/src/main/java/org/opentripplanner/transit/model/framework/TransitEntityBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/framework/TransitEntityBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/framework/TransitEntityBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/framework/TransitEntityBuilder.java diff --git a/src/main/java/org/opentripplanner/transit/model/framework/TransitObject.java b/application/src/main/java/org/opentripplanner/transit/model/framework/TransitObject.java similarity index 93% rename from src/main/java/org/opentripplanner/transit/model/framework/TransitObject.java rename to application/src/main/java/org/opentripplanner/transit/model/framework/TransitObject.java index ad09a40db07..60d261fee00 100644 --- a/src/main/java/org/opentripplanner/transit/model/framework/TransitObject.java +++ b/application/src/main/java/org/opentripplanner/transit/model/framework/TransitObject.java @@ -1,7 +1,6 @@ package org.opentripplanner.transit.model.framework; import java.io.Serializable; -import javax.annotation.Nonnull; public interface TransitObject, T extends TransitBuilder> extends Serializable { @@ -10,7 +9,7 @@ public interface TransitObject, T extends TransitB * the same value. This is used to avoid creating new objects during transit model construction * and during RealTime updates. */ - boolean sameAs(@Nonnull E other); + boolean sameAs(E other); /** * The copy method is used to mutate the existing object by creating a builder and setting @@ -25,6 +24,5 @@ public interface TransitObject, T extends TransitB *

    * TODO RTM - Document design "rules" in a package readme, when the design is set. */ - @Nonnull TransitBuilder copy(); } diff --git a/src/main/java/org/opentripplanner/transit/model/network/BikeAccess.java b/application/src/main/java/org/opentripplanner/transit/model/network/BikeAccess.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/network/BikeAccess.java rename to application/src/main/java/org/opentripplanner/transit/model/network/BikeAccess.java diff --git a/src/main/java/org/opentripplanner/transit/model/network/GroupOfRoutes.java b/application/src/main/java/org/opentripplanner/transit/model/network/GroupOfRoutes.java similarity index 94% rename from src/main/java/org/opentripplanner/transit/model/network/GroupOfRoutes.java rename to application/src/main/java/org/opentripplanner/transit/model/network/GroupOfRoutes.java index c52e7ffe3e6..66cf57788c6 100644 --- a/src/main/java/org/opentripplanner/transit/model/network/GroupOfRoutes.java +++ b/application/src/main/java/org/opentripplanner/transit/model/network/GroupOfRoutes.java @@ -1,7 +1,6 @@ package org.opentripplanner.transit.model.network; import java.util.Objects; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.transit.model.framework.AbstractTransitEntity; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -34,13 +33,11 @@ public static GroupOfRoutesBuilder of(FeedScopedId id) { return new GroupOfRoutesBuilder(id); } - @Nonnull public String getName() { return logName(); } @Override - @Nonnull public String logName() { return name; } @@ -66,7 +63,7 @@ public GroupOfRoutesBuilder copy() { } @Override - public boolean sameAs(@Nonnull GroupOfRoutes other) { + public boolean sameAs(GroupOfRoutes other) { return ( getId().equals(other.getId()) && Objects.equals(name, other.name) && diff --git a/src/main/java/org/opentripplanner/transit/model/network/GroupOfRoutesBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/network/GroupOfRoutesBuilder.java similarity index 95% rename from src/main/java/org/opentripplanner/transit/model/network/GroupOfRoutesBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/network/GroupOfRoutesBuilder.java index 1080209f33c..c4fb7967a55 100644 --- a/src/main/java/org/opentripplanner/transit/model/network/GroupOfRoutesBuilder.java +++ b/application/src/main/java/org/opentripplanner/transit/model/network/GroupOfRoutesBuilder.java @@ -1,6 +1,5 @@ package org.opentripplanner.transit.model.network; -import javax.annotation.Nonnull; import org.opentripplanner.transit.model.framework.AbstractEntityBuilder; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -21,7 +20,7 @@ public class GroupOfRoutesBuilder super(id); } - GroupOfRoutesBuilder(@Nonnull GroupOfRoutes original) { + GroupOfRoutesBuilder(GroupOfRoutes original) { super(original); this.privateCode = original.getPrivateCode(); this.shortName = original.getShortName(); diff --git a/src/main/java/org/opentripplanner/transit/model/network/Route.java b/application/src/main/java/org/opentripplanner/transit/model/network/Route.java similarity index 96% rename from src/main/java/org/opentripplanner/transit/model/network/Route.java rename to application/src/main/java/org/opentripplanner/transit/model/network/Route.java index 721c6098ac8..206e65f7af9 100644 --- a/src/main/java/org/opentripplanner/transit/model/network/Route.java +++ b/application/src/main/java/org/opentripplanner/transit/model/network/Route.java @@ -7,7 +7,6 @@ import java.util.List; import java.util.Locale; import java.util.Objects; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.lang.IntUtils; @@ -65,12 +64,12 @@ public final class Route extends AbstractTransitEntity impl this.textColor = builder.getTextColor(); } - public static RouteBuilder of(@Nonnull FeedScopedId id) { + public static RouteBuilder of(FeedScopedId id) { return new RouteBuilder(id); } @Override - public boolean sameAs(@Nonnull Route other) { + public boolean sameAs(Route other) { return ( getId().equals(other.getId()) && Objects.equals(this.agency, other.agency) && @@ -101,7 +100,6 @@ public RouteBuilder copy() { * The 'agency' property represent a GTFS Agency and NeTEx the Authority. Note that Agency does * NOT map 1-1 to Authority, it is rather a mix between Authority and Operator. */ - @Nonnull public Agency getAgency() { return agency; } @@ -119,7 +117,6 @@ public Branding getBranding() { return branding; } - @Nonnull public List getGroupsOfRoutes() { return groupsOfRoutes; } @@ -134,7 +131,6 @@ public I18NString getLongName() { return longName; } - @Nonnull public TransitMode getMode() { return mode; } @@ -160,7 +156,6 @@ public Integer getGtfsSortOrder() { return gtfsSortOrder; } - @Nonnull public SubMode getNetexSubmode() { return netexSubmode; } @@ -180,7 +175,6 @@ public String getTextColor() { return textColor; } - @Nonnull public BikeAccess getBikesAllowed() { return bikesAllowed; } @@ -194,13 +188,11 @@ public String getFlexibleLineType() { } /** @return the route's short name, or the long name if the short name is null. */ - @Nonnull public String getName(Locale locale) { return shortName == null ? longName.toString(locale) : shortName; } /** @return the route's short name, or the long name if the short name is null. */ - @Nonnull public String getName() { return shortName == null ? longName.toString() : shortName; } diff --git a/src/main/java/org/opentripplanner/transit/model/network/RouteBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/network/RouteBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/network/RouteBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/network/RouteBuilder.java diff --git a/src/main/java/org/opentripplanner/transit/model/network/RoutingTripPattern.java b/application/src/main/java/org/opentripplanner/transit/model/network/RoutingTripPattern.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/network/RoutingTripPattern.java rename to application/src/main/java/org/opentripplanner/transit/model/network/RoutingTripPattern.java diff --git a/src/main/java/org/opentripplanner/transit/model/network/StopPattern.java b/application/src/main/java/org/opentripplanner/transit/model/network/StopPattern.java similarity index 98% rename from src/main/java/org/opentripplanner/transit/model/network/StopPattern.java rename to application/src/main/java/org/opentripplanner/transit/model/network/StopPattern.java index 3fc51cea0c6..7395d28419f 100644 --- a/src/main/java/org/opentripplanner/transit/model/network/StopPattern.java +++ b/application/src/main/java/org/opentripplanner/transit/model/network/StopPattern.java @@ -8,7 +8,6 @@ import java.util.Objects; import java.util.Optional; import java.util.function.Predicate; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.framework.lang.MemEfficientArrayBuilder; import org.opentripplanner.model.PickDrop; @@ -272,7 +271,7 @@ private int findStopPosition( * @param index Given index for stop * @return true if stop and next stop are equal on both stop patterns, else false */ - boolean sameStops(@Nonnull StopPattern other, int index) { + boolean sameStops(StopPattern other, int index) { var otherOrigin = other.getStop(index); var otherDestination = other.getStop(index + 1); var origin = getStop(index); @@ -289,7 +288,7 @@ boolean sameStops(@Nonnull StopPattern other, int index) { * @return true if the stops have the same stations, else false. If any station is null then * false. */ - boolean sameStations(@Nonnull StopPattern other, int index) { + boolean sameStations(StopPattern other, int index) { var otherOrigin = other.getStop(index).getParentStation(); var otherDestination = other.getStop(index + 1).getParentStation(); var origin = getStop(index).getParentStation(); diff --git a/src/main/java/org/opentripplanner/transit/model/network/TripPattern.java b/application/src/main/java/org/opentripplanner/transit/model/network/TripPattern.java similarity index 86% rename from src/main/java/org/opentripplanner/transit/model/network/TripPattern.java rename to application/src/main/java/org/opentripplanner/transit/model/network/TripPattern.java index 57c71d06113..becf1686733 100644 --- a/src/main/java/org/opentripplanner/transit/model/network/TripPattern.java +++ b/application/src/main/java/org/opentripplanner/transit/model/network/TripPattern.java @@ -1,17 +1,14 @@ package org.opentripplanner.transit.model.network; import static java.util.Objects.requireNonNull; -import static java.util.Objects.requireNonNullElseGet; import static org.opentripplanner.framework.lang.ObjectUtils.requireNotInitialized; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Objects; -import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.LineString; import org.opentripplanner.framework.geometry.CompactLineStringUtils; @@ -28,7 +25,6 @@ import org.opentripplanner.transit.model.site.Station; import org.opentripplanner.transit.model.site.StopLocation; import org.opentripplanner.transit.model.timetable.Direction; -import org.opentripplanner.transit.model.timetable.FrequencyEntry; import org.opentripplanner.transit.model.timetable.Trip; import org.opentripplanner.transit.model.timetable.TripTimes; import org.slf4j.Logger; @@ -122,20 +118,27 @@ public final class TripPattern private final RoutingTripPattern routingTripPattern; - public TripPattern(TripPatternBuilder builder) { + TripPattern(TripPatternBuilder builder) { super(builder.getId()); this.name = builder.getName(); this.route = builder.getRoute(); this.stopPattern = requireNonNull(builder.getStopPattern()); this.createdByRealtimeUpdater = builder.isCreatedByRealtimeUpdate(); - this.mode = requireNonNullElseGet(builder.getMode(), route::getMode); - this.netexSubMode = requireNonNullElseGet(builder.getNetexSubmode(), route::getNetexSubmode); + this.mode = requireNonNull(builder.getMode()); + this.netexSubMode = requireNonNull(builder.getNetexSubmode()); this.containsMultipleModes = builder.getContainsMultipleModes(); - this.scheduledTimetable = - builder.getScheduledTimetable() != null - ? builder.getScheduledTimetable() - : new Timetable(this); + if (builder.getScheduledTimetable() != null) { + if (builder.getScheduledTimetableBuilder() != null) { + throw new IllegalArgumentException( + "Cannot provide both scheduled timetable and scheduled timetable builder" + ); + } + this.scheduledTimetable = builder.getScheduledTimetable(); + } else { + this.scheduledTimetable = + builder.getScheduledTimetableBuilder().withTripPattern(this).build(); + } this.originalTripPattern = builder.getOriginalTripPattern(); @@ -143,7 +146,7 @@ public TripPattern(TripPatternBuilder builder) { this.routingTripPattern = new RoutingTripPattern(this, builder); } - public static TripPatternBuilder of(@Nonnull FeedScopedId id) { + public static TripPatternBuilder of(FeedScopedId id) { return new TripPatternBuilder(id); } @@ -331,56 +334,6 @@ public boolean isBoardAndAlightAt(int stopIndex, PickDrop value) { /* METHODS THAT DELEGATE TO THE SCHEDULED TIMETABLE */ - // TODO OTP2 this method modifies the state, it will be refactored in a subsequent step - /** - * Add the given tripTimes to this pattern's scheduled timetable, recording the corresponding trip - * as one of the scheduled trips on this pattern. - */ - public void add(TripTimes tt) { - // Only scheduled trips (added at graph build time, rather than directly to the timetable - // via updates) are in this list. - scheduledTimetable.addTripTimes(tt); - - // Check that all trips added to this pattern are on the initially declared route. - // Identity equality is valid on GTFS entity objects. - if (this.route != tt.getTrip().getRoute()) { - LOG.warn( - "The trip {} is on route {} but its stop pattern is on route {}.", - tt.getTrip(), - tt.getTrip().getRoute(), - route - ); - } - } - - // TODO OTP2 this method modifies the state, it will be refactored in a subsequent step - /** - * Add the given FrequencyEntry to this pattern's scheduled timetable, recording the corresponding - * trip as one of the scheduled trips on this pattern. - * TODO possible improvements: combine freq entries and TripTimes. Do not keep trips list in TripPattern - * since it is redundant. - */ - public void add(FrequencyEntry freq) { - scheduledTimetable.addFrequencyEntry(freq); - if (this.getRoute() != freq.tripTimes.getTrip().getRoute()) { - LOG.warn( - "The trip {} is on a different route than its stop pattern, which is on {}.", - freq.tripTimes.getTrip(), - route - ); - } - } - - // TODO OTP2 this method modifies the state, it will be refactored in a subsequent step - /** - * Remove all trips matching the given predicate. - * - * @param removeTrip it the predicate returns true - */ - public void removeTrips(Predicate removeTrip) { - scheduledTimetable.getTripTimes().removeIf(tt -> removeTrip.test(tt.getTrip())); - } - /** * Checks that this is TripPattern is based of the provided TripPattern and contains same stops * (but not necessarily with same pickup and dropoff values). @@ -394,7 +347,11 @@ public boolean isModifiedFromTripPatternWithEqualStops(TripPattern other) { } /** - * The direction for all the trips in this pattern. + * Return the direction for all the trips in this pattern. + * By construction, all trips in a pattern have the same direction: + * - trips derived from NeTEx data belong to a ServiceJourney that belongs to a JourneyPattern + * that belongs to a NeTEx Route that specifies a single direction. + * - trips derived from GTFS data are grouped by direction in a trip pattern, during graph build. */ public Direction getDirection() { return scheduledTimetable.getDirection(); @@ -503,7 +460,7 @@ private static Coordinate coordinate(StopLocation s) { } @Override - public boolean sameAs(@Nonnull TripPattern other) { + public boolean sameAs(TripPattern other) { return ( getId().equals(other.getId()) && Objects.equals(this.route, other.route) && diff --git a/src/main/java/org/opentripplanner/transit/model/network/TripPatternBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/network/TripPatternBuilder.java similarity index 84% rename from src/main/java/org/opentripplanner/transit/model/network/TripPatternBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/network/TripPatternBuilder.java index f34d206922b..ec2451ea66d 100644 --- a/src/main/java/org/opentripplanner/transit/model/network/TripPatternBuilder.java +++ b/application/src/main/java/org/opentripplanner/transit/model/network/TripPatternBuilder.java @@ -1,18 +1,23 @@ package org.opentripplanner.transit.model.network; +import static java.util.Objects.requireNonNullElseGet; + import java.util.ArrayList; import java.util.List; +import java.util.function.UnaryOperator; import java.util.stream.IntStream; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.LineString; import org.opentripplanner.framework.geometry.CompactLineStringUtils; import org.opentripplanner.framework.geometry.GeometryUtils; import org.opentripplanner.model.Timetable; +import org.opentripplanner.model.TimetableBuilder; import org.opentripplanner.routing.algorithm.raptoradapter.api.SlackProvider; import org.opentripplanner.transit.model.basic.SubMode; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.AbstractEntityBuilder; import org.opentripplanner.transit.model.framework.FeedScopedId; +import org.opentripplanner.transit.model.timetable.Direction; @SuppressWarnings("UnusedReturnValue") public final class TripPatternBuilder @@ -24,6 +29,7 @@ public final class TripPatternBuilder private boolean containsMultipleModes; private StopPattern stopPattern; private Timetable scheduledTimetable; + private TimetableBuilder scheduledTimetableBuilder; private String name; private boolean createdByRealtimeUpdate; @@ -33,6 +39,7 @@ public final class TripPatternBuilder TripPatternBuilder(FeedScopedId id) { super(id); + this.scheduledTimetableBuilder = Timetable.of(); } TripPatternBuilder(TripPattern original) { @@ -86,10 +93,28 @@ public TripPatternBuilder withStopPattern(StopPattern stopPattern) { } public TripPatternBuilder withScheduledTimeTable(Timetable scheduledTimetable) { + if (scheduledTimetableBuilder != null) { + throw new IllegalStateException( + "Cannot set scheduled Timetable after scheduled Timetable builder is created" + ); + } this.scheduledTimetable = scheduledTimetable; return this; } + public TripPatternBuilder withScheduledTimeTableBuilder( + UnaryOperator producer + ) { + // create a builder for the scheduled timetable only if it needs to be modified. + // otherwise reuse the existing timetable + if (scheduledTimetableBuilder == null) { + scheduledTimetableBuilder = scheduledTimetable.copyOf(); + scheduledTimetable = null; + } + producer.apply(scheduledTimetableBuilder); + return this; + } + public TripPatternBuilder withCreatedByRealtimeUpdater(boolean createdByRealtimeUpdate) { this.createdByRealtimeUpdate = createdByRealtimeUpdate; return this; @@ -115,6 +140,13 @@ public int transitReluctanceFactorIndex() { return route.getMode().ordinal(); } + public Direction getDirection() { + if (scheduledTimetable != null) { + return scheduledTimetable.getDirection(); + } + return scheduledTimetableBuilder.getDirection(); + } + @Override protected TripPattern buildFromValues() { return new TripPattern(this); @@ -125,11 +157,11 @@ public Route getRoute() { } public TransitMode getMode() { - return mode; + return mode != null ? mode : route.getMode(); } public SubMode getNetexSubmode() { - return netexSubMode; + return netexSubMode != null ? netexSubMode : route.getNetexSubmode(); } public boolean getContainsMultipleModes() { @@ -144,6 +176,10 @@ public Timetable getScheduledTimetable() { return scheduledTimetable; } + public TimetableBuilder getScheduledTimetableBuilder() { + return scheduledTimetableBuilder; + } + public String getName() { return name; } diff --git a/src/main/java/org/opentripplanner/transit/model/network/grouppriority/BinarySetOperator.java b/application/src/main/java/org/opentripplanner/transit/model/network/grouppriority/BinarySetOperator.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/network/grouppriority/BinarySetOperator.java rename to application/src/main/java/org/opentripplanner/transit/model/network/grouppriority/BinarySetOperator.java diff --git a/src/main/java/org/opentripplanner/transit/model/network/grouppriority/DefaultTransitGroupPriorityCalculator.java b/application/src/main/java/org/opentripplanner/transit/model/network/grouppriority/DefaultTransitGroupPriorityCalculator.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/network/grouppriority/DefaultTransitGroupPriorityCalculator.java rename to application/src/main/java/org/opentripplanner/transit/model/network/grouppriority/DefaultTransitGroupPriorityCalculator.java diff --git a/src/main/java/org/opentripplanner/transit/model/network/grouppriority/EntityAdapter.java b/application/src/main/java/org/opentripplanner/transit/model/network/grouppriority/EntityAdapter.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/network/grouppriority/EntityAdapter.java rename to application/src/main/java/org/opentripplanner/transit/model/network/grouppriority/EntityAdapter.java diff --git a/src/main/java/org/opentripplanner/transit/model/network/grouppriority/Matcher.java b/application/src/main/java/org/opentripplanner/transit/model/network/grouppriority/Matcher.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/network/grouppriority/Matcher.java rename to application/src/main/java/org/opentripplanner/transit/model/network/grouppriority/Matcher.java diff --git a/src/main/java/org/opentripplanner/transit/model/network/grouppriority/Matchers.java b/application/src/main/java/org/opentripplanner/transit/model/network/grouppriority/Matchers.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/network/grouppriority/Matchers.java rename to application/src/main/java/org/opentripplanner/transit/model/network/grouppriority/Matchers.java diff --git a/src/main/java/org/opentripplanner/transit/model/network/grouppriority/TransitGroupPriority32n.java b/application/src/main/java/org/opentripplanner/transit/model/network/grouppriority/TransitGroupPriority32n.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/network/grouppriority/TransitGroupPriority32n.java rename to application/src/main/java/org/opentripplanner/transit/model/network/grouppriority/TransitGroupPriority32n.java diff --git a/src/main/java/org/opentripplanner/transit/model/network/grouppriority/TransitGroupPriorityService.java b/application/src/main/java/org/opentripplanner/transit/model/network/grouppriority/TransitGroupPriorityService.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/network/grouppriority/TransitGroupPriorityService.java rename to application/src/main/java/org/opentripplanner/transit/model/network/grouppriority/TransitGroupPriorityService.java diff --git a/src/main/java/org/opentripplanner/transit/model/network/grouppriority/TripAdapter.java b/application/src/main/java/org/opentripplanner/transit/model/network/grouppriority/TripAdapter.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/network/grouppriority/TripAdapter.java rename to application/src/main/java/org/opentripplanner/transit/model/network/grouppriority/TripAdapter.java diff --git a/src/main/java/org/opentripplanner/transit/model/network/grouppriority/TripPatternAdapter.java b/application/src/main/java/org/opentripplanner/transit/model/network/grouppriority/TripPatternAdapter.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/network/grouppriority/TripPatternAdapter.java rename to application/src/main/java/org/opentripplanner/transit/model/network/grouppriority/TripPatternAdapter.java diff --git a/src/main/java/org/opentripplanner/transit/model/organization/Agency.java b/application/src/main/java/org/opentripplanner/transit/model/organization/Agency.java similarity index 93% rename from src/main/java/org/opentripplanner/transit/model/organization/Agency.java rename to application/src/main/java/org/opentripplanner/transit/model/organization/Agency.java index d72aa6588f3..4d82ab05e57 100644 --- a/src/main/java/org/opentripplanner/transit/model/organization/Agency.java +++ b/application/src/main/java/org/opentripplanner/transit/model/organization/Agency.java @@ -5,7 +5,6 @@ import java.time.ZoneId; import java.util.Objects; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.transit.model.framework.AbstractTransitEntity; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -47,16 +46,14 @@ public final class Agency extends AbstractTransitEntity i this.brandingUrl = builder.getBrandingUrl(); } - public static AgencyBuilder of(@Nonnull FeedScopedId id) { + public static AgencyBuilder of(FeedScopedId id) { return new AgencyBuilder(id); } - @Nonnull public String getName() { return logName(); } - @Nonnull public ZoneId getTimezone() { return timezone; } @@ -87,19 +84,17 @@ public String getBrandingUrl() { } @Override - @Nonnull public AgencyBuilder copy() { return new AgencyBuilder(this); } @Override - @Nonnull public String logName() { return name; } @Override - public boolean sameAs(@Nonnull Agency other) { + public boolean sameAs(Agency other) { return ( getId().equals(other.getId()) && Objects.equals(name, other.name) && diff --git a/src/main/java/org/opentripplanner/transit/model/organization/AgencyBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/organization/AgencyBuilder.java similarity index 96% rename from src/main/java/org/opentripplanner/transit/model/organization/AgencyBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/organization/AgencyBuilder.java index 8411797f888..3cf24523c5d 100644 --- a/src/main/java/org/opentripplanner/transit/model/organization/AgencyBuilder.java +++ b/application/src/main/java/org/opentripplanner/transit/model/organization/AgencyBuilder.java @@ -1,6 +1,5 @@ package org.opentripplanner.transit.model.organization; -import javax.annotation.Nonnull; import org.opentripplanner.transit.model.framework.AbstractEntityBuilder; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -18,7 +17,7 @@ public class AgencyBuilder extends AbstractEntityBuilder super(id); } - AgencyBuilder(@Nonnull Agency original) { + AgencyBuilder(Agency original) { super(original); this.name = original.getName(); this.timezone = original.getTimezone().getId(); diff --git a/src/main/java/org/opentripplanner/transit/model/organization/Branding.java b/application/src/main/java/org/opentripplanner/transit/model/organization/Branding.java similarity index 92% rename from src/main/java/org/opentripplanner/transit/model/organization/Branding.java rename to application/src/main/java/org/opentripplanner/transit/model/organization/Branding.java index b0599d31341..502c4a27cc7 100644 --- a/src/main/java/org/opentripplanner/transit/model/organization/Branding.java +++ b/application/src/main/java/org/opentripplanner/transit/model/organization/Branding.java @@ -1,7 +1,6 @@ package org.opentripplanner.transit.model.organization; import java.util.Objects; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.transit.model.framework.AbstractTransitEntity; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -30,7 +29,7 @@ public class Branding extends AbstractTransitEntity i this.image = builder.getImage(); } - public static BrandingBuilder of(@Nonnull FeedScopedId id) { + public static BrandingBuilder of(FeedScopedId id) { return new BrandingBuilder(id); } @@ -66,13 +65,12 @@ public String getDescription() { } @Override - @Nonnull public BrandingBuilder copy() { return new BrandingBuilder(this); } @Override - public boolean sameAs(@Nonnull Branding other) { + public boolean sameAs(Branding other) { return ( getId().equals(other.getId()) && Objects.equals(name, other.name) && diff --git a/src/main/java/org/opentripplanner/transit/model/organization/BrandingBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/organization/BrandingBuilder.java similarity index 94% rename from src/main/java/org/opentripplanner/transit/model/organization/BrandingBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/organization/BrandingBuilder.java index 1367d683058..77f35d86fa1 100644 --- a/src/main/java/org/opentripplanner/transit/model/organization/BrandingBuilder.java +++ b/application/src/main/java/org/opentripplanner/transit/model/organization/BrandingBuilder.java @@ -1,6 +1,5 @@ package org.opentripplanner.transit.model.organization; -import javax.annotation.Nonnull; import org.opentripplanner.transit.model.framework.AbstractEntityBuilder; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -16,7 +15,7 @@ public class BrandingBuilder extends AbstractEntityBuilder i this.phone = builder.getPhone(); } - public static OperatorBuilder of(@Nonnull FeedScopedId id) { + public static OperatorBuilder of(FeedScopedId id) { return new OperatorBuilder(id); } - @Nonnull public String getName() { return logName(); } @Override - @Nonnull public String logName() { return name; } @@ -60,13 +57,12 @@ public String getPhone() { } @Override - @Nonnull public OperatorBuilder copy() { return new OperatorBuilder(this); } @Override - public boolean sameAs(@Nonnull Operator other) { + public boolean sameAs(Operator other) { return ( getId().equals(other.getId()) && Objects.equals(name, other.name) && diff --git a/src/main/java/org/opentripplanner/transit/model/organization/OperatorBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/organization/OperatorBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/organization/OperatorBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/organization/OperatorBuilder.java diff --git a/src/main/java/org/opentripplanner/transit/model/package.md b/application/src/main/java/org/opentripplanner/transit/model/package.md similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/package.md rename to application/src/main/java/org/opentripplanner/transit/model/package.md diff --git a/src/main/java/org/opentripplanner/transit/model/site/AreaStop.java b/application/src/main/java/org/opentripplanner/transit/model/site/AreaStop.java similarity index 96% rename from src/main/java/org/opentripplanner/transit/model/site/AreaStop.java rename to application/src/main/java/org/opentripplanner/transit/model/site/AreaStop.java index 35576e0c42f..03844c80b77 100644 --- a/src/main/java/org/opentripplanner/transit/model/site/AreaStop.java +++ b/application/src/main/java/org/opentripplanner/transit/model/site/AreaStop.java @@ -3,7 +3,6 @@ import java.util.Objects; import java.util.Optional; import java.util.function.IntSupplier; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.locationtech.jts.geom.Geometry; import org.opentripplanner.framework.geometry.WgsCoordinate; @@ -69,7 +68,6 @@ public int getIndex() { * communication, eg. the name of the village where the service stops. */ @Override - @Nonnull public I18NString getName() { return name; } @@ -85,7 +83,6 @@ public I18NString getUrl() { return url; } - @Nonnull @Override public StopType getStopType() { return StopType.FLEXIBLE_AREA; @@ -97,7 +94,6 @@ public String getFirstZoneAsString() { } @Override - @Nonnull public WgsCoordinate getCoordinate() { return centroid; } @@ -137,7 +133,7 @@ public boolean hasFallbackName() { } @Override - public boolean sameAs(@Nonnull AreaStop other) { + public boolean sameAs(AreaStop other) { return ( getId().equals(other.getId()) && Objects.equals(name, other.getName()) && @@ -149,7 +145,6 @@ public boolean sameAs(@Nonnull AreaStop other) { } @Override - @Nonnull public AreaStopBuilder copy() { return new AreaStopBuilder(this); } diff --git a/src/main/java/org/opentripplanner/transit/model/site/AreaStopBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/site/AreaStopBuilder.java similarity index 96% rename from src/main/java/org/opentripplanner/transit/model/site/AreaStopBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/site/AreaStopBuilder.java index 8e29ad4acbf..51bbc06f427 100644 --- a/src/main/java/org/opentripplanner/transit/model/site/AreaStopBuilder.java +++ b/application/src/main/java/org/opentripplanner/transit/model/site/AreaStopBuilder.java @@ -2,7 +2,6 @@ import java.util.Objects; import java.util.function.IntSupplier; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.Geometry; import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.i18n.I18NString; @@ -26,7 +25,7 @@ public class AreaStopBuilder extends AbstractEntityBuilder getChildStops() { return this.childStations.stream().flatMap(s -> s.getChildStops().stream()).toList(); } - @Nonnull public Collection getChildStations() { return this.childStations; } @@ -70,7 +66,7 @@ public GroupOfStationsPurpose getPurposeOfGrouping() { } @Override - public boolean sameAs(@Nonnull GroupOfStations other) { + public boolean sameAs(GroupOfStations other) { return ( getId().equals(other.getId()) && Objects.equals(name, other.getName()) && @@ -80,7 +76,6 @@ public boolean sameAs(@Nonnull GroupOfStations other) { ); } - @Nonnull @Override public GroupOfStationsBuilder copy() { return new GroupOfStationsBuilder(this); diff --git a/src/main/java/org/opentripplanner/transit/model/site/GroupOfStationsBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/site/GroupOfStationsBuilder.java similarity index 95% rename from src/main/java/org/opentripplanner/transit/model/site/GroupOfStationsBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/site/GroupOfStationsBuilder.java index 72da8921446..a9e87c4c022 100644 --- a/src/main/java/org/opentripplanner/transit/model/site/GroupOfStationsBuilder.java +++ b/application/src/main/java/org/opentripplanner/transit/model/site/GroupOfStationsBuilder.java @@ -2,7 +2,6 @@ import java.util.HashSet; import java.util.Set; -import javax.annotation.Nonnull; import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.transit.model.framework.AbstractEntityBuilder; @@ -20,7 +19,7 @@ public class GroupOfStationsBuilder super(id); } - GroupOfStationsBuilder(@Nonnull GroupOfStations original) { + GroupOfStationsBuilder(GroupOfStations original) { super(original); // Required fields this.name = I18NString.assertHasValue(original.getName()); diff --git a/src/main/java/org/opentripplanner/transit/model/site/GroupOfStationsPurpose.java b/application/src/main/java/org/opentripplanner/transit/model/site/GroupOfStationsPurpose.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/site/GroupOfStationsPurpose.java rename to application/src/main/java/org/opentripplanner/transit/model/site/GroupOfStationsPurpose.java diff --git a/src/main/java/org/opentripplanner/transit/model/site/GroupStop.java b/application/src/main/java/org/opentripplanner/transit/model/site/GroupStop.java similarity index 96% rename from src/main/java/org/opentripplanner/transit/model/site/GroupStop.java rename to application/src/main/java/org/opentripplanner/transit/model/site/GroupStop.java index c674d588238..40618e60ace 100644 --- a/src/main/java/org/opentripplanner/transit/model/site/GroupStop.java +++ b/application/src/main/java/org/opentripplanner/transit/model/site/GroupStop.java @@ -4,7 +4,6 @@ import java.util.Objects; import java.util.Optional; import java.util.function.IntSupplier; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.GeometryCollection; @@ -65,7 +64,6 @@ public I18NString getUrl() { } @Override - @Nonnull public StopType getStopType() { return StopType.FLEXIBLE_GROUP; } @@ -79,7 +77,6 @@ public String getFirstZoneAsString() { * Returns the centroid of all stops and areas belonging to this location group. */ @Override - @Nonnull public WgsCoordinate getCoordinate() { return centroid; } @@ -116,13 +113,12 @@ public boolean isPartOfSameStationAs(StopLocation alternativeStop) { * Returns all the locations belonging to this location group. */ @Override - @Nonnull public List getChildLocations() { return stopLocations; } @Override - public boolean sameAs(@Nonnull GroupStop other) { + public boolean sameAs(GroupStop other) { return ( getId().equals(other.getId()) && Objects.equals(name, other.getName()) && @@ -131,7 +127,6 @@ public boolean sameAs(@Nonnull GroupStop other) { } @Override - @Nonnull public GroupStopBuilder copy() { return new GroupStopBuilder(this); } diff --git a/src/main/java/org/opentripplanner/transit/model/site/GroupStopBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/site/GroupStopBuilder.java similarity index 97% rename from src/main/java/org/opentripplanner/transit/model/site/GroupStopBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/site/GroupStopBuilder.java index 64cad9325d1..c51b704aa33 100644 --- a/src/main/java/org/opentripplanner/transit/model/site/GroupStopBuilder.java +++ b/application/src/main/java/org/opentripplanner/transit/model/site/GroupStopBuilder.java @@ -3,7 +3,6 @@ import java.util.ArrayList; import java.util.List; import java.util.function.IntSupplier; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.GeometryCollection; import org.opentripplanner.framework.geometry.GeometryUtils; @@ -34,7 +33,7 @@ public class GroupStopBuilder extends AbstractEntityBuilder getFareZones() { return fareZones; } - @Nonnull public Collection getBoardingAreas() { return boardingAreas; } @Override - @Nonnull public RegularStopBuilder copy() { return new RegularStopBuilder(this); } @Override - public boolean sameAs(@Nonnull RegularStop other) { + public boolean sameAs(RegularStop other) { return ( super.sameAs(other) && Objects.equals(platformCode, other.platformCode) && diff --git a/src/main/java/org/opentripplanner/transit/model/site/RegularStopBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/site/RegularStopBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/site/RegularStopBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/site/RegularStopBuilder.java diff --git a/src/main/java/org/opentripplanner/transit/model/site/Station.java b/application/src/main/java/org/opentripplanner/transit/model/site/Station.java similarity index 92% rename from src/main/java/org/opentripplanner/transit/model/site/Station.java rename to application/src/main/java/org/opentripplanner/transit/model/site/Station.java index 68ce2d6d5a2..c8d2558a5cd 100644 --- a/src/main/java/org/opentripplanner/transit/model/site/Station.java +++ b/application/src/main/java/org/opentripplanner/transit/model/site/Station.java @@ -9,7 +9,6 @@ import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.locationtech.jts.algorithm.ConvexHull; import org.locationtech.jts.geom.Geometry; @@ -34,6 +33,7 @@ public class Station private final String code; private final I18NString description; private final WgsCoordinate coordinate; + private final boolean shouldRouteToCentroid; private final StopTransferPriority priority; private final I18NString url; private final ZoneId timezone; @@ -50,6 +50,7 @@ public class Station // Required fields this.name = Objects.requireNonNull(builder.getName()); this.coordinate = Objects.requireNonNull(builder.getCoordinate()); + this.shouldRouteToCentroid = builder.shouldRouteToCentroid(); this.priority = Objects.requireNonNullElse(builder.getPriority(), StopTransferPriority.defaultValue()); this.transfersNotAllowed = builder.isTransfersNotAllowed(); @@ -77,12 +78,10 @@ public boolean includes(StopLocation stop) { return childStops.contains(stop); } - @Nonnull public I18NString getName() { return name; } - @Nonnull public Collection getChildStops() { return childStops; } @@ -97,11 +96,18 @@ public double getLon() { return coordinate.longitude(); } - @Nonnull public WgsCoordinate getCoordinate() { return coordinate; } + /** + * When doing a street search from/to the station, we can either route to the centroid of the station + * or from/to any child stop. This feature is inactive unless configured. + */ + public boolean shouldRouteToCentroid() { + return shouldRouteToCentroid; + } + /** Public facing station code (short text or number) */ @Nullable public String getCode() { @@ -132,7 +138,6 @@ public I18NString getUrl() { * that the {@link StopTransferPriority#ALLOWED} (which is default) should a nett-effect of adding * 0 - zero cost. */ - @Nonnull public StopTransferPriority getPriority() { return priority; } @@ -153,7 +158,6 @@ public boolean isTransfersNotAllowed() { * A geometry collection that contains the center point and the convex hull of all the child * stops. */ - @Nonnull public GeometryCollection getGeometry() { return geometry; } @@ -165,19 +169,19 @@ public String logName() { } @Override - @Nonnull public StationBuilder copy() { return new StationBuilder(this); } @Override - public boolean sameAs(@Nonnull Station other) { + public boolean sameAs(Station other) { return ( getId().equals(other.getId()) && Objects.equals(name, other.name) && Objects.equals(code, other.code) && Objects.equals(description, other.description) && Objects.equals(coordinate, other.coordinate) && + Objects.equals(shouldRouteToCentroid, other.shouldRouteToCentroid) && Objects.equals(priority, other.priority) && Objects.equals(url, other.url) && Objects.equals(timezone, other.timezone) diff --git a/src/main/java/org/opentripplanner/transit/model/site/StationBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/site/StationBuilder.java similarity index 88% rename from src/main/java/org/opentripplanner/transit/model/site/StationBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/site/StationBuilder.java index 8d74f36fb73..79b3b529146 100644 --- a/src/main/java/org/opentripplanner/transit/model/site/StationBuilder.java +++ b/application/src/main/java/org/opentripplanner/transit/model/site/StationBuilder.java @@ -16,6 +16,7 @@ public class StationBuilder extends AbstractEntityBuilder getFareZones() { return List.of(); } - @Nonnull default Accessibility getWheelchairAccessibility() { return Accessibility.NO_INFORMATION; } @@ -112,7 +107,6 @@ default String getFirstZoneAsString() { * Representative location for the StopLocation. Can either be the actual location of the stop, or * the centroid of an area or line. */ - @Nonnull WgsCoordinate getCoordinate(); /** @@ -140,7 +134,6 @@ default ZoneId getTimeZone() { boolean isPartOfStation(); - @Nonnull default StopTransferPriority getPriority() { return StopTransferPriority.defaultValue(); } diff --git a/src/main/java/org/opentripplanner/transit/model/site/StopLocationsGroup.java b/application/src/main/java/org/opentripplanner/transit/model/site/StopLocationsGroup.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/site/StopLocationsGroup.java rename to application/src/main/java/org/opentripplanner/transit/model/site/StopLocationsGroup.java diff --git a/src/main/java/org/opentripplanner/transit/model/site/StopTransferPriority.java b/application/src/main/java/org/opentripplanner/transit/model/site/StopTransferPriority.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/site/StopTransferPriority.java rename to application/src/main/java/org/opentripplanner/transit/model/site/StopTransferPriority.java diff --git a/src/main/java/org/opentripplanner/transit/model/site/StopType.java b/application/src/main/java/org/opentripplanner/transit/model/site/StopType.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/site/StopType.java rename to application/src/main/java/org/opentripplanner/transit/model/site/StopType.java diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/Direction.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/Direction.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/timetable/Direction.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/Direction.java diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/FrequencyEntry.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/FrequencyEntry.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/timetable/FrequencyEntry.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/FrequencyEntry.java diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/OccupancyStatus.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/OccupancyStatus.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/timetable/OccupancyStatus.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/OccupancyStatus.java diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/RealTimeState.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/RealTimeState.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/timetable/RealTimeState.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/RealTimeState.java diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/RealTimeTripTimes.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/RealTimeTripTimes.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/timetable/RealTimeTripTimes.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/RealTimeTripTimes.java diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/ScheduledTripTimes.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/ScheduledTripTimes.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/timetable/ScheduledTripTimes.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/ScheduledTripTimes.java diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/ScheduledTripTimesBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/ScheduledTripTimesBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/timetable/ScheduledTripTimesBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/ScheduledTripTimesBuilder.java diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/StopRealTimeState.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/StopRealTimeState.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/timetable/StopRealTimeState.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/StopRealTimeState.java diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/StopTimeKey.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/StopTimeKey.java similarity index 84% rename from src/main/java/org/opentripplanner/transit/model/timetable/StopTimeKey.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/StopTimeKey.java index d110778a267..d3267804f70 100644 --- a/src/main/java/org/opentripplanner/transit/model/timetable/StopTimeKey.java +++ b/application/src/main/java/org/opentripplanner/transit/model/timetable/StopTimeKey.java @@ -1,6 +1,5 @@ package org.opentripplanner.transit.model.timetable; -import javax.annotation.Nonnull; import org.opentripplanner.transit.model.framework.AbstractTransitEntity; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -16,18 +15,17 @@ public class StopTimeKey extends AbstractTransitEntity impleme this.netexInternalPlanningCode = builder.getNetexInternalPlanningCode(); } - public static TripBuilder of(@Nonnull FeedScopedId id) { + public static TripBuilder of(FeedScopedId id) { return new TripBuilder(id); } @@ -93,7 +92,6 @@ public Operator getOperator() { return operator; } - @Nonnull public Route getRoute() { return route; } @@ -117,12 +115,10 @@ public String getShortName() { return shortName; } - @Nonnull public TransitMode getMode() { return mode; } - @Nonnull public SubMode getNetexSubMode() { return netexSubmode; } @@ -140,17 +136,14 @@ public FeedScopedId getShapeId() { /** * The direction for this Trip (and all other Trips in this TripPattern). */ - @Nonnull public Direction getDirection() { return direction; } - @Nonnull public BikeAccess getBikesAllowed() { return bikesAllowed; } - @Nonnull public Accessibility getWheelchairBoarding() { return wheelchairBoarding; } @@ -175,7 +168,6 @@ public String getNetexInternalPlanningCode() { *

    * This is planned, by default (e.g. GTFS and if not set explicit). */ - @Nonnull public TripAlteration getNetexAlteration() { return netexAlteration; } @@ -198,7 +190,7 @@ public String logName() { } @Override - public boolean sameAs(@Nonnull Trip other) { + public boolean sameAs(Trip other) { return ( getId().equals(other.getId()) && Objects.equals(this.operator, other.operator) && diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/TripAlteration.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/TripAlteration.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/timetable/TripAlteration.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/TripAlteration.java diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/TripBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/TripBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/timetable/TripBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/TripBuilder.java diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/TripIdAndServiceDate.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/TripIdAndServiceDate.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/timetable/TripIdAndServiceDate.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/TripIdAndServiceDate.java diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/TripOnServiceDate.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/TripOnServiceDate.java similarity index 91% rename from src/main/java/org/opentripplanner/transit/model/timetable/TripOnServiceDate.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/TripOnServiceDate.java index 1b4ecc964cf..ee520f9e0f0 100644 --- a/src/main/java/org/opentripplanner/transit/model/timetable/TripOnServiceDate.java +++ b/application/src/main/java/org/opentripplanner/transit/model/timetable/TripOnServiceDate.java @@ -3,7 +3,6 @@ import java.time.LocalDate; import java.util.List; import java.util.Objects; -import javax.annotation.Nonnull; import org.opentripplanner.transit.model.framework.AbstractTransitEntity; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -26,7 +25,7 @@ public class TripOnServiceDate this.replacementFor = builder.getReplacementFor(); } - public static TripOnServiceDateBuilder of(@Nonnull FeedScopedId id) { + public static TripOnServiceDateBuilder of(FeedScopedId id) { return new TripOnServiceDateBuilder(id); } @@ -51,7 +50,7 @@ public TripIdAndServiceDate getTripIdAndServiceDate() { } @Override - public boolean sameAs(@Nonnull TripOnServiceDate other) { + public boolean sameAs(TripOnServiceDate other) { return ( getId().equals(other.getId()) && Objects.equals(this.trip, other.trip) && @@ -61,7 +60,6 @@ public boolean sameAs(@Nonnull TripOnServiceDate other) { ); } - @Nonnull @Override public TripOnServiceDateBuilder copy() { return new TripOnServiceDateBuilder(this); diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/TripOnServiceDateBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/TripOnServiceDateBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/timetable/TripOnServiceDateBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/TripOnServiceDateBuilder.java diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/TripTimes.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/TripTimes.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/timetable/TripTimes.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/TripTimes.java diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/TripTimesFactory.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/TripTimesFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/timetable/TripTimesFactory.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/TripTimesFactory.java diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/TripTimesStringBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/TripTimesStringBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/timetable/TripTimesStringBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/TripTimesStringBuilder.java diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/booking/BookingInfo.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/booking/BookingInfo.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/timetable/booking/BookingInfo.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/booking/BookingInfo.java diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/booking/BookingInfoBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/booking/BookingInfoBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/timetable/booking/BookingInfoBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/booking/BookingInfoBuilder.java diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/booking/BookingMethod.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/booking/BookingMethod.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/timetable/booking/BookingMethod.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/booking/BookingMethod.java diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/booking/BookingTime.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/booking/BookingTime.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/timetable/booking/BookingTime.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/booking/BookingTime.java diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/booking/RoutingBookingInfo.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/booking/RoutingBookingInfo.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/timetable/booking/RoutingBookingInfo.java rename to application/src/main/java/org/opentripplanner/transit/model/timetable/booking/RoutingBookingInfo.java diff --git a/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java b/application/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java similarity index 91% rename from src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java rename to application/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java index 8fa18443bab..ce2d3aa0ad2 100644 --- a/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java +++ b/application/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java @@ -35,8 +35,11 @@ import org.opentripplanner.routing.services.TransitAlertService; import org.opentripplanner.routing.stoptimes.ArrivalDeparture; import org.opentripplanner.routing.stoptimes.StopTimesHelper; +import org.opentripplanner.transit.api.request.TripOnServiceDateRequest; import org.opentripplanner.transit.model.basic.Notice; import org.opentripplanner.transit.model.basic.TransitMode; +import org.opentripplanner.transit.model.filter.expr.Matcher; +import org.opentripplanner.transit.model.filter.transit.TripOnServiceDateMatcherFactory; import org.opentripplanner.transit.model.framework.AbstractTransitEntity; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -119,11 +122,6 @@ public void addFeedInfo(FeedInfo info) { this.transitModel.addFeedInfo(info); } - @Override - public Collection getOperators() { - return this.transitModel.getOperators(); - } - @Override public Collection getNoticesByEntity(AbstractTransitEntity entity) { return this.transitModel.getNoticesByElement().get(entity); @@ -231,12 +229,12 @@ public Collection getTripsForStop(StopLocation stop) { @Override public Collection getAllOperators() { OTPRequestTimeoutException.checkForTimeout(); - return this.transitModelIndex.getAllOperators(); + return this.transitModel.getOperators(); } @Override public Operator getOperatorForId(FeedScopedId id) { - return this.transitModelIndex.getOperatorForId().get(id); + return this.transitModelIndex.getOperatorForId(id); } @Override @@ -293,7 +291,7 @@ public Trip getTripForId(FeedScopedId id) { @Nullable @Override public Trip getScheduledTripForId(FeedScopedId id) { - return this.transitModelIndex.getTripForId().get(id); + return this.transitModelIndex.getTripForId(id); } @Override @@ -302,11 +300,11 @@ public Collection getAllTrips() { TimetableSnapshot currentSnapshot = lazyGetTimeTableSnapShot(); if (currentSnapshot != null) { return new CollectionsView<>( - transitModelIndex.getTripForId().values(), - currentSnapshot.getAllRealTimeAddedTrips() + transitModelIndex.getAllTrips(), + currentSnapshot.listRealTimeAddedTrips() ); } - return Collections.unmodifiableCollection(transitModelIndex.getTripForId().values()); + return Collections.unmodifiableCollection(transitModelIndex.getAllTrips()); } @Override @@ -316,10 +314,10 @@ public Collection getAllRoutes() { if (currentSnapshot != null) { return new CollectionsView<>( transitModelIndex.getAllRoutes(), - currentSnapshot.getAllRealTimeAddedRoutes() + currentSnapshot.listRealTimeAddedRoutes() ); } - return Collections.unmodifiableCollection(transitModelIndex.getAllRoutes()); + return transitModelIndex.getAllRoutes(); } @Override @@ -331,12 +329,12 @@ public TripPattern getPatternForTrip(Trip trip) { return realtimeAddedTripPattern; } } - return this.transitModelIndex.getPatternForTrip().get(trip); + return this.transitModelIndex.getPatternForTrip(trip); } @Override public TripPattern getPatternForTrip(Trip trip, LocalDate serviceDate) { - TripPattern realtimePattern = getRealtimeAddedTripPattern(trip.getId(), serviceDate); + TripPattern realtimePattern = getNewTripPatternForModifiedTrip(trip.getId(), serviceDate); if (realtimePattern != null) { return realtimePattern; } @@ -347,7 +345,7 @@ public TripPattern getPatternForTrip(Trip trip, LocalDate serviceDate) { public Collection getPatternsForRoute(Route route) { OTPRequestTimeoutException.checkForTimeout(); Collection tripPatterns = new HashSet<>( - transitModelIndex.getPatternsForRoute().get(route) + transitModelIndex.getPatternsForRoute(route) ); TimetableSnapshot currentSnapshot = lazyGetTimeTableSnapShot(); if (currentSnapshot != null) { @@ -488,18 +486,18 @@ public Collection getPatternsForStop( @Override public Collection getGroupsOfRoutes() { OTPRequestTimeoutException.checkForTimeout(); - return transitModelIndex.getRoutesForGroupOfRoutes().keySet(); + return transitModelIndex.getAllGroupOfRoutes(); } @Override public Collection getRoutesForGroupOfRoutes(GroupOfRoutes groupOfRoutes) { OTPRequestTimeoutException.checkForTimeout(); - return transitModelIndex.getRoutesForGroupOfRoutes().get(groupOfRoutes); + return transitModelIndex.getRoutesForGroupOfRoutes(groupOfRoutes); } @Override public GroupOfRoutes getGroupOfRoutesForId(FeedScopedId id) { - return transitModelIndex.getGroupOfRoutesForId().get(id); + return transitModelIndex.getGroupOfRoutesForId(id); } /** @@ -517,21 +515,21 @@ public Timetable getTimetableForTripPattern(TripPattern tripPattern, LocalDate s } @Override - public TripPattern getRealtimeAddedTripPattern(FeedScopedId tripId, LocalDate serviceDate) { + public TripPattern getNewTripPatternForModifiedTrip(FeedScopedId tripId, LocalDate serviceDate) { TimetableSnapshot currentSnapshot = lazyGetTimeTableSnapShot(); if (currentSnapshot == null) { return null; } - return currentSnapshot.getRealtimeAddedTripPattern(tripId, serviceDate); + return currentSnapshot.getNewTripPatternForModifiedTrip(tripId, serviceDate); } @Override - public boolean hasRealtimeAddedTripPatterns() { + public boolean hasNewTripPatternsForModifiedTrips() { TimetableSnapshot currentSnapshot = lazyGetTimeTableSnapShot(); if (currentSnapshot == null) { return false; } - return currentSnapshot.hasRealtimeAddedTripPatterns(); + return currentSnapshot.hasNewTripPatternsForModifiedTrips(); } /** @@ -548,17 +546,17 @@ private TimetableSnapshot lazyGetTimeTableSnapShot() { } @Override - public TripOnServiceDate getTripOnServiceDateById(FeedScopedId datedServiceJourneyId) { + public TripOnServiceDate getTripOnServiceDateById(FeedScopedId tripOnServiceDateId) { TimetableSnapshot currentSnapshot = lazyGetTimeTableSnapShot(); if (currentSnapshot != null) { TripOnServiceDate tripOnServiceDate = currentSnapshot.getRealTimeAddedTripOnServiceDateById( - datedServiceJourneyId + tripOnServiceDateId ); if (tripOnServiceDate != null) { return tripOnServiceDate; } } - return transitModelIndex.getTripOnServiceDateById().get(datedServiceJourneyId); + return transitModel.getTripOnServiceDateById(tripOnServiceDateId); } @Override @@ -566,13 +564,11 @@ public Collection getAllTripOnServiceDates() { TimetableSnapshot currentSnapshot = lazyGetTimeTableSnapShot(); if (currentSnapshot != null) { return new CollectionsView<>( - transitModelIndex.getTripOnServiceDateForTripAndDay().values(), - currentSnapshot.getAllRealTimeAddedTripOnServiceDate() + transitModel.getAllTripsOnServiceDates(), + currentSnapshot.listRealTimeAddedTripOnServiceDate() ); } - return Collections.unmodifiableCollection( - transitModelIndex.getTripOnServiceDateForTripAndDay().values() - ); + return transitModel.getAllTripsOnServiceDates(); } @Override @@ -588,7 +584,19 @@ public TripOnServiceDate getTripOnServiceDateForTripAndDay( return tripOnServiceDate; } } - return transitModelIndex.getTripOnServiceDateForTripAndDay().get(tripIdAndServiceDate); + return transitModelIndex.getTripOnServiceDateForTripAndDay(tripIdAndServiceDate); + } + + /** + * Returns a list of TripOnServiceDates that match the filtering defined in the request. + * + * @param request - A TripOnServiceDateRequest object with filtering defined. + * @return - A list of TripOnServiceDates + */ + @Override + public List getTripOnServiceDates(TripOnServiceDateRequest request) { + Matcher matcher = TripOnServiceDateMatcherFactory.of(request); + return getAllTripOnServiceDates().stream().filter(matcher::match).toList(); } /** diff --git a/src/main/java/org/opentripplanner/apis/gtfs/PatternByServiceDatesFilter.java b/application/src/main/java/org/opentripplanner/transit/service/PatternByServiceDatesFilter.java similarity index 79% rename from src/main/java/org/opentripplanner/apis/gtfs/PatternByServiceDatesFilter.java rename to application/src/main/java/org/opentripplanner/transit/service/PatternByServiceDatesFilter.java index 8eecfe6273b..21890975acf 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/PatternByServiceDatesFilter.java +++ b/application/src/main/java/org/opentripplanner/transit/service/PatternByServiceDatesFilter.java @@ -1,16 +1,13 @@ -package org.opentripplanner.apis.gtfs; +package org.opentripplanner.transit.service; import java.time.LocalDate; import java.util.Collection; import java.util.Objects; import java.util.function.Function; -import java.util.stream.Stream; -import org.opentripplanner.apis.gtfs.generated.GraphQLTypes; import org.opentripplanner.apis.gtfs.model.LocalDateRange; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.timetable.Trip; -import org.opentripplanner.transit.service.TransitService; /** * Encapsulates the logic to filter patterns by the service dates that they operate on. It also @@ -29,7 +26,7 @@ public class PatternByServiceDatesFilter { * This method is not private to enable unit testing. *

    */ - PatternByServiceDatesFilter( + public PatternByServiceDatesFilter( LocalDateRange range, Function> getPatternsForRoute, Function> getServiceDatesForTrip @@ -45,17 +42,6 @@ public class PatternByServiceDatesFilter { } } - public PatternByServiceDatesFilter( - GraphQLTypes.GraphQLLocalDateRangeInput filterInput, - TransitService transitService - ) { - this( - new LocalDateRange(filterInput.getGraphQLStart(), filterInput.getGraphQLEnd()), - transitService::getPatternsForRoute, - trip -> transitService.getCalendarService().getServiceDatesForServiceId(trip.getServiceId()) - ); - } - /** * Filter the patterns by the service dates that it operates on. */ @@ -67,8 +53,9 @@ public Collection filterPatterns(Collection tripPatter * Filter the routes by listing all their patterns' service dates and checking if they * operate on the specified dates. */ - public Collection filterRoutes(Stream routeStream) { + public Collection filterRoutes(Collection routeStream) { return routeStream + .stream() .filter(r -> { var patterns = getPatternsForRoute.apply(r); return !this.filterPatterns(patterns).isEmpty(); diff --git a/src/main/java/org/opentripplanner/transit/service/StopModel.java b/application/src/main/java/org/opentripplanner/transit/service/StopModel.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/service/StopModel.java rename to application/src/main/java/org/opentripplanner/transit/service/StopModel.java diff --git a/src/main/java/org/opentripplanner/transit/service/StopModelBuilder.java b/application/src/main/java/org/opentripplanner/transit/service/StopModelBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/service/StopModelBuilder.java rename to application/src/main/java/org/opentripplanner/transit/service/StopModelBuilder.java diff --git a/src/main/java/org/opentripplanner/transit/service/StopModelIndex.java b/application/src/main/java/org/opentripplanner/transit/service/StopModelIndex.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/service/StopModelIndex.java rename to application/src/main/java/org/opentripplanner/transit/service/StopModelIndex.java diff --git a/src/main/java/org/opentripplanner/transit/service/TransitEditorService.java b/application/src/main/java/org/opentripplanner/transit/service/TransitEditorService.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/service/TransitEditorService.java rename to application/src/main/java/org/opentripplanner/transit/service/TransitEditorService.java diff --git a/src/main/java/org/opentripplanner/transit/service/TransitModel.java b/application/src/main/java/org/opentripplanner/transit/service/TransitModel.java similarity index 96% rename from src/main/java/org/opentripplanner/transit/service/TransitModel.java rename to application/src/main/java/org/opentripplanner/transit/service/TransitModel.java index 84c7597d562..91c5ba8e5d9 100644 --- a/src/main/java/org/opentripplanner/transit/service/TransitModel.java +++ b/application/src/main/java/org/opentripplanner/transit/service/TransitModel.java @@ -13,13 +13,13 @@ import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.Set; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.ext.flex.trip.FlexTrip; import org.opentripplanner.framework.lang.ObjectUtils; @@ -261,7 +261,7 @@ public void updateCalendarServiceData( * service period {@code null} is returned. */ @Nullable - public FeedScopedId getOrCreateServiceIdForDate(@Nonnull LocalDate serviceDate) { + public FeedScopedId getOrCreateServiceIdForDate(LocalDate serviceDate) { // Start of day ZonedDateTime time = ServiceDateUtils.asStartOfService(serviceDate, getTimeZone()); @@ -350,7 +350,11 @@ public Set getAgencyTimeZones() { } public Collection getOperators() { - return operators; + return Collections.unmodifiableCollection(operators); + } + + public void addOperators(Collection operators) { + this.operators.addAll(operators); } /** @@ -407,9 +411,9 @@ public TripPattern getTripPatternForId(FeedScopedId id) { return tripPatternForId.get(id); } - public void addTripOnServiceDate(FeedScopedId id, TripOnServiceDate tripOnServiceDate) { + public void addTripOnServiceDate(TripOnServiceDate tripOnServiceDate) { invalidateIndex(); - tripOnServiceDates.put(id, tripOnServiceDate); + tripOnServiceDates.put(tripOnServiceDate.getId(), tripOnServiceDate); } /** @@ -443,8 +447,12 @@ public Collection getAllTripPatterns() { return tripPatternForId.values(); } - public Collection getAllTripOnServiceDates() { - return tripOnServiceDates.values(); + public TripOnServiceDate getTripOnServiceDateById(FeedScopedId tripOnServiceDateId) { + return tripOnServiceDates.get(tripOnServiceDateId); + } + + public Collection getAllTripsOnServiceDates() { + return Collections.unmodifiableCollection(tripOnServiceDates.values()); } /** diff --git a/src/main/java/org/opentripplanner/transit/service/TransitModelIndex.java b/application/src/main/java/org/opentripplanner/transit/service/TransitModelIndex.java similarity index 83% rename from src/main/java/org/opentripplanner/transit/service/TransitModelIndex.java rename to application/src/main/java/org/opentripplanner/transit/service/TransitModelIndex.java index 36ab937416c..7f44854eb9a 100644 --- a/src/main/java/org/opentripplanner/transit/service/TransitModelIndex.java +++ b/application/src/main/java/org/opentripplanner/transit/service/TransitModelIndex.java @@ -7,6 +7,7 @@ import gnu.trove.set.hash.TIntHashSet; import java.time.LocalDate; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -47,10 +48,9 @@ class TransitModelIndex { private final Map patternForTrip = new HashMap<>(); private final Multimap patternsForRoute = ArrayListMultimap.create(); - private final Multimap patternsForStopId = ArrayListMultimap.create(); + private final Multimap patternsForStop = ArrayListMultimap.create(); private final Map serviceCodesRunningForDate = new HashMap<>(); - private final Map tripOnServiceDateById = new HashMap<>(); private final Map tripOnServiceDateForTripAndDay = new HashMap<>(); private final Multimap routesForGroupOfRoutes = ArrayListMultimap.create(); @@ -78,7 +78,7 @@ class TransitModelIndex { tripForId.put(trip.getId(), trip); }); for (StopLocation stop : pattern.getStops()) { - patternsForStopId.put(stop, pattern); + patternsForStop.put(stop, pattern); } } for (Route route : patternsForRoute.asMap().keySet()) { @@ -91,8 +91,7 @@ class TransitModelIndex { groupOfRoutesForId.put(groupOfRoutes.getId(), groupOfRoutes); } - for (TripOnServiceDate tripOnServiceDate : transitModel.getAllTripOnServiceDates()) { - tripOnServiceDateById.put(tripOnServiceDate.getId(), tripOnServiceDate); + for (TripOnServiceDate tripOnServiceDate : transitModel.getAllTripsOnServiceDates()) { tripOnServiceDateForTripAndDay.put( new TripIdAndServiceDate( tripOnServiceDate.getTrip().getId(), @@ -132,56 +131,50 @@ void addRoutes(Route route) { /** Dynamically generate the set of Routes passing though a Stop on demand. */ Set getRoutesForStop(StopLocation stop) { Set routes = new HashSet<>(); - for (TripPattern p : getPatternsForStop(stop)) { + for (TripPattern p : patternsForStop.get(stop)) { routes.add(p.getRoute()); } return routes; } Collection getPatternsForStop(StopLocation stop) { - return patternsForStopId.get(stop); + return Collections.unmodifiableCollection(patternsForStop.get(stop)); } Collection getTripsForStop(StopLocation stop) { - return getPatternsForStop(stop) + return patternsForStop + .get(stop) .stream() .flatMap(TripPattern::scheduledTripsAsStream) .collect(Collectors.toList()); } - /** - * Get a list of all operators spanning across all feeds. - */ - Collection getAllOperators() { - return getOperatorForId().values(); + Operator getOperatorForId(FeedScopedId operatorId) { + return operatorForId.get(operatorId); } - Map getOperatorForId() { - return operatorForId; + Collection getAllTrips() { + return Collections.unmodifiableCollection(tripForId.values()); } - Map getTripForId() { - return tripForId; + Trip getTripForId(FeedScopedId tripId) { + return tripForId.get(tripId); } - Map getTripOnServiceDateById() { - return tripOnServiceDateById; - } - - Map getTripOnServiceDateForTripAndDay() { - return tripOnServiceDateForTripAndDay; + TripOnServiceDate getTripOnServiceDateForTripAndDay(TripIdAndServiceDate tripIdAndServiceDate) { + return tripOnServiceDateForTripAndDay.get(tripIdAndServiceDate); } Collection getAllRoutes() { - return routeForId.values(); + return Collections.unmodifiableCollection(routeForId.values()); } - Map getPatternForTrip() { - return patternForTrip; + TripPattern getPatternForTrip(Trip trip) { + return patternForTrip.get(trip); } - Multimap getPatternsForRoute() { - return patternsForRoute; + Collection getPatternsForRoute(Route route) { + return Collections.unmodifiableCollection(patternsForRoute.get(route)); } Map getServiceCodesRunningForDate() { @@ -229,11 +222,15 @@ private void initalizeServiceCodesForDate(TransitModel transitModel) { } } - Multimap getRoutesForGroupOfRoutes() { - return routesForGroupOfRoutes; + Collection getAllGroupOfRoutes() { + return Collections.unmodifiableCollection(groupOfRoutesForId.values()); + } + + Collection getRoutesForGroupOfRoutes(GroupOfRoutes groupOfRoutes) { + return Collections.unmodifiableCollection(routesForGroupOfRoutes.get(groupOfRoutes)); } - Map getGroupOfRoutesForId() { - return groupOfRoutesForId; + GroupOfRoutes getGroupOfRoutesForId(FeedScopedId id) { + return groupOfRoutesForId.get(id); } } diff --git a/src/main/java/org/opentripplanner/transit/service/TransitService.java b/application/src/main/java/org/opentripplanner/transit/service/TransitService.java similarity index 92% rename from src/main/java/org/opentripplanner/transit/service/TransitService.java rename to application/src/main/java/org/opentripplanner/transit/service/TransitService.java index 1836b5612d2..12fcbc9bc46 100644 --- a/src/main/java/org/opentripplanner/transit/service/TransitService.java +++ b/application/src/main/java/org/opentripplanner/transit/service/TransitService.java @@ -24,6 +24,7 @@ import org.opentripplanner.routing.algorithm.raptoradapter.transit.TransitLayer; import org.opentripplanner.routing.services.TransitAlertService; import org.opentripplanner.routing.stoptimes.ArrivalDeparture; +import org.opentripplanner.transit.api.request.TripOnServiceDateRequest; import org.opentripplanner.transit.model.basic.Notice; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.AbstractTransitEntity; @@ -70,8 +71,6 @@ public interface TransitService { FeedInfo getFeedInfo(String feedId); - Collection getOperators(); - Collection getNoticesByEntity(AbstractTransitEntity entity); /** @@ -139,6 +138,12 @@ public interface TransitService { StopLocation getStopLocation(FeedScopedId parseId); + /** + * Return all stops associated with the given id. If a Station, a MultiModalStation, or a + * GroupOfStations matches the id, then all child stops are returned. If the id matches a regular + * stop, area stop or stop group, then a list with one item is returned. + * An empty list is if nothing is found. + */ Collection getStopOrChildStops(FeedScopedId id); Collection listStopLocationGroups(); @@ -233,12 +238,12 @@ List stopTimesForPatternAtStop( * this date (that is: it is still using its scheduled trip pattern for this date). */ @Nullable - TripPattern getRealtimeAddedTripPattern(FeedScopedId tripId, LocalDate serviceDate); + TripPattern getNewTripPatternForModifiedTrip(FeedScopedId tripId, LocalDate serviceDate); /** - * Return true if at least one trip pattern has been created by a real-time update. + * Return true if at least one trip pattern has been modified by a real-time update. */ - boolean hasRealtimeAddedTripPatterns(); + boolean hasNewTripPatternsForModifiedTrips(); TripOnServiceDate getTripOnServiceDateForTripAndDay(TripIdAndServiceDate tripIdAndServiceDate); @@ -307,4 +312,12 @@ List stopTimesForPatternAtStop( Set getAllServiceCodes(); Map getServiceCodesRunningForDate(); + + /** + * Returns a list of TripOnServiceDates that match the filtering defined in the request. + * + * @param request - A TripOnServiceDateRequest object with filtering defined. + * @return - A list of TripOnServiceDates + */ + List getTripOnServiceDates(TripOnServiceDateRequest request); } diff --git a/src/main/java/org/opentripplanner/updater/DefaultRealTimeUpdateContext.java b/application/src/main/java/org/opentripplanner/updater/DefaultRealTimeUpdateContext.java similarity index 93% rename from src/main/java/org/opentripplanner/updater/DefaultRealTimeUpdateContext.java rename to application/src/main/java/org/opentripplanner/updater/DefaultRealTimeUpdateContext.java index 0921ed5a30d..a7f8e77dc00 100644 --- a/src/main/java/org/opentripplanner/updater/DefaultRealTimeUpdateContext.java +++ b/application/src/main/java/org/opentripplanner/updater/DefaultRealTimeUpdateContext.java @@ -1,12 +1,12 @@ package org.opentripplanner.updater; -import org.opentripplanner.ext.siri.EntityResolver; -import org.opentripplanner.ext.siri.SiriFuzzyTripMatcher; import org.opentripplanner.model.TimetableSnapshot; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.transit.service.DefaultTransitService; import org.opentripplanner.transit.service.TransitModel; import org.opentripplanner.transit.service.TransitService; +import org.opentripplanner.updater.siri.EntityResolver; +import org.opentripplanner.updater.siri.SiriFuzzyTripMatcher; public class DefaultRealTimeUpdateContext implements RealTimeUpdateContext { diff --git a/src/main/java/org/opentripplanner/updater/GraphUpdaterManager.java b/application/src/main/java/org/opentripplanner/updater/GraphUpdaterManager.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/GraphUpdaterManager.java rename to application/src/main/java/org/opentripplanner/updater/GraphUpdaterManager.java diff --git a/src/main/java/org/opentripplanner/updater/GraphUpdaterStatus.java b/application/src/main/java/org/opentripplanner/updater/GraphUpdaterStatus.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/GraphUpdaterStatus.java rename to application/src/main/java/org/opentripplanner/updater/GraphUpdaterStatus.java diff --git a/src/main/java/org/opentripplanner/updater/GraphWriterRunnable.java b/application/src/main/java/org/opentripplanner/updater/GraphWriterRunnable.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/GraphWriterRunnable.java rename to application/src/main/java/org/opentripplanner/updater/GraphWriterRunnable.java diff --git a/src/main/java/org/opentripplanner/updater/GtfsRealtimeFuzzyTripMatcher.java b/application/src/main/java/org/opentripplanner/updater/GtfsRealtimeFuzzyTripMatcher.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/GtfsRealtimeFuzzyTripMatcher.java rename to application/src/main/java/org/opentripplanner/updater/GtfsRealtimeFuzzyTripMatcher.java diff --git a/src/main/java/org/opentripplanner/updater/GtfsRealtimeMapper.java b/application/src/main/java/org/opentripplanner/updater/GtfsRealtimeMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/GtfsRealtimeMapper.java rename to application/src/main/java/org/opentripplanner/updater/GtfsRealtimeMapper.java diff --git a/src/main/java/org/opentripplanner/updater/RealTimeUpdateContext.java b/application/src/main/java/org/opentripplanner/updater/RealTimeUpdateContext.java similarity index 93% rename from src/main/java/org/opentripplanner/updater/RealTimeUpdateContext.java rename to application/src/main/java/org/opentripplanner/updater/RealTimeUpdateContext.java index 5a95d01562d..b3190b2ff00 100644 --- a/src/main/java/org/opentripplanner/updater/RealTimeUpdateContext.java +++ b/application/src/main/java/org/opentripplanner/updater/RealTimeUpdateContext.java @@ -1,9 +1,9 @@ package org.opentripplanner.updater; -import org.opentripplanner.ext.siri.EntityResolver; -import org.opentripplanner.ext.siri.SiriFuzzyTripMatcher; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.transit.service.TransitService; +import org.opentripplanner.updater.siri.EntityResolver; +import org.opentripplanner.updater.siri.SiriFuzzyTripMatcher; /** * Give access to the transit data and street model in the context of a real-time updater. diff --git a/src/main/java/org/opentripplanner/updater/TimetableSnapshotSourceParameters.java b/application/src/main/java/org/opentripplanner/updater/TimetableSnapshotSourceParameters.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/TimetableSnapshotSourceParameters.java rename to application/src/main/java/org/opentripplanner/updater/TimetableSnapshotSourceParameters.java diff --git a/src/main/java/org/opentripplanner/updater/UpdatersParameters.java b/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java similarity index 88% rename from src/main/java/org/opentripplanner/updater/UpdatersParameters.java rename to application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java index 5f27f9dbd45..312fa3e2fbc 100644 --- a/src/main/java/org/opentripplanner/updater/UpdatersParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java @@ -1,13 +1,13 @@ package org.opentripplanner.updater; import java.util.List; -import org.opentripplanner.ext.siri.updater.SiriETUpdaterParameters; -import org.opentripplanner.ext.siri.updater.SiriSXUpdaterParameters; import org.opentripplanner.ext.siri.updater.azure.SiriAzureETUpdaterParameters; import org.opentripplanner.ext.siri.updater.azure.SiriAzureSXUpdaterParameters; -import org.opentripplanner.ext.siri.updater.google.SiriETGooglePubsubUpdaterParameters; import org.opentripplanner.ext.vehiclerentalservicedirectory.api.VehicleRentalServiceDirectoryFetcherParameters; import org.opentripplanner.updater.alert.GtfsRealtimeAlertsUpdaterParameters; +import org.opentripplanner.updater.siri.updater.SiriETUpdaterParameters; +import org.opentripplanner.updater.siri.updater.SiriSXUpdaterParameters; +import org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdaterParameters; import org.opentripplanner.updater.trip.MqttGtfsRealtimeUpdaterParameters; import org.opentripplanner.updater.trip.PollingTripUpdaterParameters; import org.opentripplanner.updater.vehicle_parking.VehicleParkingUpdaterParameters; diff --git a/src/main/java/org/opentripplanner/updater/alert/AlertsUpdateHandler.java b/application/src/main/java/org/opentripplanner/updater/alert/AlertsUpdateHandler.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/alert/AlertsUpdateHandler.java rename to application/src/main/java/org/opentripplanner/updater/alert/AlertsUpdateHandler.java diff --git a/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java rename to application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java diff --git a/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdaterParameters.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdaterParameters.java rename to application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdaterParameters.java diff --git a/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeCauseMapper.java b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeCauseMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeCauseMapper.java rename to application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeCauseMapper.java diff --git a/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeEffectMapper.java b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeEffectMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeEffectMapper.java rename to application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeEffectMapper.java diff --git a/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeSeverityMapper.java b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeSeverityMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeSeverityMapper.java rename to application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeSeverityMapper.java diff --git a/src/main/java/org/opentripplanner/updater/alert/TransitAlertProvider.java b/application/src/main/java/org/opentripplanner/updater/alert/TransitAlertProvider.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/alert/TransitAlertProvider.java rename to application/src/main/java/org/opentripplanner/updater/alert/TransitAlertProvider.java diff --git a/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java similarity index 97% rename from src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java rename to application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java index aed4ef13ece..df7014f2151 100644 --- a/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java +++ b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java @@ -3,12 +3,8 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; -import org.opentripplanner.ext.siri.SiriTimetableSnapshotSource; -import org.opentripplanner.ext.siri.updater.SiriETUpdater; -import org.opentripplanner.ext.siri.updater.SiriSXUpdater; import org.opentripplanner.ext.siri.updater.azure.SiriAzureETUpdater; import org.opentripplanner.ext.siri.updater.azure.SiriAzureSXUpdater; -import org.opentripplanner.ext.siri.updater.google.SiriETGooglePubsubUpdater; import org.opentripplanner.ext.vehiclerentalservicedirectory.VehicleRentalServiceDirectoryFetcher; import org.opentripplanner.ext.vehiclerentalservicedirectory.api.VehicleRentalServiceDirectoryFetcherParameters; import org.opentripplanner.framework.io.OtpHttpClientFactory; @@ -22,6 +18,10 @@ import org.opentripplanner.updater.GraphUpdaterManager; import org.opentripplanner.updater.UpdatersParameters; import org.opentripplanner.updater.alert.GtfsRealtimeAlertsUpdater; +import org.opentripplanner.updater.siri.SiriTimetableSnapshotSource; +import org.opentripplanner.updater.siri.updater.SiriETUpdater; +import org.opentripplanner.updater.siri.updater.SiriSXUpdater; +import org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdater; import org.opentripplanner.updater.spi.GraphUpdater; import org.opentripplanner.updater.spi.TimetableSnapshotFlush; import org.opentripplanner.updater.trip.MqttGtfsRealtimeUpdater; diff --git a/src/main/java/org/opentripplanner/updater/images/snapshot-manager-1.excalidraw b/application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-1.excalidraw similarity index 100% rename from src/main/java/org/opentripplanner/updater/images/snapshot-manager-1.excalidraw rename to application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-1.excalidraw diff --git a/src/main/java/org/opentripplanner/updater/images/snapshot-manager-1.svg b/application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-1.svg similarity index 100% rename from src/main/java/org/opentripplanner/updater/images/snapshot-manager-1.svg rename to application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-1.svg diff --git a/src/main/java/org/opentripplanner/updater/images/snapshot-manager-2.excalidraw b/application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-2.excalidraw similarity index 100% rename from src/main/java/org/opentripplanner/updater/images/snapshot-manager-2.excalidraw rename to application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-2.excalidraw diff --git a/src/main/java/org/opentripplanner/updater/images/snapshot-manager-2.svg b/application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-2.svg similarity index 100% rename from src/main/java/org/opentripplanner/updater/images/snapshot-manager-2.svg rename to application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-2.svg diff --git a/src/main/java/org/opentripplanner/updater/images/snapshot-manager-3.excalidraw b/application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-3.excalidraw similarity index 100% rename from src/main/java/org/opentripplanner/updater/images/snapshot-manager-3.excalidraw rename to application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-3.excalidraw diff --git a/src/main/java/org/opentripplanner/updater/images/snapshot-manager-3.svg b/application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-3.svg similarity index 100% rename from src/main/java/org/opentripplanner/updater/images/snapshot-manager-3.svg rename to application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-3.svg diff --git a/src/main/java/org/opentripplanner/updater/images/snapshot-manager-4.excalidraw b/application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-4.excalidraw similarity index 100% rename from src/main/java/org/opentripplanner/updater/images/snapshot-manager-4.excalidraw rename to application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-4.excalidraw diff --git a/src/main/java/org/opentripplanner/updater/images/snapshot-manager-4.svg b/application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-4.svg similarity index 100% rename from src/main/java/org/opentripplanner/updater/images/snapshot-manager-4.svg rename to application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-4.svg diff --git a/src/main/java/org/opentripplanner/updater/images/snapshot-manager-5.excalidraw b/application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-5.excalidraw similarity index 100% rename from src/main/java/org/opentripplanner/updater/images/snapshot-manager-5.excalidraw rename to application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-5.excalidraw diff --git a/src/main/java/org/opentripplanner/updater/images/snapshot-manager-5.svg b/application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-5.svg similarity index 100% rename from src/main/java/org/opentripplanner/updater/images/snapshot-manager-5.svg rename to application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-5.svg diff --git a/src/main/java/org/opentripplanner/updater/images/snapshot-manager-6.excalidraw b/application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-6.excalidraw similarity index 100% rename from src/main/java/org/opentripplanner/updater/images/snapshot-manager-6.excalidraw rename to application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-6.excalidraw diff --git a/src/main/java/org/opentripplanner/updater/images/snapshot-manager-6.svg b/application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-6.svg similarity index 100% rename from src/main/java/org/opentripplanner/updater/images/snapshot-manager-6.svg rename to application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-6.svg diff --git a/src/main/java/org/opentripplanner/updater/images/snapshot-manager-7.excalidraw b/application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-7.excalidraw similarity index 100% rename from src/main/java/org/opentripplanner/updater/images/snapshot-manager-7.excalidraw rename to application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-7.excalidraw diff --git a/src/main/java/org/opentripplanner/updater/images/snapshot-manager-7.svg b/application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-7.svg similarity index 100% rename from src/main/java/org/opentripplanner/updater/images/snapshot-manager-7.svg rename to application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-7.svg diff --git a/src/main/java/org/opentripplanner/updater/images/snapshot-manager-8.excalidraw b/application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-8.excalidraw similarity index 100% rename from src/main/java/org/opentripplanner/updater/images/snapshot-manager-8.excalidraw rename to application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-8.excalidraw diff --git a/src/main/java/org/opentripplanner/updater/images/snapshot-manager-8.svg b/application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-8.svg similarity index 100% rename from src/main/java/org/opentripplanner/updater/images/snapshot-manager-8.svg rename to application/src/main/java/org/opentripplanner/updater/images/snapshot-manager-8.svg diff --git a/src/main/java/org/opentripplanner/updater/images/timetable-lookup.excalidraw b/application/src/main/java/org/opentripplanner/updater/images/timetable-lookup.excalidraw similarity index 100% rename from src/main/java/org/opentripplanner/updater/images/timetable-lookup.excalidraw rename to application/src/main/java/org/opentripplanner/updater/images/timetable-lookup.excalidraw diff --git a/src/main/java/org/opentripplanner/updater/images/timetable-lookup.svg b/application/src/main/java/org/opentripplanner/updater/images/timetable-lookup.svg similarity index 100% rename from src/main/java/org/opentripplanner/updater/images/timetable-lookup.svg rename to application/src/main/java/org/opentripplanner/updater/images/timetable-lookup.svg diff --git a/src/main/java/org/opentripplanner/updater/images/updater-threads-queues.excalidraw b/application/src/main/java/org/opentripplanner/updater/images/updater-threads-queues.excalidraw similarity index 100% rename from src/main/java/org/opentripplanner/updater/images/updater-threads-queues.excalidraw rename to application/src/main/java/org/opentripplanner/updater/images/updater-threads-queues.excalidraw diff --git a/src/main/java/org/opentripplanner/updater/images/updater-threads-queues.svg b/application/src/main/java/org/opentripplanner/updater/images/updater-threads-queues.svg similarity index 100% rename from src/main/java/org/opentripplanner/updater/images/updater-threads-queues.svg rename to application/src/main/java/org/opentripplanner/updater/images/updater-threads-queues.svg diff --git a/src/main/java/org/opentripplanner/updater/package.md b/application/src/main/java/org/opentripplanner/updater/package.md similarity index 100% rename from src/main/java/org/opentripplanner/updater/package.md rename to application/src/main/java/org/opentripplanner/updater/package.md diff --git a/src/ext/java/org/opentripplanner/ext/siri/AddedTripBuilder.java b/application/src/main/java/org/opentripplanner/updater/siri/AddedTripBuilder.java similarity index 98% rename from src/ext/java/org/opentripplanner/ext/siri/AddedTripBuilder.java rename to application/src/main/java/org/opentripplanner/updater/siri/AddedTripBuilder.java index cdbaa8f3d4c..b3f9a3e4e00 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/AddedTripBuilder.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/AddedTripBuilder.java @@ -1,7 +1,7 @@ -package org.opentripplanner.ext.siri; +package org.opentripplanner.updater.siri; import static java.lang.Boolean.TRUE; -import static org.opentripplanner.ext.siri.mapper.SiriTransportModeMapper.mapTransitMainMode; +import static org.opentripplanner.updater.siri.mapper.SiriTransportModeMapper.mapTransitMainMode; import static org.opentripplanner.updater.spi.UpdateError.UpdateErrorType.CANNOT_RESOLVE_AGENCY; import static org.opentripplanner.updater.spi.UpdateError.UpdateErrorType.NO_START_DATE; import static org.opentripplanner.updater.spi.UpdateError.UpdateErrorType.NO_VALID_STOPS; @@ -14,9 +14,7 @@ import java.util.List; import java.util.Objects; import java.util.function.Function; -import javax.annotation.Nonnull; import javax.annotation.Nullable; -import org.opentripplanner.ext.siri.mapper.PickDropMapper; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.framework.time.ServiceDateUtils; import org.opentripplanner.model.StopTime; @@ -36,6 +34,7 @@ import org.opentripplanner.transit.model.timetable.TripOnServiceDate; import org.opentripplanner.transit.model.timetable.TripTimesFactory; import org.opentripplanner.transit.service.TransitEditorService; +import org.opentripplanner.updater.siri.mapper.PickDropMapper; import org.opentripplanner.updater.spi.DataValidationExceptionMapper; import org.opentripplanner.updater.spi.UpdateError; import org.rutebanken.netex.model.BusSubmodeEnumeration; @@ -210,13 +209,6 @@ Result build() { // TODO: We always create a new TripPattern to be able to modify its scheduled timetable StopPattern stopPattern = new StopPattern(aimedStopTimes); - TripPattern pattern = TripPattern - .of(getTripPatternId.apply(trip)) - .withRoute(trip.getRoute()) - .withMode(trip.getMode()) - .withNetexSubmode(trip.getNetexSubMode()) - .withStopPattern(stopPattern) - .build(); RealTimeTripTimes tripTimes = TripTimesFactory.tripTimes( trip, @@ -229,7 +221,16 @@ Result build() { // therefore they must be valid tripTimes.validateNonIncreasingTimes(); tripTimes.setServiceCode(transitService.getServiceCodeForId(trip.getServiceId())); - pattern.add(tripTimes); + + TripPattern pattern = TripPattern + .of(getTripPatternId.apply(trip)) + .withRoute(trip.getRoute()) + .withMode(trip.getMode()) + .withNetexSubmode(trip.getNetexSubMode()) + .withStopPattern(stopPattern) + .withScheduledTimeTableBuilder(builder -> builder.addTripTimes(tripTimes)) + .build(); + RealTimeTripTimes updatedTripTimes = tripTimes.copyScheduledTimes(); // Loop through calls again and apply updates @@ -284,7 +285,6 @@ Result build() { * * @return a new Route */ - @Nonnull private Route createRoute(Agency agency) { var routeBuilder = Route.of(entityResolver.resolveId(lineRef)); diff --git a/src/ext/java/org/opentripplanner/ext/siri/CallWrapper.java b/application/src/main/java/org/opentripplanner/updater/siri/CallWrapper.java similarity index 99% rename from src/ext/java/org/opentripplanner/ext/siri/CallWrapper.java rename to application/src/main/java/org/opentripplanner/updater/siri/CallWrapper.java index 82649e08afb..5b89e6cc50e 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/CallWrapper.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/CallWrapper.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri; +package org.opentripplanner.updater.siri; import java.time.ZonedDateTime; import java.util.ArrayList; diff --git a/src/ext/java/org/opentripplanner/ext/siri/DebugString.java b/application/src/main/java/org/opentripplanner/updater/siri/DebugString.java similarity index 97% rename from src/ext/java/org/opentripplanner/ext/siri/DebugString.java rename to application/src/main/java/org/opentripplanner/updater/siri/DebugString.java index d6b1e573599..e8265856245 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/DebugString.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/DebugString.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri; +package org.opentripplanner.updater.siri; import org.opentripplanner.framework.tostring.ToStringBuilder; import uk.org.siri.siri20.DataFrameRefStructure; diff --git a/src/ext/java/org/opentripplanner/ext/siri/EntityResolver.java b/application/src/main/java/org/opentripplanner/updater/siri/EntityResolver.java similarity index 97% rename from src/ext/java/org/opentripplanner/ext/siri/EntityResolver.java rename to application/src/main/java/org/opentripplanner/updater/siri/EntityResolver.java index 3c142ac693d..1bce3e63974 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/EntityResolver.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/EntityResolver.java @@ -1,12 +1,9 @@ -package org.opentripplanner.ext.siri; +package org.opentripplanner.updater.siri; import java.time.Duration; import java.time.LocalDate; import java.time.ZonedDateTime; import java.time.format.DateTimeParseException; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; import javax.annotation.Nullable; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.Route; @@ -15,7 +12,6 @@ import org.opentripplanner.transit.model.timetable.Trip; import org.opentripplanner.transit.model.timetable.TripIdAndServiceDate; import org.opentripplanner.transit.model.timetable.TripOnServiceDate; -import org.opentripplanner.transit.model.timetable.TripOnServiceDateBuilder; import org.opentripplanner.transit.service.TransitService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -23,7 +19,6 @@ import uk.org.siri.siri20.EstimatedVehicleJourney; import uk.org.siri.siri20.FramedVehicleJourneyRefStructure; import uk.org.siri.siri20.MonitoredVehicleJourneyStructure; -import uk.org.siri.siri20.VehicleJourneyRef; /** * This class is responsible for resolving references to various entities in the transit model for diff --git a/src/ext/java/org/opentripplanner/ext/siri/ModifiedTripBuilder.java b/application/src/main/java/org/opentripplanner/updater/siri/ModifiedTripBuilder.java similarity index 98% rename from src/ext/java/org/opentripplanner/ext/siri/ModifiedTripBuilder.java rename to application/src/main/java/org/opentripplanner/updater/siri/ModifiedTripBuilder.java index 5c21be364a5..68435290d1b 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/ModifiedTripBuilder.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/ModifiedTripBuilder.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri; +package org.opentripplanner.updater.siri; import static java.lang.Boolean.TRUE; import static org.opentripplanner.model.PickDrop.NONE; @@ -10,7 +10,6 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import org.opentripplanner.ext.siri.mapper.PickDropMapper; import org.opentripplanner.framework.time.ServiceDateUtils; import org.opentripplanner.transit.model.framework.DataValidationException; import org.opentripplanner.transit.model.framework.Result; @@ -21,6 +20,7 @@ import org.opentripplanner.transit.model.timetable.RealTimeState; import org.opentripplanner.transit.model.timetable.RealTimeTripTimes; import org.opentripplanner.transit.model.timetable.TripTimes; +import org.opentripplanner.updater.siri.mapper.PickDropMapper; import org.opentripplanner.updater.spi.DataValidationExceptionMapper; import org.opentripplanner.updater.spi.UpdateError; import org.slf4j.Logger; diff --git a/src/ext/java/org/opentripplanner/ext/siri/SiriAlertsUpdateHandler.java b/application/src/main/java/org/opentripplanner/updater/siri/SiriAlertsUpdateHandler.java similarity index 98% rename from src/ext/java/org/opentripplanner/ext/siri/SiriAlertsUpdateHandler.java rename to application/src/main/java/org/opentripplanner/updater/siri/SiriAlertsUpdateHandler.java index 1a2d82df843..a5817eca41b 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/SiriAlertsUpdateHandler.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/SiriAlertsUpdateHandler.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri; +package org.opentripplanner.updater.siri; import java.time.Duration; import java.time.ZonedDateTime; @@ -8,8 +8,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.opentripplanner.ext.siri.mapper.AffectsMapper; -import org.opentripplanner.ext.siri.mapper.SiriSeverityMapper; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.framework.i18n.TranslatedString; @@ -21,6 +19,8 @@ import org.opentripplanner.routing.services.TransitAlertService; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.updater.RealTimeUpdateContext; +import org.opentripplanner.updater.siri.mapper.AffectsMapper; +import org.opentripplanner.updater.siri.mapper.SiriSeverityMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import uk.org.siri.siri20.DefaultedTextStructure; diff --git a/src/ext/java/org/opentripplanner/ext/siri/SiriFuzzyTripMatcher.java b/application/src/main/java/org/opentripplanner/updater/siri/SiriFuzzyTripMatcher.java similarity index 96% rename from src/ext/java/org/opentripplanner/ext/siri/SiriFuzzyTripMatcher.java rename to application/src/main/java/org/opentripplanner/updater/siri/SiriFuzzyTripMatcher.java index ed5e9818b32..db3fa50e94c 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/SiriFuzzyTripMatcher.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/SiriFuzzyTripMatcher.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri; +package org.opentripplanner.updater.siri; import java.time.LocalDate; import java.time.ZonedDateTime; @@ -10,7 +10,6 @@ import java.util.Set; import java.util.function.BiFunction; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.framework.time.ServiceDateUtils; import org.opentripplanner.model.Timetable; @@ -88,7 +87,7 @@ public TripAndPattern match( EstimatedVehicleJourney journey, EntityResolver entityResolver, BiFunction getCurrentTimetable, - BiFunction getRealtimeAddedTripPattern + BiFunction getNewTripPatternForModifiedTrip ) { List calls = CallWrapper.of(journey); @@ -137,7 +136,7 @@ public TripAndPattern match( calls, entityResolver, getCurrentTimetable, - getRealtimeAddedTripPattern + getNewTripPatternForModifiedTrip ); } @@ -196,7 +195,6 @@ private static String createStartStopKey(String lastStopId, int lastStopArrivalT return lastStopId + ":" + lastStopArrivalTime; } - @Nonnull private Set getMatchingTripsOnStopOrSiblings( String lastStopPoint, ZonedDateTime arrivalTime, @@ -261,7 +259,7 @@ TripAndPattern getTripAndPatternForJourney( List calls, EntityResolver entityResolver, BiFunction getCurrentTimetable, - BiFunction getRealtimeAddedTripPattern + BiFunction getNewTripPatternForModifiedTrip ) { var journeyFirstStop = entityResolver.resolveQuay(calls.getFirst().getStopPointRef()); var journeyLastStop = entityResolver.resolveQuay(calls.getLast().getStopPointRef()); @@ -284,9 +282,12 @@ TripAndPattern getTripAndPatternForJourney( continue; } - var realTimeAddedTripPattern = getRealtimeAddedTripPattern.apply(trip.getId(), serviceDate); - TripPattern tripPattern = realTimeAddedTripPattern != null - ? realTimeAddedTripPattern + var newTripPatternForModifiedTrip = getNewTripPatternForModifiedTrip.apply( + trip.getId(), + serviceDate + ); + TripPattern tripPattern = newTripPatternForModifiedTrip != null + ? newTripPatternForModifiedTrip : transitService.getPatternForTrip(trip); var firstStop = tripPattern.firstStop(); diff --git a/src/ext/java/org/opentripplanner/ext/siri/SiriTimetableSnapshotSource.java b/application/src/main/java/org/opentripplanner/updater/siri/SiriTimetableSnapshotSource.java similarity index 99% rename from src/ext/java/org/opentripplanner/ext/siri/SiriTimetableSnapshotSource.java rename to application/src/main/java/org/opentripplanner/updater/siri/SiriTimetableSnapshotSource.java index 7746df7d02f..ad49af38235 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/SiriTimetableSnapshotSource.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/SiriTimetableSnapshotSource.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri; +package org.opentripplanner.updater.siri; import static java.lang.Boolean.TRUE; import static org.opentripplanner.updater.spi.UpdateError.UpdateErrorType.NOT_MONITORED; @@ -244,7 +244,7 @@ private Result handleModifiedTrip( estimatedVehicleJourney, entityResolver, this::getCurrentTimetable, - snapshotManager::getRealtimeAddedTripPattern + snapshotManager::getNewTripPatternForModifiedTrip ); if (tripAndPattern == null) { diff --git a/src/ext/java/org/opentripplanner/ext/siri/SiriTripPatternCache.java b/application/src/main/java/org/opentripplanner/updater/siri/SiriTripPatternCache.java similarity index 97% rename from src/ext/java/org/opentripplanner/ext/siri/SiriTripPatternCache.java rename to application/src/main/java/org/opentripplanner/updater/siri/SiriTripPatternCache.java index 40c008d0004..b750df8b69f 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/SiriTripPatternCache.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/SiriTripPatternCache.java @@ -1,10 +1,9 @@ -package org.opentripplanner.ext.siri; +package org.opentripplanner.updater.siri; import java.time.LocalDate; import java.util.HashMap; import java.util.Map; import java.util.function.Function; -import javax.annotation.Nonnull; import org.opentripplanner.transit.model.network.StopPattern; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.timetable.Trip; @@ -71,9 +70,9 @@ public SiriTripPatternCache( * @return cached or newly created trip pattern */ public synchronized TripPattern getOrCreateTripPattern( - @Nonnull final StopPattern stopPattern, - @Nonnull final Trip trip, - @Nonnull LocalDate serviceDate + final StopPattern stopPattern, + final Trip trip, + LocalDate serviceDate ) { TripPattern originalTripPattern = getPatternForTrip.apply(trip); diff --git a/src/ext/java/org/opentripplanner/ext/siri/SiriTripPatternIdGenerator.java b/application/src/main/java/org/opentripplanner/updater/siri/SiriTripPatternIdGenerator.java similarity index 97% rename from src/ext/java/org/opentripplanner/ext/siri/SiriTripPatternIdGenerator.java rename to application/src/main/java/org/opentripplanner/updater/siri/SiriTripPatternIdGenerator.java index 1b56938d712..c8ecc5e86a1 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/SiriTripPatternIdGenerator.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/SiriTripPatternIdGenerator.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri; +package org.opentripplanner.updater.siri; import java.util.concurrent.atomic.AtomicInteger; import org.opentripplanner.gtfs.GenerateTripPatternsOperation; diff --git a/src/ext/java/org/opentripplanner/ext/siri/TimetableHelper.java b/application/src/main/java/org/opentripplanner/updater/siri/TimetableHelper.java similarity index 97% rename from src/ext/java/org/opentripplanner/ext/siri/TimetableHelper.java rename to application/src/main/java/org/opentripplanner/updater/siri/TimetableHelper.java index fea8bda686f..870316403f6 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/TimetableHelper.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/TimetableHelper.java @@ -1,13 +1,13 @@ -package org.opentripplanner.ext.siri; +package org.opentripplanner.updater.siri; import static java.lang.Boolean.TRUE; import java.time.ZonedDateTime; import java.util.function.Supplier; -import org.opentripplanner.ext.siri.mapper.OccupancyMapper; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.framework.time.ServiceDateUtils; import org.opentripplanner.transit.model.timetable.RealTimeTripTimes; +import org.opentripplanner.updater.siri.mapper.OccupancyMapper; import uk.org.siri.siri20.NaturalLanguageStringStructure; import uk.org.siri.siri20.OccupancyEnumeration; diff --git a/src/ext/java/org/opentripplanner/ext/siri/TripAndPattern.java b/application/src/main/java/org/opentripplanner/updater/siri/TripAndPattern.java similarity index 81% rename from src/ext/java/org/opentripplanner/ext/siri/TripAndPattern.java rename to application/src/main/java/org/opentripplanner/updater/siri/TripAndPattern.java index e8d700d8c72..2d3b547c356 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/TripAndPattern.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/TripAndPattern.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri; +package org.opentripplanner.updater.siri; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.timetable.Trip; diff --git a/src/ext/java/org/opentripplanner/ext/siri/TripUpdate.java b/application/src/main/java/org/opentripplanner/updater/siri/TripUpdate.java similarity index 97% rename from src/ext/java/org/opentripplanner/ext/siri/TripUpdate.java rename to application/src/main/java/org/opentripplanner/updater/siri/TripUpdate.java index 9874e9d0825..71c521b76fb 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/TripUpdate.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/TripUpdate.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri; +package org.opentripplanner.updater.siri; import java.time.LocalDate; import java.util.Objects; diff --git a/src/ext/java/org/opentripplanner/ext/siri/mapper/AffectsMapper.java b/application/src/main/java/org/opentripplanner/updater/siri/mapper/AffectsMapper.java similarity index 98% rename from src/ext/java/org/opentripplanner/ext/siri/mapper/AffectsMapper.java rename to application/src/main/java/org/opentripplanner/updater/siri/mapper/AffectsMapper.java index a1fb943f60c..a600f26c640 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/mapper/AffectsMapper.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/mapper/AffectsMapper.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri.mapper; +package org.opentripplanner.updater.siri.mapper; import java.io.Serializable; import java.time.LocalDate; @@ -6,14 +6,14 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import org.opentripplanner.ext.siri.EntityResolver; -import org.opentripplanner.ext.siri.SiriFuzzyTripMatcher; import org.opentripplanner.routing.alertpatch.EntitySelector; import org.opentripplanner.routing.alertpatch.StopCondition; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.timetable.Trip; import org.opentripplanner.transit.model.timetable.TripOnServiceDate; import org.opentripplanner.transit.service.TransitService; +import org.opentripplanner.updater.siri.EntityResolver; +import org.opentripplanner.updater.siri.SiriFuzzyTripMatcher; import uk.org.ifopt.siri20.StopPlaceRef; import uk.org.siri.siri20.AffectedLineStructure; import uk.org.siri.siri20.AffectedOperatorStructure; diff --git a/src/ext/java/org/opentripplanner/ext/siri/mapper/OccupancyMapper.java b/application/src/main/java/org/opentripplanner/updater/siri/mapper/OccupancyMapper.java similarity index 92% rename from src/ext/java/org/opentripplanner/ext/siri/mapper/OccupancyMapper.java rename to application/src/main/java/org/opentripplanner/updater/siri/mapper/OccupancyMapper.java index 61b7a15798a..310846ebf9a 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/mapper/OccupancyMapper.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/mapper/OccupancyMapper.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri.mapper; +package org.opentripplanner.updater.siri.mapper; import org.opentripplanner.transit.model.timetable.OccupancyStatus; import uk.org.siri.siri20.OccupancyEnumeration; diff --git a/src/ext/java/org/opentripplanner/ext/siri/mapper/PickDropMapper.java b/application/src/main/java/org/opentripplanner/updater/siri/mapper/PickDropMapper.java similarity index 96% rename from src/ext/java/org/opentripplanner/ext/siri/mapper/PickDropMapper.java rename to application/src/main/java/org/opentripplanner/updater/siri/mapper/PickDropMapper.java index d35696ec35e..a82000fa08f 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/mapper/PickDropMapper.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/mapper/PickDropMapper.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri.mapper; +package org.opentripplanner.updater.siri.mapper; import static java.lang.Boolean.TRUE; import static org.opentripplanner.model.PickDrop.CANCELLED; @@ -6,8 +6,8 @@ import static org.opentripplanner.model.PickDrop.SCHEDULED; import java.util.Optional; -import org.opentripplanner.ext.siri.CallWrapper; import org.opentripplanner.model.PickDrop; +import org.opentripplanner.updater.siri.CallWrapper; import uk.org.siri.siri20.CallStatusEnumeration; public class PickDropMapper { diff --git a/src/ext/java/org/opentripplanner/ext/siri/mapper/SiriSeverityMapper.java b/application/src/main/java/org/opentripplanner/updater/siri/mapper/SiriSeverityMapper.java similarity index 95% rename from src/ext/java/org/opentripplanner/ext/siri/mapper/SiriSeverityMapper.java rename to application/src/main/java/org/opentripplanner/updater/siri/mapper/SiriSeverityMapper.java index 3b4b315aeb9..26962c62bb8 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/mapper/SiriSeverityMapper.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/mapper/SiriSeverityMapper.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri.mapper; +package org.opentripplanner.updater.siri.mapper; import org.opentripplanner.routing.alertpatch.AlertSeverity; import uk.org.siri.siri20.SeverityEnumeration; diff --git a/src/ext/java/org/opentripplanner/ext/siri/mapper/SiriTransportModeMapper.java b/application/src/main/java/org/opentripplanner/updater/siri/mapper/SiriTransportModeMapper.java similarity index 93% rename from src/ext/java/org/opentripplanner/ext/siri/mapper/SiriTransportModeMapper.java rename to application/src/main/java/org/opentripplanner/updater/siri/mapper/SiriTransportModeMapper.java index 02be6682140..7bae9d83436 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/mapper/SiriTransportModeMapper.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/mapper/SiriTransportModeMapper.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri.mapper; +package org.opentripplanner.updater.siri.mapper; import java.util.List; import org.opentripplanner.transit.model.basic.TransitMode; diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/AsyncEstimatedTimetableProcessor.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/AsyncEstimatedTimetableProcessor.java similarity index 96% rename from src/ext/java/org/opentripplanner/ext/siri/updater/AsyncEstimatedTimetableProcessor.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/AsyncEstimatedTimetableProcessor.java index db36936afd9..efcfab77a46 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/updater/AsyncEstimatedTimetableProcessor.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/AsyncEstimatedTimetableProcessor.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri.updater; +package org.opentripplanner.updater.siri.updater; import java.util.concurrent.Future; import java.util.function.Consumer; diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/AsyncEstimatedTimetableSource.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/AsyncEstimatedTimetableSource.java similarity index 95% rename from src/ext/java/org/opentripplanner/ext/siri/updater/AsyncEstimatedTimetableSource.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/AsyncEstimatedTimetableSource.java index 9a70c9d5615..b2fe96ba80f 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/updater/AsyncEstimatedTimetableSource.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/AsyncEstimatedTimetableSource.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri.updater; +package org.opentripplanner.updater.siri.updater; import java.util.concurrent.Future; import java.util.function.Function; diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/EstimatedTimetableHandler.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/EstimatedTimetableHandler.java similarity index 91% rename from src/ext/java/org/opentripplanner/ext/siri/updater/EstimatedTimetableHandler.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/EstimatedTimetableHandler.java index aa2882d8fe2..367055c6f66 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/updater/EstimatedTimetableHandler.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/EstimatedTimetableHandler.java @@ -1,8 +1,8 @@ -package org.opentripplanner.ext.siri.updater; +package org.opentripplanner.updater.siri.updater; import java.util.List; -import org.opentripplanner.ext.siri.SiriTimetableSnapshotSource; import org.opentripplanner.updater.RealTimeUpdateContext; +import org.opentripplanner.updater.siri.SiriTimetableSnapshotSource; import org.opentripplanner.updater.spi.UpdateResult; import org.opentripplanner.updater.trip.UpdateIncrementality; import uk.org.siri.siri20.EstimatedTimetableDeliveryStructure; diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/EstimatedTimetableSource.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/EstimatedTimetableSource.java similarity index 94% rename from src/ext/java/org/opentripplanner/ext/siri/updater/EstimatedTimetableSource.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/EstimatedTimetableSource.java index c86be9629d2..f8a1b549c96 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/updater/EstimatedTimetableSource.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/EstimatedTimetableSource.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri.updater; +package org.opentripplanner.updater.siri.updater; import java.util.Optional; import org.opentripplanner.updater.trip.UpdateIncrementality; diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/SiriETHttpTripUpdateSource.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETHttpTripUpdateSource.java similarity index 98% rename from src/ext/java/org/opentripplanner/ext/siri/updater/SiriETHttpTripUpdateSource.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETHttpTripUpdateSource.java index 534539ead57..fec6e2885a7 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/updater/SiriETHttpTripUpdateSource.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETHttpTripUpdateSource.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri.updater; +package org.opentripplanner.updater.siri.updater; import static org.opentripplanner.updater.trip.UpdateIncrementality.DIFFERENTIAL; import static org.opentripplanner.updater.trip.UpdateIncrementality.FULL_DATASET; diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/SiriETUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java similarity index 96% rename from src/ext/java/org/opentripplanner/ext/siri/updater/SiriETUpdater.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java index 3b2ec5984d3..087bf28e875 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/updater/SiriETUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java @@ -1,8 +1,8 @@ -package org.opentripplanner.ext.siri.updater; +package org.opentripplanner.updater.siri.updater; import java.util.List; import java.util.function.Consumer; -import org.opentripplanner.ext.siri.SiriTimetableSnapshotSource; +import org.opentripplanner.updater.siri.SiriTimetableSnapshotSource; import org.opentripplanner.updater.spi.PollingGraphUpdater; import org.opentripplanner.updater.spi.ResultLogger; import org.opentripplanner.updater.spi.UpdateResult; diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/SiriETUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java similarity index 93% rename from src/ext/java/org/opentripplanner/ext/siri/updater/SiriETUpdaterParameters.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java index 8e2bf7dedf2..8bbe66559c6 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/updater/SiriETUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri.updater; +package org.opentripplanner.updater.siri.updater; import java.time.Duration; import org.opentripplanner.updater.spi.HttpHeaders; diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/SiriFileLoader.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriFileLoader.java similarity index 98% rename from src/ext/java/org/opentripplanner/ext/siri/updater/SiriFileLoader.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/SiriFileLoader.java index 84da542ef47..dea656f46ff 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/updater/SiriFileLoader.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriFileLoader.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri.updater; +package org.opentripplanner.updater.siri.updater; import java.io.File; import java.io.FileInputStream; diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/SiriHelper.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriHelper.java similarity index 98% rename from src/ext/java/org/opentripplanner/ext/siri/updater/SiriHelper.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/SiriHelper.java index 0f1bd449075..0b9c7c61413 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/updater/SiriHelper.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriHelper.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri.updater; +package org.opentripplanner.updater.siri.updater; import jakarta.xml.bind.JAXBException; import java.io.InputStream; diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/SiriHttpLoader.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriHttpLoader.java similarity index 98% rename from src/ext/java/org/opentripplanner/ext/siri/updater/SiriHttpLoader.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/SiriHttpLoader.java index daf3d0397cc..0ad9309e354 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/updater/SiriHttpLoader.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriHttpLoader.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri.updater; +package org.opentripplanner.updater.siri.updater; import jakarta.xml.bind.JAXBException; import java.time.Duration; diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/SiriLoader.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLoader.java similarity index 90% rename from src/ext/java/org/opentripplanner/ext/siri/updater/SiriLoader.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLoader.java index 785bcbaa826..953aa555ca5 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/updater/SiriLoader.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLoader.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri.updater; +package org.opentripplanner.updater.siri.updater; import jakarta.xml.bind.JAXBException; import java.util.Optional; diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/SiriSXUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java similarity index 98% rename from src/ext/java/org/opentripplanner/ext/siri/updater/SiriSXUpdater.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java index 6ef7f504e85..5eeb6ffc66e 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/updater/SiriSXUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java @@ -1,10 +1,9 @@ -package org.opentripplanner.ext.siri.updater; +package org.opentripplanner.updater.siri.updater; import java.time.Duration; import java.time.ZonedDateTime; import java.util.Optional; import java.util.UUID; -import org.opentripplanner.ext.siri.SiriAlertsUpdateHandler; import org.opentripplanner.framework.io.OtpHttpClientException; import org.opentripplanner.framework.retry.OtpRetry; import org.opentripplanner.framework.retry.OtpRetryBuilder; @@ -12,6 +11,7 @@ import org.opentripplanner.routing.services.TransitAlertService; import org.opentripplanner.transit.service.TransitModel; import org.opentripplanner.updater.alert.TransitAlertProvider; +import org.opentripplanner.updater.siri.SiriAlertsUpdateHandler; import org.opentripplanner.updater.spi.PollingGraphUpdater; import org.opentripplanner.updater.spi.WriteToGraphCallback; import org.slf4j.Logger; diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/SiriSXUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdaterParameters.java similarity index 89% rename from src/ext/java/org/opentripplanner/ext/siri/updater/SiriSXUpdaterParameters.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdaterParameters.java index 183e296a98c..f51584f86f5 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/updater/SiriSXUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdaterParameters.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri.updater; +package org.opentripplanner.updater.siri.updater; import java.time.Duration; import org.opentripplanner.updater.spi.HttpHeaders; diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/google/GooglePubsubEstimatedTimetableSource.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/google/GooglePubsubEstimatedTimetableSource.java similarity index 99% rename from src/ext/java/org/opentripplanner/ext/siri/updater/google/GooglePubsubEstimatedTimetableSource.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/google/GooglePubsubEstimatedTimetableSource.java index 88b04feb9c5..4592d102d1d 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/updater/google/GooglePubsubEstimatedTimetableSource.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/google/GooglePubsubEstimatedTimetableSource.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri.updater.google; +package org.opentripplanner.updater.siri.updater.google; import com.google.api.gax.rpc.NotFoundException; import com.google.cloud.pubsub.v1.AckReplyConsumer; @@ -25,13 +25,13 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.function.Function; import org.entur.protobuf.mapper.SiriMapper; -import org.opentripplanner.ext.siri.updater.AsyncEstimatedTimetableSource; import org.opentripplanner.framework.application.ApplicationShutdownSupport; import org.opentripplanner.framework.io.OtpHttpClientFactory; import org.opentripplanner.framework.retry.OtpRetry; import org.opentripplanner.framework.retry.OtpRetryBuilder; import org.opentripplanner.framework.text.FileSizeToTextConverter; import org.opentripplanner.framework.time.DurationUtils; +import org.opentripplanner.updater.siri.updater.AsyncEstimatedTimetableSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import uk.org.siri.siri20.ServiceDelivery; diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/google/SiriETGooglePubsubUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/google/SiriETGooglePubsubUpdater.java similarity index 86% rename from src/ext/java/org/opentripplanner/ext/siri/updater/google/SiriETGooglePubsubUpdater.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/google/SiriETGooglePubsubUpdater.java index 7680e535bfa..ae97c14b5b1 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/updater/google/SiriETGooglePubsubUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/google/SiriETGooglePubsubUpdater.java @@ -1,10 +1,10 @@ -package org.opentripplanner.ext.siri.updater.google; +package org.opentripplanner.updater.siri.updater.google; import java.util.function.Consumer; -import org.opentripplanner.ext.siri.SiriTimetableSnapshotSource; -import org.opentripplanner.ext.siri.updater.AsyncEstimatedTimetableProcessor; -import org.opentripplanner.ext.siri.updater.AsyncEstimatedTimetableSource; -import org.opentripplanner.ext.siri.updater.EstimatedTimetableHandler; +import org.opentripplanner.updater.siri.SiriTimetableSnapshotSource; +import org.opentripplanner.updater.siri.updater.AsyncEstimatedTimetableProcessor; +import org.opentripplanner.updater.siri.updater.AsyncEstimatedTimetableSource; +import org.opentripplanner.updater.siri.updater.EstimatedTimetableHandler; import org.opentripplanner.updater.spi.GraphUpdater; import org.opentripplanner.updater.spi.UpdateResult; import org.opentripplanner.updater.spi.WriteToGraphCallback; diff --git a/src/ext/java/org/opentripplanner/ext/siri/updater/google/SiriETGooglePubsubUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/google/SiriETGooglePubsubUpdaterParameters.java similarity index 93% rename from src/ext/java/org/opentripplanner/ext/siri/updater/google/SiriETGooglePubsubUpdaterParameters.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/google/SiriETGooglePubsubUpdaterParameters.java index c9e070311c6..fc698142adc 100644 --- a/src/ext/java/org/opentripplanner/ext/siri/updater/google/SiriETGooglePubsubUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/google/SiriETGooglePubsubUpdaterParameters.java @@ -1,14 +1,13 @@ -package org.opentripplanner.ext.siri.updater.google; +package org.opentripplanner.updater.siri.updater.google; import java.time.Duration; import java.util.Objects; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.framework.tostring.ToStringBuilder; import org.opentripplanner.updater.trip.UrlUpdaterParameters; public record SiriETGooglePubsubUpdaterParameters( - @Nonnull String configRef, + String configRef, @Nullable String feedId, String subscriptionProjectName, String topicProjectName, diff --git a/src/main/java/org/opentripplanner/updater/spi/DataSource.java b/application/src/main/java/org/opentripplanner/updater/spi/DataSource.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/spi/DataSource.java rename to application/src/main/java/org/opentripplanner/updater/spi/DataSource.java diff --git a/src/main/java/org/opentripplanner/updater/spi/DataValidationExceptionMapper.java b/application/src/main/java/org/opentripplanner/updater/spi/DataValidationExceptionMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/spi/DataValidationExceptionMapper.java rename to application/src/main/java/org/opentripplanner/updater/spi/DataValidationExceptionMapper.java diff --git a/src/main/java/org/opentripplanner/updater/spi/GenericJsonDataSource.java b/application/src/main/java/org/opentripplanner/updater/spi/GenericJsonDataSource.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/spi/GenericJsonDataSource.java rename to application/src/main/java/org/opentripplanner/updater/spi/GenericJsonDataSource.java diff --git a/src/main/java/org/opentripplanner/updater/spi/GraphUpdater.java b/application/src/main/java/org/opentripplanner/updater/spi/GraphUpdater.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/spi/GraphUpdater.java rename to application/src/main/java/org/opentripplanner/updater/spi/GraphUpdater.java diff --git a/src/main/java/org/opentripplanner/updater/spi/HttpHeaders.java b/application/src/main/java/org/opentripplanner/updater/spi/HttpHeaders.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/spi/HttpHeaders.java rename to application/src/main/java/org/opentripplanner/updater/spi/HttpHeaders.java diff --git a/src/main/java/org/opentripplanner/updater/spi/PollingGraphUpdater.java b/application/src/main/java/org/opentripplanner/updater/spi/PollingGraphUpdater.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/spi/PollingGraphUpdater.java rename to application/src/main/java/org/opentripplanner/updater/spi/PollingGraphUpdater.java diff --git a/src/main/java/org/opentripplanner/updater/spi/PollingGraphUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/spi/PollingGraphUpdaterParameters.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/spi/PollingGraphUpdaterParameters.java rename to application/src/main/java/org/opentripplanner/updater/spi/PollingGraphUpdaterParameters.java diff --git a/src/main/java/org/opentripplanner/updater/spi/ResultLogger.java b/application/src/main/java/org/opentripplanner/updater/spi/ResultLogger.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/spi/ResultLogger.java rename to application/src/main/java/org/opentripplanner/updater/spi/ResultLogger.java diff --git a/src/main/java/org/opentripplanner/updater/spi/TimetableSnapshotFlush.java b/application/src/main/java/org/opentripplanner/updater/spi/TimetableSnapshotFlush.java similarity index 95% rename from src/main/java/org/opentripplanner/updater/spi/TimetableSnapshotFlush.java rename to application/src/main/java/org/opentripplanner/updater/spi/TimetableSnapshotFlush.java index 3f5c8f4d23d..89dbeb23302 100644 --- a/src/main/java/org/opentripplanner/updater/spi/TimetableSnapshotFlush.java +++ b/application/src/main/java/org/opentripplanner/updater/spi/TimetableSnapshotFlush.java @@ -1,6 +1,6 @@ package org.opentripplanner.updater.spi; -import org.opentripplanner.ext.siri.SiriTimetableSnapshotSource; +import org.opentripplanner.updater.siri.SiriTimetableSnapshotSource; import org.opentripplanner.updater.trip.TimetableSnapshotSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/opentripplanner/updater/spi/UpdateError.java b/application/src/main/java/org/opentripplanner/updater/spi/UpdateError.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/spi/UpdateError.java rename to application/src/main/java/org/opentripplanner/updater/spi/UpdateError.java diff --git a/src/main/java/org/opentripplanner/updater/spi/UpdateResult.java b/application/src/main/java/org/opentripplanner/updater/spi/UpdateResult.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/spi/UpdateResult.java rename to application/src/main/java/org/opentripplanner/updater/spi/UpdateResult.java diff --git a/src/main/java/org/opentripplanner/updater/spi/UpdateSuccess.java b/application/src/main/java/org/opentripplanner/updater/spi/UpdateSuccess.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/spi/UpdateSuccess.java rename to application/src/main/java/org/opentripplanner/updater/spi/UpdateSuccess.java diff --git a/src/main/java/org/opentripplanner/updater/spi/UpdaterConstructionException.java b/application/src/main/java/org/opentripplanner/updater/spi/UpdaterConstructionException.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/spi/UpdaterConstructionException.java rename to application/src/main/java/org/opentripplanner/updater/spi/UpdaterConstructionException.java diff --git a/src/main/java/org/opentripplanner/updater/spi/WriteToGraphCallback.java b/application/src/main/java/org/opentripplanner/updater/spi/WriteToGraphCallback.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/spi/WriteToGraphCallback.java rename to application/src/main/java/org/opentripplanner/updater/spi/WriteToGraphCallback.java diff --git a/src/main/java/org/opentripplanner/updater/trip/AddedRoute.java b/application/src/main/java/org/opentripplanner/updater/trip/AddedRoute.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/trip/AddedRoute.java rename to application/src/main/java/org/opentripplanner/updater/trip/AddedRoute.java diff --git a/src/main/java/org/opentripplanner/updater/trip/AddedStopTime.java b/application/src/main/java/org/opentripplanner/updater/trip/AddedStopTime.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/trip/AddedStopTime.java rename to application/src/main/java/org/opentripplanner/updater/trip/AddedStopTime.java diff --git a/src/main/java/org/opentripplanner/updater/trip/BackwardsDelayPropagationType.java b/application/src/main/java/org/opentripplanner/updater/trip/BackwardsDelayPropagationType.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/trip/BackwardsDelayPropagationType.java rename to application/src/main/java/org/opentripplanner/updater/trip/BackwardsDelayPropagationType.java diff --git a/src/main/java/org/opentripplanner/updater/trip/GtfsRealtimeTripUpdateSource.java b/application/src/main/java/org/opentripplanner/updater/trip/GtfsRealtimeTripUpdateSource.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/trip/GtfsRealtimeTripUpdateSource.java rename to application/src/main/java/org/opentripplanner/updater/trip/GtfsRealtimeTripUpdateSource.java diff --git a/src/main/java/org/opentripplanner/updater/trip/MqttGtfsRealtimeUpdater.java b/application/src/main/java/org/opentripplanner/updater/trip/MqttGtfsRealtimeUpdater.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/trip/MqttGtfsRealtimeUpdater.java rename to application/src/main/java/org/opentripplanner/updater/trip/MqttGtfsRealtimeUpdater.java diff --git a/src/main/java/org/opentripplanner/updater/trip/MqttGtfsRealtimeUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/trip/MqttGtfsRealtimeUpdaterParameters.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/trip/MqttGtfsRealtimeUpdaterParameters.java rename to application/src/main/java/org/opentripplanner/updater/trip/MqttGtfsRealtimeUpdaterParameters.java diff --git a/src/main/java/org/opentripplanner/updater/trip/PollingTripUpdater.java b/application/src/main/java/org/opentripplanner/updater/trip/PollingTripUpdater.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/trip/PollingTripUpdater.java rename to application/src/main/java/org/opentripplanner/updater/trip/PollingTripUpdater.java diff --git a/src/main/java/org/opentripplanner/updater/trip/PollingTripUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/trip/PollingTripUpdaterParameters.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/trip/PollingTripUpdaterParameters.java rename to application/src/main/java/org/opentripplanner/updater/trip/PollingTripUpdaterParameters.java diff --git a/src/main/java/org/opentripplanner/updater/trip/TimetableSnapshotManager.java b/application/src/main/java/org/opentripplanner/updater/trip/TimetableSnapshotManager.java similarity index 97% rename from src/main/java/org/opentripplanner/updater/trip/TimetableSnapshotManager.java rename to application/src/main/java/org/opentripplanner/updater/trip/TimetableSnapshotManager.java index fc762347aec..e95afe399ab 100644 --- a/src/main/java/org/opentripplanner/updater/trip/TimetableSnapshotManager.java +++ b/application/src/main/java/org/opentripplanner/updater/trip/TimetableSnapshotManager.java @@ -118,8 +118,8 @@ void commitTimetableSnapshot(final boolean force) { * @return trip pattern created by the updater; null if pattern has not been changed for this trip. */ @Nullable - public TripPattern getRealtimeAddedTripPattern(FeedScopedId tripId, LocalDate serviceDate) { - return buffer.getRealtimeAddedTripPattern(tripId, serviceDate); + public TripPattern getNewTripPatternForModifiedTrip(FeedScopedId tripId, LocalDate serviceDate) { + return buffer.getNewTripPatternForModifiedTrip(tripId, serviceDate); } /** diff --git a/src/main/java/org/opentripplanner/updater/trip/TimetableSnapshotSource.java b/application/src/main/java/org/opentripplanner/updater/trip/TimetableSnapshotSource.java similarity index 99% rename from src/main/java/org/opentripplanner/updater/trip/TimetableSnapshotSource.java rename to application/src/main/java/org/opentripplanner/updater/trip/TimetableSnapshotSource.java index 03ce9052331..6273de676b5 100644 --- a/src/main/java/org/opentripplanner/updater/trip/TimetableSnapshotSource.java +++ b/application/src/main/java/org/opentripplanner/updater/trip/TimetableSnapshotSource.java @@ -35,7 +35,6 @@ import java.util.Objects; import java.util.Set; import java.util.function.Supplier; -import javax.annotation.Nonnull; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.framework.lang.StringUtils; @@ -295,7 +294,10 @@ private void purgePatternModifications( FeedScopedId tripId, LocalDate serviceDate ) { - final TripPattern pattern = snapshotManager.getRealtimeAddedTripPattern(tripId, serviceDate); + final TripPattern pattern = snapshotManager.getNewTripPatternForModifiedTrip( + tripId, + serviceDate + ); if ( !isPreviouslyAddedTrip(tripId, pattern, serviceDate) || ( @@ -513,7 +515,6 @@ private Result validateAndHandleAddedTrip( /** * Remove any stop that is not know in the static transit data. */ - @Nonnull private List removeUnknownStops(TripUpdate tripUpdate, FeedScopedId tripId) { return tripUpdate .getStopTimeUpdateList() @@ -948,7 +949,10 @@ private boolean cancelPreviouslyAddedTrip( ) { boolean cancelledAddedTrip = false; - final TripPattern pattern = snapshotManager.getRealtimeAddedTripPattern(tripId, serviceDate); + final TripPattern pattern = snapshotManager.getNewTripPatternForModifiedTrip( + tripId, + serviceDate + ); if (isPreviouslyAddedTrip(tripId, pattern, serviceDate)) { // Cancel trip times for this trip in this pattern final Timetable timetable = snapshotManager.resolve(pattern, serviceDate); diff --git a/src/main/java/org/opentripplanner/updater/trip/TripPatternCache.java b/application/src/main/java/org/opentripplanner/updater/trip/TripPatternCache.java similarity index 97% rename from src/main/java/org/opentripplanner/updater/trip/TripPatternCache.java rename to application/src/main/java/org/opentripplanner/updater/trip/TripPatternCache.java index bf8e75418ae..f94d023c560 100644 --- a/src/main/java/org/opentripplanner/updater/trip/TripPatternCache.java +++ b/application/src/main/java/org/opentripplanner/updater/trip/TripPatternCache.java @@ -2,7 +2,6 @@ import java.util.HashMap; import java.util.Map; -import javax.annotation.Nonnull; import org.opentripplanner.gtfs.GenerateTripPatternsOperation; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.Route; @@ -47,8 +46,8 @@ public class TripPatternCache { * @return cached or newly created trip pattern */ public synchronized TripPattern getOrCreateTripPattern( - @Nonnull final StopPattern stopPattern, - @Nonnull final Trip trip, + final StopPattern stopPattern, + final Trip trip, final TripPattern originalTripPattern ) { Route route = trip.getRoute(); diff --git a/src/main/java/org/opentripplanner/updater/trip/TripUpdateGraphWriterRunnable.java b/application/src/main/java/org/opentripplanner/updater/trip/TripUpdateGraphWriterRunnable.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/trip/TripUpdateGraphWriterRunnable.java rename to application/src/main/java/org/opentripplanner/updater/trip/TripUpdateGraphWriterRunnable.java diff --git a/src/main/java/org/opentripplanner/updater/trip/UpdateIncrementality.java b/application/src/main/java/org/opentripplanner/updater/trip/UpdateIncrementality.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/trip/UpdateIncrementality.java rename to application/src/main/java/org/opentripplanner/updater/trip/UpdateIncrementality.java diff --git a/src/main/java/org/opentripplanner/updater/trip/UrlUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/trip/UrlUpdaterParameters.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/trip/UrlUpdaterParameters.java rename to application/src/main/java/org/opentripplanner/updater/trip/UrlUpdaterParameters.java diff --git a/src/main/java/org/opentripplanner/updater/trip/metrics/BatchTripUpdateMetrics.java b/application/src/main/java/org/opentripplanner/updater/trip/metrics/BatchTripUpdateMetrics.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/trip/metrics/BatchTripUpdateMetrics.java rename to application/src/main/java/org/opentripplanner/updater/trip/metrics/BatchTripUpdateMetrics.java diff --git a/src/main/java/org/opentripplanner/updater/trip/metrics/StreamingTripUpdateMetrics.java b/application/src/main/java/org/opentripplanner/updater/trip/metrics/StreamingTripUpdateMetrics.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/trip/metrics/StreamingTripUpdateMetrics.java rename to application/src/main/java/org/opentripplanner/updater/trip/metrics/StreamingTripUpdateMetrics.java diff --git a/src/main/java/org/opentripplanner/updater/trip/metrics/TripUpdateMetrics.java b/application/src/main/java/org/opentripplanner/updater/trip/metrics/TripUpdateMetrics.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/trip/metrics/TripUpdateMetrics.java rename to application/src/main/java/org/opentripplanner/updater/trip/metrics/TripUpdateMetrics.java diff --git a/src/main/java/org/opentripplanner/updater/vehicle_parking/AvailabilityDatasourceFactory.java b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/AvailabilityDatasourceFactory.java similarity index 96% rename from src/main/java/org/opentripplanner/updater/vehicle_parking/AvailabilityDatasourceFactory.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_parking/AvailabilityDatasourceFactory.java index 876cd303c78..66c01b4b33b 100644 --- a/src/main/java/org/opentripplanner/updater/vehicle_parking/AvailabilityDatasourceFactory.java +++ b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/AvailabilityDatasourceFactory.java @@ -16,7 +16,6 @@ public static DataSource create(VehicleParkingUpdaterParamete BICYCLE_PARK_API, HSL_PARK, BIKEEP, - NOI_OPEN_DATA_HUB, BIKELY -> throw new IllegalArgumentException("Cannot instantiate SIRI-FM data source"); }; } diff --git a/src/main/java/org/opentripplanner/updater/vehicle_parking/AvailabiltyUpdate.java b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/AvailabiltyUpdate.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/vehicle_parking/AvailabiltyUpdate.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_parking/AvailabiltyUpdate.java diff --git a/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdater.java b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdater.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdater.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdater.java diff --git a/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingDataSourceFactory.java b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingDataSourceFactory.java similarity index 90% rename from src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingDataSourceFactory.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingDataSourceFactory.java index 09ecb67a54d..ef587cd2b68 100644 --- a/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingDataSourceFactory.java +++ b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingDataSourceFactory.java @@ -6,8 +6,6 @@ import org.opentripplanner.ext.vehicleparking.bikely.BikelyUpdaterParameters; import org.opentripplanner.ext.vehicleparking.hslpark.HslParkUpdater; import org.opentripplanner.ext.vehicleparking.hslpark.HslParkUpdaterParameters; -import org.opentripplanner.ext.vehicleparking.noi.NoiUpdater; -import org.opentripplanner.ext.vehicleparking.noi.NoiUpdaterParameters; import org.opentripplanner.ext.vehicleparking.parkapi.BicycleParkAPIUpdater; import org.opentripplanner.ext.vehicleparking.parkapi.CarParkAPIUpdater; import org.opentripplanner.ext.vehicleparking.parkapi.ParkAPIUpdaterParameters; @@ -40,7 +38,6 @@ public static DataSource create( openingHoursCalendarService ); case BIKELY -> new BikelyUpdater((BikelyUpdaterParameters) parameters); - case NOI_OPEN_DATA_HUB -> new NoiUpdater((NoiUpdaterParameters) parameters); case BIKEEP -> new BikeepUpdater((BikeepUpdaterParameters) parameters); case SIRI_FM -> throw new IllegalArgumentException("Cannot instantiate SIRI-FM data source"); }; diff --git a/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingSourceType.java b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingSourceType.java similarity index 89% rename from src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingSourceType.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingSourceType.java index 1601245b16c..f146bb7dcf2 100644 --- a/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingSourceType.java +++ b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingSourceType.java @@ -5,7 +5,6 @@ public enum VehicleParkingSourceType { BICYCLE_PARK_API, HSL_PARK, BIKELY, - NOI_OPEN_DATA_HUB, BIKEEP, SIRI_FM, } diff --git a/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdater.java b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdater.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdater.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdater.java diff --git a/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdaterParameters.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdaterParameters.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdaterParameters.java diff --git a/src/main/java/org/opentripplanner/updater/vehicle_position/GtfsRealtimeHttpVehiclePositionSource.java b/application/src/main/java/org/opentripplanner/updater/vehicle_position/GtfsRealtimeHttpVehiclePositionSource.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/vehicle_position/GtfsRealtimeHttpVehiclePositionSource.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_position/GtfsRealtimeHttpVehiclePositionSource.java diff --git a/src/main/java/org/opentripplanner/updater/vehicle_position/PollingVehiclePositionUpdater.java b/application/src/main/java/org/opentripplanner/updater/vehicle_position/PollingVehiclePositionUpdater.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/vehicle_position/PollingVehiclePositionUpdater.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_position/PollingVehiclePositionUpdater.java diff --git a/src/main/java/org/opentripplanner/updater/vehicle_position/RealtimeVehiclePatternMatcher.java b/application/src/main/java/org/opentripplanner/updater/vehicle_position/RealtimeVehiclePatternMatcher.java similarity index 99% rename from src/main/java/org/opentripplanner/updater/vehicle_position/RealtimeVehiclePatternMatcher.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_position/RealtimeVehiclePatternMatcher.java index fe29ef35b97..0723adc91b8 100644 --- a/src/main/java/org/opentripplanner/updater/vehicle_position/RealtimeVehiclePatternMatcher.java +++ b/application/src/main/java/org/opentripplanner/updater/vehicle_position/RealtimeVehiclePatternMatcher.java @@ -29,7 +29,6 @@ import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.lang.StringUtils; import org.opentripplanner.framework.time.ServiceDateUtils; @@ -206,8 +205,8 @@ protected static LocalDate inferServiceDate( private RealtimeVehicle mapRealtimeVehicle( VehiclePosition vehiclePosition, List stopsOnVehicleTrip, - @Nonnull Trip trip, - @Nonnull Function stopIndexOfGtfsSequence + Trip trip, + Function stopIndexOfGtfsSequence ) { var newVehicle = RealtimeVehicle.builder(); diff --git a/src/main/java/org/opentripplanner/updater/vehicle_position/VehiclePositionUpdaterRunnable.java b/application/src/main/java/org/opentripplanner/updater/vehicle_position/VehiclePositionUpdaterRunnable.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/vehicle_position/VehiclePositionUpdaterRunnable.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_position/VehiclePositionUpdaterRunnable.java diff --git a/src/main/java/org/opentripplanner/updater/vehicle_position/VehiclePositionsUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/vehicle_position/VehiclePositionsUpdaterParameters.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/vehicle_position/VehiclePositionsUpdaterParameters.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_position/VehiclePositionsUpdaterParameters.java diff --git a/src/main/java/org/opentripplanner/updater/vehicle_rental/GeofencingVertexUpdater.java b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/GeofencingVertexUpdater.java similarity index 99% rename from src/main/java/org/opentripplanner/updater/vehicle_rental/GeofencingVertexUpdater.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_rental/GeofencingVertexUpdater.java index a024bac9629..60eaae3a8ed 100644 --- a/src/main/java/org/opentripplanner/updater/vehicle_rental/GeofencingVertexUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/GeofencingVertexUpdater.java @@ -7,7 +7,6 @@ import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.Envelope; import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.LineString; @@ -142,7 +141,6 @@ private Map applyExtension( * When finding the edges near the business area border in Oslo this speeds up the computation * from ~25 seconds to ~3 seconds (on 2021 hardware). */ - @Nonnull private Set getEdgesAlongLineStrings(Collection lineStrings) { return lineStrings .stream() diff --git a/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalSourceType.java b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalSourceType.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalSourceType.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalSourceType.java diff --git a/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdater.java b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdater.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdater.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdater.java diff --git a/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdaterParameters.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdaterParameters.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdaterParameters.java diff --git a/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsFeedLoader.java b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsFeedLoader.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsFeedLoader.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsFeedLoader.java diff --git a/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsFreeVehicleStatusMapper.java b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsFreeVehicleStatusMapper.java similarity index 98% rename from src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsFreeVehicleStatusMapper.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsFreeVehicleStatusMapper.java index 7fd884b7ab8..959521e017e 100644 --- a/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsFreeVehicleStatusMapper.java +++ b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsFreeVehicleStatusMapper.java @@ -5,7 +5,6 @@ import java.time.Instant; import java.util.HashMap; import java.util.Map; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.mobilitydata.gbfs.v2_3.free_bike_status.GBFSBike; import org.mobilitydata.gbfs.v2_3.free_bike_status.GBFSRentalUris; @@ -20,7 +19,6 @@ public class GbfsFreeVehicleStatusMapper { private final VehicleRentalSystem system; - @Nonnull private final Map vehicleTypes; public GbfsFreeVehicleStatusMapper( diff --git a/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsGeofencingZoneMapper.java b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsGeofencingZoneMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsGeofencingZoneMapper.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsGeofencingZoneMapper.java diff --git a/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsStationInformationMapper.java b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsStationInformationMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsStationInformationMapper.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsStationInformationMapper.java diff --git a/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsStationStatusMapper.java b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsStationStatusMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsStationStatusMapper.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsStationStatusMapper.java diff --git a/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsSystemInformationMapper.java b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsSystemInformationMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsSystemInformationMapper.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsSystemInformationMapper.java diff --git a/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsVehicleRentalDataSource.java b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsVehicleRentalDataSource.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsVehicleRentalDataSource.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsVehicleRentalDataSource.java diff --git a/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsVehicleTypeMapper.java b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsVehicleTypeMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsVehicleTypeMapper.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsVehicleTypeMapper.java diff --git a/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/VehicleRentalDataSourceFactory.java b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/VehicleRentalDataSourceFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/VehicleRentalDataSourceFactory.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/VehicleRentalDataSourceFactory.java diff --git a/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/VehicleRentalDatasource.java b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/VehicleRentalDatasource.java similarity index 100% rename from src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/VehicleRentalDatasource.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/VehicleRentalDatasource.java diff --git a/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/params/GbfsVehicleRentalDataSourceParameters.java b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/params/GbfsVehicleRentalDataSourceParameters.java similarity index 93% rename from src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/params/GbfsVehicleRentalDataSourceParameters.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/params/GbfsVehicleRentalDataSourceParameters.java index 99a5b48772c..7d7a6c75a5d 100644 --- a/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/params/GbfsVehicleRentalDataSourceParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/params/GbfsVehicleRentalDataSourceParameters.java @@ -1,6 +1,5 @@ package org.opentripplanner.updater.vehicle_rental.datasources.params; -import javax.annotation.Nonnull; import org.opentripplanner.updater.spi.HttpHeaders; import org.opentripplanner.updater.vehicle_rental.VehicleRentalSourceType; @@ -14,7 +13,6 @@ public record GbfsVehicleRentalDataSourceParameters( boolean overloadingAllowed ) implements VehicleRentalDataSourceParameters { - @Nonnull @Override public VehicleRentalSourceType sourceType() { return VehicleRentalSourceType.GBFS; diff --git a/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/params/VehicleRentalDataSourceParameters.java b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/params/VehicleRentalDataSourceParameters.java similarity index 86% rename from src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/params/VehicleRentalDataSourceParameters.java rename to application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/params/VehicleRentalDataSourceParameters.java index abf7aa805cd..cdff994ab18 100644 --- a/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/params/VehicleRentalDataSourceParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/datasources/params/VehicleRentalDataSourceParameters.java @@ -1,20 +1,16 @@ package org.opentripplanner.updater.vehicle_rental.datasources.params; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.updater.spi.HttpHeaders; import org.opentripplanner.updater.vehicle_rental.VehicleRentalSourceType; public interface VehicleRentalDataSourceParameters { - @Nonnull String url(); @Nullable String network(); - @Nonnull VehicleRentalSourceType sourceType(); - @Nonnull HttpHeaders httpHeaders(); } diff --git a/src/main/java/org/opentripplanner/visualizer/GraphVisualizer.java b/application/src/main/java/org/opentripplanner/visualizer/GraphVisualizer.java similarity index 99% rename from src/main/java/org/opentripplanner/visualizer/GraphVisualizer.java rename to application/src/main/java/org/opentripplanner/visualizer/GraphVisualizer.java index 6ab7d86917c..5ca8e55fc14 100644 --- a/src/main/java/org/opentripplanner/visualizer/GraphVisualizer.java +++ b/application/src/main/java/org/opentripplanner/visualizer/GraphVisualizer.java @@ -514,7 +514,8 @@ protected void route(String from, String to) { try ( var temporaryVertices = new TemporaryVerticesContainer( graph, - options, + options.from(), + options.to(), options.journey().direct().mode(), options.journey().direct().mode() ) diff --git a/src/main/java/org/opentripplanner/visualizer/RouteDialog.java b/application/src/main/java/org/opentripplanner/visualizer/RouteDialog.java similarity index 100% rename from src/main/java/org/opentripplanner/visualizer/RouteDialog.java rename to application/src/main/java/org/opentripplanner/visualizer/RouteDialog.java diff --git a/src/main/java/org/opentripplanner/visualizer/ShowGraph.java b/application/src/main/java/org/opentripplanner/visualizer/ShowGraph.java similarity index 100% rename from src/main/java/org/opentripplanner/visualizer/ShowGraph.java rename to application/src/main/java/org/opentripplanner/visualizer/ShowGraph.java diff --git a/src/main/java/org/opentripplanner/visualizer/VertexSelectionListener.java b/application/src/main/java/org/opentripplanner/visualizer/VertexSelectionListener.java similarity index 100% rename from src/main/java/org/opentripplanner/visualizer/VertexSelectionListener.java rename to application/src/main/java/org/opentripplanner/visualizer/VertexSelectionListener.java diff --git a/src/main/java/org/opentripplanner/visualizer/VisualTraverseVisitor.java b/application/src/main/java/org/opentripplanner/visualizer/VisualTraverseVisitor.java similarity index 100% rename from src/main/java/org/opentripplanner/visualizer/VisualTraverseVisitor.java rename to application/src/main/java/org/opentripplanner/visualizer/VisualTraverseVisitor.java diff --git a/src/main/java/org/opentripplanner/visualizer/package-info.java b/application/src/main/java/org/opentripplanner/visualizer/package-info.java similarity index 100% rename from src/main/java/org/opentripplanner/visualizer/package-info.java rename to application/src/main/java/org/opentripplanner/visualizer/package-info.java diff --git a/src/main/jib/docker-entrypoint.sh b/application/src/main/jib/docker-entrypoint.sh similarity index 100% rename from src/main/jib/docker-entrypoint.sh rename to application/src/main/jib/docker-entrypoint.sh diff --git a/src/main/proto/gtfs-realtime.proto b/application/src/main/proto/gtfs-realtime.proto similarity index 100% rename from src/main/proto/gtfs-realtime.proto rename to application/src/main/proto/gtfs-realtime.proto diff --git a/src/main/proto/mfdz-realtime-extensions.proto b/application/src/main/proto/mfdz-realtime-extensions.proto similarity index 100% rename from src/main/proto/mfdz-realtime-extensions.proto rename to application/src/main/proto/mfdz-realtime-extensions.proto diff --git a/src/main/resources/Message.properties b/application/src/main/resources/Message.properties similarity index 100% rename from src/main/resources/Message.properties rename to application/src/main/resources/Message.properties diff --git a/src/main/resources/Message_de.properties b/application/src/main/resources/Message_de.properties similarity index 100% rename from src/main/resources/Message_de.properties rename to application/src/main/resources/Message_de.properties diff --git a/src/main/resources/Message_es.properties b/application/src/main/resources/Message_es.properties similarity index 100% rename from src/main/resources/Message_es.properties rename to application/src/main/resources/Message_es.properties diff --git a/src/main/resources/Message_fr.properties b/application/src/main/resources/Message_fr.properties similarity index 100% rename from src/main/resources/Message_fr.properties rename to application/src/main/resources/Message_fr.properties diff --git a/src/main/resources/Message_hu.properties b/application/src/main/resources/Message_hu.properties similarity index 100% rename from src/main/resources/Message_hu.properties rename to application/src/main/resources/Message_hu.properties diff --git a/src/main/resources/Message_nl.properties b/application/src/main/resources/Message_nl.properties similarity index 100% rename from src/main/resources/Message_nl.properties rename to application/src/main/resources/Message_nl.properties diff --git a/src/main/resources/WayProperties.properties b/application/src/main/resources/WayProperties.properties similarity index 100% rename from src/main/resources/WayProperties.properties rename to application/src/main/resources/WayProperties.properties diff --git a/src/main/resources/WayProperties_de.properties b/application/src/main/resources/WayProperties_de.properties similarity index 100% rename from src/main/resources/WayProperties_de.properties rename to application/src/main/resources/WayProperties_de.properties diff --git a/src/main/resources/WayProperties_fi.properties b/application/src/main/resources/WayProperties_fi.properties similarity index 100% rename from src/main/resources/WayProperties_fi.properties rename to application/src/main/resources/WayProperties_fi.properties diff --git a/src/main/resources/WayProperties_fr.properties b/application/src/main/resources/WayProperties_fr.properties similarity index 100% rename from src/main/resources/WayProperties_fr.properties rename to application/src/main/resources/WayProperties_fr.properties diff --git a/src/main/resources/WayProperties_hu.properties b/application/src/main/resources/WayProperties_hu.properties similarity index 100% rename from src/main/resources/WayProperties_hu.properties rename to application/src/main/resources/WayProperties_hu.properties diff --git a/src/main/resources/WayProperties_nl.properties b/application/src/main/resources/WayProperties_nl.properties similarity index 100% rename from src/main/resources/WayProperties_nl.properties rename to application/src/main/resources/WayProperties_nl.properties diff --git a/src/main/resources/WayProperties_no.properties b/application/src/main/resources/WayProperties_no.properties similarity index 100% rename from src/main/resources/WayProperties_no.properties rename to application/src/main/resources/WayProperties_no.properties diff --git a/src/main/resources/WayProperties_sv.properties b/application/src/main/resources/WayProperties_sv.properties similarity index 100% rename from src/main/resources/WayProperties_sv.properties rename to application/src/main/resources/WayProperties_sv.properties diff --git a/src/main/resources/internals.properties b/application/src/main/resources/internals.properties similarity index 100% rename from src/main/resources/internals.properties rename to application/src/main/resources/internals.properties diff --git a/src/main/resources/internals_de.properties b/application/src/main/resources/internals_de.properties similarity index 100% rename from src/main/resources/internals_de.properties rename to application/src/main/resources/internals_de.properties diff --git a/src/main/resources/internals_fi.properties b/application/src/main/resources/internals_fi.properties similarity index 100% rename from src/main/resources/internals_fi.properties rename to application/src/main/resources/internals_fi.properties diff --git a/src/main/resources/internals_fr.properties b/application/src/main/resources/internals_fr.properties similarity index 100% rename from src/main/resources/internals_fr.properties rename to application/src/main/resources/internals_fr.properties diff --git a/src/main/resources/internals_hu.properties b/application/src/main/resources/internals_hu.properties similarity index 100% rename from src/main/resources/internals_hu.properties rename to application/src/main/resources/internals_hu.properties diff --git a/src/main/resources/internals_no.properties b/application/src/main/resources/internals_no.properties similarity index 100% rename from src/main/resources/internals_no.properties rename to application/src/main/resources/internals_no.properties diff --git a/src/main/resources/internals_sv.properties b/application/src/main/resources/internals_sv.properties similarity index 100% rename from src/main/resources/internals_sv.properties rename to application/src/main/resources/internals_sv.properties diff --git a/src/main/resources/logback.xml b/application/src/main/resources/logback.xml similarity index 96% rename from src/main/resources/logback.xml rename to application/src/main/resources/logback.xml index 7ff48379a7d..8e01f9aef01 100644 --- a/src/main/resources/logback.xml +++ b/application/src/main/resources/logback.xml @@ -102,8 +102,8 @@ - - + + diff --git a/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls b/application/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls similarity index 99% rename from src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls rename to application/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls index 90b40cfe9a6..ae19925033f 100644 --- a/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls +++ b/application/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls @@ -670,6 +670,11 @@ type Leg { """ headsign: String """ + An identifier for the leg, which can be used to re-fetch transit leg information. + Re-fetching fails when the underlying transit data no longer exists. + """ + id: String + """ Interlines with previous leg. This is true when the same vehicle is used for the previous leg as for this leg and passenger can stay inside the vehicle. @@ -1184,6 +1189,11 @@ type QueryType { time: Int! ): Trip """ + Try refetching the current state of a transit leg using its id. + This fails when the underlying transit data (mostly IDs) has changed or are no longer available. + """ + leg(id: String!): Leg + """ Get all places (stops, stations, etc. with coordinates) within the specified radius from a location. The returned type is a Relay connection (see https://facebook.github.io/relay/graphql/connections.htm). The placeAtDistance @@ -1530,7 +1540,7 @@ type QueryType { walkSpeed: Float, "Whether the itinerary must be wheelchair accessible. Default value: false" wheelchair: Boolean - ): Plan @async + ): Plan @async @deprecated(reason : "Use `planConnection` instead.") """ Plan (itinerary) search that follows [GraphQL Cursor Connections Specification](https://relay.dev/graphql/connections.htm). @@ -1615,7 +1625,7 @@ type QueryType { number of itineraries in each search. """ searchWindow: Duration - ): PlanConnection @async @deprecated(reason : "Experimental and can include breaking changes, use plan instead") + ): PlanConnection @async "Get a single rental vehicle based on its ID, i.e. value of field `vehicleId`" rentalVehicle(id: String!): RentalVehicle "Get all rental vehicles" @@ -2019,7 +2029,16 @@ type Stop implements Node & PlaceInterface { "Identifier of the platform, usually a number. This value is only present for stops that are part of a station" platformCode: String "Routes which pass through this stop" - routes: [Route!] + routes( + """ + Only include routes which are operational on at least one service date specified by this filter. + + **Note**: A service date is a technical term useful for transit planning purposes and might not + correspond to a how a passenger thinks of a calendar date. For example, a night bus running + on Sunday morning at 1am to 3am, might have the previous Saturday's service date. + """ + serviceDates: LocalDateRangeInput + ): [Route!] "Returns timetable of the specified pattern at this stop" stopTimesForPattern( "Id of the pattern" diff --git a/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql b/application/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql similarity index 97% rename from src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql rename to application/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql index 0d2bf71dcc6..9aa743fd42d 100644 --- a/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql +++ b/application/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql @@ -325,7 +325,7 @@ type Leg { fromPlace: Place! "Generalized cost or weight of the leg. Used for debugging." generalizedCost: Int - "An identifier for the leg, which can be used to re-fetch the information." + "An identifier for the leg, which can be used to re-fetch transit leg information." id: ID interchangeFrom: Interchange interchangeTo: Interchange @@ -647,7 +647,7 @@ type QueryType { groupOfLines(id: String!): GroupOfLines "Get all groups of lines" groupsOfLines: [GroupOfLines!]! - "Refetch a single leg based on its id" + "Refetch a single transit leg based on its id" leg(id: ID!): Leg @timingData "Get a single line based on its id" line(id: ID!): Line @timingData @@ -730,7 +730,7 @@ type QueryType { ): quayAtDistanceConnection @timingData "Get default routing parameters." routingParameters: RoutingParameters @timingData - "Get OTP server information" + "Get OTP deployment information. This is only useful for developers of OTP itself not regular API users." serverInfo: ServerInfo! @timingData "Get a single service journey based on its id" serviceJourney(id: String!): ServiceJourney @timingData @@ -834,7 +834,7 @@ type QueryType { "Use the cursor to go to the next \"page\" of itineraries. Copy the cursor from the last response and keep the original request as is. This will enable you to search for itineraries in the next or previous time-window." pageCursor: String, "The list of points the journey is required to pass through." - passThroughPoints: [PassThroughPoint!], + passThroughPoints: [PassThroughPoint!] @deprecated(reason : "Use via instead"), """ Relax generalized-cost when comparing trips with a different set of transit-group-priorities. The groups are set server side for service-journey and @@ -900,6 +900,11 @@ type QueryType { triangleFactors: TriangleFactors, "Whether or not bike rental availability information will be used to plan bike rental trips." useBikeRentalAvailabilityInformation: Boolean = false, + """ + The list of via locations the journey is required to visit. All locations are + visited in the order they are listed. + """ + via: [TripViaLocationInput!], "Wait cost is multiplied by this value. Setting this to a value lower than 1 indicates that waiting is better than staying on a vehicle. This should never be set higher than walkReluctance, since that would lead to walking down a line to avoid waiting." waitReluctance: Float = 1.0, "Walk cost is multiplied by this value. This is the main parameter to use for limiting walking." @@ -943,7 +948,7 @@ type QueryType { via: [ViaLocationInput!]!, "Whether the trip must be wheelchair accessible. Supported for the street part to the search, not implemented for the transit yet." wheelchairAccessible: Boolean = false - ): ViaTrip! @timingData + ): ViaTrip! @deprecated(reason : "Use the regular trip query with via stop instead.") @timingData } type RentalVehicle implements PlaceInterface { @@ -1067,6 +1072,11 @@ type RoutingParameters { wheelChairAccessible: Boolean } +""" +Information about the deployment. This is only useful to developers of OTP itself. +It is not recommended for regular API consumers to use this type as it has no +stability guarantees. +""" type ServerInfo { "The 'configVersion' of the build-config.json file." buildConfigVersion: String @@ -1075,6 +1085,12 @@ type ServerInfo { gitBranch: String gitCommit: String gitCommitTime: String + """ + The internal time zone of the transit data. + + Note: The input data can be in several time zones, but OTP internally operates on a single one. + """ + internalTransitModelTimeZone: String "The 'configVersion' of the otp-config.json file." otpConfigVersion: String "The otp-serialization-version-id used to check graphs for compatibility with current version of OTP." @@ -2176,6 +2192,56 @@ input TripFilterSelectInput { transportModes: [TransportModes!] } +""" +One of the listed stop locations must be visited on-board a transit vehicle or the journey must +alight or board at the location. +""" +input TripPassThroughViaLocationInput { + "The label/name of the location. This is pass-through information and is not used in routing." + label: String + """ + A list of stop locations. A stop location can be a quay, a stop place, a multimodal + stop place or a group of stop places. It is enough to visit ONE of the locations + listed. + """ + stopLocationIds: [String!] +} + +""" +A via-location is used to specifying a location as an intermediate place the router must +route through. The via-location is either a pass-through-location or a visit-via-location. +""" +input TripViaLocationInput @oneOf { + "Board, alight or pass-through(on-board) at the stop location." + passThrough: TripPassThroughViaLocationInput + "Board or alight at a stop location or visit a coordinate." + visit: TripVisitViaLocationInput +} + +""" +A visit-via-location is a physical visit to one of the stop locations or coordinates listed. An +on-board visit does not count, the traveler must alight or board at the given stop for it to to +be accepted. To visit a coordinate, the traveler must walk(bike or drive) to the closest point +in the street network from a stop and back to another stop to join the transit network. + +NOTE! Coordinates are NOT supported yet. +""" +input TripVisitViaLocationInput { + "The label/name of the location. This is pass-through information and is not used in routing." + label: String + """ + The minimum wait time is used to force the trip to stay the given duration at the + via-location before the trip is continued. + """ + minimumWaitTime: Duration = "PT0S" + """ + A list of stop locations. A stop location can be a quay, a stop place, a multimodal + stop place or a group of stop places. It is enough to visit ONE of the locations + listed. + """ + stopLocationIds: [String!] +} + "Input format for specifying a location through either a place reference (id), coordinates or both. If both place and coordinates are provided the place ref will be used if found, coordinates will only be used if place is not known. The location also contain information about the minimum and maximum time the user is willing to stay at the via location." input ViaLocationInput { "Coordinates for the location. This can be used alone or as fallback if the place id is not found." diff --git a/src/main/resources/otp-project-info.properties b/application/src/main/resources/otp-project-info.properties similarity index 100% rename from src/main/resources/otp-project-info.properties rename to application/src/main/resources/otp-project-info.properties diff --git a/src/test/java/org/opentripplanner/ConstantsForTests.java b/application/src/test/java/org/opentripplanner/ConstantsForTests.java similarity index 99% rename from src/test/java/org/opentripplanner/ConstantsForTests.java rename to application/src/test/java/org/opentripplanner/ConstantsForTests.java index e74c66e527b..b9ec788dac0 100644 --- a/src/test/java/org/opentripplanner/ConstantsForTests.java +++ b/application/src/test/java/org/opentripplanner/ConstantsForTests.java @@ -26,7 +26,7 @@ import org.opentripplanner.model.impl.OtpTransitServiceBuilder; import org.opentripplanner.netex.NetexBundle; import org.opentripplanner.netex.configure.NetexConfigure; -import org.opentripplanner.openstreetmap.OsmProvider; +import org.opentripplanner.osm.OsmProvider; import org.opentripplanner.routing.fares.FareServiceFactory; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.routing.linking.LinkingDirection; diff --git a/src/test/java/org/opentripplanner/DateTimeHelper.java b/application/src/test/java/org/opentripplanner/DateTimeHelper.java similarity index 100% rename from src/test/java/org/opentripplanner/DateTimeHelper.java rename to application/src/test/java/org/opentripplanner/DateTimeHelper.java diff --git a/src/test/java/org/opentripplanner/GtfsTest.java b/application/src/test/java/org/opentripplanner/GtfsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/GtfsTest.java rename to application/src/test/java/org/opentripplanner/GtfsTest.java diff --git a/src/test/java/org/opentripplanner/OtpArchitectureModules.java b/application/src/test/java/org/opentripplanner/OtpArchitectureModules.java similarity index 100% rename from src/test/java/org/opentripplanner/OtpArchitectureModules.java rename to application/src/test/java/org/opentripplanner/OtpArchitectureModules.java diff --git a/src/test/java/org/opentripplanner/TestOtpModel.java b/application/src/test/java/org/opentripplanner/TestOtpModel.java similarity index 100% rename from src/test/java/org/opentripplanner/TestOtpModel.java rename to application/src/test/java/org/opentripplanner/TestOtpModel.java diff --git a/src/test/java/org/opentripplanner/TestServerContext.java b/application/src/test/java/org/opentripplanner/TestServerContext.java similarity index 100% rename from src/test/java/org/opentripplanner/TestServerContext.java rename to application/src/test/java/org/opentripplanner/TestServerContext.java diff --git a/src/test/java/org/opentripplanner/_support/arch/ArchComponent.java b/application/src/test/java/org/opentripplanner/_support/arch/ArchComponent.java similarity index 100% rename from src/test/java/org/opentripplanner/_support/arch/ArchComponent.java rename to application/src/test/java/org/opentripplanner/_support/arch/ArchComponent.java diff --git a/src/test/java/org/opentripplanner/_support/arch/Module.java b/application/src/test/java/org/opentripplanner/_support/arch/Module.java similarity index 100% rename from src/test/java/org/opentripplanner/_support/arch/Module.java rename to application/src/test/java/org/opentripplanner/_support/arch/Module.java diff --git a/src/test/java/org/opentripplanner/_support/arch/Package.java b/application/src/test/java/org/opentripplanner/_support/arch/Package.java similarity index 100% rename from src/test/java/org/opentripplanner/_support/arch/Package.java rename to application/src/test/java/org/opentripplanner/_support/arch/Package.java diff --git a/application/src/test/java/org/opentripplanner/_support/asserts/AssertEqualsAndHashCode.java b/application/src/test/java/org/opentripplanner/_support/asserts/AssertEqualsAndHashCode.java new file mode 100644 index 00000000000..7e4fbe91676 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/_support/asserts/AssertEqualsAndHashCode.java @@ -0,0 +1,33 @@ +package org.opentripplanner._support.asserts; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; + +public class AssertEqualsAndHashCode { + + private final Object subject; + + @SuppressWarnings("EqualsWithItself") + public AssertEqualsAndHashCode(Object subject) { + this.subject = subject; + assertEquals(subject, subject); + } + + public static AssertEqualsAndHashCode verify(Object subject) { + return new AssertEqualsAndHashCode(subject); + } + + public AssertEqualsAndHashCode sameAs(Object same) { + assertEquals(subject, same); + assertEquals(subject.hashCode(), same.hashCode()); + return this; + } + + public AssertEqualsAndHashCode differentFrom(Object... others) { + for (Object other : others) { + assertNotEquals(subject, other); + assertNotEquals(subject.hashCode(), other.hashCode()); + } + return this; + } +} diff --git a/src/test/java/org/opentripplanner/_support/debug/TestDebug.java b/application/src/test/java/org/opentripplanner/_support/debug/TestDebug.java similarity index 100% rename from src/test/java/org/opentripplanner/_support/debug/TestDebug.java rename to application/src/test/java/org/opentripplanner/_support/debug/TestDebug.java diff --git a/src/test/java/org/opentripplanner/_support/geometry/Coordinates.java b/application/src/test/java/org/opentripplanner/_support/geometry/Coordinates.java similarity index 100% rename from src/test/java/org/opentripplanner/_support/geometry/Coordinates.java rename to application/src/test/java/org/opentripplanner/_support/geometry/Coordinates.java diff --git a/src/test/java/org/opentripplanner/_support/geometry/LineStrings.java b/application/src/test/java/org/opentripplanner/_support/geometry/LineStrings.java similarity index 100% rename from src/test/java/org/opentripplanner/_support/geometry/LineStrings.java rename to application/src/test/java/org/opentripplanner/_support/geometry/LineStrings.java diff --git a/src/test/java/org/opentripplanner/_support/geometry/Polygons.java b/application/src/test/java/org/opentripplanner/_support/geometry/Polygons.java similarity index 100% rename from src/test/java/org/opentripplanner/_support/geometry/Polygons.java rename to application/src/test/java/org/opentripplanner/_support/geometry/Polygons.java diff --git a/src/test/java/org/opentripplanner/_support/text/I18NStrings.java b/application/src/test/java/org/opentripplanner/_support/text/I18NStrings.java similarity index 100% rename from src/test/java/org/opentripplanner/_support/text/I18NStrings.java rename to application/src/test/java/org/opentripplanner/_support/text/I18NStrings.java diff --git a/src/test/java/org/opentripplanner/_support/time/ZoneIds.java b/application/src/test/java/org/opentripplanner/_support/time/ZoneIds.java similarity index 100% rename from src/test/java/org/opentripplanner/_support/time/ZoneIds.java rename to application/src/test/java/org/opentripplanner/_support/time/ZoneIds.java diff --git a/src/test/java/org/opentripplanner/api/common/LocationStringParserTest.java b/application/src/test/java/org/opentripplanner/api/common/LocationStringParserTest.java similarity index 100% rename from src/test/java/org/opentripplanner/api/common/LocationStringParserTest.java rename to application/src/test/java/org/opentripplanner/api/common/LocationStringParserTest.java diff --git a/src/test/java/org/opentripplanner/api/resource/MessageTest.java b/application/src/test/java/org/opentripplanner/api/resource/MessageTest.java similarity index 100% rename from src/test/java/org/opentripplanner/api/resource/MessageTest.java rename to application/src/test/java/org/opentripplanner/api/resource/MessageTest.java diff --git a/src/test/java/org/opentripplanner/api/resource/WebMercatorTileTest.java b/application/src/test/java/org/opentripplanner/api/resource/WebMercatorTileTest.java similarity index 100% rename from src/test/java/org/opentripplanner/api/resource/WebMercatorTileTest.java rename to application/src/test/java/org/opentripplanner/api/resource/WebMercatorTileTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/CoordinateValueScalarTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/CoordinateValueScalarTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/CoordinateValueScalarTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/CoordinateValueScalarTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/CostScalarTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/CostScalarTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/CostScalarTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/CostScalarTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/DurationScalarTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/DurationScalarTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/DurationScalarTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/DurationScalarTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/GeoJsonScalarTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/GeoJsonScalarTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/GeoJsonScalarTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/GeoJsonScalarTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/GraphQLFormattingTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/GraphQLFormattingTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/GraphQLFormattingTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/GraphQLFormattingTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIndexTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIndexTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/GraphQLIndexTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIndexTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java similarity index 96% rename from src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java index 79590ca2775..be016d7cefe 100644 --- a/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java +++ b/application/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java @@ -28,8 +28,8 @@ import java.util.Comparator; import java.util.List; import java.util.Locale; +import java.util.Set; import java.util.stream.Stream; -import javax.annotation.Nonnull; import org.glassfish.jersey.message.internal.OutboundJaxrsResponse; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; @@ -86,6 +86,7 @@ import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.BikeAccess; +import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.organization.Agency; import org.opentripplanner.transit.model.site.RegularStop; @@ -114,6 +115,7 @@ class GraphQLIntegrationTest { .of(A, B, C, D, E, F, G, H) .map(p -> (RegularStop) p.stop) .toList(); + private static final Route ROUTE = TransitModelForTest.route("a-route").build(); private static VehicleRentalStation VEHICLE_RENTAL_STATION = new TestVehicleRentalStationBuilder() .withVehicles(10) @@ -160,11 +162,13 @@ static void setup() { var model = stopModel.build(); var transitModel = new TransitModel(model, DEDUPLICATOR); - final TripPattern pattern = TEST_MODEL.pattern(BUS).build(); var trip = TransitModelForTest.trip("123").withHeadsign(I18NString.of("Trip Headsign")).build(); var stopTimes = TEST_MODEL.stopTimesEvery5Minutes(3, trip, T11_00); var tripTimes = TripTimesFactory.tripTimes(trip, stopTimes, DEDUPLICATOR); - pattern.add(tripTimes); + final TripPattern pattern = TEST_MODEL + .pattern(BUS) + .withScheduledTimeTableBuilder(builder -> builder.addTripTimes(tripTimes)) + .build(); transitModel.addTripPattern(id("pattern-1"), pattern); @@ -209,6 +213,11 @@ public List getModesOfStopLocation(StopLocation stop) { public TransitAlertService getTransitAlertService() { return alertService; } + + @Override + public Set getRoutesForStop(StopLocation stop) { + return Set.of(ROUTE); + } }; routes.forEach(transitService::addRoutes); @@ -342,7 +351,9 @@ private static void add10MinuteDelay(Itinerary i1) { }); } - @FilePatternSource(pattern = "src/test/resources/org/opentripplanner/apis/gtfs/queries/*.graphql") + @FilePatternSource( + pattern = "application/src/test/resources/org/opentripplanner/apis/gtfs/queries/*.graphql" + ) @ParameterizedTest(name = "Check GraphQL query in {0}") void graphQL(Path path) throws IOException { var query = Files.readString(path); @@ -375,7 +386,6 @@ void graphQL(Path path) throws IOException { assertEqualJson(expectedJson, actualJson); } - @Nonnull private static List getTransitAlert(EntitySelector.Stop entitySelector) { var alertWithoutDescription = TransitAlert .of(id("no-description")) @@ -396,7 +406,6 @@ private static List getTransitAlert(EntitySelector.Stop entitySele .toList(); } - @Nonnull private static WalkStepBuilder walkStep(String name) { return WalkStep .builder() @@ -405,7 +414,6 @@ private static WalkStepBuilder walkStep(String name) { .withAngle(10); } - @Nonnull private static FareProduct fareProduct(String name) { return new FareProduct( id(name), @@ -421,7 +429,6 @@ private static FareProduct fareProduct(String name) { * Locate 'expectations' relative to the given query input file. The 'expectations' and 'queries' * subdirectories are expected to be in the same directory. */ - @Nonnull private static Path getExpectation(Path path) { return path .getParent() diff --git a/src/test/java/org/opentripplanner/apis/gtfs/OffsetDateTimeScalarTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/OffsetDateTimeScalarTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/OffsetDateTimeScalarTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/OffsetDateTimeScalarTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/RatioScalarTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/RatioScalarTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/RatioScalarTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/RatioScalarTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/ReluctanceScalarTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/ReluctanceScalarTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/ReluctanceScalarTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/ReluctanceScalarTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/TestRoutingService.java b/application/src/test/java/org/opentripplanner/apis/gtfs/TestRoutingService.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/TestRoutingService.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/TestRoutingService.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/datafetchers/QueryTypeImplTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/datafetchers/QueryTypeImplTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/datafetchers/QueryTypeImplTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/datafetchers/QueryTypeImplTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/mapping/BikesAllowedMapperTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/BikesAllowedMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/mapping/BikesAllowedMapperTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/mapping/BikesAllowedMapperTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/mapping/DirectionMapperTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/DirectionMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/mapping/DirectionMapperTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/mapping/DirectionMapperTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/mapping/LocalDateRangeMapperTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/LocalDateRangeMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/mapping/LocalDateRangeMapperTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/mapping/LocalDateRangeMapperTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/mapping/StreetNoteMapperTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/StreetNoteMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/mapping/StreetNoteMapperTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/mapping/StreetNoteMapperTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperAccessibilityTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperAccessibilityTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperAccessibilityTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperAccessibilityTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperBicycleTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperBicycleTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperBicycleTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperBicycleTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperCarTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperCarTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperCarTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperCarTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperModesTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperModesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperModesTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperModesTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperScooterTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperScooterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperScooterTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperScooterTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperTransitTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperTransitTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperTransitTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperTransitTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperWalkTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperWalkTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperWalkTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperWalkTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/model/LocalDateRangeTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/model/LocalDateRangeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/gtfs/model/LocalDateRangeTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/model/LocalDateRangeTest.java diff --git a/src/test/java/org/opentripplanner/apis/support/TileJsonTest.java b/application/src/test/java/org/opentripplanner/apis/support/TileJsonTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/support/TileJsonTest.java rename to application/src/test/java/org/opentripplanner/apis/support/TileJsonTest.java diff --git a/src/test/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLSchemaTest.java b/application/src/test/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLSchemaTest.java similarity index 89% rename from src/test/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLSchemaTest.java rename to application/src/test/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLSchemaTest.java index d762d784d3f..bfbaedfabbf 100644 --- a/src/test/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLSchemaTest.java +++ b/application/src/test/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLSchemaTest.java @@ -9,7 +9,6 @@ import java.io.File; import org.junit.jupiter.api.Test; import org.opentripplanner._support.time.ZoneIds; -import org.opentripplanner.apis.transmodel.support.GqlUtil; import org.opentripplanner.routing.api.request.RouteRequest; class TransmodelGraphQLSchemaTest { @@ -20,8 +19,7 @@ class TransmodelGraphQLSchemaTest { @Test void testSchemaBuild() { - GqlUtil gqlUtil = new GqlUtil(ZoneIds.OSLO); - var schema = TransmodelGraphQLSchema.create(new RouteRequest(), gqlUtil); + var schema = TransmodelGraphQLSchema.create(new RouteRequest(), ZoneIds.OSLO); assertNotNull(schema); String original = readFile(SCHEMA_FILE); diff --git a/src/test/java/org/opentripplanner/apis/transmodel/mapping/RequestModesMapperTest.java b/application/src/test/java/org/opentripplanner/apis/transmodel/mapping/RequestModesMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/transmodel/mapping/RequestModesMapperTest.java rename to application/src/test/java/org/opentripplanner/apis/transmodel/mapping/RequestModesMapperTest.java diff --git a/src/test/java/org/opentripplanner/apis/transmodel/mapping/TransitIdMapperTest.java b/application/src/test/java/org/opentripplanner/apis/transmodel/mapping/TransitIdMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/transmodel/mapping/TransitIdMapperTest.java rename to application/src/test/java/org/opentripplanner/apis/transmodel/mapping/TransitIdMapperTest.java diff --git a/src/test/java/org/opentripplanner/apis/transmodel/mapping/TripRequestMapperTest.java b/application/src/test/java/org/opentripplanner/apis/transmodel/mapping/TripRequestMapperTest.java similarity index 94% rename from src/test/java/org/opentripplanner/apis/transmodel/mapping/TripRequestMapperTest.java rename to application/src/test/java/org/opentripplanner/apis/transmodel/mapping/TripRequestMapperTest.java index ab7e2b62b7c..38a411ac1cf 100644 --- a/src/test/java/org/opentripplanner/apis/transmodel/mapping/TripRequestMapperTest.java +++ b/application/src/test/java/org/opentripplanner/apis/transmodel/mapping/TripRequestMapperTest.java @@ -39,11 +39,11 @@ import org.opentripplanner.model.plan.PlanTestConstants; import org.opentripplanner.model.plan.ScheduledTransitLeg; import org.opentripplanner.raptor.configure.RaptorConfig; -import org.opentripplanner.routing.api.request.PassThroughPoint; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.api.request.StreetMode; import org.opentripplanner.routing.api.request.preference.StreetPreferences; import org.opentripplanner.routing.api.request.preference.TimeSlopeSafetyTriangle; +import org.opentripplanner.routing.api.request.via.ViaLocation; import org.opentripplanner.routing.core.VehicleRoutingOptimizeType; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.service.realtimevehicles.internal.DefaultRealtimeVehicleService; @@ -311,39 +311,29 @@ public void testBikeTriangleFactorsHasNoEffect(VehicleRoutingOptimizeType bot) { } @Test - void testPassThroughPoints() { + void testViaLocations() { TransitIdMapper.clearFixedFeedId(); - final List PTP1 = List.of(stop1, stop2, stop3).stream().map(STOP_TO_ID).toList(); - final List PTP2 = List.of(stop2, stop3, stop1).stream().map(STOP_TO_ID).toList(); + final List PTP1 = Stream.of(stop1, stop2, stop3).map(STOP_TO_ID).toList(); + final List PTP2 = Stream.of(stop3, stop2).map(STOP_TO_ID).toList(); final Map arguments = Map.of( "passThroughPoints", List.of(Map.of("name", "PTP1", "placeIds", PTP1), Map.of("placeIds", PTP2, "name", "PTP2")) ); - final List points = TripRequestMapper + final List viaLocations = TripRequestMapper .createRequest(executionContext(arguments)) - .getPassThroughPoints(); - assertEquals(PTP1, points.get(0).stopLocations().stream().map(STOP_TO_ID).toList()); - assertEquals("PTP1", points.get(0).name()); - assertEquals(PTP2, points.get(1).stopLocations().stream().map(STOP_TO_ID).toList()); - assertEquals("PTP2", points.get(1).name()); - } - - @Test - void testPassThroughPointsNoMatch() { - TransitIdMapper.clearFixedFeedId(); - - final Map arguments = Map.of( - "passThroughPoints", - List.of(Map.of("placeIds", List.of("F:XX:NonExisting"))) + .getViaLocations(); + assertEquals( + "PassThroughViaLocation{label: PTP1, stopLocationIds: [F:ST:stop1, F:ST:stop2, F:ST:stop3]}", + viaLocations.get(0).toString() ); - - final RuntimeException ex = assertThrows( - RuntimeException.class, - () -> TripRequestMapper.createRequest(executionContext(arguments)) + assertEquals("PTP1", viaLocations.get(0).label()); + assertEquals( + "PassThroughViaLocation{label: PTP2, stopLocationIds: [F:ST:stop3, F:ST:stop2]}", + viaLocations.get(1).toString() ); - assertEquals("No match for F:XX:NonExisting.", ex.getMessage()); + assertEquals("PTP2", viaLocations.get(1).label()); } @Test diff --git a/application/src/test/java/org/opentripplanner/apis/transmodel/mapping/TripViaLocationMapperTest.java b/application/src/test/java/org/opentripplanner/apis/transmodel/mapping/TripViaLocationMapperTest.java new file mode 100644 index 00000000000..49304ee1e05 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/apis/transmodel/mapping/TripViaLocationMapperTest.java @@ -0,0 +1,141 @@ +package org.opentripplanner.apis.transmodel.mapping; + +import static java.util.Map.entry; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.opentripplanner.apis.transmodel.model.plan.ViaLocationInputType.FIELD_LABEL; +import static org.opentripplanner.apis.transmodel.model.plan.ViaLocationInputType.FIELD_MINIMUM_WAIT_TIME; +import static org.opentripplanner.apis.transmodel.model.plan.ViaLocationInputType.FIELD_PASS_THROUGH; +import static org.opentripplanner.apis.transmodel.model.plan.ViaLocationInputType.FIELD_STOP_LOCATION_IDS; +import static org.opentripplanner.apis.transmodel.model.plan.ViaLocationInputType.FIELD_VISIT; + +import java.time.Duration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class TripViaLocationMapperTest { + + public static final String LABEL = "TestLabel"; + public static final Duration MIN_WAIT_TIME = Duration.ofMinutes(5); + public static final List LIST_IDS_INPUT = List.of("F:ID1", "F:ID2"); + public static final String EXPECTED_IDS_AS_STRING = "[F:ID1, F:ID2]"; + + @BeforeEach + void setup() { + TransitIdMapper.clearFixedFeedId(); + } + + @Test + void testMapToVisitViaLocations() { + Map input = Map.ofEntries( + entry(FIELD_VISIT, visitInput(LABEL, MIN_WAIT_TIME, LIST_IDS_INPUT)) + ); + var result = TripViaLocationMapper.mapToViaLocations(List.of(input)); + + var via = result.getFirst(); + + assertEquals(LABEL, via.label()); + assertEquals(MIN_WAIT_TIME, via.minimumWaitTime()); + assertEquals(EXPECTED_IDS_AS_STRING, via.stopLocationIds().toString()); + assertFalse(via.isPassThroughLocation()); + assertEquals( + "[VisitViaLocation{label: TestLabel, minimumWaitTime: 5m, stopLocationIds: [F:ID1, F:ID2], coordinates: []}]", + result.toString() + ); + } + + @Test + void testMapToVisitViaLocationsWithBareMinimum() { + Map input = Map.of( + FIELD_VISIT, + Map.of(FIELD_STOP_LOCATION_IDS, List.of("F:1")) + ); + var result = TripViaLocationMapper.mapToViaLocations(List.of(input)); + + var via = result.getFirst(); + + assertNull(via.label()); + assertEquals(Duration.ZERO, via.minimumWaitTime()); + assertEquals("[F:1]", via.stopLocationIds().toString()); + assertFalse(via.isPassThroughLocation()); + } + + @Test + void tetMapToPassThrough() { + Map input = Map.of(FIELD_PASS_THROUGH, passThroughInput(LABEL, LIST_IDS_INPUT)); + var result = TripViaLocationMapper.mapToViaLocations(List.of(input)); + var via = result.getFirst(); + + assertEquals(LABEL, via.label()); + assertEquals(EXPECTED_IDS_AS_STRING, via.stopLocationIds().toString()); + assertTrue(via.isPassThroughLocation()); + assertEquals( + "PassThroughViaLocation{label: TestLabel, stopLocationIds: [F:ID1, F:ID2]}", + via.toString() + ); + } + + @Test + void tetMapToPassThroughWithBareMinimum() { + Map input = Map.of( + FIELD_PASS_THROUGH, + Map.of(FIELD_STOP_LOCATION_IDS, List.of("F:1")) + ); + var result = TripViaLocationMapper.mapToViaLocations(List.of(input)); + var via = result.getFirst(); + + assertNull(via.label()); + assertEquals("[F:1]", via.stopLocationIds().toString()); + assertTrue(via.isPassThroughLocation()); + } + + @Test + void testOneOf() { + Map input = Map.ofEntries( + entry(FIELD_VISIT, visitInput("A", Duration.ofMinutes(1), List.of("F:99"))), + entry(FIELD_PASS_THROUGH, passThroughInput(LABEL, LIST_IDS_INPUT)) + ); + var ex = assertThrows( + IllegalArgumentException.class, + () -> TripViaLocationMapper.mapToViaLocations(List.of(input)) + ); + assertEquals( + "Only one entry in 'via @oneOf' is allowed. Set: 'visit', 'passThrough'", + ex.getMessage() + ); + + ex = + assertThrows( + IllegalArgumentException.class, + () -> TripViaLocationMapper.mapToViaLocations(List.of(Map.of())) + ); + assertEquals( + "No entries in 'via @oneOf'. One of 'visit', 'passThrough' must be set.", + ex.getMessage() + ); + } + + private Map visitInput(String label, Duration minWaitTime, List ids) { + var map = new HashMap(); + if (label != null) { + map.put(FIELD_LABEL, label); + } + if (minWaitTime != null) { + map.put(FIELD_MINIMUM_WAIT_TIME, minWaitTime); + } + if (ids != null) { + map.put(FIELD_STOP_LOCATION_IDS, ids); + } + return map; + } + + private Map passThroughInput(String label, List ids) { + return visitInput(label, null, ids); + } +} diff --git a/src/test/java/org/opentripplanner/apis/transmodel/mapping/preferences/BikePreferencesMapperTest.java b/application/src/test/java/org/opentripplanner/apis/transmodel/mapping/preferences/BikePreferencesMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/transmodel/mapping/preferences/BikePreferencesMapperTest.java rename to application/src/test/java/org/opentripplanner/apis/transmodel/mapping/preferences/BikePreferencesMapperTest.java diff --git a/src/test/java/org/opentripplanner/apis/transmodel/mapping/preferences/CarPreferencesMapperTest.java b/application/src/test/java/org/opentripplanner/apis/transmodel/mapping/preferences/CarPreferencesMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/transmodel/mapping/preferences/CarPreferencesMapperTest.java rename to application/src/test/java/org/opentripplanner/apis/transmodel/mapping/preferences/CarPreferencesMapperTest.java diff --git a/src/test/java/org/opentripplanner/apis/transmodel/mapping/preferences/ScooterPreferencesMapperTest.java b/application/src/test/java/org/opentripplanner/apis/transmodel/mapping/preferences/ScooterPreferencesMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/transmodel/mapping/preferences/ScooterPreferencesMapperTest.java rename to application/src/test/java/org/opentripplanner/apis/transmodel/mapping/preferences/ScooterPreferencesMapperTest.java diff --git a/src/test/java/org/opentripplanner/apis/transmodel/mapping/preferences/WalkPreferencesMapperTest.java b/application/src/test/java/org/opentripplanner/apis/transmodel/mapping/preferences/WalkPreferencesMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/transmodel/mapping/preferences/WalkPreferencesMapperTest.java rename to application/src/test/java/org/opentripplanner/apis/transmodel/mapping/preferences/WalkPreferencesMapperTest.java diff --git a/src/test/java/org/opentripplanner/apis/transmodel/model/EnumTypesTest.java b/application/src/test/java/org/opentripplanner/apis/transmodel/model/EnumTypesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/transmodel/model/EnumTypesTest.java rename to application/src/test/java/org/opentripplanner/apis/transmodel/model/EnumTypesTest.java diff --git a/src/test/java/org/opentripplanner/apis/transmodel/model/TransportModeSlackTest.java b/application/src/test/java/org/opentripplanner/apis/transmodel/model/TransportModeSlackTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/transmodel/model/TransportModeSlackTest.java rename to application/src/test/java/org/opentripplanner/apis/transmodel/model/TransportModeSlackTest.java diff --git a/src/test/java/org/opentripplanner/apis/transmodel/model/plan/RelaxCostTypeTest.java b/application/src/test/java/org/opentripplanner/apis/transmodel/model/plan/RelaxCostTypeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/transmodel/model/plan/RelaxCostTypeTest.java rename to application/src/test/java/org/opentripplanner/apis/transmodel/model/plan/RelaxCostTypeTest.java diff --git a/src/test/java/org/opentripplanner/apis/transmodel/model/plan/TripPlanTimePenaltyDtoTest.java b/application/src/test/java/org/opentripplanner/apis/transmodel/model/plan/TripPlanTimePenaltyDtoTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/transmodel/model/plan/TripPlanTimePenaltyDtoTest.java rename to application/src/test/java/org/opentripplanner/apis/transmodel/model/plan/TripPlanTimePenaltyDtoTest.java diff --git a/src/test/java/org/opentripplanner/apis/transmodel/model/scalars/DateTimeScalarFactoryTest.java b/application/src/test/java/org/opentripplanner/apis/transmodel/model/scalars/DateTimeScalarFactoryTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/transmodel/model/scalars/DateTimeScalarFactoryTest.java rename to application/src/test/java/org/opentripplanner/apis/transmodel/model/scalars/DateTimeScalarFactoryTest.java diff --git a/src/test/java/org/opentripplanner/apis/transmodel/support/ExecutionResultMapperTest.java b/application/src/test/java/org/opentripplanner/apis/transmodel/support/ExecutionResultMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/transmodel/support/ExecutionResultMapperTest.java rename to application/src/test/java/org/opentripplanner/apis/transmodel/support/ExecutionResultMapperTest.java diff --git a/src/test/java/org/opentripplanner/apis/transmodel/support/GqlUtilTest.java b/application/src/test/java/org/opentripplanner/apis/transmodel/support/GqlUtilTest.java similarity index 100% rename from src/test/java/org/opentripplanner/apis/transmodel/support/GqlUtilTest.java rename to application/src/test/java/org/opentripplanner/apis/transmodel/support/GqlUtilTest.java diff --git a/application/src/test/java/org/opentripplanner/apis/transmodel/support/OneOfInputValidatorTest.java b/application/src/test/java/org/opentripplanner/apis/transmodel/support/OneOfInputValidatorTest.java new file mode 100644 index 00000000000..e641a1cc855 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/apis/transmodel/support/OneOfInputValidatorTest.java @@ -0,0 +1,53 @@ +package org.opentripplanner.apis.transmodel.support; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Test; + +class OneOfInputValidatorTest { + + @Test + void testValidateOneReturnsTheFieldName() { + assertEquals( + "two", + OneOfInputValidator.validateOneOf(Map.of("two", "X"), "parent", "one", "two") + ); + } + + @Test + void testValidateOneOfWithEmptySetOfArguments() { + var ex = assertThrows( + IllegalArgumentException.class, + () -> OneOfInputValidator.validateOneOf(Map.of(), "parent", "one", "two") + ); + assertEquals( + "No entries in 'parent @oneOf'. One of 'one', 'two' must be set.", + ex.getMessage() + ); + } + + @Test + void testValidateOneOfWithTooManyArguments() { + var ex = assertThrows( + IllegalArgumentException.class, + () -> + OneOfInputValidator.validateOneOf(Map.of("one", "X", "two", "Y"), "parent", "one", "two") + ); + assertEquals( + "Only one entry in 'parent @oneOf' is allowed. Set: 'one', 'two'", + ex.getMessage() + ); + } + + @Test + void testValidateOneOfWithEmptyCollection() { + var ex = assertThrows( + IllegalArgumentException.class, + () -> OneOfInputValidator.validateOneOf(Map.of("one", List.of()), "parent", "one", "two") + ); + assertEquals("'one' can not be empty in 'parent @oneOf'.", ex.getMessage()); + } +} diff --git a/src/test/java/org/opentripplanner/apis/vectortiles/DebugStyleSpecTest.java b/application/src/test/java/org/opentripplanner/apis/vectortiles/DebugStyleSpecTest.java similarity index 94% rename from src/test/java/org/opentripplanner/apis/vectortiles/DebugStyleSpecTest.java rename to application/src/test/java/org/opentripplanner/apis/vectortiles/DebugStyleSpecTest.java index 6a60490a07f..db056050394 100644 --- a/src/test/java/org/opentripplanner/apis/vectortiles/DebugStyleSpecTest.java +++ b/application/src/test/java/org/opentripplanner/apis/vectortiles/DebugStyleSpecTest.java @@ -16,6 +16,9 @@ class DebugStyleSpecTest { private final ResourceLoader RESOURCES = ResourceLoader.of(this); + /** + * Remove the style.json file and re-run this test in order to regenerate the file. + */ @Test void spec() throws IOException { var vectorSource = new VectorSource("vectorSource", "https://example.com"); diff --git a/src/test/java/org/opentripplanner/astar/AStarArchitectureTest.java b/application/src/test/java/org/opentripplanner/astar/AStarArchitectureTest.java similarity index 100% rename from src/test/java/org/opentripplanner/astar/AStarArchitectureTest.java rename to application/src/test/java/org/opentripplanner/astar/AStarArchitectureTest.java diff --git a/src/test/java/org/opentripplanner/astar/AStarTest.java b/application/src/test/java/org/opentripplanner/astar/AStarTest.java similarity index 100% rename from src/test/java/org/opentripplanner/astar/AStarTest.java rename to application/src/test/java/org/opentripplanner/astar/AStarTest.java diff --git a/src/test/java/org/opentripplanner/astar/model/BinHeapTest.java b/application/src/test/java/org/opentripplanner/astar/model/BinHeapTest.java similarity index 100% rename from src/test/java/org/opentripplanner/astar/model/BinHeapTest.java rename to application/src/test/java/org/opentripplanner/astar/model/BinHeapTest.java diff --git a/src/test/java/org/opentripplanner/astar/strategy/MaxCountSkipEdgeStrategyTest.java b/application/src/test/java/org/opentripplanner/astar/strategy/MaxCountSkipEdgeStrategyTest.java similarity index 76% rename from src/test/java/org/opentripplanner/astar/strategy/MaxCountSkipEdgeStrategyTest.java rename to application/src/test/java/org/opentripplanner/astar/strategy/MaxCountSkipEdgeStrategyTest.java index 88976591ea1..c190ff1abac 100644 --- a/src/test/java/org/opentripplanner/astar/strategy/MaxCountSkipEdgeStrategyTest.java +++ b/application/src/test/java/org/opentripplanner/astar/strategy/MaxCountSkipEdgeStrategyTest.java @@ -9,10 +9,12 @@ class MaxCountSkipEdgeStrategyTest { + private final StreetNearbyStopFinder finder = new StreetNearbyStopFinder(null, 0, null); + @Test void countStops() { var state = TestStateBuilder.ofWalking().stop().build(); - var strategy = new MaxCountSkipEdgeStrategy<>(1, StreetNearbyStopFinder::hasReachedStop); + var strategy = new MaxCountSkipEdgeStrategy<>(1, finder::hasReachedStop); assertFalse(strategy.shouldSkipEdge(state, null)); assertTrue(strategy.shouldSkipEdge(state, null)); } @@ -20,7 +22,7 @@ void countStops() { @Test void doNotCountStop() { var state = TestStateBuilder.ofWalking().build(); - var strategy = new MaxCountSkipEdgeStrategy<>(1, StreetNearbyStopFinder::hasReachedStop); + var strategy = new MaxCountSkipEdgeStrategy<>(1, finder::hasReachedStop); assertFalse(strategy.shouldSkipEdge(state, null)); assertFalse(strategy.shouldSkipEdge(state, null)); assertFalse(strategy.shouldSkipEdge(state, null)); @@ -30,7 +32,7 @@ void doNotCountStop() { void nonFinalState() { var state = TestStateBuilder.ofScooterRentalArriveBy().stop().build(); assertFalse(state.isFinal()); - var strategy = new MaxCountSkipEdgeStrategy<>(1, StreetNearbyStopFinder::hasReachedStop); + var strategy = new MaxCountSkipEdgeStrategy<>(1, finder::hasReachedStop); assertFalse(strategy.shouldSkipEdge(state, null)); } } diff --git a/src/test/java/org/opentripplanner/astar/strategy/PathComparatorTest.java b/application/src/test/java/org/opentripplanner/astar/strategy/PathComparatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/astar/strategy/PathComparatorTest.java rename to application/src/test/java/org/opentripplanner/astar/strategy/PathComparatorTest.java diff --git a/src/test/java/org/opentripplanner/datastore/DataStoreArchitectureTest.java b/application/src/test/java/org/opentripplanner/datastore/DataStoreArchitectureTest.java similarity index 100% rename from src/test/java/org/opentripplanner/datastore/DataStoreArchitectureTest.java rename to application/src/test/java/org/opentripplanner/datastore/DataStoreArchitectureTest.java diff --git a/src/test/java/org/opentripplanner/datastore/OtpDataStoreTest.java b/application/src/test/java/org/opentripplanner/datastore/OtpDataStoreTest.java similarity index 100% rename from src/test/java/org/opentripplanner/datastore/OtpDataStoreTest.java rename to application/src/test/java/org/opentripplanner/datastore/OtpDataStoreTest.java diff --git a/src/test/java/org/opentripplanner/datastore/base/ByteArrayDataSourceTest.java b/application/src/test/java/org/opentripplanner/datastore/base/ByteArrayDataSourceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/datastore/base/ByteArrayDataSourceTest.java rename to application/src/test/java/org/opentripplanner/datastore/base/ByteArrayDataSourceTest.java diff --git a/src/test/java/org/opentripplanner/datastore/file/DirectoryDataSourceTest.java b/application/src/test/java/org/opentripplanner/datastore/file/DirectoryDataSourceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/datastore/file/DirectoryDataSourceTest.java rename to application/src/test/java/org/opentripplanner/datastore/file/DirectoryDataSourceTest.java diff --git a/src/test/java/org/opentripplanner/datastore/file/FileDataSourceTest.java b/application/src/test/java/org/opentripplanner/datastore/file/FileDataSourceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/datastore/file/FileDataSourceTest.java rename to application/src/test/java/org/opentripplanner/datastore/file/FileDataSourceTest.java diff --git a/src/test/java/org/opentripplanner/datastore/file/ZipFileDataSourceTest.java b/application/src/test/java/org/opentripplanner/datastore/file/ZipFileDataSourceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/datastore/file/ZipFileDataSourceTest.java rename to application/src/test/java/org/opentripplanner/datastore/file/ZipFileDataSourceTest.java diff --git a/src/test/java/org/opentripplanner/datastore/file/ZipStreamDataSourceDecoratorTest.java b/application/src/test/java/org/opentripplanner/datastore/file/ZipStreamDataSourceDecoratorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/datastore/file/ZipStreamDataSourceDecoratorTest.java rename to application/src/test/java/org/opentripplanner/datastore/file/ZipStreamDataSourceDecoratorTest.java diff --git a/src/test/java/org/opentripplanner/datastore/https/HttpsDataSourceRepositoryTest.java b/application/src/test/java/org/opentripplanner/datastore/https/HttpsDataSourceRepositoryTest.java similarity index 100% rename from src/test/java/org/opentripplanner/datastore/https/HttpsDataSourceRepositoryTest.java rename to application/src/test/java/org/opentripplanner/datastore/https/HttpsDataSourceRepositoryTest.java diff --git a/src/test/java/org/opentripplanner/datastore/https/HttpsFileDataSourceTest.java b/application/src/test/java/org/opentripplanner/datastore/https/HttpsFileDataSourceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/datastore/https/HttpsFileDataSourceTest.java rename to application/src/test/java/org/opentripplanner/datastore/https/HttpsFileDataSourceTest.java diff --git a/src/test/java/org/opentripplanner/ext/restapi/resources/PlannerResourceTest.java b/application/src/test/java/org/opentripplanner/ext/restapi/resources/PlannerResourceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/ext/restapi/resources/PlannerResourceTest.java rename to application/src/test/java/org/opentripplanner/ext/restapi/resources/PlannerResourceTest.java diff --git a/src/test/java/org/opentripplanner/ext/transmodelapi/_support/TestDataFetcherDecorator.java b/application/src/test/java/org/opentripplanner/ext/transmodelapi/_support/TestDataFetcherDecorator.java similarity index 100% rename from src/test/java/org/opentripplanner/ext/transmodelapi/_support/TestDataFetcherDecorator.java rename to application/src/test/java/org/opentripplanner/ext/transmodelapi/_support/TestDataFetcherDecorator.java diff --git a/src/test/java/org/opentripplanner/framework/FrameworkArchitectureTest.java b/application/src/test/java/org/opentripplanner/framework/FrameworkArchitectureTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/FrameworkArchitectureTest.java rename to application/src/test/java/org/opentripplanner/framework/FrameworkArchitectureTest.java diff --git a/src/test/java/org/opentripplanner/framework/application/OTPFeatureTest.java b/application/src/test/java/org/opentripplanner/framework/application/OTPFeatureTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/application/OTPFeatureTest.java rename to application/src/test/java/org/opentripplanner/framework/application/OTPFeatureTest.java diff --git a/src/test/java/org/opentripplanner/framework/application/OtpAppExceptionTest.java b/application/src/test/java/org/opentripplanner/framework/application/OtpAppExceptionTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/application/OtpAppExceptionTest.java rename to application/src/test/java/org/opentripplanner/framework/application/OtpAppExceptionTest.java diff --git a/src/test/java/org/opentripplanner/framework/application/OtpFileNamesTest.java b/application/src/test/java/org/opentripplanner/framework/application/OtpFileNamesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/application/OtpFileNamesTest.java rename to application/src/test/java/org/opentripplanner/framework/application/OtpFileNamesTest.java diff --git a/src/test/java/org/opentripplanner/framework/collection/CollectionUtilsTest.java b/application/src/test/java/org/opentripplanner/framework/collection/CollectionUtilsTest.java similarity index 63% rename from src/test/java/org/opentripplanner/framework/collection/CollectionUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/collection/CollectionUtilsTest.java index ae33e493bcc..6686ac8e0d9 100644 --- a/src/test/java/org/opentripplanner/framework/collection/CollectionUtilsTest.java +++ b/application/src/test/java/org/opentripplanner/framework/collection/CollectionUtilsTest.java @@ -1,13 +1,17 @@ package org.opentripplanner.framework.collection; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.type.Month; import java.time.Duration; import java.util.ArrayList; +import java.util.Collection; import java.util.EnumSet; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import org.junit.jupiter.api.Test; @@ -15,6 +19,13 @@ class CollectionUtilsTest { public static final String NULL_STRING = ""; + @Test + void testIsEmpty() { + assertTrue(CollectionUtils.isEmpty((List) null)); + assertTrue(CollectionUtils.isEmpty(List.of())); + assertFalse(CollectionUtils.isEmpty(List.of(1))); + } + @Test void testToString() { assertEquals("", CollectionUtils.toString(null, NULL_STRING)); @@ -40,4 +51,18 @@ void testToString() { Set set = new HashSet<>(list); assertEquals("[, APRIL, JUNE, PT3H]", CollectionUtils.toString(set, NULL_STRING)); } + + @Test + void testIsEmptyMap() { + assertTrue(CollectionUtils.isEmpty((Map) null)); + assertTrue(CollectionUtils.isEmpty(Map.of())); + assertFalse(CollectionUtils.isEmpty(Map.of(1, 1))); + } + + @Test + void testIsEmptyCollection() { + assertTrue(CollectionUtils.isEmpty((Collection) null)); + assertTrue(CollectionUtils.isEmpty(List.of())); + assertFalse(CollectionUtils.isEmpty(Set.of(1))); + } } diff --git a/src/test/java/org/opentripplanner/framework/collection/CollectionsViewTest.java b/application/src/test/java/org/opentripplanner/framework/collection/CollectionsViewTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/collection/CollectionsViewTest.java rename to application/src/test/java/org/opentripplanner/framework/collection/CollectionsViewTest.java diff --git a/src/test/java/org/opentripplanner/framework/collection/CompositeComparatorTest.java b/application/src/test/java/org/opentripplanner/framework/collection/CompositeComparatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/collection/CompositeComparatorTest.java rename to application/src/test/java/org/opentripplanner/framework/collection/CompositeComparatorTest.java diff --git a/src/test/java/org/opentripplanner/framework/collection/ListSectionTest.java b/application/src/test/java/org/opentripplanner/framework/collection/ListSectionTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/collection/ListSectionTest.java rename to application/src/test/java/org/opentripplanner/framework/collection/ListSectionTest.java diff --git a/src/test/java/org/opentripplanner/framework/collection/ListUtilsTest.java b/application/src/test/java/org/opentripplanner/framework/collection/ListUtilsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/collection/ListUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/collection/ListUtilsTest.java diff --git a/src/test/java/org/opentripplanner/framework/collection/MapUtilsTest.java b/application/src/test/java/org/opentripplanner/framework/collection/MapUtilsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/collection/MapUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/collection/MapUtilsTest.java diff --git a/src/test/java/org/opentripplanner/framework/collection/SetUtilsTest.java b/application/src/test/java/org/opentripplanner/framework/collection/SetUtilsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/collection/SetUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/collection/SetUtilsTest.java diff --git a/src/test/java/org/opentripplanner/framework/doc/DocumentedEnumTestHelper.java b/application/src/test/java/org/opentripplanner/framework/doc/DocumentedEnumTestHelper.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/doc/DocumentedEnumTestHelper.java rename to application/src/test/java/org/opentripplanner/framework/doc/DocumentedEnumTestHelper.java diff --git a/src/test/java/org/opentripplanner/framework/geometry/CompactElevationProfileTest.java b/application/src/test/java/org/opentripplanner/framework/geometry/CompactElevationProfileTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/geometry/CompactElevationProfileTest.java rename to application/src/test/java/org/opentripplanner/framework/geometry/CompactElevationProfileTest.java diff --git a/src/test/java/org/opentripplanner/framework/geometry/CompactLineStringUtilsTest.java b/application/src/test/java/org/opentripplanner/framework/geometry/CompactLineStringUtilsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/geometry/CompactLineStringUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/geometry/CompactLineStringUtilsTest.java diff --git a/src/test/java/org/opentripplanner/framework/geometry/DirectionUtilsTest.java b/application/src/test/java/org/opentripplanner/framework/geometry/DirectionUtilsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/geometry/DirectionUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/geometry/DirectionUtilsTest.java diff --git a/src/test/java/org/opentripplanner/framework/geometry/DistanceLibTest.java b/application/src/test/java/org/opentripplanner/framework/geometry/DistanceLibTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/geometry/DistanceLibTest.java rename to application/src/test/java/org/opentripplanner/framework/geometry/DistanceLibTest.java diff --git a/src/test/java/org/opentripplanner/framework/geometry/GeometryUtilsTest.java b/application/src/test/java/org/opentripplanner/framework/geometry/GeometryUtilsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/geometry/GeometryUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/geometry/GeometryUtilsTest.java diff --git a/src/test/java/org/opentripplanner/framework/geometry/HashGridTest.java b/application/src/test/java/org/opentripplanner/framework/geometry/HashGridTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/geometry/HashGridTest.java rename to application/src/test/java/org/opentripplanner/framework/geometry/HashGridTest.java diff --git a/src/test/java/org/opentripplanner/framework/geometry/PolylineEncoderTest.java b/application/src/test/java/org/opentripplanner/framework/geometry/PolylineEncoderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/geometry/PolylineEncoderTest.java rename to application/src/test/java/org/opentripplanner/framework/geometry/PolylineEncoderTest.java diff --git a/src/test/java/org/opentripplanner/framework/geometry/SphericalDistanceLibraryTest.java b/application/src/test/java/org/opentripplanner/framework/geometry/SphericalDistanceLibraryTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/geometry/SphericalDistanceLibraryTest.java rename to application/src/test/java/org/opentripplanner/framework/geometry/SphericalDistanceLibraryTest.java diff --git a/src/test/java/org/opentripplanner/framework/geometry/WgsCoordinateTest.java b/application/src/test/java/org/opentripplanner/framework/geometry/WgsCoordinateTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/geometry/WgsCoordinateTest.java rename to application/src/test/java/org/opentripplanner/framework/geometry/WgsCoordinateTest.java diff --git a/src/test/java/org/opentripplanner/framework/graphql/GraphQLUtilsTest.java b/application/src/test/java/org/opentripplanner/framework/graphql/GraphQLUtilsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/graphql/GraphQLUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/graphql/GraphQLUtilsTest.java diff --git a/src/test/java/org/opentripplanner/framework/graphql/scalar/DateScalarFactoryTest.java b/application/src/test/java/org/opentripplanner/framework/graphql/scalar/DateScalarFactoryTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/graphql/scalar/DateScalarFactoryTest.java rename to application/src/test/java/org/opentripplanner/framework/graphql/scalar/DateScalarFactoryTest.java diff --git a/src/test/java/org/opentripplanner/framework/i18n/LocalizedStringTest.java b/application/src/test/java/org/opentripplanner/framework/i18n/LocalizedStringTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/i18n/LocalizedStringTest.java rename to application/src/test/java/org/opentripplanner/framework/i18n/LocalizedStringTest.java diff --git a/src/test/java/org/opentripplanner/framework/i18n/TranslatedStringTest.java b/application/src/test/java/org/opentripplanner/framework/i18n/TranslatedStringTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/i18n/TranslatedStringTest.java rename to application/src/test/java/org/opentripplanner/framework/i18n/TranslatedStringTest.java diff --git a/src/test/java/org/opentripplanner/framework/io/HttpUtilsTest.java b/application/src/test/java/org/opentripplanner/framework/io/HttpUtilsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/io/HttpUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/io/HttpUtilsTest.java diff --git a/src/test/java/org/opentripplanner/framework/json/JsonUtilsTest.java b/application/src/test/java/org/opentripplanner/framework/json/JsonUtilsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/json/JsonUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/json/JsonUtilsTest.java diff --git a/src/test/java/org/opentripplanner/framework/lang/ArrayUtilsTest.java b/application/src/test/java/org/opentripplanner/framework/lang/ArrayUtilsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/lang/ArrayUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/lang/ArrayUtilsTest.java diff --git a/src/test/java/org/opentripplanner/framework/lang/BitSetUtilsTest.java b/application/src/test/java/org/opentripplanner/framework/lang/BitSetUtilsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/lang/BitSetUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/lang/BitSetUtilsTest.java diff --git a/src/test/java/org/opentripplanner/framework/lang/BoxTest.java b/application/src/test/java/org/opentripplanner/framework/lang/BoxTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/lang/BoxTest.java rename to application/src/test/java/org/opentripplanner/framework/lang/BoxTest.java diff --git a/src/test/java/org/opentripplanner/framework/lang/DoubleUtilsTest.java b/application/src/test/java/org/opentripplanner/framework/lang/DoubleUtilsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/lang/DoubleUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/lang/DoubleUtilsTest.java diff --git a/src/test/java/org/opentripplanner/framework/lang/IntBoxTest.java b/application/src/test/java/org/opentripplanner/framework/lang/IntBoxTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/lang/IntBoxTest.java rename to application/src/test/java/org/opentripplanner/framework/lang/IntBoxTest.java diff --git a/src/test/java/org/opentripplanner/framework/lang/IntRangeTest.java b/application/src/test/java/org/opentripplanner/framework/lang/IntRangeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/lang/IntRangeTest.java rename to application/src/test/java/org/opentripplanner/framework/lang/IntRangeTest.java diff --git a/src/test/java/org/opentripplanner/framework/lang/IntUtilsTest.java b/application/src/test/java/org/opentripplanner/framework/lang/IntUtilsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/lang/IntUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/lang/IntUtilsTest.java diff --git a/src/test/java/org/opentripplanner/framework/lang/MemEfficientArrayBuilderTest.java b/application/src/test/java/org/opentripplanner/framework/lang/MemEfficientArrayBuilderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/lang/MemEfficientArrayBuilderTest.java rename to application/src/test/java/org/opentripplanner/framework/lang/MemEfficientArrayBuilderTest.java diff --git a/src/test/java/org/opentripplanner/framework/lang/ObjectUtilsTest.java b/application/src/test/java/org/opentripplanner/framework/lang/ObjectUtilsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/lang/ObjectUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/lang/ObjectUtilsTest.java diff --git a/src/test/java/org/opentripplanner/framework/lang/OtpNumberFormatTest.java b/application/src/test/java/org/opentripplanner/framework/lang/OtpNumberFormatTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/lang/OtpNumberFormatTest.java rename to application/src/test/java/org/opentripplanner/framework/lang/OtpNumberFormatTest.java diff --git a/src/test/java/org/opentripplanner/framework/lang/StringUtilsTest.java b/application/src/test/java/org/opentripplanner/framework/lang/StringUtilsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/lang/StringUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/lang/StringUtilsTest.java diff --git a/src/test/java/org/opentripplanner/framework/logging/ProgressTrackerTest.java b/application/src/test/java/org/opentripplanner/framework/logging/ProgressTrackerTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/logging/ProgressTrackerTest.java rename to application/src/test/java/org/opentripplanner/framework/logging/ProgressTrackerTest.java diff --git a/src/test/java/org/opentripplanner/framework/logging/ThrottleTest.java b/application/src/test/java/org/opentripplanner/framework/logging/ThrottleTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/logging/ThrottleTest.java rename to application/src/test/java/org/opentripplanner/framework/logging/ThrottleTest.java diff --git a/src/test/java/org/opentripplanner/framework/model/CostTest.java b/application/src/test/java/org/opentripplanner/framework/model/CostTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/model/CostTest.java rename to application/src/test/java/org/opentripplanner/framework/model/CostTest.java diff --git a/src/test/java/org/opentripplanner/framework/model/TimeAndCostTest.java b/application/src/test/java/org/opentripplanner/framework/model/TimeAndCostTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/model/TimeAndCostTest.java rename to application/src/test/java/org/opentripplanner/framework/model/TimeAndCostTest.java diff --git a/src/test/java/org/opentripplanner/framework/model/UnitsTest.java b/application/src/test/java/org/opentripplanner/framework/model/UnitsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/model/UnitsTest.java rename to application/src/test/java/org/opentripplanner/framework/model/UnitsTest.java diff --git a/src/test/java/org/opentripplanner/framework/resources/ResourceBundleSingletonTest.java b/application/src/test/java/org/opentripplanner/framework/resources/ResourceBundleSingletonTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/resources/ResourceBundleSingletonTest.java rename to application/src/test/java/org/opentripplanner/framework/resources/ResourceBundleSingletonTest.java diff --git a/src/test/java/org/opentripplanner/framework/retry/OtpRetryTest.java b/application/src/test/java/org/opentripplanner/framework/retry/OtpRetryTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/retry/OtpRetryTest.java rename to application/src/test/java/org/opentripplanner/framework/retry/OtpRetryTest.java diff --git a/src/test/java/org/opentripplanner/framework/text/CharacterEscapeFormatterTest.java b/application/src/test/java/org/opentripplanner/framework/text/CharacterEscapeFormatterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/text/CharacterEscapeFormatterTest.java rename to application/src/test/java/org/opentripplanner/framework/text/CharacterEscapeFormatterTest.java diff --git a/src/test/java/org/opentripplanner/framework/text/FileSizeToTextConverterTest.java b/application/src/test/java/org/opentripplanner/framework/text/FileSizeToTextConverterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/text/FileSizeToTextConverterTest.java rename to application/src/test/java/org/opentripplanner/framework/text/FileSizeToTextConverterTest.java diff --git a/src/test/java/org/opentripplanner/framework/text/HexStringTest.java b/application/src/test/java/org/opentripplanner/framework/text/HexStringTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/text/HexStringTest.java rename to application/src/test/java/org/opentripplanner/framework/text/HexStringTest.java diff --git a/src/test/java/org/opentripplanner/framework/text/MarkdownFormatterTest.java b/application/src/test/java/org/opentripplanner/framework/text/MarkdownFormatterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/text/MarkdownFormatterTest.java rename to application/src/test/java/org/opentripplanner/framework/text/MarkdownFormatterTest.java diff --git a/src/test/java/org/opentripplanner/framework/text/TableTest.java b/application/src/test/java/org/opentripplanner/framework/text/TableTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/text/TableTest.java rename to application/src/test/java/org/opentripplanner/framework/text/TableTest.java diff --git a/src/test/java/org/opentripplanner/framework/time/CountdownTimerTest.java b/application/src/test/java/org/opentripplanner/framework/time/CountdownTimerTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/time/CountdownTimerTest.java rename to application/src/test/java/org/opentripplanner/framework/time/CountdownTimerTest.java diff --git a/src/test/java/org/opentripplanner/framework/time/DateUtilsTest.java b/application/src/test/java/org/opentripplanner/framework/time/DateUtilsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/time/DateUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/time/DateUtilsTest.java diff --git a/src/test/java/org/opentripplanner/framework/time/DurationUtilsTest.java b/application/src/test/java/org/opentripplanner/framework/time/DurationUtilsTest.java similarity index 85% rename from src/test/java/org/opentripplanner/framework/time/DurationUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/time/DurationUtilsTest.java index 97b8afc52c0..de6ac046310 100644 --- a/src/test/java/org/opentripplanner/framework/time/DurationUtilsTest.java +++ b/application/src/test/java/org/opentripplanner/framework/time/DurationUtilsTest.java @@ -4,9 +4,9 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.params.provider.Arguments.of; import static org.opentripplanner.framework.time.DurationUtils.requireNonNegative; -import static org.opentripplanner.framework.time.DurationUtils.requireNonNegativeLong; -import static org.opentripplanner.framework.time.DurationUtils.requireNonNegativeMedium; -import static org.opentripplanner.framework.time.DurationUtils.requireNonNegativeShort; +import static org.opentripplanner.framework.time.DurationUtils.requireNonNegativeMax2days; +import static org.opentripplanner.framework.time.DurationUtils.requireNonNegativeMax2hours; +import static org.opentripplanner.framework.time.DurationUtils.requireNonNegativeMax30minutes; import static org.opentripplanner.framework.time.DurationUtils.toIntMilliseconds; import java.time.Duration; @@ -23,6 +23,8 @@ public class DurationUtilsTest { + private final Duration NEG_1s = Duration.ofSeconds(-1); + private final Duration D1s = Duration.ofSeconds(1); private final Duration D3d = Duration.ofDays(3); private final Duration D2h = Duration.ofHours(2); private final Duration D5m = Duration.ofMinutes(5); @@ -127,42 +129,64 @@ public void testRequireNonNegative() { assertThrows(IllegalArgumentException.class, () -> requireNonNegative(Duration.ofSeconds(-1))); } + @Test + public void testRequireNonNegativeAndMaxLimit() { + // Firs make sure legal values are accepted + requireNonNegative(Duration.ZERO, D2h, "test"); + requireNonNegative(D2h.minus(D1s), D2h, "test"); + + // null is not supported + assertThrows(NullPointerException.class, () -> requireNonNegative(null, D2h, "test")); + + // Test max limit + var ex = assertThrows( + IllegalArgumentException.class, + () -> requireNonNegative(D2h, D2h, "test") + ); + assertEquals("Duration test can't be longer or equals too 2h: PT2H", ex.getMessage()); + + // Test non-negative + ex = + assertThrows(IllegalArgumentException.class, () -> requireNonNegative(NEG_1s, D2h, "test")); + assertEquals("Duration test can't be negative: PT-1S", ex.getMessage()); + } + @Test public void testRequireNonNegativeLong() { - assertThrows(NullPointerException.class, () -> requireNonNegativeLong(null, "test")); + assertThrows(NullPointerException.class, () -> requireNonNegativeMax2days(null, "test")); assertThrows( IllegalArgumentException.class, - () -> requireNonNegativeLong(Duration.ofSeconds(-1), "test") + () -> requireNonNegativeMax2days(Duration.ofSeconds(-1), "test") ); assertThrows( IllegalArgumentException.class, - () -> requireNonNegativeLong(Duration.ofDays(3), "test") + () -> requireNonNegativeMax2days(Duration.ofDays(3), "test") ); } @Test public void testRequireNonNegativeMedium() { - assertThrows(NullPointerException.class, () -> requireNonNegativeMedium(null, "test")); + assertThrows(NullPointerException.class, () -> requireNonNegativeMax2hours(null, "test")); assertThrows( IllegalArgumentException.class, - () -> requireNonNegativeMedium(Duration.ofSeconds(-1), "test") + () -> requireNonNegativeMax2hours(Duration.ofSeconds(-1), "test") ); assertThrows( IllegalArgumentException.class, - () -> requireNonNegativeMedium(Duration.ofHours(3), "test") + () -> requireNonNegativeMax2hours(Duration.ofHours(3), "test") ); } @Test public void testRequireNonNegativeShort() { - assertThrows(NullPointerException.class, () -> requireNonNegativeShort(null, "test")); + assertThrows(NullPointerException.class, () -> requireNonNegativeMax30minutes(null, "test")); assertThrows( IllegalArgumentException.class, - () -> requireNonNegativeShort(Duration.ofSeconds(-1), "test") + () -> requireNonNegativeMax30minutes(Duration.ofSeconds(-1), "test") ); assertThrows( IllegalArgumentException.class, - () -> requireNonNegativeShort(Duration.ofMinutes(31), "test") + () -> requireNonNegativeMax30minutes(Duration.ofMinutes(31), "test") ); } diff --git a/src/test/java/org/opentripplanner/framework/time/LocalDateUtilsTest.java b/application/src/test/java/org/opentripplanner/framework/time/LocalDateUtilsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/time/LocalDateUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/time/LocalDateUtilsTest.java diff --git a/src/test/java/org/opentripplanner/framework/time/OffsetDateTimeParserTest.java b/application/src/test/java/org/opentripplanner/framework/time/OffsetDateTimeParserTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/time/OffsetDateTimeParserTest.java rename to application/src/test/java/org/opentripplanner/framework/time/OffsetDateTimeParserTest.java diff --git a/src/test/java/org/opentripplanner/framework/time/ServiceDateUtilsTest.java b/application/src/test/java/org/opentripplanner/framework/time/ServiceDateUtilsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/time/ServiceDateUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/time/ServiceDateUtilsTest.java diff --git a/src/test/java/org/opentripplanner/framework/time/TimeUtilsTest.java b/application/src/test/java/org/opentripplanner/framework/time/TimeUtilsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/time/TimeUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/time/TimeUtilsTest.java diff --git a/src/test/java/org/opentripplanner/framework/time/ZoneIdFallbackTest.java b/application/src/test/java/org/opentripplanner/framework/time/ZoneIdFallbackTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/time/ZoneIdFallbackTest.java rename to application/src/test/java/org/opentripplanner/framework/time/ZoneIdFallbackTest.java diff --git a/src/test/java/org/opentripplanner/framework/token/AdvancedTokenSchemaTest.java b/application/src/test/java/org/opentripplanner/framework/token/AdvancedTokenSchemaTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/token/AdvancedTokenSchemaTest.java rename to application/src/test/java/org/opentripplanner/framework/token/AdvancedTokenSchemaTest.java diff --git a/src/test/java/org/opentripplanner/framework/token/FieldDefinitionTest.java b/application/src/test/java/org/opentripplanner/framework/token/FieldDefinitionTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/token/FieldDefinitionTest.java rename to application/src/test/java/org/opentripplanner/framework/token/FieldDefinitionTest.java diff --git a/src/test/java/org/opentripplanner/framework/token/TestTokenSchemaConstants.java b/application/src/test/java/org/opentripplanner/framework/token/TestTokenSchemaConstants.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/token/TestTokenSchemaConstants.java rename to application/src/test/java/org/opentripplanner/framework/token/TestTokenSchemaConstants.java diff --git a/src/test/java/org/opentripplanner/framework/token/TokenSchemaTest.java b/application/src/test/java/org/opentripplanner/framework/token/TokenSchemaTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/token/TokenSchemaTest.java rename to application/src/test/java/org/opentripplanner/framework/token/TokenSchemaTest.java diff --git a/src/test/java/org/opentripplanner/framework/token/TokenTypeTest.java b/application/src/test/java/org/opentripplanner/framework/token/TokenTypeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/token/TokenTypeTest.java rename to application/src/test/java/org/opentripplanner/framework/token/TokenTypeTest.java diff --git a/src/test/java/org/opentripplanner/framework/tostring/MultiLineToStringBuilderTest.java b/application/src/test/java/org/opentripplanner/framework/tostring/MultiLineToStringBuilderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/tostring/MultiLineToStringBuilderTest.java rename to application/src/test/java/org/opentripplanner/framework/tostring/MultiLineToStringBuilderTest.java diff --git a/src/test/java/org/opentripplanner/framework/tostring/ToStringBuilderTest.java b/application/src/test/java/org/opentripplanner/framework/tostring/ToStringBuilderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/tostring/ToStringBuilderTest.java rename to application/src/test/java/org/opentripplanner/framework/tostring/ToStringBuilderTest.java diff --git a/src/test/java/org/opentripplanner/framework/tostring/ValueObjectToStringBuilderTest.java b/application/src/test/java/org/opentripplanner/framework/tostring/ValueObjectToStringBuilderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/framework/tostring/ValueObjectToStringBuilderTest.java rename to application/src/test/java/org/opentripplanner/framework/tostring/ValueObjectToStringBuilderTest.java diff --git a/src/test/java/org/opentripplanner/generate/doc/BuildConfigurationDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/BuildConfigurationDocTest.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/BuildConfigurationDocTest.java rename to application/src/test/java/org/opentripplanner/generate/doc/BuildConfigurationDocTest.java diff --git a/src/test/java/org/opentripplanner/generate/doc/ConfigurationDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/ConfigurationDocTest.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/ConfigurationDocTest.java rename to application/src/test/java/org/opentripplanner/generate/doc/ConfigurationDocTest.java diff --git a/src/test/java/org/opentripplanner/generate/doc/EmissionsConfigurationDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/EmissionsConfigurationDocTest.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/EmissionsConfigurationDocTest.java rename to application/src/test/java/org/opentripplanner/generate/doc/EmissionsConfigurationDocTest.java diff --git a/src/test/java/org/opentripplanner/generate/doc/FlexConfigurationDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/FlexConfigurationDocTest.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/FlexConfigurationDocTest.java rename to application/src/test/java/org/opentripplanner/generate/doc/FlexConfigurationDocTest.java diff --git a/src/test/java/org/opentripplanner/generate/doc/GraphQLTutorialDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/GraphQLTutorialDocTest.java similarity index 95% rename from src/test/java/org/opentripplanner/generate/doc/GraphQLTutorialDocTest.java rename to application/src/test/java/org/opentripplanner/generate/doc/GraphQLTutorialDocTest.java index 7eb6a685cca..3353d901f98 100644 --- a/src/test/java/org/opentripplanner/generate/doc/GraphQLTutorialDocTest.java +++ b/application/src/test/java/org/opentripplanner/generate/doc/GraphQLTutorialDocTest.java @@ -12,7 +12,6 @@ import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; -import javax.annotation.Nonnull; import org.junit.jupiter.api.Test; import org.opentripplanner.generate.doc.framework.GeneratesDocumentation; import org.opentripplanner.generate.doc.framework.TemplateUtil; @@ -38,7 +37,7 @@ public void updateTutorialDoc() throws IOException { String original = readFile(OUT_FILE); var routeQuery = getGraphQlQuery("routes-tutorial.graphql"); - var planQuery = getGraphQlQuery("plan-tutorial.graphql"); + var planQuery = getGraphQlQuery("planConnection-tutorial.graphql"); doc = replaceSection(doc, "route-query", routeQuery); doc = replaceSection(doc, "plan-query", planQuery); @@ -47,7 +46,6 @@ public void updateTutorialDoc() throws IOException { assertFileEquals(original, OUT_FILE); } - @Nonnull private static String getGraphQlQuery(String resourceName) throws IOException { var url = Resources.getResource("org/opentripplanner/apis/gtfs/queries/" + resourceName); var query = TemplateUtil.graphQlExample(Resources.toString(url, StandardCharsets.UTF_8)); diff --git a/application/src/test/java/org/opentripplanner/generate/doc/NetexTutorialDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/NetexTutorialDocTest.java new file mode 100644 index 00000000000..5a953c1d21c --- /dev/null +++ b/application/src/test/java/org/opentripplanner/generate/doc/NetexTutorialDocTest.java @@ -0,0 +1,55 @@ +package org.opentripplanner.generate.doc; + +import static org.opentripplanner.framework.application.OtpFileNames.BUILD_CONFIG_FILENAME; +import static org.opentripplanner.framework.application.OtpFileNames.ROUTER_CONFIG_FILENAME; +import static org.opentripplanner.framework.io.FileUtils.assertFileEquals; +import static org.opentripplanner.framework.io.FileUtils.readFile; +import static org.opentripplanner.framework.io.FileUtils.writeFile; +import static org.opentripplanner.generate.doc.framework.DocsTestConstants.TEMPLATE_PATH; +import static org.opentripplanner.generate.doc.framework.DocsTestConstants.USER_DOC_PATH; +import static org.opentripplanner.generate.doc.framework.TemplateUtil.replaceSection; +import static org.opentripplanner.standalone.config.framework.json.JsonSupport.jsonNodeFromResource; + +import java.io.File; +import org.junit.jupiter.api.Test; +import org.opentripplanner.generate.doc.framework.DocBuilder; +import org.opentripplanner.generate.doc.framework.GeneratesDocumentation; +import org.opentripplanner.standalone.config.RouterConfig; +import org.opentripplanner.standalone.config.framework.json.NodeAdapter; + +@GeneratesDocumentation +class NetexTutorialDocTest { + + private static final String NETEX_TUTORIAL_MD = "Netex-Tutorial.md"; + private static final File TEMPLATE = new File(TEMPLATE_PATH, NETEX_TUTORIAL_MD); + private static final File OUT_FILE = new File(USER_DOC_PATH, NETEX_TUTORIAL_MD); + + private static final String TUTORIAL_PATH = "standalone/config/netex-tutorial/"; + + @Test + void updateTutorialDoc() { + // Read and close input file (same as output file) + String template = readFile(TEMPLATE); + String original = readFile(OUT_FILE); + + template = replaceSection(template, "build-config", toJson(BUILD_CONFIG_FILENAME)); + template = replaceSection(template, "router-config", toJson(ROUTER_CONFIG_FILENAME)); + + writeFile(OUT_FILE, template); + assertFileEquals(original, OUT_FILE); + } + + private static String toJson(String fileName) { + var path = TUTORIAL_PATH + fileName; + var nodeAdapter = loadBuildConfig(path); + var buf = new DocBuilder(); + buf.addExample(fileName, nodeAdapter.rawNode()); + return buf.toString(); + } + + private static NodeAdapter loadBuildConfig(String buildConfigPath) { + var json = jsonNodeFromResource(buildConfigPath); + var conf = new RouterConfig(json, buildConfigPath, false); + return conf.asNodeAdapter(); + } +} diff --git a/src/test/java/org/opentripplanner/generate/doc/OsmMapperDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/OsmMapperDocTest.java similarity index 81% rename from src/test/java/org/opentripplanner/generate/doc/OsmMapperDocTest.java rename to application/src/test/java/org/opentripplanner/generate/doc/OsmMapperDocTest.java index d3eb0a44122..91c6f5c530a 100644 --- a/src/test/java/org/opentripplanner/generate/doc/OsmMapperDocTest.java +++ b/application/src/test/java/org/opentripplanner/generate/doc/OsmMapperDocTest.java @@ -6,11 +6,11 @@ import static org.opentripplanner.generate.doc.framework.DocsTestConstants.TEMPLATE_PATH; import static org.opentripplanner.generate.doc.framework.DocsTestConstants.USER_DOC_PATH; import static org.opentripplanner.generate.doc.framework.TemplateUtil.replaceSection; -import static org.opentripplanner.openstreetmap.tagmapping.OsmTagMapperSource.ATLANTA; -import static org.opentripplanner.openstreetmap.tagmapping.OsmTagMapperSource.CONSTANT_SPEED_FINLAND; -import static org.opentripplanner.openstreetmap.tagmapping.OsmTagMapperSource.HAMBURG; -import static org.opentripplanner.openstreetmap.tagmapping.OsmTagMapperSource.HOUSTON; -import static org.opentripplanner.openstreetmap.tagmapping.OsmTagMapperSource.PORTLAND; +import static org.opentripplanner.osm.tagmapping.OsmTagMapperSource.ATLANTA; +import static org.opentripplanner.osm.tagmapping.OsmTagMapperSource.CONSTANT_SPEED_FINLAND; +import static org.opentripplanner.osm.tagmapping.OsmTagMapperSource.HAMBURG; +import static org.opentripplanner.osm.tagmapping.OsmTagMapperSource.HOUSTON; +import static org.opentripplanner.osm.tagmapping.OsmTagMapperSource.PORTLAND; import java.io.File; import java.util.Arrays; @@ -20,12 +20,11 @@ import org.junit.jupiter.params.provider.MethodSource; import org.opentripplanner.framework.text.Table; import org.opentripplanner.framework.text.TableBuilder; -import org.opentripplanner.generate.doc.framework.DocsTestConstants; import org.opentripplanner.generate.doc.framework.GeneratesDocumentation; -import org.opentripplanner.openstreetmap.tagmapping.OsmTagMapper; -import org.opentripplanner.openstreetmap.tagmapping.OsmTagMapperSource; -import org.opentripplanner.openstreetmap.wayproperty.SafetyFeatures; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertySet; +import org.opentripplanner.osm.tagmapping.OsmTagMapper; +import org.opentripplanner.osm.tagmapping.OsmTagMapperSource; +import org.opentripplanner.osm.wayproperty.SafetyFeatures; +import org.opentripplanner.osm.wayproperty.WayPropertySet; @GeneratesDocumentation public class OsmMapperDocTest { diff --git a/src/test/java/org/opentripplanner/generate/doc/RideHailingDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/RideHailingDocTest.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/RideHailingDocTest.java rename to application/src/test/java/org/opentripplanner/generate/doc/RideHailingDocTest.java diff --git a/src/test/java/org/opentripplanner/generate/doc/RouteRequestDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/RouteRequestDocTest.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/RouteRequestDocTest.java rename to application/src/test/java/org/opentripplanner/generate/doc/RouteRequestDocTest.java diff --git a/src/test/java/org/opentripplanner/generate/doc/RouterConfigurationDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/RouterConfigurationDocTest.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/RouterConfigurationDocTest.java rename to application/src/test/java/org/opentripplanner/generate/doc/RouterConfigurationDocTest.java diff --git a/src/test/java/org/opentripplanner/generate/doc/RoutingModeDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/RoutingModeDocTest.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/RoutingModeDocTest.java rename to application/src/test/java/org/opentripplanner/generate/doc/RoutingModeDocTest.java diff --git a/src/test/java/org/opentripplanner/generate/doc/SiriAzureConfigDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/SiriAzureConfigDocTest.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/SiriAzureConfigDocTest.java rename to application/src/test/java/org/opentripplanner/generate/doc/SiriAzureConfigDocTest.java diff --git a/src/test/java/org/opentripplanner/generate/doc/SiriConfigDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/SiriConfigDocTest.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/SiriConfigDocTest.java rename to application/src/test/java/org/opentripplanner/generate/doc/SiriConfigDocTest.java diff --git a/src/test/java/org/opentripplanner/generate/doc/SiriGooglePubSubConfigDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/SiriGooglePubSubConfigDocTest.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/SiriGooglePubSubConfigDocTest.java rename to application/src/test/java/org/opentripplanner/generate/doc/SiriGooglePubSubConfigDocTest.java diff --git a/src/test/java/org/opentripplanner/generate/doc/StopConsolidationDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/StopConsolidationDocTest.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/StopConsolidationDocTest.java rename to application/src/test/java/org/opentripplanner/generate/doc/StopConsolidationDocTest.java diff --git a/src/test/java/org/opentripplanner/generate/doc/UpdaterConfigDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/UpdaterConfigDocTest.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/UpdaterConfigDocTest.java rename to application/src/test/java/org/opentripplanner/generate/doc/UpdaterConfigDocTest.java diff --git a/src/test/java/org/opentripplanner/generate/doc/VehicleParkingDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/VehicleParkingDocTest.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/VehicleParkingDocTest.java rename to application/src/test/java/org/opentripplanner/generate/doc/VehicleParkingDocTest.java diff --git a/src/test/java/org/opentripplanner/generate/doc/framework/AbstractTable.java b/application/src/test/java/org/opentripplanner/generate/doc/framework/AbstractTable.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/framework/AbstractTable.java rename to application/src/test/java/org/opentripplanner/generate/doc/framework/AbstractTable.java diff --git a/src/test/java/org/opentripplanner/generate/doc/framework/DocBuilder.java b/application/src/test/java/org/opentripplanner/generate/doc/framework/DocBuilder.java similarity index 97% rename from src/test/java/org/opentripplanner/generate/doc/framework/DocBuilder.java rename to application/src/test/java/org/opentripplanner/generate/doc/framework/DocBuilder.java index a105adb62d6..16579075077 100644 --- a/src/test/java/org/opentripplanner/generate/doc/framework/DocBuilder.java +++ b/application/src/test/java/org/opentripplanner/generate/doc/framework/DocBuilder.java @@ -99,6 +99,9 @@ public DocBuilder addSection(String text) { return endParagraph(); } + /** + * Adds a JSON snippet which is formatted as a fenced code block. + */ public void addExample(String comment, JsonNode body) { buffer.append(TemplateUtil.jsonExample(body, comment)); } diff --git a/src/test/java/org/opentripplanner/generate/doc/framework/DocBuilderTest.java b/application/src/test/java/org/opentripplanner/generate/doc/framework/DocBuilderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/framework/DocBuilderTest.java rename to application/src/test/java/org/opentripplanner/generate/doc/framework/DocBuilderTest.java diff --git a/src/test/java/org/opentripplanner/generate/doc/framework/DocsTestConstants.java b/application/src/test/java/org/opentripplanner/generate/doc/framework/DocsTestConstants.java similarity index 68% rename from src/test/java/org/opentripplanner/generate/doc/framework/DocsTestConstants.java rename to application/src/test/java/org/opentripplanner/generate/doc/framework/DocsTestConstants.java index a7f7afa806a..e646625ec24 100644 --- a/src/test/java/org/opentripplanner/generate/doc/framework/DocsTestConstants.java +++ b/application/src/test/java/org/opentripplanner/generate/doc/framework/DocsTestConstants.java @@ -9,24 +9,25 @@ */ public interface DocsTestConstants { Logger LOG = LoggerFactory.getLogger(DocsTestConstants.class); - File DOC_ROOT = new File("doc"); + File DOC_ROOT = new File("../doc"); File TEMPLATE_PATH = new File(DOC_ROOT, "templates"); File USER_DOC_PATH = new File(DOC_ROOT, "user"); /** - * This method return {@code true} if the /docs directory is available. If not, a warning is + * This method return {@code true} if both the /doc/user and /doc/templates directories are available. If not, a warning is * logged and the method returns {@code false}. This is used by the {@link GeneratesDocumentation} * annotation. */ static boolean docsExistOrWarn() { - if (USER_DOC_PATH.exists()) { + if (USER_DOC_PATH.exists() && TEMPLATE_PATH.exists()) { return true; } + LOG.warn( """ - SKIP TEST - '/docs' NOT FOUND + SKIP TEST - '/doc/user' or '/doc/templates' NOT FOUND - The doc/templates directory might not be available if you run the tests outside the + The /doc/user and /doc/templates directories might not be available if you run the tests outside the root of the projects. This may happen if the project root is not the working directory, if you run tests using jar files or in a Maven multi-module project. diff --git a/src/test/java/org/opentripplanner/generate/doc/framework/GeneratesDocumentation.java b/application/src/test/java/org/opentripplanner/generate/doc/framework/GeneratesDocumentation.java similarity index 92% rename from src/test/java/org/opentripplanner/generate/doc/framework/GeneratesDocumentation.java rename to application/src/test/java/org/opentripplanner/generate/doc/framework/GeneratesDocumentation.java index d8ce7a529d2..2dc099b2a0b 100644 --- a/src/test/java/org/opentripplanner/generate/doc/framework/GeneratesDocumentation.java +++ b/application/src/test/java/org/opentripplanner/generate/doc/framework/GeneratesDocumentation.java @@ -8,7 +8,7 @@ import org.junit.jupiter.api.condition.EnabledIf; /** - * Use this annotation on tests that generate(access) the /docs directory outside the + * Use this annotation on tests that generate(access) the /doc directory outside the * source/resource. *

    * All tests annotated with this annotation is tagged with "docs". You may include or exclude diff --git a/src/test/java/org/opentripplanner/generate/doc/framework/JsonExampleBuilder.java b/application/src/test/java/org/opentripplanner/generate/doc/framework/JsonExampleBuilder.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/framework/JsonExampleBuilder.java rename to application/src/test/java/org/opentripplanner/generate/doc/framework/JsonExampleBuilder.java diff --git a/src/test/java/org/opentripplanner/generate/doc/framework/NodeAdapterHelper.java b/application/src/test/java/org/opentripplanner/generate/doc/framework/NodeAdapterHelper.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/framework/NodeAdapterHelper.java rename to application/src/test/java/org/opentripplanner/generate/doc/framework/NodeAdapterHelper.java diff --git a/src/test/java/org/opentripplanner/generate/doc/framework/ParameterDetailsList.java b/application/src/test/java/org/opentripplanner/generate/doc/framework/ParameterDetailsList.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/framework/ParameterDetailsList.java rename to application/src/test/java/org/opentripplanner/generate/doc/framework/ParameterDetailsList.java diff --git a/src/test/java/org/opentripplanner/generate/doc/framework/ParameterSummaryTable.java b/application/src/test/java/org/opentripplanner/generate/doc/framework/ParameterSummaryTable.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/framework/ParameterSummaryTable.java rename to application/src/test/java/org/opentripplanner/generate/doc/framework/ParameterSummaryTable.java diff --git a/src/test/java/org/opentripplanner/generate/doc/framework/SkipNodes.java b/application/src/test/java/org/opentripplanner/generate/doc/framework/SkipNodes.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/framework/SkipNodes.java rename to application/src/test/java/org/opentripplanner/generate/doc/framework/SkipNodes.java diff --git a/src/test/java/org/opentripplanner/generate/doc/framework/TemplateUtil.java b/application/src/test/java/org/opentripplanner/generate/doc/framework/TemplateUtil.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/framework/TemplateUtil.java rename to application/src/test/java/org/opentripplanner/generate/doc/framework/TemplateUtil.java diff --git a/src/test/java/org/opentripplanner/generate/doc/framework/TemplateUtilTest.java b/application/src/test/java/org/opentripplanner/generate/doc/framework/TemplateUtilTest.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/framework/TemplateUtilTest.java rename to application/src/test/java/org/opentripplanner/generate/doc/framework/TemplateUtilTest.java diff --git a/src/test/java/org/opentripplanner/generate/doc/support/ConfigTypeTable.java b/application/src/test/java/org/opentripplanner/generate/doc/support/ConfigTypeTable.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/support/ConfigTypeTable.java rename to application/src/test/java/org/opentripplanner/generate/doc/support/ConfigTypeTable.java diff --git a/src/test/java/org/opentripplanner/generate/doc/support/ConfigTypeTableTest.java b/application/src/test/java/org/opentripplanner/generate/doc/support/ConfigTypeTableTest.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/support/ConfigTypeTableTest.java rename to application/src/test/java/org/opentripplanner/generate/doc/support/ConfigTypeTableTest.java diff --git a/src/test/java/org/opentripplanner/generate/doc/support/OTPFeatureTable.java b/application/src/test/java/org/opentripplanner/generate/doc/support/OTPFeatureTable.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/support/OTPFeatureTable.java rename to application/src/test/java/org/opentripplanner/generate/doc/support/OTPFeatureTable.java diff --git a/src/test/java/org/opentripplanner/generate/doc/support/OTPFeatureTableTest.java b/application/src/test/java/org/opentripplanner/generate/doc/support/OTPFeatureTableTest.java similarity index 100% rename from src/test/java/org/opentripplanner/generate/doc/support/OTPFeatureTableTest.java rename to application/src/test/java/org/opentripplanner/generate/doc/support/OTPFeatureTableTest.java diff --git a/src/test/java/org/opentripplanner/graph_builder/issue/api/DataImportIssueSummaryTest.java b/application/src/test/java/org/opentripplanner/graph_builder/issue/api/DataImportIssueSummaryTest.java similarity index 100% rename from src/test/java/org/opentripplanner/graph_builder/issue/api/DataImportIssueSummaryTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/issue/api/DataImportIssueSummaryTest.java diff --git a/src/test/java/org/opentripplanner/graph_builder/issue/report/DataImportIssueReporterTest.java b/application/src/test/java/org/opentripplanner/graph_builder/issue/report/DataImportIssueReporterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/graph_builder/issue/report/DataImportIssueReporterTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/issue/report/DataImportIssueReporterTest.java diff --git a/src/test/java/org/opentripplanner/graph_builder/module/DirectTransferGeneratorTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/DirectTransferGeneratorTest.java similarity index 96% rename from src/test/java/org/opentripplanner/graph_builder/module/DirectTransferGeneratorTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/DirectTransferGeneratorTest.java index ebde5cbdfe8..002c386d151 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/DirectTransferGeneratorTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/DirectTransferGeneratorTest.java @@ -290,13 +290,18 @@ private TestOtpModel model( new Builder() { @Override public void build() { - S0 = stop("S0", 47.495, 19.001, withNoTransfersOnStations); - S11 = stop("S11", 47.500, 19.001, withNoTransfersOnStations); - S12 = stop("S12", 47.520, 19.001, withNoTransfersOnStations); - S13 = stop("S13", 47.540, 19.001, withNoTransfersOnStations); - S21 = stop("S21", 47.500, 19.011, withNoTransfersOnStations); - S22 = stop("S22", 47.520, 19.011, withNoTransfersOnStations); - S23 = stop("S23", 47.540, 19.011, withNoTransfersOnStations); + var station = stationEntity( + "1", + builder -> builder.withTransfersNotAllowed(withNoTransfersOnStations) + ); + + S0 = stop("S0", 47.495, 19.001, station); + S11 = stop("S11", 47.500, 19.001, station); + S12 = stop("S12", 47.520, 19.001, station); + S13 = stop("S13", 47.540, 19.001, station); + S21 = stop("S21", 47.500, 19.011, station); + S22 = stop("S22", 47.520, 19.011, station); + S23 = stop("S23", 47.540, 19.011, station); V0 = intersection("V0", 47.495, 19.000); V11 = intersection("V11", 47.500, 19.000); diff --git a/src/test/java/org/opentripplanner/graph_builder/module/ElevationModuleTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/ElevationModuleTest.java similarity index 100% rename from src/test/java/org/opentripplanner/graph_builder/module/ElevationModuleTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/ElevationModuleTest.java diff --git a/src/test/java/org/opentripplanner/graph_builder/module/GtfsFeedIdTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/GtfsFeedIdTest.java similarity index 96% rename from src/test/java/org/opentripplanner/graph_builder/module/GtfsFeedIdTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/GtfsFeedIdTest.java index 133ec71070a..f1d6f2e8e77 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/GtfsFeedIdTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/GtfsFeedIdTest.java @@ -5,7 +5,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.stream.Stream; -import javax.annotation.Nonnull; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; @@ -36,7 +35,6 @@ void keepUnderscore() { assertEquals("feed_id_", feedId("feed_id_")); } - @Nonnull private static String feedId(String input) { var id = new GtfsFeedId.Builder().id(input).build().getId(); assertNotNull(id); diff --git a/src/test/java/org/opentripplanner/graph_builder/module/GtfsModuleTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/GtfsModuleTest.java similarity index 100% rename from src/test/java/org/opentripplanner/graph_builder/module/GtfsModuleTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/GtfsModuleTest.java diff --git a/src/test/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModuleTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModuleTest.java similarity index 99% rename from src/test/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModuleTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModuleTest.java index 4756608f57d..9409171920f 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModuleTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModuleTest.java @@ -12,7 +12,7 @@ import org.junit.jupiter.params.provider.MethodSource; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.graph_builder.module.osm.OsmModule; -import org.opentripplanner.openstreetmap.OsmProvider; +import org.opentripplanner.osm.OsmProvider; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.street.model.edge.AreaEdge; import org.opentripplanner.street.model.edge.BoardingLocationToStopLink; diff --git a/src/test/java/org/opentripplanner/graph_builder/module/StreetLinkerModuleTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/StreetLinkerModuleTest.java similarity index 100% rename from src/test/java/org/opentripplanner/graph_builder/module/StreetLinkerModuleTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/StreetLinkerModuleTest.java diff --git a/src/test/java/org/opentripplanner/graph_builder/module/TestStreetLinkerModule.java b/application/src/test/java/org/opentripplanner/graph_builder/module/TestStreetLinkerModule.java similarity index 100% rename from src/test/java/org/opentripplanner/graph_builder/module/TestStreetLinkerModule.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/TestStreetLinkerModule.java diff --git a/src/test/java/org/opentripplanner/graph_builder/module/VehicleParkingLinkingTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/VehicleParkingLinkingTest.java similarity index 100% rename from src/test/java/org/opentripplanner/graph_builder/module/VehicleParkingLinkingTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/VehicleParkingLinkingTest.java diff --git a/src/test/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModuleTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModuleTest.java similarity index 97% rename from src/test/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModuleTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModuleTest.java index fb7ae2b8a10..9157f8433b8 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModuleTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModuleTest.java @@ -3,7 +3,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.List; -import javax.annotation.Nonnull; import org.junit.jupiter.api.Test; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.street.model.vertex.Vertex; @@ -63,7 +62,6 @@ public VertexLabel getLabel() { return VertexLabel.string("%s/%s".formatted(getX(), getY())); } - @Nonnull @Override public I18NString getName() { return I18NString.of(getLabel().toString()); diff --git a/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/AdaptivePruningTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/AdaptivePruningTest.java similarity index 100% rename from src/test/java/org/opentripplanner/graph_builder/module/islandpruning/AdaptivePruningTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/AdaptivePruningTest.java diff --git a/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/EscalatorPruningTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/EscalatorPruningTest.java similarity index 100% rename from src/test/java/org/opentripplanner/graph_builder/module/islandpruning/EscalatorPruningTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/EscalatorPruningTest.java diff --git a/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/IslandPruningUtils.java b/application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/IslandPruningUtils.java similarity index 97% rename from src/test/java/org/opentripplanner/graph_builder/module/islandpruning/IslandPruningUtils.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/IslandPruningUtils.java index 59362472771..72d9f817bd8 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/IslandPruningUtils.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/IslandPruningUtils.java @@ -3,7 +3,7 @@ import java.io.File; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.graph_builder.module.osm.OsmModule; -import org.opentripplanner.openstreetmap.OsmProvider; +import org.opentripplanner.osm.OsmProvider; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.service.StopModel; diff --git a/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/PruneNoThruIslandsTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/PruneNoThruIslandsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/graph_builder/module/islandpruning/PruneNoThruIslandsTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/PruneNoThruIslandsTest.java diff --git a/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/SubgraphOnlyFerryTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/SubgraphOnlyFerryTest.java similarity index 100% rename from src/test/java/org/opentripplanner/graph_builder/module/islandpruning/SubgraphOnlyFerryTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/SubgraphOnlyFerryTest.java diff --git a/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/TestNamer.java b/application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/TestNamer.java similarity index 74% rename from src/test/java/org/opentripplanner/graph_builder/module/islandpruning/TestNamer.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/TestNamer.java index 4002da919d8..dc94aba993f 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/TestNamer.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/TestNamer.java @@ -4,17 +4,17 @@ import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.graph_builder.module.osm.StreetEdgePair; import org.opentripplanner.graph_builder.services.osm.EdgeNamer; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; class TestNamer implements EdgeNamer { @Override - public I18NString name(OSMWithTags way) { + public I18NString name(OsmWithTags way) { return new NonLocalizedString(String.valueOf(way.getId())); } @Override - public void recordEdges(OSMWithTags way, StreetEdgePair edge) {} + public void recordEdges(OsmWithTags way, StreetEdgePair edge) {} @Override public void postprocess() {} diff --git a/src/test/java/org/opentripplanner/graph_builder/module/linking/LinkingTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/linking/LinkingTest.java similarity index 99% rename from src/test/java/org/opentripplanner/graph_builder/module/linking/LinkingTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/linking/LinkingTest.java index 41a74fb2dd3..a51095163fc 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/linking/LinkingTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/linking/LinkingTest.java @@ -19,7 +19,7 @@ import org.opentripplanner.framework.geometry.SphericalDistanceLibrary; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.graph_builder.module.osm.OsmModule; -import org.opentripplanner.openstreetmap.OsmProvider; +import org.opentripplanner.osm.OsmProvider; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.street.model.StreetTraversalPermission; import org.opentripplanner.street.model._data.StreetModelForTest; diff --git a/src/test/java/org/opentripplanner/graph_builder/module/linking/TestGraph.java b/application/src/test/java/org/opentripplanner/graph_builder/module/linking/TestGraph.java similarity index 100% rename from src/test/java/org/opentripplanner/graph_builder/module/linking/TestGraph.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/linking/TestGraph.java diff --git a/application/src/test/java/org/opentripplanner/graph_builder/module/nearbystops/StreetNearbyStopFinderTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/nearbystops/StreetNearbyStopFinderTest.java new file mode 100644 index 00000000000..261a40454f0 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/nearbystops/StreetNearbyStopFinderTest.java @@ -0,0 +1,197 @@ +package org.opentripplanner.graph_builder.module.nearbystops; + +import static com.google.common.truth.Truth.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + +import java.time.Duration; +import java.util.Collection; +import java.util.Comparator; +import java.util.List; +import java.util.Set; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.opentripplanner.framework.geometry.WgsCoordinate; +import org.opentripplanner.routing.algorithm.GraphRoutingTest; +import org.opentripplanner.routing.api.request.RouteRequest; +import org.opentripplanner.routing.api.request.request.StreetRequest; +import org.opentripplanner.routing.graphfinder.NearbyStop; +import org.opentripplanner.street.model.vertex.TransitStopVertex; +import org.opentripplanner.street.model.vertex.Vertex; + +class StreetNearbyStopFinderTest extends GraphRoutingTest { + + private static final WgsCoordinate origin = new WgsCoordinate(0.0, 0.0); + private TransitStopVertex isolatedStop; + private TransitStopVertex stopA; + private TransitStopVertex stopB; + private TransitStopVertex stopC; + private TransitStopVertex stopD; + + @BeforeEach + protected void setUp() throws Exception { + modelOf( + new GraphRoutingTest.Builder() { + @Override + public void build() { + var isolated = intersection("isolated", origin.moveNorthMeters(1000)); + + var A = intersection("A", origin); + var B = intersection("B", origin.moveEastMeters(100)); + var C = intersection("C", origin.moveEastMeters(200)); + var D = intersection("D", origin.moveEastMeters(300)); + + biStreet(A, B, 100); + biStreet(B, C, 100); + biStreet(C, D, 100); + + isolatedStop = stop("IsolatedStop", isolated.toWgsCoordinate()); + stopA = stop("StopA", A.toWgsCoordinate()); + stopB = stop("StopB", B.toWgsCoordinate()); + stopC = stop("StopC", C.toWgsCoordinate()); + stopD = stop("StopD", D.toWgsCoordinate()); + + biLink(A, stopA); + biLink(B, stopB); + biLink(C, stopC); + biLink(D, stopD); + } + } + ); + } + + @Test + void testIsolatedStop() { + var durationLimit = Duration.ofMinutes(10); + var maxStopCount = 0; + var finder = new StreetNearbyStopFinder(durationLimit, maxStopCount, null); + + var nearbyStops = finder.findNearbyStops( + isolatedStop, + new RouteRequest(), + new StreetRequest(), + false + ); + + assertThat(nearbyStops).hasSize(1); + var nearbyStop = nearbyStops.stream().findFirst().get(); + assertZeroDistanceStop(isolatedStop, nearbyStop); + } + + @Test + void testMultipleStops() { + var durationLimit = Duration.ofMinutes(10); + var maxStopCount = 0; + var finder = new StreetNearbyStopFinder(durationLimit, maxStopCount, null); + + var sortedNearbyStops = sort( + finder.findNearbyStops(stopA, new RouteRequest(), new StreetRequest(), false) + ); + + assertThat(sortedNearbyStops).hasSize(4); + assertZeroDistanceStop(stopA, sortedNearbyStops.get(0)); + assertStopAtDistance(stopB, 100, sortedNearbyStops.get(1)); + assertStopAtDistance(stopC, 200, sortedNearbyStops.get(2)); + assertStopAtDistance(stopD, 300, sortedNearbyStops.get(3)); + } + + @Test + @Disabled("Currently disabled because of a bug in stop counting") + void testMaxStopCount() { + var durationLimit = Duration.ofMinutes(10); + var maxStopCount = 2; + var finder = new StreetNearbyStopFinder(durationLimit, maxStopCount, null); + + var sortedNearbyStops = sort( + finder.findNearbyStops(stopA, new RouteRequest(), new StreetRequest(), false) + ); + + assertThat(sortedNearbyStops).hasSize(2); + assertZeroDistanceStop(stopA, sortedNearbyStops.get(0)); + assertStopAtDistance(stopB, 100, sortedNearbyStops.get(1)); + } + + @Test + void testDurationLimit() { + // If we only allow walk for 101 seconds and speed is 1 m/s we should only be able to reach + // one extra stop. + var durationLimit = Duration.ofSeconds(101); + var maxStopCount = 0; + var routeRequest = new RouteRequest() + .withPreferences(b -> b.withWalk(walkPreferences -> walkPreferences.withSpeed(1.0))); + + var finder = new StreetNearbyStopFinder(durationLimit, maxStopCount, null); + var sortedNearbyStops = sort( + finder.findNearbyStops(stopA, routeRequest, new StreetRequest(), false) + ); + + assertThat(sortedNearbyStops).hasSize(2); + assertZeroDistanceStop(stopA, sortedNearbyStops.get(0)); + assertStopAtDistance(stopB, 100, sortedNearbyStops.get(1)); + } + + @Test + void testIgnoreStops() { + var durationLimit = Duration.ofMinutes(10); + var maxStopCount = 0; + Set ignore = Set.of(stopA, stopB); + var finder = new StreetNearbyStopFinder(durationLimit, maxStopCount, null, ignore); + + var sortedNearbyStops = sort( + finder.findNearbyStops(Set.of(stopA), new RouteRequest(), new StreetRequest(), false) + ); + + assertThat(sortedNearbyStops).hasSize(2); + assertStopAtDistance(stopC, 200, sortedNearbyStops.get(0)); + assertStopAtDistance(stopD, 300, sortedNearbyStops.get(1)); + } + + @Test + @Disabled("Currently disabled because of a bug in stop counting") + void testIgnoreStopsWithMaxStops() { + var durationLimit = Duration.ofMinutes(10); + var maxStopCount = 1; + Set ignore = Set.of(stopA, stopB); + var finder = new StreetNearbyStopFinder(durationLimit, maxStopCount, null, ignore); + + var sortedNearbyStops = sort( + finder.findNearbyStops(Set.of(stopA), new RouteRequest(), new StreetRequest(), false) + ); + + assertThat(sortedNearbyStops).hasSize(1); + assertStopAtDistance(stopC, 200, sortedNearbyStops.get(0)); + } + + private List sort(Collection stops) { + return stops.stream().sorted(Comparator.comparing(x -> x.distance)).toList(); + } + + /** + * Verify that the nearby stop is zero distance and corresponds to the expected vertex + */ + private void assertZeroDistanceStop(TransitStopVertex expected, NearbyStop nearbyStop) { + assertEquals(expected.getStop(), nearbyStop.stop); + assertEquals(0, nearbyStop.distance); + assertEquals(0, nearbyStop.edges.size()); + assertEquals(expected, nearbyStop.state.getVertex()); + assertNull(nearbyStop.state.getBackState()); + } + + /** + * Verify that the nearby stop is at a specific distance and corresponds to the expected vertex + */ + private void assertStopAtDistance( + TransitStopVertex expected, + double expectedDistance, + NearbyStop nearbyStop + ) { + assertEquals(expected.getStop(), nearbyStop.stop); + assertEquals(expectedDistance, nearbyStop.distance); + assertEquals(expected, nearbyStop.state.getVertex()); + assertFalse(nearbyStop.edges.isEmpty()); + assertNotNull(nearbyStop.state.getBackState()); + } +} diff --git a/src/test/java/org/opentripplanner/graph_builder/module/ned/MissingElevationHandlerTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/ned/MissingElevationHandlerTest.java similarity index 100% rename from src/test/java/org/opentripplanner/graph_builder/module/ned/MissingElevationHandlerTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/ned/MissingElevationHandlerTest.java diff --git a/src/test/java/org/opentripplanner/graph_builder/module/osm/DisjointSetTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/DisjointSetTest.java similarity index 100% rename from src/test/java/org/opentripplanner/graph_builder/module/osm/DisjointSetTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/osm/DisjointSetTest.java diff --git a/src/test/java/org/opentripplanner/graph_builder/module/osm/OsmDatabaseTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/OsmDatabaseTest.java similarity index 94% rename from src/test/java/org/opentripplanner/graph_builder/module/osm/OsmDatabaseTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/osm/OsmDatabaseTest.java index 8c5671d3bf0..88003e9218f 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/osm/OsmDatabaseTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/OsmDatabaseTest.java @@ -5,7 +5,7 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; -import org.opentripplanner.openstreetmap.OsmProvider; +import org.opentripplanner.osm.OsmProvider; import org.opentripplanner.test.support.ResourceLoader; public class OsmDatabaseTest { @@ -21,7 +21,7 @@ public class OsmDatabaseTest { void bicycleRouteRelations() { var osmdb = new OsmDatabase(DataImportIssueStore.NOOP); var provider = new OsmProvider(RESOURCE_LOADER.file("ehningen-minimal.osm.pbf"), true); - provider.readOSM(osmdb); + provider.readOsm(osmdb); osmdb.postLoad(); var way = osmdb.getWay(13876983L); @@ -41,7 +41,7 @@ void invalidPublicTransportRelation() { var osmdb = new OsmDatabase(DataImportIssueStore.NOOP); var file = RESOURCE_LOADER.file("brenner-invalid-relation-reference.osm.pbf"); var provider = new OsmProvider(file, true); - provider.readOSM(osmdb); + provider.readOsm(osmdb); osmdb.postLoad(); var way = osmdb.getWay(302732658L); diff --git a/src/test/java/org/opentripplanner/graph_builder/module/osm/OsmModuleTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/OsmModuleTest.java similarity index 93% rename from src/test/java/org/opentripplanner/graph_builder/module/osm/OsmModuleTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/osm/OsmModuleTest.java index 091652a2dbf..0b3d762ed6e 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/osm/OsmModuleTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/OsmModuleTest.java @@ -5,7 +5,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; -import static org.opentripplanner.openstreetmap.wayproperty.WayPropertiesBuilder.withModes; +import static org.opentripplanner.osm.wayproperty.WayPropertiesBuilder.withModes; import static org.opentripplanner.street.model.StreetTraversalPermission.ALL; import static org.opentripplanner.street.model.StreetTraversalPermission.PEDESTRIAN; @@ -15,21 +15,20 @@ import java.util.Locale; import java.util.Set; import java.util.stream.Stream; -import javax.annotation.Nonnull; import org.junit.jupiter.api.Test; import org.opentripplanner.astar.model.GraphPath; import org.opentripplanner.framework.i18n.LocalizedString; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.openstreetmap.OsmProvider; -import org.opentripplanner.openstreetmap.model.OSMWay; -import org.opentripplanner.openstreetmap.model.OSMWithTags; -import org.opentripplanner.openstreetmap.wayproperty.CreativeNamer; -import org.opentripplanner.openstreetmap.wayproperty.MixinPropertiesBuilder; -import org.opentripplanner.openstreetmap.wayproperty.WayProperties; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertiesBuilder; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertySet; -import org.opentripplanner.openstreetmap.wayproperty.specifier.BestMatchSpecifier; -import org.opentripplanner.openstreetmap.wayproperty.specifier.OsmSpecifier; +import org.opentripplanner.osm.OsmProvider; +import org.opentripplanner.osm.model.OsmWay; +import org.opentripplanner.osm.model.OsmWithTags; +import org.opentripplanner.osm.wayproperty.CreativeNamer; +import org.opentripplanner.osm.wayproperty.MixinPropertiesBuilder; +import org.opentripplanner.osm.wayproperty.WayProperties; +import org.opentripplanner.osm.wayproperty.WayPropertiesBuilder; +import org.opentripplanner.osm.wayproperty.WayPropertySet; +import org.opentripplanner.osm.wayproperty.specifier.BestMatchSpecifier; +import org.opentripplanner.osm.wayproperty.specifier.OsmSpecifier; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.routing.impl.GraphPathFinder; @@ -160,7 +159,7 @@ public void testBuildAreaWithVisibility() { @Test public void testWayDataSet() { - OSMWithTags way = new OSMWay(); + OsmWithTags way = new OsmWay(); way.addTag("highway", "footway"); way.addTag("cycleway", "lane"); way.addTag("surface", "gravel"); @@ -214,7 +213,7 @@ public void testWayDataSet() { assertEquals(dataForWay.bicycleSafety().forward(), 1.5); // test a left-right distinction - way = new OSMWay(); + way = new OsmWay(); way.addTag("highway", "footway"); way.addTag("cycleway", "lane"); way.addTag("cycleway:right", "track"); @@ -232,7 +231,7 @@ public void testWayDataSet() { // left comes from lane assertEquals(0.75, dataForWay.bicycleSafety().back()); - way = new OSMWay(); + way = new OsmWay(); way.addTag("highway", "footway"); way.addTag("footway", "sidewalk"); way.addTag("RLIS:reviewed", "no"); @@ -249,7 +248,7 @@ public void testWayDataSet() { @Test public void testCreativeNaming() { - OSMWithTags way = new OSMWay(); + OsmWithTags way = new OsmWay(); way.addTag("highway", "footway"); way.addTag("cycleway", "lane"); way.addTag("access", "no"); @@ -323,7 +322,6 @@ void testBarrierAtEnd() { assertEquals(barrier.getBarrierPermissions(), ALL); } - @Nonnull private Graph buildParkingLots() { var graph = new Graph(); var providers = Stream diff --git a/src/test/java/org/opentripplanner/graph_builder/module/osm/OpenStreetMapParserTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/OsmParserTest.java similarity index 80% rename from src/test/java/org/opentripplanner/graph_builder/module/osm/OpenStreetMapParserTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/osm/OsmParserTest.java index b0073475699..f477f76fc60 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/osm/OpenStreetMapParserTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/OsmParserTest.java @@ -7,12 +7,12 @@ import java.io.File; import org.junit.jupiter.api.Test; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; -import org.opentripplanner.openstreetmap.OsmProvider; -import org.opentripplanner.openstreetmap.model.OSMNode; -import org.opentripplanner.openstreetmap.model.OSMWay; +import org.opentripplanner.osm.OsmProvider; +import org.opentripplanner.osm.model.OsmNode; +import org.opentripplanner.osm.model.OsmWay; import org.opentripplanner.test.support.ResourceLoader; -public class OpenStreetMapParserTest { +public class OsmParserTest { @Test public void testBinaryParser() { @@ -20,11 +20,11 @@ public void testBinaryParser() { OsmProvider pr = new OsmProvider(osmFile, true); OsmDatabase osmdb = new OsmDatabase(DataImportIssueStore.NOOP); - pr.readOSM(osmdb); + pr.readOsm(osmdb); assertEquals(2297, osmdb.nodeCount()); - OSMNode nodeA = osmdb.getNode(314192918L); + OsmNode nodeA = osmdb.getNode(314192918L); assertEquals(314192918, nodeA.getId()); assertEquals(52.3750447, nodeA.lat, 0.0000001); assertEquals(16.8431974, nodeA.lon, 0.0000001); @@ -33,7 +33,7 @@ public void testBinaryParser() { assertEquals(545, osmdb.wayCount()); - OSMWay wayA = osmdb.getWay(13490353L); + OsmWay wayA = osmdb.getWay(13490353L); assertEquals(13490353, wayA.getId()); TLongList nodeRefsA = wayA.getNodeRefs(); assertEquals(2, nodeRefsA.size()); diff --git a/src/test/java/org/opentripplanner/graph_builder/module/osm/PlatformLinkerTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/PlatformLinkerTest.java similarity index 96% rename from src/test/java/org/opentripplanner/graph_builder/module/osm/PlatformLinkerTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/osm/PlatformLinkerTest.java index 9d3ea5a1d81..2a5d4e8a163 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/osm/PlatformLinkerTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/PlatformLinkerTest.java @@ -4,7 +4,7 @@ import java.io.File; import org.junit.jupiter.api.Test; -import org.opentripplanner.openstreetmap.OsmProvider; +import org.opentripplanner.osm.OsmProvider; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.street.model.edge.AreaEdge; import org.opentripplanner.street.model.vertex.Vertex; diff --git a/src/test/java/org/opentripplanner/graph_builder/module/osm/RingTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/RingTest.java similarity index 88% rename from src/test/java/org/opentripplanner/graph_builder/module/osm/RingTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/osm/RingTest.java index ea47bed8842..e851de66046 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/osm/RingTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/RingTest.java @@ -6,25 +6,25 @@ import java.util.List; import org.junit.jupiter.api.Test; -import org.opentripplanner.openstreetmap.model.OSMNode; +import org.opentripplanner.osm.model.OsmNode; class RingTest { @Test void testIsNodeConvex() { - OSMNode a = new OSMNode(); + OsmNode a = new OsmNode(); a.lat = 0.0; a.lon = 0.0; - OSMNode b = new OSMNode(); + OsmNode b = new OsmNode(); b.lat = 1.0; b.lon = 0.0; - OSMNode c = new OSMNode(); + OsmNode c = new OsmNode(); c.lat = 1.0; c.lon = 1.0; - OSMNode d = new OSMNode(); + OsmNode d = new OsmNode(); d.lat = 0.0; d.lon = 1.0; - OSMNode e = new OSMNode(); + OsmNode e = new OsmNode(); e.lat = 0.5; e.lon = 0.5; diff --git a/src/test/java/org/opentripplanner/graph_builder/module/osm/TriangleInequalityTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/TriangleInequalityTest.java similarity index 99% rename from src/test/java/org/opentripplanner/graph_builder/module/osm/TriangleInequalityTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/osm/TriangleInequalityTest.java index b6c498de44c..bbf59ad9c53 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/osm/TriangleInequalityTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/TriangleInequalityTest.java @@ -15,7 +15,7 @@ import org.opentripplanner.astar.model.GraphPath; import org.opentripplanner.astar.model.ShortestPathTree; import org.opentripplanner.model.modes.ExcludeAllTransitFilter; -import org.opentripplanner.openstreetmap.OsmProvider; +import org.opentripplanner.osm.OsmProvider; import org.opentripplanner.routing.api.request.RequestModes; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.api.request.request.filter.AllowAllTransitFilter; diff --git a/src/test/java/org/opentripplanner/graph_builder/module/osm/UnconnectedAreasTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/UnconnectedAreasTest.java similarity index 95% rename from src/test/java/org/opentripplanner/graph_builder/module/osm/UnconnectedAreasTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/osm/UnconnectedAreasTest.java index 01221f16c31..be1666824f3 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/osm/UnconnectedAreasTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/UnconnectedAreasTest.java @@ -11,7 +11,7 @@ import org.opentripplanner.graph_builder.issue.service.DefaultDataImportIssueStore; import org.opentripplanner.graph_builder.issues.ParkAndRideUnlinked; import org.opentripplanner.graph_builder.module.TestStreetLinkerModule; -import org.opentripplanner.openstreetmap.OsmProvider; +import org.opentripplanner.osm.OsmProvider; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.street.model.edge.StreetVehicleParkingLink; import org.opentripplanner.street.model.edge.VehicleParkingEdge; @@ -39,7 +39,7 @@ public class UnconnectedAreasTest { @Test public void unconnectedCarParkAndRide() { DefaultDataImportIssueStore issueStore = new DefaultDataImportIssueStore(); - Graph gg = buildOSMGraph("P+R.osm.pbf", issueStore); + Graph gg = buildOsmGraph("P+R.osm.pbf", issueStore); assertEquals(1, getParkAndRideUnlinkedIssueCount(issueStore)); @@ -56,7 +56,7 @@ public void unconnectedCarParkAndRide() { @Test public void unconnectedBikeParkAndRide() { DefaultDataImportIssueStore issueStore = new DefaultDataImportIssueStore(); - Graph gg = buildOSMGraph("B+R.osm.pbf", issueStore); + Graph gg = buildOsmGraph("B+R.osm.pbf", issueStore); assertEquals(2, getParkAndRideUnlinkedIssueCount(issueStore)); @@ -151,11 +151,11 @@ public void testRoadPassingOverParkRide() { assertTrue(connections.contains(VertexLabel.osm(-102284))); } - private Graph buildOSMGraph(String osmFileName) { - return buildOSMGraph(osmFileName, DataImportIssueStore.NOOP); + private Graph buildOsmGraph(String osmFileName) { + return buildOsmGraph(osmFileName, DataImportIssueStore.NOOP); } - private Graph buildOSMGraph(String osmFileName, DataImportIssueStore issueStore) { + private Graph buildOsmGraph(String osmFileName, DataImportIssueStore issueStore) { var deduplicator = new Deduplicator(); var stopModel = new StopModel(); var graph = new Graph(deduplicator); @@ -185,7 +185,7 @@ private List testGeometricGraphWithClasspathFile( int prCount, int prlCount ) { - Graph graph = buildOSMGraph(fileName); + Graph graph = buildOsmGraph(fileName); var vehicleParkingVertices = graph.getVerticesOfType(VehicleParkingEntranceVertex.class); int nParkAndRide = vehicleParkingVertices.size(); diff --git a/src/test/java/org/opentripplanner/graph_builder/module/osm/UnroutableTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/UnroutableTest.java similarity index 98% rename from src/test/java/org/opentripplanner/graph_builder/module/osm/UnroutableTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/osm/UnroutableTest.java index f921062e790..b759ace9b94 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/osm/UnroutableTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/UnroutableTest.java @@ -6,7 +6,7 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.astar.model.GraphPath; import org.opentripplanner.astar.model.ShortestPathTree; -import org.opentripplanner.openstreetmap.OsmProvider; +import org.opentripplanner.osm.OsmProvider; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.api.request.StreetMode; import org.opentripplanner.routing.graph.Graph; diff --git a/src/test/java/org/opentripplanner/graph_builder/module/osm/WalkableAreaBuilderTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/WalkableAreaBuilderTest.java similarity index 97% rename from src/test/java/org/opentripplanner/graph_builder/module/osm/WalkableAreaBuilderTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/osm/WalkableAreaBuilderTest.java index 4906bce930d..b712ee48c5a 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/osm/WalkableAreaBuilderTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/WalkableAreaBuilderTest.java @@ -19,8 +19,8 @@ import org.junit.jupiter.api.TestInfo; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.graph_builder.module.osm.naming.DefaultNamer; -import org.opentripplanner.openstreetmap.OsmProvider; -import org.opentripplanner.openstreetmap.model.OSMLevel; +import org.opentripplanner.osm.OsmProvider; +import org.opentripplanner.osm.model.OsmLevel; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.street.model.edge.AreaEdge; import org.opentripplanner.street.model.vertex.VertexLabel; @@ -42,7 +42,7 @@ public Graph buildGraph(final TestInfo testInfo) { final File file = ResourceLoader.of(WalkableAreaBuilderTest.class).file(osmFile); assertTrue(file.exists()); - new OsmProvider(file, false).readOSM(osmdb); + new OsmProvider(file, false).readOsm(osmdb); osmdb.postLoad(); final WalkableAreaBuilder walkableAreaBuilder = new WalkableAreaBuilder( @@ -57,7 +57,7 @@ public Graph buildGraph(final TestInfo testInfo) { boardingAreaRefTags ); - final Map areasLevels = osmdb + final Map areasLevels = osmdb .getWalkableAreas() .stream() .collect(toMap(a -> a, a -> osmdb.getLevelForWay(a.parent))); diff --git a/src/test/java/org/opentripplanner/graph_builder/module/osm/naming/SidewalkNamerTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/naming/SidewalkNamerTest.java similarity index 95% rename from src/test/java/org/opentripplanner/graph_builder/module/osm/naming/SidewalkNamerTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/module/osm/naming/SidewalkNamerTest.java index c1c3d7e5e73..465eeb32ba2 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/osm/naming/SidewalkNamerTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/naming/SidewalkNamerTest.java @@ -14,8 +14,8 @@ import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.graph_builder.module.osm.StreetEdgePair; import org.opentripplanner.graph_builder.services.osm.EdgeNamer; -import org.opentripplanner.openstreetmap.model.OSMWay; -import org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData; +import org.opentripplanner.osm.model.OsmWay; +import org.opentripplanner.osm.wayproperty.specifier.WayTestData; import org.opentripplanner.street.model.StreetTraversalPermission; import org.opentripplanner.street.model._data.StreetModelForTest; import org.opentripplanner.street.model.edge.StreetEdge; @@ -111,5 +111,5 @@ private static StreetEdgeBuilder edgeBuilder(WgsCoordinate... c) { } } - private record EdgePair(OSMWay way, StreetEdge edge) {} + private record EdgePair(OsmWay way, StreetEdge edge) {} } diff --git a/src/test/java/org/opentripplanner/graph_builder/services/osm/EdgeNamerTest.java b/application/src/test/java/org/opentripplanner/graph_builder/services/osm/EdgeNamerTest.java similarity index 100% rename from src/test/java/org/opentripplanner/graph_builder/services/osm/EdgeNamerTest.java rename to application/src/test/java/org/opentripplanner/graph_builder/services/osm/EdgeNamerTest.java diff --git a/application/src/test/java/org/opentripplanner/gtfs/GenerateTripPatternsOperationTest.java b/application/src/test/java/org/opentripplanner/gtfs/GenerateTripPatternsOperationTest.java new file mode 100644 index 00000000000..74819deabc2 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/gtfs/GenerateTripPatternsOperationTest.java @@ -0,0 +1,305 @@ +package org.opentripplanner.gtfs; + +import static org.opentripplanner.transit.model._data.TransitModelForTest.trip; + +import java.util.Collection; +import java.util.List; +import java.util.Set; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; +import org.opentripplanner.graph_builder.issue.service.DefaultDataImportIssueStore; +import org.opentripplanner.graph_builder.issues.TripDegenerate; +import org.opentripplanner.graph_builder.issues.TripUndefinedService; +import org.opentripplanner.graph_builder.module.geometry.GeometryProcessor; +import org.opentripplanner.model.StopTime; +import org.opentripplanner.model.impl.OtpTransitServiceBuilder; +import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model.basic.TransitMode; +import org.opentripplanner.transit.model.framework.Deduplicator; +import org.opentripplanner.transit.model.framework.FeedScopedId; +import org.opentripplanner.transit.model.site.RegularStop; +import org.opentripplanner.transit.model.timetable.Direction; +import org.opentripplanner.transit.model.timetable.Trip; +import org.opentripplanner.transit.service.StopModel; + +class GenerateTripPatternsOperationTest { + + private static StopModel stopModel; + private static RegularStop stopA; + private static RegularStop stopB; + private static RegularStop stopC; + private static Trip trip1; + private static Trip trip2; + private static Trip trip3; + private static Trip trip4; + private static Trip trip5; + private static StopTime stopTimeA; + private static StopTime stopTimeB; + private static StopTime stopTimeC; + + private Deduplicator deduplicator; + private DataImportIssueStore issueStore; + private OtpTransitServiceBuilder transitServiceBuilder; + private GeometryProcessor geometryProcessor; + + @BeforeAll + static void setupClass() { + TransitModelForTest transitModelForTest = TransitModelForTest.of(); + stopA = transitModelForTest.stop("stopA").build(); + stopB = transitModelForTest.stop("stopB").build(); + stopC = transitModelForTest.stop("stopC").build(); + stopModel = + transitModelForTest + .stopModelBuilder() + .withRegularStop(stopA) + .withRegularStop(stopB) + .withRegularStop(stopC) + .build(); + + stopTimeA = new StopTime(); + stopTimeA.setStop(stopA); + stopTimeB = new StopTime(); + stopTimeB.setStop(stopB); + stopTimeC = new StopTime(); + stopTimeC.setStop(stopC); + + FeedScopedId serviceId1 = TransitModelForTest.id("SERVICE_ID_1"); + trip1 = + trip("TRIP_ID_1") + .withServiceId(serviceId1) + .withMode(TransitMode.RAIL) + .withNetexSubmode("SUBMODE_1") + .withDirection(Direction.INBOUND) + .build(); + + // same route, mode, submode and direction as trip1 + FeedScopedId serviceId2 = TransitModelForTest.id("SERVICE_ID_2"); + trip2 = + trip("TRIP_ID_2") + .withServiceId(serviceId2) + .withRoute(trip1.getRoute()) + .withMode(trip1.getMode()) + .withNetexSubmode(trip1.getNetexSubMode().name()) + .withDirection(trip1.getDirection()) + .build(); + + // same route, direction as trip1, different mode + FeedScopedId serviceId3 = TransitModelForTest.id("SERVICE_ID_3"); + trip3 = + trip("TRIP_ID_3") + .withServiceId(serviceId3) + .withRoute(trip1.getRoute()) + .withMode(TransitMode.BUS) + .withDirection(trip1.getDirection()) + .build(); + + // same route, mode, direction as trip1, different submode + FeedScopedId serviceId4 = TransitModelForTest.id("SERVICE_ID_4"); + trip4 = + trip("TRIP_ID_4") + .withServiceId(serviceId4) + .withRoute(trip1.getRoute()) + .withMode(trip1.getMode()) + .withNetexSubmode("SUMODE_2") + .withDirection(trip1.getDirection()) + .build(); + + // same route, mode as trip1, different direction + FeedScopedId serviceId5 = TransitModelForTest.id("SERVICE_ID_5"); + trip5 = + trip("TRIP_ID_5") + .withServiceId(serviceId5) + .withRoute(trip1.getRoute()) + .withMode(trip1.getMode()) + .withNetexSubmode(trip1.getNetexSubMode().name()) + .withDirection(Direction.OUTBOUND) + .build(); + } + + @BeforeEach + void setup() { + deduplicator = new Deduplicator(); + issueStore = new DefaultDataImportIssueStore(); + transitServiceBuilder = new OtpTransitServiceBuilder(stopModel, issueStore); + double maxStopToShapeSnapDistance = 100; + geometryProcessor = + new GeometryProcessor(transitServiceBuilder, maxStopToShapeSnapDistance, issueStore); + } + + @Test + void testGenerateTripPatternsNoTrip() { + Set calendarServiceIds = Set.of(); + GenerateTripPatternsOperation generateTripPatternsOperation = new GenerateTripPatternsOperation( + transitServiceBuilder, + issueStore, + deduplicator, + calendarServiceIds, + geometryProcessor + ); + generateTripPatternsOperation.run(); + + Assertions.assertTrue(transitServiceBuilder.getTripPatterns().isEmpty()); + Assertions.assertTrue(issueStore.listIssues().isEmpty()); + } + + @Test + void testGenerateTripPatternsTripWithUndefinedService() { + transitServiceBuilder.getTripsById().computeIfAbsent(trip1.getId(), feedScopedId -> trip1); + Set calendarServiceIds = Set.of(); + + GenerateTripPatternsOperation generateTripPatternsOperation = new GenerateTripPatternsOperation( + transitServiceBuilder, + issueStore, + deduplicator, + calendarServiceIds, + geometryProcessor + ); + generateTripPatternsOperation.run(); + + Assertions.assertTrue(transitServiceBuilder.getTripPatterns().isEmpty()); + Assertions.assertFalse(issueStore.listIssues().isEmpty()); + Assertions.assertInstanceOf(TripUndefinedService.class, issueStore.listIssues().getFirst()); + } + + @Test + void testGenerateTripPatternsDegeneratedTrip() { + transitServiceBuilder.getTripsById().computeIfAbsent(trip1.getId(), feedScopedId -> trip1); + Set calendarServiceIds = Set.of(trip1.getServiceId()); + + GenerateTripPatternsOperation generateTripPatternsOperation = new GenerateTripPatternsOperation( + transitServiceBuilder, + issueStore, + deduplicator, + calendarServiceIds, + geometryProcessor + ); + generateTripPatternsOperation.run(); + + Assertions.assertTrue(transitServiceBuilder.getTripPatterns().isEmpty()); + Assertions.assertFalse(issueStore.listIssues().isEmpty()); + Assertions.assertInstanceOf(TripDegenerate.class, issueStore.listIssues().getFirst()); + } + + @Test + void testGenerateTripPatterns() { + transitServiceBuilder.getTripsById().computeIfAbsent(trip1.getId(), feedScopedId -> trip1); + Collection stopTimes = List.of(stopTimeA, stopTimeB); + transitServiceBuilder.getStopTimesSortedByTrip().put(trip1, stopTimes); + Set calendarServiceIds = Set.of(trip1.getServiceId()); + + GenerateTripPatternsOperation generateTripPatternsOperation = new GenerateTripPatternsOperation( + transitServiceBuilder, + issueStore, + deduplicator, + calendarServiceIds, + geometryProcessor + ); + generateTripPatternsOperation.run(); + + Assertions.assertEquals(1, transitServiceBuilder.getTripPatterns().size()); + Assertions.assertTrue(issueStore.listIssues().isEmpty()); + } + + @Test + void testGenerateTripPatterns2TripsSameStops() { + transitServiceBuilder.getTripsById().computeIfAbsent(trip1.getId(), feedScopedId -> trip1); + transitServiceBuilder.getTripsById().computeIfAbsent(trip2.getId(), feedScopedId -> trip2); + Collection stopTimes = List.of(stopTimeA, stopTimeB); + + transitServiceBuilder.getStopTimesSortedByTrip().put(trip1, stopTimes); + transitServiceBuilder.getStopTimesSortedByTrip().put(trip2, stopTimes); + + Set calendarServiceIds = Set.of(trip1.getServiceId(), trip2.getServiceId()); + + GenerateTripPatternsOperation generateTripPatternsOperation = new GenerateTripPatternsOperation( + transitServiceBuilder, + issueStore, + deduplicator, + calendarServiceIds, + geometryProcessor + ); + generateTripPatternsOperation.run(); + + Assertions.assertEquals(1, transitServiceBuilder.getTripPatterns().size()); + Assertions.assertEquals( + 2, + transitServiceBuilder + .getTripPatterns() + .values() + .stream() + .findFirst() + .orElseThrow() + .getScheduledTimetable() + .getTripTimes() + .size() + ); + Assertions.assertTrue(issueStore.listIssues().isEmpty()); + } + + @Test + void testGenerateTripPatterns2TripsDifferentStops() { + transitServiceBuilder.getTripsById().computeIfAbsent(trip1.getId(), feedScopedId -> trip1); + transitServiceBuilder.getTripsById().computeIfAbsent(trip2.getId(), feedScopedId -> trip2); + Collection stopTimesTrip1 = List.of(stopTimeA, stopTimeB); + Collection stopTimesTrip2 = List.of(stopTimeA, stopTimeC); + + transitServiceBuilder.getStopTimesSortedByTrip().put(trip1, stopTimesTrip1); + transitServiceBuilder.getStopTimesSortedByTrip().put(trip2, stopTimesTrip2); + + Set calendarServiceIds = Set.of(trip1.getServiceId(), trip2.getServiceId()); + + GenerateTripPatternsOperation generateTripPatternsOperation = new GenerateTripPatternsOperation( + transitServiceBuilder, + issueStore, + deduplicator, + calendarServiceIds, + geometryProcessor + ); + generateTripPatternsOperation.run(); + + Assertions.assertEquals(2, transitServiceBuilder.getTripPatterns().size()); + Assertions.assertTrue(issueStore.listIssues().isEmpty()); + } + + static List testCases() { + return List.of( + // trips with different modes + Arguments.of(trip1, trip3), + // trips with different sub-modes + Arguments.of(trip1, trip4), + // trips with different directions + Arguments.of(trip1, trip5) + ); + } + + @ParameterizedTest + @MethodSource("testCases") + void testGenerateDifferentTripPatterns(Trip t1, Trip t2) { + transitServiceBuilder.getTripsById().computeIfAbsent(t1.getId(), feedScopedId -> t1); + transitServiceBuilder.getTripsById().computeIfAbsent(t2.getId(), feedScopedId -> t2); + Collection stopTimes = List.of(stopTimeA, stopTimeB); + + transitServiceBuilder.getStopTimesSortedByTrip().put(t1, stopTimes); + transitServiceBuilder.getStopTimesSortedByTrip().put(t2, stopTimes); + + Set calendarServiceIds = Set.of(t1.getServiceId(), t2.getServiceId()); + + GenerateTripPatternsOperation generateTripPatternsOperation = new GenerateTripPatternsOperation( + transitServiceBuilder, + issueStore, + deduplicator, + calendarServiceIds, + geometryProcessor + ); + generateTripPatternsOperation.run(); + + Assertions.assertEquals(2, transitServiceBuilder.getTripPatterns().size()); + Assertions.assertTrue(issueStore.listIssues().isEmpty()); + } +} diff --git a/src/test/java/org/opentripplanner/gtfs/GtfsContext.java b/application/src/test/java/org/opentripplanner/gtfs/GtfsContext.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/GtfsContext.java rename to application/src/test/java/org/opentripplanner/gtfs/GtfsContext.java diff --git a/src/test/java/org/opentripplanner/gtfs/GtfsContextBuilder.java b/application/src/test/java/org/opentripplanner/gtfs/GtfsContextBuilder.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/GtfsContextBuilder.java rename to application/src/test/java/org/opentripplanner/gtfs/GtfsContextBuilder.java diff --git a/src/test/java/org/opentripplanner/gtfs/GtfsImport.java b/application/src/test/java/org/opentripplanner/gtfs/GtfsImport.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/GtfsImport.java rename to application/src/test/java/org/opentripplanner/gtfs/GtfsImport.java diff --git a/src/test/java/org/opentripplanner/gtfs/integration/InterliningTest.java b/application/src/test/java/org/opentripplanner/gtfs/integration/InterliningTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/integration/InterliningTest.java rename to application/src/test/java/org/opentripplanner/gtfs/integration/InterliningTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/interlining/InterlineProcessorTest.java b/application/src/test/java/org/opentripplanner/gtfs/interlining/InterlineProcessorTest.java similarity index 98% rename from src/test/java/org/opentripplanner/gtfs/interlining/InterlineProcessorTest.java rename to application/src/test/java/org/opentripplanner/gtfs/interlining/InterlineProcessorTest.java index a1aa4f9d753..e14a33cd276 100644 --- a/src/test/java/org/opentripplanner/gtfs/interlining/InterlineProcessorTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/interlining/InterlineProcessorTest.java @@ -163,13 +163,12 @@ private static TripPattern tripPattern(String tripId, String blockId, String ser ); var stopPattern = new StopPattern(stopTimes); - var tp = TripPattern + var tripTimes = TripTimesFactory.tripTimes(trip, stopTimes, new Deduplicator()); + return TripPattern .of(TransitModelForTest.id(tripId)) .withRoute(trip.getRoute()) .withStopPattern(stopPattern) + .withScheduledTimeTableBuilder(builder -> builder.addTripTimes(tripTimes)) .build(); - var tripTimes = TripTimesFactory.tripTimes(trip, stopTimes, new Deduplicator()); - tp.add(tripTimes); - return tp; } } diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/AgencyMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/AgencyMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/AgencyMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/AgencyMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/BikeAccessMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/BikeAccessMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/BikeAccessMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/BikeAccessMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/BoardingAreaMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/BoardingAreaMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/BoardingAreaMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/BoardingAreaMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/EntranceMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/EntranceMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/EntranceMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/EntranceMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/FareAttributeMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/FareAttributeMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/FareAttributeMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/FareAttributeMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/FareLegRuleMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/FareLegRuleMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/FareLegRuleMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/FareLegRuleMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/FareProductMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/FareProductMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/FareProductMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/FareProductMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/FareRuleMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/FareRuleMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/FareRuleMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/FareRuleMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/FareTransferRuleMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/FareTransferRuleMapperTest.java similarity index 98% rename from src/test/java/org/opentripplanner/gtfs/mapping/FareTransferRuleMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/FareTransferRuleMapperTest.java index dc924f6f0aa..eda714257cd 100644 --- a/src/test/java/org/opentripplanner/gtfs/mapping/FareTransferRuleMapperTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/mapping/FareTransferRuleMapperTest.java @@ -6,7 +6,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; -import javax.annotation.Nonnull; import org.junit.jupiter.api.Test; import org.onebusaway.gtfs.model.AgencyAndId; import org.onebusaway.gtfs.model.FareProduct; @@ -65,7 +64,6 @@ void transferRuleWithLegGroup() { assertEquals(groupId2.getId(), transferRule.toLegGroup().getId()); } - @Nonnull private FareProduct fareProduct() { var fareProduct = new FareProduct(); fareProduct.setId(id); diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/FeedInfoMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/FeedInfoMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/FeedInfoMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/FeedInfoMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/FeedScopedIdMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/FeedScopedIdMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/FeedScopedIdMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/FeedScopedIdMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/FrequencyMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/FrequencyMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/FrequencyMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/FrequencyMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/GtfsTestData.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/GtfsTestData.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/GtfsTestData.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/GtfsTestData.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/LocationGroupMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/LocationGroupMapperTest.java similarity index 97% rename from src/test/java/org/opentripplanner/gtfs/mapping/LocationGroupMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/LocationGroupMapperTest.java index 3a3c3f28649..67b18ead0c5 100644 --- a/src/test/java/org/opentripplanner/gtfs/mapping/LocationGroupMapperTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/mapping/LocationGroupMapperTest.java @@ -4,7 +4,6 @@ import java.util.Set; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import org.junit.jupiter.api.Test; import org.onebusaway.gtfs.model.AgencyAndId; import org.onebusaway.gtfs.model.LocationGroup; @@ -45,7 +44,6 @@ void map() { ); } - @Nonnull private static AgencyAndId id(String id) { return new AgencyAndId("1", id); } diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/LocationMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/LocationMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/LocationMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/LocationMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/PathwayMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/PathwayMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/PathwayMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/PathwayMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/PathwayNodeMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/PathwayNodeMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/PathwayNodeMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/PathwayNodeMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/RouteMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/RouteMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/RouteMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/RouteMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/ServiceCalendarDateMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/ServiceCalendarDateMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/ServiceCalendarDateMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/ServiceCalendarDateMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/ServiceCalendarMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/ServiceCalendarMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/ServiceCalendarMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/ServiceCalendarMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/ServiceDateMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/ServiceDateMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/ServiceDateMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/ServiceDateMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/ShapePointMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/ShapePointMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/ShapePointMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/ShapePointMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/StationMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/StationMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/StationMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/StationMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/StopAndStationMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/StopAndStationMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/StopAndStationMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/StopAndStationMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/StopTimeMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/StopTimeMapperTest.java similarity index 98% rename from src/test/java/org/opentripplanner/gtfs/mapping/StopTimeMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/StopTimeMapperTest.java index e45f7a8ff0d..d17c22c4abe 100644 --- a/src/test/java/org/opentripplanner/gtfs/mapping/StopTimeMapperTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/mapping/StopTimeMapperTest.java @@ -85,17 +85,11 @@ public class StopTimeMapperTest { locationMapper, stopModelBuilder ); - private final StopAreaMapper stopAreaMapper = new StopAreaMapper( - stopMapper, - locationMapper, - stopModelBuilder - ); private final TranslationHelper translationHelper = new TranslationHelper(); private final StopTimeMapper subject = new StopTimeMapper( stopMapper, locationMapper, locationGroupMapper, - stopAreaMapper, new TripMapper( new RouteMapper(new AgencyMapper(FEED_ID), ISSUE_STORE, translationHelper), new DirectionMapper(ISSUE_STORE), diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/TransferMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/TransferMapperTest.java similarity index 98% rename from src/test/java/org/opentripplanner/gtfs/mapping/TransferMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/TransferMapperTest.java index 3581cca9ac8..3c5a1eff42a 100644 --- a/src/test/java/org/opentripplanner/gtfs/mapping/TransferMapperTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/mapping/TransferMapperTest.java @@ -56,11 +56,6 @@ public class TransferMapperTest { LOCATION_MAPPER, STOP_MODEL_BUILDER ); - private static final StopAreaMapper STOP_AREA_MAPPER = new StopAreaMapper( - STOP_MAPPER, - LOCATION_MAPPER, - STOP_MODEL_BUILDER - ); private static StopTimeMapper STOP_TIME_MAPPER; private static final Integer ID = 45; @@ -99,7 +94,6 @@ void prepare() { STOP_MAPPER, LOCATION_MAPPER, LOCATION_GROUP_MAPPER, - STOP_AREA_MAPPER, new TripMapper( new RouteMapper(new AgencyMapper(FEED_ID), ISSUE_STORE, TRANSLATION_HELPER), new DirectionMapper(ISSUE_STORE), diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/TransitModeMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/TransitModeMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/TransitModeMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/TransitModeMapperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/TranslationHelperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/TranslationHelperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/TranslationHelperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/TranslationHelperTest.java diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/TripMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/TripMapperTest.java similarity index 84% rename from src/test/java/org/opentripplanner/gtfs/mapping/TripMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/TripMapperTest.java index c438fb2fd06..581cff59e79 100644 --- a/src/test/java/org/opentripplanner/gtfs/mapping/TripMapperTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/mapping/TripMapperTest.java @@ -9,7 +9,11 @@ import java.time.Duration; import java.util.Collection; import java.util.Collections; +import java.util.stream.Stream; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; import org.onebusaway.gtfs.model.AgencyAndId; import org.onebusaway.gtfs.model.Trip; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; @@ -118,17 +122,32 @@ void noFlexTimePenalty() { assertTrue(mapper.flexSafeTimePenalties().isEmpty()); } - @Test - void flexTimePenalty() { + @ParameterizedTest + @MethodSource("provideOffsetAndFactor") + void testFlexFactorAndOffset( + Double inputFactor, + Double inputOffset, + double expectedCoefficient, + Duration expectedConstant + ) { var flexTrip = new Trip(); flexTrip.setId(new AgencyAndId("1", "1")); - flexTrip.setSafeDurationFactor(1.5); - flexTrip.setSafeDurationOffset(60d); + flexTrip.setSafeDurationFactor(inputFactor); + flexTrip.setSafeDurationOffset(inputOffset); flexTrip.setRoute(new GtfsTestData().route); var mapper = defaultTripMapper(); var mapped = mapper.map(flexTrip); var penalty = mapper.flexSafeTimePenalties().get(mapped); - assertEquals(1.5f, penalty.coefficient()); - assertEquals(Duration.ofHours(1), penalty.constant()); + + assertEquals(expectedCoefficient, penalty.coefficient()); + assertEquals(expectedConstant, penalty.constant()); + } + + private static Stream provideOffsetAndFactor() { + return Stream.of( + Arguments.of(1.5d, 60d, 1.5d, Duration.ofHours(1)), + Arguments.of(null, 120d, 1d, Duration.ofHours(2)), + Arguments.of(1.5d, null, 1.5d, Duration.ZERO) + ); } } diff --git a/src/test/java/org/opentripplanner/inspector/vector/VectorTileResponseFactoryTest.java b/application/src/test/java/org/opentripplanner/inspector/vector/VectorTileResponseFactoryTest.java similarity index 100% rename from src/test/java/org/opentripplanner/inspector/vector/VectorTileResponseFactoryTest.java rename to application/src/test/java/org/opentripplanner/inspector/vector/VectorTileResponseFactoryTest.java diff --git a/src/test/java/org/opentripplanner/inspector/vector/stop/AreaStopLayerBuilderTest.java b/application/src/test/java/org/opentripplanner/inspector/vector/stop/AreaStopLayerBuilderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/inspector/vector/stop/AreaStopLayerBuilderTest.java rename to application/src/test/java/org/opentripplanner/inspector/vector/stop/AreaStopLayerBuilderTest.java diff --git a/src/test/java/org/opentripplanner/mmri/BeneficialChangesTest.java b/application/src/test/java/org/opentripplanner/mmri/BeneficialChangesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/mmri/BeneficialChangesTest.java rename to application/src/test/java/org/opentripplanner/mmri/BeneficialChangesTest.java diff --git a/src/test/java/org/opentripplanner/mmri/ExcludedRoutesTest.java b/application/src/test/java/org/opentripplanner/mmri/ExcludedRoutesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/mmri/ExcludedRoutesTest.java rename to application/src/test/java/org/opentripplanner/mmri/ExcludedRoutesTest.java diff --git a/src/test/java/org/opentripplanner/mmri/ExcludedTripsTest.java b/application/src/test/java/org/opentripplanner/mmri/ExcludedTripsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/mmri/ExcludedTripsTest.java rename to application/src/test/java/org/opentripplanner/mmri/ExcludedTripsTest.java diff --git a/src/test/java/org/opentripplanner/mmri/FirstForbiddenTripToTripTransferTest.java b/application/src/test/java/org/opentripplanner/mmri/FirstForbiddenTripToTripTransferTest.java similarity index 100% rename from src/test/java/org/opentripplanner/mmri/FirstForbiddenTripToTripTransferTest.java rename to application/src/test/java/org/opentripplanner/mmri/FirstForbiddenTripToTripTransferTest.java diff --git a/src/test/java/org/opentripplanner/mmri/FirstPreferredTripToTripTransferTest.java b/application/src/test/java/org/opentripplanner/mmri/FirstPreferredTripToTripTransferTest.java similarity index 100% rename from src/test/java/org/opentripplanner/mmri/FirstPreferredTripToTripTransferTest.java rename to application/src/test/java/org/opentripplanner/mmri/FirstPreferredTripToTripTransferTest.java diff --git a/src/test/java/org/opentripplanner/mmri/FirstUnpreferredTransferTest.java b/application/src/test/java/org/opentripplanner/mmri/FirstUnpreferredTransferTest.java similarity index 100% rename from src/test/java/org/opentripplanner/mmri/FirstUnpreferredTransferTest.java rename to application/src/test/java/org/opentripplanner/mmri/FirstUnpreferredTransferTest.java diff --git a/src/test/java/org/opentripplanner/mmri/MMRI Testdocument.pdf b/application/src/test/java/org/opentripplanner/mmri/MMRI Testdocument.pdf similarity index 100% rename from src/test/java/org/opentripplanner/mmri/MMRI Testdocument.pdf rename to application/src/test/java/org/opentripplanner/mmri/MMRI Testdocument.pdf diff --git a/src/test/java/org/opentripplanner/mmri/OptimizationTest.java b/application/src/test/java/org/opentripplanner/mmri/OptimizationTest.java similarity index 100% rename from src/test/java/org/opentripplanner/mmri/OptimizationTest.java rename to application/src/test/java/org/opentripplanner/mmri/OptimizationTest.java diff --git a/src/test/java/org/opentripplanner/mmri/PreferencesTest.java b/application/src/test/java/org/opentripplanner/mmri/PreferencesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/mmri/PreferencesTest.java rename to application/src/test/java/org/opentripplanner/mmri/PreferencesTest.java diff --git a/src/test/java/org/opentripplanner/mmri/SecondForbiddenTripToTripTransferTest.java b/application/src/test/java/org/opentripplanner/mmri/SecondForbiddenTripToTripTransferTest.java similarity index 100% rename from src/test/java/org/opentripplanner/mmri/SecondForbiddenTripToTripTransferTest.java rename to application/src/test/java/org/opentripplanner/mmri/SecondForbiddenTripToTripTransferTest.java diff --git a/src/test/java/org/opentripplanner/mmri/SecondPreferredTripToTripTransferTest.java b/application/src/test/java/org/opentripplanner/mmri/SecondPreferredTripToTripTransferTest.java similarity index 100% rename from src/test/java/org/opentripplanner/mmri/SecondPreferredTripToTripTransferTest.java rename to application/src/test/java/org/opentripplanner/mmri/SecondPreferredTripToTripTransferTest.java diff --git a/src/test/java/org/opentripplanner/mmri/SecondUnpreferredTransferTest.java b/application/src/test/java/org/opentripplanner/mmri/SecondUnpreferredTransferTest.java similarity index 100% rename from src/test/java/org/opentripplanner/mmri/SecondUnpreferredTransferTest.java rename to application/src/test/java/org/opentripplanner/mmri/SecondUnpreferredTransferTest.java diff --git a/src/test/java/org/opentripplanner/mmri/StopToStopTransfersTest.java b/application/src/test/java/org/opentripplanner/mmri/StopToStopTransfersTest.java similarity index 100% rename from src/test/java/org/opentripplanner/mmri/StopToStopTransfersTest.java rename to application/src/test/java/org/opentripplanner/mmri/StopToStopTransfersTest.java diff --git a/src/test/java/org/opentripplanner/mmri/TimeTest.java b/application/src/test/java/org/opentripplanner/mmri/TimeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/mmri/TimeTest.java rename to application/src/test/java/org/opentripplanner/mmri/TimeTest.java diff --git a/src/test/java/org/opentripplanner/mmri/UnplannedChangesTest.java b/application/src/test/java/org/opentripplanner/mmri/UnplannedChangesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/mmri/UnplannedChangesTest.java rename to application/src/test/java/org/opentripplanner/mmri/UnplannedChangesTest.java diff --git a/src/test/java/org/opentripplanner/mmri/WheelchairTest.java b/application/src/test/java/org/opentripplanner/mmri/WheelchairTest.java similarity index 100% rename from src/test/java/org/opentripplanner/mmri/WheelchairTest.java rename to application/src/test/java/org/opentripplanner/mmri/WheelchairTest.java diff --git a/src/test/java/org/opentripplanner/mmri/package-info.java b/application/src/test/java/org/opentripplanner/mmri/package-info.java similarity index 100% rename from src/test/java/org/opentripplanner/mmri/package-info.java rename to application/src/test/java/org/opentripplanner/mmri/package-info.java diff --git a/src/test/java/org/opentripplanner/model/ShapeGeometryTest.java b/application/src/test/java/org/opentripplanner/model/ShapeGeometryTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/ShapeGeometryTest.java rename to application/src/test/java/org/opentripplanner/model/ShapeGeometryTest.java diff --git a/src/test/java/org/opentripplanner/model/TimetableSnapshotTest.java b/application/src/test/java/org/opentripplanner/model/TimetableSnapshotTest.java similarity index 84% rename from src/test/java/org/opentripplanner/model/TimetableSnapshotTest.java rename to application/src/test/java/org/opentripplanner/model/TimetableSnapshotTest.java index 0a737630a5b..ffdfc027b76 100644 --- a/src/test/java/org/opentripplanner/model/TimetableSnapshotTest.java +++ b/application/src/test/java/org/opentripplanner/model/TimetableSnapshotTest.java @@ -2,6 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertNull; @@ -52,9 +53,9 @@ public static void setUp() throws Exception { @Test public void testCompare() { - Timetable orig = new Timetable(null); - Timetable a = new Timetable(orig, LocalDate.now(timeZone).minusDays(1)); - Timetable b = new Timetable(orig, LocalDate.now(timeZone)); + Timetable orig = Timetable.of().build(); + Timetable a = orig.copyOf().withServiceDate(LocalDate.now(timeZone).minusDays(1)).build(); + Timetable b = orig.copyOf().withServiceDate(LocalDate.now(timeZone)).build(); assertTrue(new TimetableSnapshot.SortedTimetableComparator().compare(a, b) < 0); } @@ -106,52 +107,50 @@ public void testResolve() { @Test public void testUpdate() { - assertThrows( - ConcurrentModificationException.class, - () -> { - LocalDate today = LocalDate.now(timeZone); - LocalDate yesterday = today.minusDays(1); - TripPattern pattern = patternIndex.get(new FeedScopedId(feedId, "1.1")); + LocalDate today = LocalDate.now(timeZone); + LocalDate yesterday = today.minusDays(1); + TripPattern pattern = patternIndex.get(new FeedScopedId(feedId, "1.1")); - TimetableSnapshot resolver = new TimetableSnapshot(); - Timetable origNow = resolver.resolve(pattern, today); + TimetableSnapshot resolver = new TimetableSnapshot(); + Timetable origNow = resolver.resolve(pattern, today); - TripDescriptor.Builder tripDescriptorBuilder = TripDescriptor.newBuilder(); + TripDescriptor.Builder tripDescriptorBuilder = TripDescriptor.newBuilder(); - tripDescriptorBuilder.setTripId("1.1"); - tripDescriptorBuilder.setScheduleRelationship(ScheduleRelationship.SCHEDULED); + tripDescriptorBuilder.setTripId("1.1"); + tripDescriptorBuilder.setScheduleRelationship(ScheduleRelationship.SCHEDULED); - TripUpdate.Builder tripUpdateBuilder = TripUpdate.newBuilder(); + TripUpdate.Builder tripUpdateBuilder = TripUpdate.newBuilder(); - tripUpdateBuilder.setTrip(tripDescriptorBuilder); + tripUpdateBuilder.setTrip(tripDescriptorBuilder); - var stopTimeUpdateBuilder = tripUpdateBuilder.addStopTimeUpdateBuilder(0); - stopTimeUpdateBuilder.setStopSequence(2); - stopTimeUpdateBuilder.setScheduleRelationship( - TripUpdate.StopTimeUpdate.ScheduleRelationship.SCHEDULED - ); - stopTimeUpdateBuilder.setDeparture( - TripUpdate.StopTimeEvent.newBuilder().setDelay(5).build() - ); + var stopTimeUpdateBuilder = tripUpdateBuilder.addStopTimeUpdateBuilder(0); + stopTimeUpdateBuilder.setStopSequence(2); + stopTimeUpdateBuilder.setScheduleRelationship( + TripUpdate.StopTimeUpdate.ScheduleRelationship.SCHEDULED + ); + stopTimeUpdateBuilder.setDeparture(TripUpdate.StopTimeEvent.newBuilder().setDelay(5).build()); - TripUpdate tripUpdate = tripUpdateBuilder.build(); + TripUpdate tripUpdate = tripUpdateBuilder.build(); - // new timetable for today - updateResolver(resolver, pattern, tripUpdate, today); - Timetable updatedNow = resolver.resolve(pattern, today); - assertNotSame(origNow, updatedNow); + // new timetable for today + updateResolver(resolver, pattern, tripUpdate, today); + Timetable updatedNow = resolver.resolve(pattern, today); + assertNotSame(origNow, updatedNow); - // reuse timetable for today - updateResolver(resolver, pattern, tripUpdate, today); - assertEquals(updatedNow, resolver.resolve(pattern, today)); + // a new timetable instance is created for today + updateResolver(resolver, pattern, tripUpdate, today); + assertNotEquals(updatedNow, resolver.resolve(pattern, today)); - // create new timetable for tomorrow - updateResolver(resolver, pattern, tripUpdate, yesterday); - assertNotSame(origNow, resolver.resolve(pattern, yesterday)); - assertNotSame(updatedNow, resolver.resolve(pattern, yesterday)); + // create new timetable for tomorrow + updateResolver(resolver, pattern, tripUpdate, yesterday); + assertNotSame(origNow, resolver.resolve(pattern, yesterday)); + assertNotSame(updatedNow, resolver.resolve(pattern, yesterday)); - // exception if we try to modify a snapshot - TimetableSnapshot snapshot = resolver.commit(); + // exception if we try to modify a snapshot + TimetableSnapshot snapshot = resolver.commit(); + assertThrows( + ConcurrentModificationException.class, + () -> { updateResolver(snapshot, pattern, tripUpdate, yesterday); } ); diff --git a/src/test/java/org/opentripplanner/model/TimetableTest.java b/application/src/test/java/org/opentripplanner/model/TimetableTest.java similarity index 98% rename from src/test/java/org/opentripplanner/model/TimetableTest.java rename to application/src/test/java/org/opentripplanner/model/TimetableTest.java index 9e6a7467dc5..dca4d3e828d 100644 --- a/src/test/java/org/opentripplanner/model/TimetableTest.java +++ b/application/src/test/java/org/opentripplanner/model/TimetableTest.java @@ -22,7 +22,6 @@ import java.util.HashMap; import java.util.Map; import java.util.function.BiConsumer; -import javax.annotation.Nonnull; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @@ -190,7 +189,7 @@ public void update() { result.ifSuccess(p -> { var updatedTripTimes = p.getTripTimes(); assertNotNull(updatedTripTimes); - timetable.setTripTimes(trip_1_1_index, updatedTripTimes); + timetable = timetable.copyOf().addOrUpdateTripTimes(updatedTripTimes).build(); assertEquals(20 * 60 + 120, timetable.getTripTimes(trip_1_1_index).getArrivalTime(2)); }); @@ -217,7 +216,7 @@ public void update() { result.ifSuccess(p -> { var updatedTripTimes = p.getTripTimes(); assertNotNull(updatedTripTimes); - timetable.setTripTimes(trip_1_1_index, updatedTripTimes); + timetable = timetable.copyOf().addOrUpdateTripTimes(updatedTripTimes).build(); }); // update trip arrival time only @@ -246,7 +245,7 @@ public void update() { result.ifSuccess(p -> { var updatedTripTimes = p.getTripTimes(); assertNotNull(updatedTripTimes); - timetable.setTripTimes(trip_1_1_index, updatedTripTimes); + timetable = timetable.copyOf().addOrUpdateTripTimes(updatedTripTimes).build(); }); // update trip departure time only @@ -273,7 +272,7 @@ public void update() { result.ifSuccess(p -> { var updatedTripTimes = p.getTripTimes(); assertNotNull(updatedTripTimes); - timetable.setTripTimes(trip_1_1_index, updatedTripTimes); + timetable = timetable.copyOf().addOrUpdateTripTimes(updatedTripTimes).build(); }); // update trip using stop id @@ -299,7 +298,7 @@ public void update() { result.ifSuccess(p -> { var updatedTripTimes = p.getTripTimes(); assertNotNull(updatedTripTimes); - timetable.setTripTimes(trip_1_1_index, updatedTripTimes); + timetable = timetable.copyOf().addOrUpdateTripTimes(updatedTripTimes).build(); }); } @@ -975,7 +974,6 @@ private static void testInvalidStopTime( }); } - @Nonnull private static StopTimeUpdate emptyStopTime( int sequence, BiConsumer setEmptyEvent diff --git a/src/test/java/org/opentripplanner/model/TripPatternTest.java b/application/src/test/java/org/opentripplanner/model/TripPatternTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/TripPatternTest.java rename to application/src/test/java/org/opentripplanner/model/TripPatternTest.java diff --git a/src/test/java/org/opentripplanner/model/TripTimeOnDateTest.java b/application/src/test/java/org/opentripplanner/model/TripTimeOnDateTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/TripTimeOnDateTest.java rename to application/src/test/java/org/opentripplanner/model/TripTimeOnDateTest.java diff --git a/src/test/java/org/opentripplanner/model/calendar/ServiceDateIntervalTest.java b/application/src/test/java/org/opentripplanner/model/calendar/ServiceDateIntervalTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/calendar/ServiceDateIntervalTest.java rename to application/src/test/java/org/opentripplanner/model/calendar/ServiceDateIntervalTest.java diff --git a/src/test/java/org/opentripplanner/model/calendar/impl/CalendarServiceDataFactoryImplTest.java b/application/src/test/java/org/opentripplanner/model/calendar/impl/CalendarServiceDataFactoryImplTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/calendar/impl/CalendarServiceDataFactoryImplTest.java rename to application/src/test/java/org/opentripplanner/model/calendar/impl/CalendarServiceDataFactoryImplTest.java diff --git a/src/test/java/org/opentripplanner/model/calendar/openinghours/OHCalendarTest.java b/application/src/test/java/org/opentripplanner/model/calendar/openinghours/OHCalendarTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/calendar/openinghours/OHCalendarTest.java rename to application/src/test/java/org/opentripplanner/model/calendar/openinghours/OHCalendarTest.java diff --git a/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderLimitPeriodTest.java b/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderLimitPeriodTest.java similarity index 87% rename from src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderLimitPeriodTest.java rename to application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderLimitPeriodTest.java index 5d1fef21271..27e6e56c645 100644 --- a/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderLimitPeriodTest.java +++ b/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderLimitPeriodTest.java @@ -1,6 +1,7 @@ package org.opentripplanner.model.impl; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertTrue; import java.time.LocalDate; @@ -22,6 +23,7 @@ import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.network.StopPattern; import org.opentripplanner.transit.model.network.TripPattern; +import org.opentripplanner.transit.model.network.TripPatternBuilder; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.timetable.Direction; import org.opentripplanner.transit.model.timetable.Trip; @@ -141,16 +143,27 @@ public void testLimitPeriod() { assertTrue(patterns.contains(patternInT1), patterns.toString()); assertTrue(patterns.contains(patternInT2), patterns.toString()); - // Verify trips in pattern (one trip is removed from patternInT1) - assertEquals(1, patternInT1.scheduledTripsAsStream().count()); - assertEquals(tripCSIn, patternInT1.scheduledTripsAsStream().findFirst().orElseThrow()); - - // Verify trips in pattern is unchanged (one trip) + // Verify patternInT1 is replaced by a copy that contains one less trip + TripPattern copyOfTripPattern1 = subject + .getTripPatterns() + .values() + .stream() + .filter(p -> p.getId().equals(patternInT1.getId())) + .findFirst() + .orElseThrow(); + assertNotSame(patternInT1, copyOfTripPattern1); + assertEquals(1, copyOfTripPattern1.scheduledTripsAsStream().count()); + assertEquals(tripCSIn, copyOfTripPattern1.scheduledTripsAsStream().findFirst().orElseThrow()); + + // Verify trips in patternInT2 is unchanged (one trip) assertEquals(1, patternInT2.scheduledTripsAsStream().count()); - // Verify scheduledTimetable trips (one trip is removed from patternInT1) - assertEquals(1, patternInT1.getScheduledTimetable().getTripTimes().size()); - assertEquals(tripCSIn, patternInT1.getScheduledTimetable().getTripTimes().get(0).getTrip()); + // Verify scheduledTimetable trips (one trip is removed from the copy of patternInT1) + assertEquals(1, copyOfTripPattern1.getScheduledTimetable().getTripTimes().size()); + assertEquals( + tripCSIn, + copyOfTripPattern1.getScheduledTimetable().getTripTimes().get(0).getTrip() + ); // Verify scheduledTimetable trips in pattern is unchanged (one trip) assertEquals(1, patternInT2.getScheduledTimetable().getTripTimes().size()); @@ -186,16 +199,17 @@ private TripPattern createTripPattern(Collection trips) { FeedScopedId patternId = TransitModelForTest.id( trips.stream().map(t -> t.getId().getId()).collect(Collectors.joining(":")) ); - TripPattern p = TripPattern + TripPatternBuilder tpb = TripPattern .of(patternId) .withRoute(route) - .withStopPattern(STOP_PATTERN) - .build(); + .withStopPattern(STOP_PATTERN); for (Trip trip : trips) { - p.add(TripTimesFactory.tripTimes(trip, STOP_TIMES, DEDUPLICATOR)); + tpb.withScheduledTimeTableBuilder(builder -> + builder.addTripTimes(TripTimesFactory.tripTimes(trip, STOP_TIMES, DEDUPLICATOR)) + ); } - return p; + return tpb.build(); } private Trip createTrip(String id, FeedScopedId serviceId) { diff --git a/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderTest.java b/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderTest.java rename to application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderTest.java diff --git a/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceImplTest.java b/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceImplTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/impl/OtpTransitServiceImplTest.java rename to application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceImplTest.java diff --git a/src/test/java/org/opentripplanner/model/modes/AllowAllModesFilterTest.java b/application/src/test/java/org/opentripplanner/model/modes/AllowAllModesFilterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/modes/AllowAllModesFilterTest.java rename to application/src/test/java/org/opentripplanner/model/modes/AllowAllModesFilterTest.java diff --git a/src/test/java/org/opentripplanner/model/modes/AllowMainAndSubModeFilterTest.java b/application/src/test/java/org/opentripplanner/model/modes/AllowMainAndSubModeFilterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/modes/AllowMainAndSubModeFilterTest.java rename to application/src/test/java/org/opentripplanner/model/modes/AllowMainAndSubModeFilterTest.java diff --git a/src/test/java/org/opentripplanner/model/modes/AllowMainAndSubModesFilterTest.java b/application/src/test/java/org/opentripplanner/model/modes/AllowMainAndSubModesFilterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/modes/AllowMainAndSubModesFilterTest.java rename to application/src/test/java/org/opentripplanner/model/modes/AllowMainAndSubModesFilterTest.java diff --git a/src/test/java/org/opentripplanner/model/modes/AllowMainModeFilterTest.java b/application/src/test/java/org/opentripplanner/model/modes/AllowMainModeFilterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/modes/AllowMainModeFilterTest.java rename to application/src/test/java/org/opentripplanner/model/modes/AllowMainModeFilterTest.java diff --git a/src/test/java/org/opentripplanner/model/modes/AllowMainModesFilterTest.java b/application/src/test/java/org/opentripplanner/model/modes/AllowMainModesFilterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/modes/AllowMainModesFilterTest.java rename to application/src/test/java/org/opentripplanner/model/modes/AllowMainModesFilterTest.java diff --git a/src/test/java/org/opentripplanner/model/modes/PathTailFilterFactoryTest.java b/application/src/test/java/org/opentripplanner/model/modes/PathTailFilterFactoryTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/modes/PathTailFilterFactoryTest.java rename to application/src/test/java/org/opentripplanner/model/modes/PathTailFilterFactoryTest.java diff --git a/src/test/java/org/opentripplanner/model/plan/ElevationProfileTest.java b/application/src/test/java/org/opentripplanner/model/plan/ElevationProfileTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/plan/ElevationProfileTest.java rename to application/src/test/java/org/opentripplanner/model/plan/ElevationProfileTest.java diff --git a/src/test/java/org/opentripplanner/model/plan/ItineraryTest.java b/application/src/test/java/org/opentripplanner/model/plan/ItineraryTest.java similarity index 96% rename from src/test/java/org/opentripplanner/model/plan/ItineraryTest.java rename to application/src/test/java/org/opentripplanner/model/plan/ItineraryTest.java index 142ced31504..1372af0f405 100644 --- a/src/test/java/org/opentripplanner/model/plan/ItineraryTest.java +++ b/application/src/test/java/org/opentripplanner/model/plan/ItineraryTest.java @@ -258,6 +258,17 @@ void bothPenalties() { ); } + @Test + void directFlex() { + assertFalse(itinerary().isDirectFlex()); + assertTrue(newItinerary(A).flex(T11_10, T11_20, B).build().isDirectFlex()); + } + + @Test + void walkOnlyIsNotDirectFlex() { + assertFalse(TestItineraryBuilder.newItinerary(A, T11_00).walk(10, B).build().isDirectFlex()); + } + private static Itinerary itinerary() { return newItinerary(A).bus(1, T11_04, T11_14, B).build(); } diff --git a/src/test/java/org/opentripplanner/model/plan/LegTest.java b/application/src/test/java/org/opentripplanner/model/plan/LegTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/plan/LegTest.java rename to application/src/test/java/org/opentripplanner/model/plan/LegTest.java diff --git a/src/test/java/org/opentripplanner/model/plan/PlaceTest.java b/application/src/test/java/org/opentripplanner/model/plan/PlaceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/plan/PlaceTest.java rename to application/src/test/java/org/opentripplanner/model/plan/PlaceTest.java diff --git a/src/test/java/org/opentripplanner/model/plan/PlanTestConstants.java b/application/src/test/java/org/opentripplanner/model/plan/PlanTestConstants.java similarity index 100% rename from src/test/java/org/opentripplanner/model/plan/PlanTestConstants.java rename to application/src/test/java/org/opentripplanner/model/plan/PlanTestConstants.java diff --git a/src/test/java/org/opentripplanner/model/plan/RelativeDirectionTest.java b/application/src/test/java/org/opentripplanner/model/plan/RelativeDirectionTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/plan/RelativeDirectionTest.java rename to application/src/test/java/org/opentripplanner/model/plan/RelativeDirectionTest.java diff --git a/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilderTest.java b/application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilderTest.java rename to application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilderTest.java diff --git a/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegTest.java b/application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegTest.java rename to application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegTest.java diff --git a/src/test/java/org/opentripplanner/model/plan/TestItineraryBuilder.java b/application/src/test/java/org/opentripplanner/model/plan/TestItineraryBuilder.java similarity index 96% rename from src/test/java/org/opentripplanner/model/plan/TestItineraryBuilder.java rename to application/src/test/java/org/opentripplanner/model/plan/TestItineraryBuilder.java index edaafabd753..7b963ae8ee6 100644 --- a/src/test/java/org/opentripplanner/model/plan/TestItineraryBuilder.java +++ b/application/src/test/java/org/opentripplanner/model/plan/TestItineraryBuilder.java @@ -73,6 +73,7 @@ public class TestItineraryBuilder implements PlanTestConstants { private int lastEndTime; private int c1 = 0; private int c2 = NOT_SET; + private boolean isSearchWindowAware = true; private TestItineraryBuilder(Place origin, int startTime) { this.lastPlace = origin; @@ -199,9 +200,13 @@ public TestItineraryBuilder flex(int start, int end, Place to) { int legCost = 0; StopTime fromStopTime = new StopTime(); fromStopTime.setStop(lastPlace.stop); + fromStopTime.setFlexWindowStart(start); + fromStopTime.setFlexWindowEnd(end); StopTime toStopTime = new StopTime(); toStopTime.setStop(to.stop); + toStopTime.setFlexWindowStart(start); + toStopTime.setFlexWindowEnd(end); Trip trip = trip("1", route("flex").build()); @@ -398,6 +403,11 @@ public TestItineraryBuilder withGeneralizedCost2(int c2) { return this; } + public TestItineraryBuilder withIsSearchWindowAware(boolean searchWindowAware) { + this.isSearchWindowAware = searchWindowAware; + return this; + } + public Itinerary egress(int walkDuration) { walk(walkDuration, null); return build(); @@ -413,7 +423,12 @@ public Itinerary build(int c1) { } public Itinerary build() { - Itinerary itinerary = new Itinerary(legs); + Itinerary itinerary; + if (isSearchWindowAware) { + itinerary = Itinerary.createScheduledTransitItinerary(legs); + } else { + itinerary = Itinerary.createDirectItinerary(legs); + } itinerary.setGeneralizedCost(c1); if (c2 != NOT_SET) { itinerary.setGeneralizedCost2(c2); @@ -482,13 +497,13 @@ public TestItineraryBuilder transit( stopTimes.add(toStopTime); StopPattern stopPattern = new StopPattern(stopTimes); + final TripTimes tripTimes = TripTimesFactory.tripTimes(trip, stopTimes, new Deduplicator()); TripPattern tripPattern = TripPattern .of(route.getId()) .withRoute(route) .withStopPattern(stopPattern) + .withScheduledTimeTableBuilder(builder -> builder.addTripTimes(tripTimes)) .build(); - final TripTimes tripTimes = TripTimesFactory.tripTimes(trip, stopTimes, new Deduplicator()); - tripPattern.add(tripTimes); ScheduledTransitLeg leg; diff --git a/src/test/java/org/opentripplanner/model/plan/WalkStepTest.java b/application/src/test/java/org/opentripplanner/model/plan/WalkStepTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/plan/WalkStepTest.java rename to application/src/test/java/org/opentripplanner/model/plan/WalkStepTest.java diff --git a/src/test/java/org/opentripplanner/model/plan/legreference/LegReferenceSerializerTest.java b/application/src/test/java/org/opentripplanner/model/plan/legreference/LegReferenceSerializerTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/plan/legreference/LegReferenceSerializerTest.java rename to application/src/test/java/org/opentripplanner/model/plan/legreference/LegReferenceSerializerTest.java diff --git a/src/test/java/org/opentripplanner/model/plan/legreference/ScheduledTransitLegReferenceTest.java b/application/src/test/java/org/opentripplanner/model/plan/legreference/ScheduledTransitLegReferenceTest.java similarity index 98% rename from src/test/java/org/opentripplanner/model/plan/legreference/ScheduledTransitLegReferenceTest.java rename to application/src/test/java/org/opentripplanner/model/plan/legreference/ScheduledTransitLegReferenceTest.java index 480639e5bda..277f65cfcae 100644 --- a/src/test/java/org/opentripplanner/model/plan/legreference/ScheduledTransitLegReferenceTest.java +++ b/application/src/test/java/org/opentripplanner/model/plan/legreference/ScheduledTransitLegReferenceTest.java @@ -11,7 +11,6 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; -import org.opentripplanner.model.Timetable; import org.opentripplanner.model.calendar.CalendarServiceData; import org.opentripplanner.model.plan.PlanTestConstants; import org.opentripplanner.model.plan.ScheduledTransitLeg; @@ -54,23 +53,23 @@ static void buildTransitService() { stop4 = TEST_MODEL.stop("STOP4", 0, 0).withParentStation(parentStation).build(); // build transit data + Trip trip = TransitModelForTest.trip("1").build(); + var tripTimes = TripTimesFactory.tripTimes( + trip, + TEST_MODEL.stopTimesEvery5Minutes(5, trip, PlanTestConstants.T11_00), + new Deduplicator() + ); + tripTimes.setServiceCode(SERVICE_CODE); TripPattern tripPattern = TransitModelForTest .tripPattern("1", TransitModelForTest.route(id("1")).build()) .withStopPattern(TransitModelForTest.stopPattern(stop1, stop2, stop3)) + .withScheduledTimeTableBuilder(builder -> builder.addTripTimes(tripTimes)) .build(); - Timetable timetable = tripPattern.getScheduledTimetable(); - Trip trip = TransitModelForTest.trip("1").build(); + tripId = trip.getId(); stopIdAtPosition0 = tripPattern.getStop(0).getId(); stopIdAtPosition1 = tripPattern.getStop(1).getId(); stopIdAtPosition2 = tripPattern.getStop(2).getId(); - var tripTimes = TripTimesFactory.tripTimes( - trip, - TEST_MODEL.stopTimesEvery5Minutes(5, trip, PlanTestConstants.T11_00), - new Deduplicator() - ); - tripTimes.setServiceCode(SERVICE_CODE); - timetable.addTripTimes(tripTimes); // build transit model StopModel stopModel = TEST_MODEL @@ -88,7 +87,6 @@ static void buildTransitService() { transitModel.updateCalendarServiceData(true, calendarServiceData, DataImportIssueStore.NOOP); transitModel.addTripOnServiceDate( - TRIP_ON_SERVICE_DATE_ID, TripOnServiceDate .of(TRIP_ON_SERVICE_DATE_ID) .withTrip(trip) diff --git a/src/test/java/org/opentripplanner/model/plan/paging/PagingSearchWindowAdjusterTest.java b/application/src/test/java/org/opentripplanner/model/plan/paging/PagingSearchWindowAdjusterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/plan/paging/PagingSearchWindowAdjusterTest.java rename to application/src/test/java/org/opentripplanner/model/plan/paging/PagingSearchWindowAdjusterTest.java diff --git a/src/test/java/org/opentripplanner/model/plan/paging/cursor/DeduplicationPageCutTest.java b/application/src/test/java/org/opentripplanner/model/plan/paging/cursor/DeduplicationPageCutTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/plan/paging/cursor/DeduplicationPageCutTest.java rename to application/src/test/java/org/opentripplanner/model/plan/paging/cursor/DeduplicationPageCutTest.java diff --git a/src/test/java/org/opentripplanner/model/plan/paging/cursor/PageCursorFactoryTest.java b/application/src/test/java/org/opentripplanner/model/plan/paging/cursor/PageCursorFactoryTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/plan/paging/cursor/PageCursorFactoryTest.java rename to application/src/test/java/org/opentripplanner/model/plan/paging/cursor/PageCursorFactoryTest.java diff --git a/src/test/java/org/opentripplanner/model/plan/paging/cursor/PageCursorSerializerTest.java b/application/src/test/java/org/opentripplanner/model/plan/paging/cursor/PageCursorSerializerTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/plan/paging/cursor/PageCursorSerializerTest.java rename to application/src/test/java/org/opentripplanner/model/plan/paging/cursor/PageCursorSerializerTest.java diff --git a/src/test/java/org/opentripplanner/model/plan/paging/cursor/PageCursorTest.java b/application/src/test/java/org/opentripplanner/model/plan/paging/cursor/PageCursorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/plan/paging/cursor/PageCursorTest.java rename to application/src/test/java/org/opentripplanner/model/plan/paging/cursor/PageCursorTest.java diff --git a/src/test/java/org/opentripplanner/model/plan/paging/cursor/PageTypeTest.java b/application/src/test/java/org/opentripplanner/model/plan/paging/cursor/PageTypeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/plan/paging/cursor/PageTypeTest.java rename to application/src/test/java/org/opentripplanner/model/plan/paging/cursor/PageTypeTest.java diff --git a/src/test/java/org/opentripplanner/model/projectinfo/GraphFileHeaderTest.java b/application/src/test/java/org/opentripplanner/model/projectinfo/GraphFileHeaderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/projectinfo/GraphFileHeaderTest.java rename to application/src/test/java/org/opentripplanner/model/projectinfo/GraphFileHeaderTest.java diff --git a/src/test/java/org/opentripplanner/model/projectinfo/MavenProjectVersionTest.java b/application/src/test/java/org/opentripplanner/model/projectinfo/MavenProjectVersionTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/projectinfo/MavenProjectVersionTest.java rename to application/src/test/java/org/opentripplanner/model/projectinfo/MavenProjectVersionTest.java diff --git a/src/test/java/org/opentripplanner/model/projectinfo/OtpProjectInfoTest.java b/application/src/test/java/org/opentripplanner/model/projectinfo/OtpProjectInfoTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/projectinfo/OtpProjectInfoTest.java rename to application/src/test/java/org/opentripplanner/model/projectinfo/OtpProjectInfoTest.java diff --git a/src/test/java/org/opentripplanner/model/routing/TripSearchMetadataTest.java b/application/src/test/java/org/opentripplanner/model/routing/TripSearchMetadataTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/routing/TripSearchMetadataTest.java rename to application/src/test/java/org/opentripplanner/model/routing/TripSearchMetadataTest.java diff --git a/src/test/java/org/opentripplanner/model/transfer/ConstrainedTransferTest.java b/application/src/test/java/org/opentripplanner/model/transfer/ConstrainedTransferTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/transfer/ConstrainedTransferTest.java rename to application/src/test/java/org/opentripplanner/model/transfer/ConstrainedTransferTest.java diff --git a/src/test/java/org/opentripplanner/model/transfer/TransferConstraintTest.java b/application/src/test/java/org/opentripplanner/model/transfer/TransferConstraintTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/transfer/TransferConstraintTest.java rename to application/src/test/java/org/opentripplanner/model/transfer/TransferConstraintTest.java diff --git a/src/test/java/org/opentripplanner/model/transfer/TransferPointMapTest.java b/application/src/test/java/org/opentripplanner/model/transfer/TransferPointMapTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/transfer/TransferPointMapTest.java rename to application/src/test/java/org/opentripplanner/model/transfer/TransferPointMapTest.java diff --git a/src/test/java/org/opentripplanner/model/transfer/TransferPointTest.java b/application/src/test/java/org/opentripplanner/model/transfer/TransferPointTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/transfer/TransferPointTest.java rename to application/src/test/java/org/opentripplanner/model/transfer/TransferPointTest.java diff --git a/src/test/java/org/opentripplanner/model/transfer/TransferPriorityTest.java b/application/src/test/java/org/opentripplanner/model/transfer/TransferPriorityTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/transfer/TransferPriorityTest.java rename to application/src/test/java/org/opentripplanner/model/transfer/TransferPriorityTest.java diff --git a/src/test/java/org/opentripplanner/model/transfer/TransferServiceTest.java b/application/src/test/java/org/opentripplanner/model/transfer/TransferServiceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/model/transfer/TransferServiceTest.java rename to application/src/test/java/org/opentripplanner/model/transfer/TransferServiceTest.java diff --git a/src/test/java/org/opentripplanner/model/transfer/TransferTestData.java b/application/src/test/java/org/opentripplanner/model/transfer/TransferTestData.java similarity index 100% rename from src/test/java/org/opentripplanner/model/transfer/TransferTestData.java rename to application/src/test/java/org/opentripplanner/model/transfer/TransferTestData.java diff --git a/src/test/java/org/opentripplanner/netex/NetexEpipBundleSmokeTest.java b/application/src/test/java/org/opentripplanner/netex/NetexEpipBundleSmokeTest.java similarity index 96% rename from src/test/java/org/opentripplanner/netex/NetexEpipBundleSmokeTest.java rename to application/src/test/java/org/opentripplanner/netex/NetexEpipBundleSmokeTest.java index b89e6883951..72e750c055f 100644 --- a/src/test/java/org/opentripplanner/netex/NetexEpipBundleSmokeTest.java +++ b/application/src/test/java/org/opentripplanner/netex/NetexEpipBundleSmokeTest.java @@ -84,7 +84,7 @@ private static FeedScopedId fId(String id) { private void assertAgencies(Collection agencies) { assertEquals(3, agencies.size()); - Agency a = list(agencies).get(0); + Agency a = list(agencies).getFirst(); assertEquals("DE::Authority:41::", a.getId().getId()); assertEquals("HOCHBAHN, Bus", a.getName()); assertNull(a.getUrl()); @@ -146,7 +146,7 @@ private void assertTripPatterns(Collection patterns) { p.getStops().toString() ); List trips = p.scheduledTripsAsStream().toList(); - assertEquals("Trip{HH:DE::ServiceJourney:36439031_0:: X86}", trips.get(0).toString()); + assertEquals("Trip{HH:DE::ServiceJourney:36439062_0:: X86}", trips.getFirst().toString()); assertEquals(55, trips.size()); assertEquals(4, patterns.size()); } @@ -176,12 +176,12 @@ private void assertServiceIds(Collection trips, Collection s private void assetServiceCalendar(CalendarServiceData cal) { ArrayList sIds = new ArrayList<>(cal.getServiceIds()); assertEquals(2, sIds.size()); - FeedScopedId serviceId1 = sIds.get(0); + FeedScopedId serviceId1 = sIds.getFirst(); List dates = cal.getServiceDatesForServiceId(serviceId1); - assertEquals("2023-02-02", dates.get(0).toString()); - assertEquals("2023-12-08", dates.get(dates.size() - 1).toString()); + assertEquals("2023-02-02", dates.getFirst().toString()); + assertEquals("2023-12-08", dates.getLast().toString()); assertEquals(214, dates.size()); } } diff --git a/src/test/java/org/opentripplanner/netex/NetexNordicBundleSmokeTest.java b/application/src/test/java/org/opentripplanner/netex/NetexNordicBundleSmokeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/NetexNordicBundleSmokeTest.java rename to application/src/test/java/org/opentripplanner/netex/NetexNordicBundleSmokeTest.java diff --git a/src/test/java/org/opentripplanner/netex/NetexTestDataSupport.java b/application/src/test/java/org/opentripplanner/netex/NetexTestDataSupport.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/NetexTestDataSupport.java rename to application/src/test/java/org/opentripplanner/netex/NetexTestDataSupport.java diff --git a/src/test/java/org/opentripplanner/netex/config/NetexFeedParametersTest.java b/application/src/test/java/org/opentripplanner/netex/config/NetexFeedParametersTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/config/NetexFeedParametersTest.java rename to application/src/test/java/org/opentripplanner/netex/config/NetexFeedParametersTest.java diff --git a/src/test/java/org/opentripplanner/netex/index/hierarchy/E.java b/application/src/test/java/org/opentripplanner/netex/index/hierarchy/E.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/index/hierarchy/E.java rename to application/src/test/java/org/opentripplanner/netex/index/hierarchy/E.java diff --git a/src/test/java/org/opentripplanner/netex/index/hierarchy/HierarchicalElementTest.java b/application/src/test/java/org/opentripplanner/netex/index/hierarchy/HierarchicalElementTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/index/hierarchy/HierarchicalElementTest.java rename to application/src/test/java/org/opentripplanner/netex/index/hierarchy/HierarchicalElementTest.java diff --git a/src/test/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMapByIdTest.java b/application/src/test/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMapByIdTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMapByIdTest.java rename to application/src/test/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMapByIdTest.java diff --git a/src/test/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMapTest.java b/application/src/test/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMapTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMapTest.java rename to application/src/test/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMapTest.java diff --git a/src/test/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMultimapTest.java b/application/src/test/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMultimapTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMultimapTest.java rename to application/src/test/java/org/opentripplanner/netex/index/hierarchy/HierarchicalMultimapTest.java diff --git a/src/test/java/org/opentripplanner/netex/index/hierarchy/HierarchicalVersionMapByIdTest.java b/application/src/test/java/org/opentripplanner/netex/index/hierarchy/HierarchicalVersionMapByIdTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/index/hierarchy/HierarchicalVersionMapByIdTest.java rename to application/src/test/java/org/opentripplanner/netex/index/hierarchy/HierarchicalVersionMapByIdTest.java diff --git a/src/test/java/org/opentripplanner/netex/index/hierarchy/SetSupport.java b/application/src/test/java/org/opentripplanner/netex/index/hierarchy/SetSupport.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/index/hierarchy/SetSupport.java rename to application/src/test/java/org/opentripplanner/netex/index/hierarchy/SetSupport.java diff --git a/src/test/java/org/opentripplanner/netex/index/hierarchy/ValidOnDateTest.java b/application/src/test/java/org/opentripplanner/netex/index/hierarchy/ValidOnDateTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/index/hierarchy/ValidOnDateTest.java rename to application/src/test/java/org/opentripplanner/netex/index/hierarchy/ValidOnDateTest.java diff --git a/src/test/java/org/opentripplanner/netex/loader/NetexEntityIndexTest.java b/application/src/test/java/org/opentripplanner/netex/loader/NetexEntityIndexTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/loader/NetexEntityIndexTest.java rename to application/src/test/java/org/opentripplanner/netex/loader/NetexEntityIndexTest.java diff --git a/src/test/java/org/opentripplanner/netex/loader/parser/ResourceFrameParserTest.java b/application/src/test/java/org/opentripplanner/netex/loader/parser/ResourceFrameParserTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/loader/parser/ResourceFrameParserTest.java rename to application/src/test/java/org/opentripplanner/netex/loader/parser/ResourceFrameParserTest.java diff --git a/src/test/java/org/opentripplanner/netex/loader/parser/ServiceCalendarFrameParserTest.java b/application/src/test/java/org/opentripplanner/netex/loader/parser/ServiceCalendarFrameParserTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/loader/parser/ServiceCalendarFrameParserTest.java rename to application/src/test/java/org/opentripplanner/netex/loader/parser/ServiceCalendarFrameParserTest.java diff --git a/src/test/java/org/opentripplanner/netex/loader/parser/SiteFrameParserTest.java b/application/src/test/java/org/opentripplanner/netex/loader/parser/SiteFrameParserTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/loader/parser/SiteFrameParserTest.java rename to application/src/test/java/org/opentripplanner/netex/loader/parser/SiteFrameParserTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/AuthorityToAgencyMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/AuthorityToAgencyMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/AuthorityToAgencyMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/AuthorityToAgencyMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/BookingInfoMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/BookingInfoMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/BookingInfoMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/BookingInfoMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/BrandingMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/BrandingMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/BrandingMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/BrandingMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/DurationMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/DurationMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/DurationMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/DurationMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/FeedScopedIdFactoryTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/FeedScopedIdFactoryTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/FeedScopedIdFactoryTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/FeedScopedIdFactoryTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/FlexStopsMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/FlexStopsMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/FlexStopsMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/FlexStopsMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/GroupOfRoutesMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/GroupOfRoutesMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/GroupOfRoutesMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/GroupOfRoutesMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/MappingSupport.java b/application/src/test/java/org/opentripplanner/netex/mapping/MappingSupport.java similarity index 94% rename from src/test/java/org/opentripplanner/netex/mapping/MappingSupport.java rename to application/src/test/java/org/opentripplanner/netex/mapping/MappingSupport.java index 49f6d88c26b..cbabe19ad2d 100644 --- a/src/test/java/org/opentripplanner/netex/mapping/MappingSupport.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/MappingSupport.java @@ -1,7 +1,6 @@ package org.opentripplanner.netex.mapping; import jakarta.xml.bind.JAXBElement; -import javax.annotation.Nonnull; import javax.xml.namespace.QName; import org.opentripplanner.netex.mapping.support.FeedScopedIdFactory; import org.rutebanken.netex.model.VersionOfObjectRefStructure; @@ -54,7 +53,7 @@ public static T createRef(String id, Cla * @return the value wrapped in a JAXBElement */ @SuppressWarnings("unchecked") - public static JAXBElement createJaxbElement(@Nonnull T value) { + public static JAXBElement createJaxbElement(T value) { return new JAXBElement<>(new QName("x"), (Class) value.getClass(), value); } } diff --git a/src/test/java/org/opentripplanner/netex/mapping/MultiModalStationMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/MultiModalStationMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/MultiModalStationMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/MultiModalStationMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/NetexTestDataSample.java b/application/src/test/java/org/opentripplanner/netex/mapping/NetexTestDataSample.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/NetexTestDataSample.java rename to application/src/test/java/org/opentripplanner/netex/mapping/NetexTestDataSample.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/NoticeAssignmentMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/NoticeAssignmentMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/NoticeAssignmentMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/NoticeAssignmentMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/NoticeMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/NoticeMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/NoticeMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/NoticeMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/OperatorToAgencyMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/OperatorToAgencyMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/OperatorToAgencyMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/OperatorToAgencyMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/RouteMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/RouteMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/RouteMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/RouteMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/ServiceLinkMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/ServiceLinkMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/ServiceLinkMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/ServiceLinkMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/StationMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/StationMapperTest.java similarity index 97% rename from src/test/java/org/opentripplanner/netex/mapping/StationMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/StationMapperTest.java index b100a38782a..8b09fe41b2a 100644 --- a/src/test/java/org/opentripplanner/netex/mapping/StationMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/StationMapperTest.java @@ -5,6 +5,7 @@ import static org.opentripplanner.netex.NetexTestDataSupport.createStopPlace; import java.time.ZoneId; +import java.util.Set; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; @@ -27,6 +28,7 @@ void setUp() { new FeedScopedIdFactory("FEED_ID"), ZoneId.of("UTC"), false, + Set.of(), StopModel.of() ); } diff --git a/src/test/java/org/opentripplanner/netex/mapping/StopAndStationMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/StopAndStationMapperTest.java similarity index 91% rename from src/test/java/org/opentripplanner/netex/mapping/StopAndStationMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/StopAndStationMapperTest.java index 30ca5cebfa8..f61bef86a19 100644 --- a/src/test/java/org/opentripplanner/netex/mapping/StopAndStationMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/StopAndStationMapperTest.java @@ -1,16 +1,19 @@ package org.opentripplanner.netex.mapping; +import static com.google.common.truth.Truth.assertThat; import static graphql.Assert.assertFalse; import static graphql.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.opentripplanner.netex.NetexTestDataSupport.createQuay; import static org.opentripplanner.netex.NetexTestDataSupport.createStopPlace; +import static org.rutebanken.netex.model.AllVehicleModesOfTransportEnumeration.TRAM; import java.time.ZoneId; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Set; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; @@ -159,7 +162,8 @@ void mapStopPlaceAndQuays() { StopModel.of(), DEFAULT_TIME_ZONE, DataImportIssueStore.NOOP, - false + false, + Set.of() ); stopMapper.mapParentAndChildStops(stopPlaces); @@ -229,7 +233,8 @@ void testMapIsolatedStopPlace(boolean isolated) { StopModel.of(), DEFAULT_TIME_ZONE, DataImportIssueStore.NOOP, - isolated + isolated, + Set.of() ); stopMapper.mapParentAndChildStops(stopPlaces); @@ -279,6 +284,33 @@ void testDuplicateStopIndices() { ); } + @Test + void testRouteToCentroid() { + var routeToCentroidStopPlaceIds = Set.of(MappingSupport.ID_FACTORY.createId("NSR:StopPlace:1")); + StopAndStationMapper stopMapper = new StopAndStationMapper( + MappingSupport.ID_FACTORY, + new HierarchicalVersionMapById<>(), + null, + StopModel.of(), + DEFAULT_TIME_ZONE, + DataImportIssueStore.NOOP, + false, + routeToCentroidStopPlaceIds + ); + + stopMapper.mapParentAndChildStops( + List.of(createStopPlace("NSR:StopPlace:1", "A", "1", 59.1, 10.0, TRAM)) + ); + stopMapper.mapParentAndChildStops( + List.of(createStopPlace("NSR:StopPlace:2", "B", "1", 59.2, 10.0, TRAM)) + ); + + var stations = stopMapper.resultStations; + assertThat(stations).hasSize(2); + assertTrue(stations.get(0).shouldRouteToCentroid()); + assertFalse(stations.get(1).shouldRouteToCentroid()); + } + private static StopAndStationMapper createStopAndStationMapper( StopModelBuilder stopModelBuilder ) { @@ -289,7 +321,8 @@ private static StopAndStationMapper createStopAndStationMapper( stopModelBuilder, DEFAULT_TIME_ZONE, DataImportIssueStore.NOOP, - false + false, + Set.of() ); } diff --git a/src/test/java/org/opentripplanner/netex/mapping/StopPlaceTypeMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/StopPlaceTypeMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/StopPlaceTypeMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/StopPlaceTypeMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/StopTimesMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/StopTimesMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/StopTimesMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/StopTimesMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/StopTransferPriorityMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/StopTransferPriorityMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/StopTransferPriorityMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/StopTransferPriorityMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/TransportModeMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/TransportModeMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/TransportModeMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/TransportModeMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/TripCalendarBuilderTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/TripCalendarBuilderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/TripCalendarBuilderTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/TripCalendarBuilderTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/TripMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/TripMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/TripMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/TripMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/TripPatternMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/TripPatternMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/TripPatternMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/TripPatternMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/VehicleParkingMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/VehicleParkingMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/VehicleParkingMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/VehicleParkingMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/WgsCoordinateMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/WgsCoordinateMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/WgsCoordinateMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/WgsCoordinateMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/calendar/CalendarServiceBuilderTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/calendar/CalendarServiceBuilderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/calendar/CalendarServiceBuilderTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/calendar/CalendarServiceBuilderTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/calendar/DatedServiceJourneyMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/calendar/DatedServiceJourneyMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/calendar/DatedServiceJourneyMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/calendar/DatedServiceJourneyMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/calendar/DayOfWeekMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/calendar/DayOfWeekMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/calendar/DayOfWeekMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/calendar/DayOfWeekMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/calendar/DayTypeAssignmentMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/calendar/DayTypeAssignmentMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/calendar/DayTypeAssignmentMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/calendar/DayTypeAssignmentMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/calendar/OperatingDayMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/calendar/OperatingDayMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/calendar/OperatingDayMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/calendar/OperatingDayMapperTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/support/NetexMapperIndexesTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/support/NetexMapperIndexesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/support/NetexMapperIndexesTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/support/NetexMapperIndexesTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/support/NetexObjectDecoratorTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/support/NetexObjectDecoratorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/support/NetexObjectDecoratorTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/support/NetexObjectDecoratorTest.java diff --git a/src/test/java/org/opentripplanner/netex/mapping/support/ValidityComparatorTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/support/ValidityComparatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/mapping/support/ValidityComparatorTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/support/ValidityComparatorTest.java diff --git a/src/test/java/org/opentripplanner/netex/support/NetexVersionHelperTest.java b/application/src/test/java/org/opentripplanner/netex/support/NetexVersionHelperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/support/NetexVersionHelperTest.java rename to application/src/test/java/org/opentripplanner/netex/support/NetexVersionHelperTest.java diff --git a/src/test/java/org/opentripplanner/netex/validation/JourneyPatternSJMismatchTest.java b/application/src/test/java/org/opentripplanner/netex/validation/JourneyPatternSJMismatchTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/validation/JourneyPatternSJMismatchTest.java rename to application/src/test/java/org/opentripplanner/netex/validation/JourneyPatternSJMismatchTest.java diff --git a/src/test/java/org/opentripplanner/netex/validation/ServiceJourneyNonIncreasingPassingTimeTest.java b/application/src/test/java/org/opentripplanner/netex/validation/ServiceJourneyNonIncreasingPassingTimeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/validation/ServiceJourneyNonIncreasingPassingTimeTest.java rename to application/src/test/java/org/opentripplanner/netex/validation/ServiceJourneyNonIncreasingPassingTimeTest.java diff --git a/src/test/java/org/opentripplanner/openstreetmap/OSMOpeningHoursParserTest.java b/application/src/test/java/org/opentripplanner/osm/OsmOpeningHoursParserTest.java similarity index 97% rename from src/test/java/org/opentripplanner/openstreetmap/OSMOpeningHoursParserTest.java rename to application/src/test/java/org/opentripplanner/osm/OsmOpeningHoursParserTest.java index 34f141e8504..bcd5f0bb4c6 100644 --- a/src/test/java/org/opentripplanner/openstreetmap/OSMOpeningHoursParserTest.java +++ b/application/src/test/java/org/opentripplanner/osm/OsmOpeningHoursParserTest.java @@ -1,4 +1,4 @@ -package org.opentripplanner.openstreetmap; +package org.opentripplanner.osm; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -17,7 +17,7 @@ import org.opentripplanner.model.calendar.openinghours.OpeningHoursCalendarService; import org.opentripplanner.transit.model.framework.Deduplicator; -public class OSMOpeningHoursParserTest { +public class OsmOpeningHoursParserTest { static OpeningHoursCalendarService openingHoursCalendarService = new OpeningHoursCalendarService( new Deduplicator(), @@ -25,7 +25,7 @@ public class OSMOpeningHoursParserTest { LocalDate.of(2023, Month.DECEMBER, 31) ); - static OSMOpeningHoursParser osmOpeningHoursParser = new OSMOpeningHoursParser( + static OsmOpeningHoursParser osmOpeningHoursParser = new OsmOpeningHoursParser( openingHoursCalendarService, ZoneIds.PARIS ); @@ -176,7 +176,7 @@ static Stream osmOpeningHoursTestCases() { @ParameterizedTest(name = "{0} should be open on {1} but not on {2}") @MethodSource("osmOpeningHoursTestCases") - void testOSMOpeningHoursParsing( + void testOsmOpeningHoursParsing( String openingHours, List openTimes, List closedTimes diff --git a/src/test/java/org/opentripplanner/openstreetmap/model/OSMNodeTest.java b/application/src/test/java/org/opentripplanner/osm/model/OsmNodeTest.java similarity index 78% rename from src/test/java/org/opentripplanner/openstreetmap/model/OSMNodeTest.java rename to application/src/test/java/org/opentripplanner/osm/model/OsmNodeTest.java index a4579dec71e..82820f4e422 100644 --- a/src/test/java/org/opentripplanner/openstreetmap/model/OSMNodeTest.java +++ b/application/src/test/java/org/opentripplanner/osm/model/OsmNodeTest.java @@ -1,15 +1,15 @@ -package org.opentripplanner.openstreetmap.model; +package org.opentripplanner.osm.model; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -public class OSMNodeTest { +public class OsmNodeTest { @Test public void testIsMultiLevel() { - OSMNode node = new OSMNode(); + OsmNode node = new OsmNode(); assertFalse(node.isMultiLevel()); node.addTag("highway", "var"); diff --git a/src/test/java/org/opentripplanner/openstreetmap/model/OSMWayTest.java b/application/src/test/java/org/opentripplanner/osm/model/OsmWayTest.java similarity index 87% rename from src/test/java/org/opentripplanner/openstreetmap/model/OSMWayTest.java rename to application/src/test/java/org/opentripplanner/osm/model/OsmWayTest.java index c0af4cf2701..424f7247415 100644 --- a/src/test/java/org/opentripplanner/openstreetmap/model/OSMWayTest.java +++ b/application/src/test/java/org/opentripplanner/osm/model/OsmWayTest.java @@ -1,16 +1,16 @@ -package org.opentripplanner.openstreetmap.model; +package org.opentripplanner.osm.model; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData; +import org.opentripplanner.osm.wayproperty.specifier.WayTestData; -public class OSMWayTest { +public class OsmWayTest { @Test void testIsBicycleDismountForced() { - OSMWay way = new OSMWay(); + OsmWay way = new OsmWay(); assertFalse(way.isBicycleDismountForced()); way.addTag("bicycle", "dismount"); @@ -19,7 +19,7 @@ void testIsBicycleDismountForced() { @Test void testIsSteps() { - OSMWay way = new OSMWay(); + OsmWay way = new OsmWay(); assertFalse(way.isSteps()); way.addTag("highway", "primary"); @@ -31,12 +31,12 @@ void testIsSteps() { @Test void wheelchairAccessibleStairs() { - var osm1 = new OSMWay(); + var osm1 = new OsmWay(); osm1.addTag("highway", "steps"); assertFalse(osm1.isWheelchairAccessible()); // explicitly suitable for wheelchair users, perhaps because of a ramp - var osm2 = new OSMWay(); + var osm2 = new OsmWay(); osm2.addTag("highway", "steps"); osm2.addTag("wheelchair", "yes"); assertTrue(osm2.isWheelchairAccessible()); @@ -44,7 +44,7 @@ void wheelchairAccessibleStairs() { @Test void testIsRoundabout() { - OSMWay way = new OSMWay(); + OsmWay way = new OsmWay(); assertFalse(way.isRoundabout()); way.addTag("junction", "dovetail"); @@ -56,7 +56,7 @@ void testIsRoundabout() { @Test void testIsOneWayDriving() { - OSMWay way = new OSMWay(); + OsmWay way = new OsmWay(); assertFalse(way.isOneWayForwardDriving()); assertFalse(way.isOneWayReverseDriving()); @@ -75,7 +75,7 @@ void testIsOneWayDriving() { @Test void testIsOneWayBicycle() { - OSMWay way = new OSMWay(); + OsmWay way = new OsmWay(); assertFalse(way.isOneWayForwardBicycle()); assertFalse(way.isOneWayReverseBicycle()); @@ -94,7 +94,7 @@ void testIsOneWayBicycle() { @Test void testIsOpposableCycleway() { - OSMWay way = new OSMWay(); + OsmWay way = new OsmWay(); assertFalse(way.isOpposableCycleway()); way.addTag("cycleway", "notatagvalue"); @@ -115,7 +115,7 @@ void testIsOpposableCycleway() { void escalator() { assertFalse(WayTestData.cycleway().isEscalator()); - var escalator = new OSMWay(); + var escalator = new OsmWay(); escalator.addTag("highway", "steps"); assertFalse(escalator.isEscalator()); diff --git a/src/test/java/org/opentripplanner/openstreetmap/model/OSMWithTagsTest.java b/application/src/test/java/org/opentripplanner/osm/model/OsmWithTagsTest.java similarity index 78% rename from src/test/java/org/opentripplanner/openstreetmap/model/OSMWithTagsTest.java rename to application/src/test/java/org/opentripplanner/osm/model/OsmWithTagsTest.java index 3b50d0bff0d..f2e26d74313 100644 --- a/src/test/java/org/opentripplanner/openstreetmap/model/OSMWithTagsTest.java +++ b/application/src/test/java/org/opentripplanner/osm/model/OsmWithTagsTest.java @@ -1,4 +1,4 @@ -package org.opentripplanner.openstreetmap.model; +package org.opentripplanner.osm.model; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -10,13 +10,13 @@ import java.util.Map; import java.util.Set; import org.junit.jupiter.api.Test; -import org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData; +import org.opentripplanner.osm.wayproperty.specifier.WayTestData; -public class OSMWithTagsTest { +public class OsmWithTagsTest { @Test void testHasTag() { - OSMWithTags o = new OSMWithTags(); + OsmWithTags o = new OsmWithTags(); assertFalse(o.hasTag("foo")); assertFalse(o.hasTag("FOO")); o.addTag("foo", "bar"); @@ -27,7 +27,7 @@ void testHasTag() { @Test void testGetTag() { - OSMWithTags o = new OSMWithTags(); + OsmWithTags o = new OsmWithTags(); assertNull(o.getTag("foo")); assertNull(o.getTag("FOO")); @@ -38,35 +38,35 @@ void testGetTag() { @Test void testIsFalse() { - assertTrue(OSMWithTags.isFalse("no")); - assertTrue(OSMWithTags.isFalse("0")); - assertTrue(OSMWithTags.isFalse("false")); - - assertFalse(OSMWithTags.isFalse("yes")); - assertFalse(OSMWithTags.isFalse("1")); - assertFalse(OSMWithTags.isFalse("true")); - assertFalse(OSMWithTags.isFalse("foo")); - assertFalse(OSMWithTags.isFalse("bar")); - assertFalse(OSMWithTags.isFalse("baz")); + assertTrue(OsmWithTags.isFalse("no")); + assertTrue(OsmWithTags.isFalse("0")); + assertTrue(OsmWithTags.isFalse("false")); + + assertFalse(OsmWithTags.isFalse("yes")); + assertFalse(OsmWithTags.isFalse("1")); + assertFalse(OsmWithTags.isFalse("true")); + assertFalse(OsmWithTags.isFalse("foo")); + assertFalse(OsmWithTags.isFalse("bar")); + assertFalse(OsmWithTags.isFalse("baz")); } @Test void testIsTrue() { - assertTrue(OSMWithTags.isTrue("yes")); - assertTrue(OSMWithTags.isTrue("1")); - assertTrue(OSMWithTags.isTrue("true")); - - assertFalse(OSMWithTags.isTrue("no")); - assertFalse(OSMWithTags.isTrue("0")); - assertFalse(OSMWithTags.isTrue("false")); - assertFalse(OSMWithTags.isTrue("foo")); - assertFalse(OSMWithTags.isTrue("bar")); - assertFalse(OSMWithTags.isTrue("baz")); + assertTrue(OsmWithTags.isTrue("yes")); + assertTrue(OsmWithTags.isTrue("1")); + assertTrue(OsmWithTags.isTrue("true")); + + assertFalse(OsmWithTags.isTrue("no")); + assertFalse(OsmWithTags.isTrue("0")); + assertFalse(OsmWithTags.isTrue("false")); + assertFalse(OsmWithTags.isTrue("foo")); + assertFalse(OsmWithTags.isTrue("bar")); + assertFalse(OsmWithTags.isTrue("baz")); } @Test void testIsTagFalseOrTrue() { - OSMWithTags o = new OSMWithTags(); + OsmWithTags o = new OsmWithTags(); assertFalse(o.isTagFalse("foo")); assertFalse(o.isTagFalse("FOO")); assertFalse(o.isTagTrue("foo")); @@ -88,7 +88,7 @@ void testIsTagFalseOrTrue() { @Test void isTag() { var name = "Brendan"; - var osm = new OSMWithTags(); + var osm = new OsmWithTags(); osm.addTag("NAME", name); assertTrue(osm.isTag("name", name)); @@ -98,7 +98,7 @@ void isTag() { @Test void testDoesAllowTagAccess() { - OSMWithTags o = new OSMWithTags(); + OsmWithTags o = new OsmWithTags(); assertFalse(o.doesTagAllowAccess("foo")); o.addTag("foo", "bar"); @@ -113,7 +113,7 @@ void testDoesAllowTagAccess() { @Test void testIsGeneralAccessDenied() { - OSMWithTags o = new OSMWithTags(); + OsmWithTags o = new OsmWithTags(); assertFalse(o.isGeneralAccessDenied()); o.addTag("access", "something"); @@ -128,7 +128,7 @@ void testIsGeneralAccessDenied() { @Test void testBicycleDenied() { - OSMWithTags tags = new OSMWithTags(); + OsmWithTags tags = new OsmWithTags(); assertFalse(tags.isBicycleExplicitlyDenied()); for (var allowedValue : List.of("yes", "unknown", "somevalue")) { @@ -144,7 +144,7 @@ void testBicycleDenied() { @Test void getReferenceTags() { - var osm = new OSMWithTags(); + var osm = new OsmWithTags(); osm.addTag("ref", "A"); assertEquals(Set.of("A"), osm.getMultiTagValues(Set.of("ref", "test"))); @@ -153,7 +153,7 @@ void getReferenceTags() { @Test void getEmptyRefList() { - var osm = new OSMWithTags(); + var osm = new OsmWithTags(); osm.addTag("ref", "A"); assertEquals(Set.of(), osm.getMultiTagValues(Set.of())); @@ -161,7 +161,7 @@ void getEmptyRefList() { @Test void ignoreRefCase() { - var osm = new OSMWithTags(); + var osm = new OsmWithTags(); osm.addTag("ref:IFOPT", "A"); assertEquals(Set.of("A"), osm.getMultiTagValues(Set.of("ref:ifopt"))); @@ -169,7 +169,7 @@ void ignoreRefCase() { @Test void readSemicolonSeparated() { - var osm = new OSMWithTags(); + var osm = new OsmWithTags(); osm.addTag("ref:A", "A;A;B"); assertEquals(Set.of("A", "B"), osm.getMultiTagValues(Set.of("ref:A"))); @@ -177,7 +177,7 @@ void readSemicolonSeparated() { @Test void removeBlankRef() { - var osm = new OSMWithTags(); + var osm = new OsmWithTags(); osm.addTag("ref1", " "); osm.addTag("ref2", ""); @@ -187,7 +187,7 @@ void removeBlankRef() { @Test void shouldNotReturnNull() { - var osm = new OSMWithTags(); + var osm = new OsmWithTags(); osm.addTag("ref1", " "); osm.addTag("ref2", ""); @@ -197,14 +197,14 @@ void shouldNotReturnNull() { @Test void isWheelchairAccessible() { - var osm1 = new OSMWithTags(); + var osm1 = new OsmWithTags(); assertTrue(osm1.isWheelchairAccessible()); - var osm2 = new OSMWithTags(); + var osm2 = new OsmWithTags(); osm2.addTag("wheelchair", "no"); assertFalse(osm2.isWheelchairAccessible()); - var osm3 = new OSMWithTags(); + var osm3 = new OsmWithTags(); osm3.addTag("wheelchair", "yes"); assertTrue(osm3.isWheelchairAccessible()); } @@ -221,13 +221,12 @@ void isPlatform() { @Test void testGenerateI18NForPattern() { - OSMWithTags osmTags = new OSMWithTags(); + OsmWithTags osmTags = new OsmWithTags(); osmTags.addTag("note", "Note EN"); osmTags.addTag("description:fr", "Description FR"); osmTags.addTag("wheelchair:description", "Wheelchair description EN"); osmTags.addTag("wheelchair:description:fr", "Wheelchair description FR"); - assertNull(osmTags.generateI18NForPattern(null)); Map expected = new HashMap<>(); expected.put(null, ""); diff --git a/src/test/java/org/opentripplanner/openstreetmap/tagmapping/AtlantaMapperTest.java b/application/src/test/java/org/opentripplanner/osm/tagmapping/AtlantaMapperTest.java similarity index 89% rename from src/test/java/org/opentripplanner/openstreetmap/tagmapping/AtlantaMapperTest.java rename to application/src/test/java/org/opentripplanner/osm/tagmapping/AtlantaMapperTest.java index 3480135cff7..45ef6a66b55 100644 --- a/src/test/java/org/opentripplanner/openstreetmap/tagmapping/AtlantaMapperTest.java +++ b/application/src/test/java/org/opentripplanner/osm/tagmapping/AtlantaMapperTest.java @@ -1,10 +1,10 @@ -package org.opentripplanner.openstreetmap.tagmapping; +package org.opentripplanner.osm.tagmapping; import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; -import org.opentripplanner.openstreetmap.model.OSMWithTags; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertySet; +import org.opentripplanner.osm.model.OsmWithTags; +import org.opentripplanner.osm.wayproperty.WayPropertySet; import org.opentripplanner.street.model.StreetTraversalPermission; class AtlantaMapperTest { @@ -27,7 +27,7 @@ class AtlantaMapperTest { public void peachtreeRoad() { // Peachtree Rd in Atlanta has sidewalks, and bikes are allowed. // https://www.openstreetmap.org/way/144429544 - OSMWithTags peachtreeRd = new OSMWithTags(); + OsmWithTags peachtreeRd = new OsmWithTags(); peachtreeRd.addTag("highway", "trunk"); peachtreeRd.addTag("lanes", "6"); peachtreeRd.addTag("name", "Peachtree Road"); @@ -42,7 +42,7 @@ public void peachtreeRoad() { public void deKalbAvenue() { // "Outer" ramps from DeKalb Ave onto Moreland Ave in Atlanta have sidewalks, and bikes are allowed. // https://www.openstreetmap.org/way/9164434 - OSMWithTags morelandRamp = new OSMWithTags(); + OsmWithTags morelandRamp = new OsmWithTags(); morelandRamp.addTag("highway", "trunk_link"); morelandRamp.addTag("lanes", "1"); morelandRamp.addTag("oneway", "yes"); @@ -57,7 +57,7 @@ public void deKalbAvenue() { public void tenthStreetNE() { // For sanity check, secondary roads (e.g. 10th Street) should remain allowed for all modes. // https://www.openstreetmap.org/way/505912700 - OSMWithTags tenthSt = new OSMWithTags(); + OsmWithTags tenthSt = new OsmWithTags(); tenthSt.addTag("highway", "secondary"); tenthSt.addTag("lanes", "4"); tenthSt.addTag("maxspeed", "30 mph"); diff --git a/src/test/java/org/opentripplanner/openstreetmap/tagmapping/DefaultMapperTest.java b/application/src/test/java/org/opentripplanner/osm/tagmapping/DefaultMapperTest.java similarity index 89% rename from src/test/java/org/opentripplanner/openstreetmap/tagmapping/DefaultMapperTest.java rename to application/src/test/java/org/opentripplanner/osm/tagmapping/DefaultMapperTest.java index 2a8988dda61..87e23acbf12 100644 --- a/src/test/java/org/opentripplanner/openstreetmap/tagmapping/DefaultMapperTest.java +++ b/application/src/test/java/org/opentripplanner/osm/tagmapping/DefaultMapperTest.java @@ -1,6 +1,7 @@ -package org.opentripplanner.openstreetmap.tagmapping; +package org.opentripplanner.osm.tagmapping; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.opentripplanner.street.model.StreetTraversalPermission.ALL; import static org.opentripplanner.street.model.StreetTraversalPermission.PEDESTRIAN; @@ -8,11 +9,11 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.opentripplanner.openstreetmap.model.OSMWithTags; -import org.opentripplanner.openstreetmap.wayproperty.SpeedPicker; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertySet; -import org.opentripplanner.openstreetmap.wayproperty.specifier.BestMatchSpecifier; -import org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData; +import org.opentripplanner.osm.model.OsmWithTags; +import org.opentripplanner.osm.wayproperty.SpeedPicker; +import org.opentripplanner.osm.wayproperty.WayPropertySet; +import org.opentripplanner.osm.wayproperty.specifier.BestMatchSpecifier; +import org.opentripplanner.osm.wayproperty.specifier.WayTestData; public class DefaultMapperTest { @@ -34,34 +35,34 @@ public void setup() { */ @Test public void testCarSpeeds() { - OSMWithTags way; + OsmWithTags way; - way = new OSMWithTags(); + way = new OsmWithTags(); way.addTag("maxspeed", "60"); assertTrue(within(kmhAsMs(60), wps.getCarSpeedForWay(way, false), epsilon)); assertTrue(within(kmhAsMs(60), wps.getCarSpeedForWay(way, true), epsilon)); - way = new OSMWithTags(); + way = new OsmWithTags(); way.addTag("maxspeed:forward", "80"); way.addTag("maxspeed:backward", "20"); way.addTag("maxspeed", "40"); assertTrue(within(kmhAsMs(80), wps.getCarSpeedForWay(way, false), epsilon)); assertTrue(within(kmhAsMs(20), wps.getCarSpeedForWay(way, true), epsilon)); - way = new OSMWithTags(); + way = new OsmWithTags(); way.addTag("maxspeed", "40"); way.addTag("maxspeed:lanes", "60|80|40"); assertTrue(within(kmhAsMs(80), wps.getCarSpeedForWay(way, false), epsilon)); assertTrue(within(kmhAsMs(80), wps.getCarSpeedForWay(way, true), epsilon)); - way = new OSMWithTags(); + way = new OsmWithTags(); way.addTag("maxspeed", "20"); way.addTag("maxspeed:motorcar", "80"); assertTrue(within(kmhAsMs(80), wps.getCarSpeedForWay(way, false), epsilon)); assertTrue(within(kmhAsMs(80), wps.getCarSpeedForWay(way, true), epsilon)); // test with english units - way = new OSMWithTags(); + way = new OsmWithTags(); way.addTag("maxspeed", "35 mph"); assertTrue(within(kmhAsMs(35 * 1.609f), wps.getCarSpeedForWay(way, false), epsilon)); assertTrue(within(kmhAsMs(35 * 1.609f), wps.getCarSpeedForWay(way, true), epsilon)); @@ -73,7 +74,7 @@ public void testCarSpeeds() { wps.addSpeedPicker(getSpeedPicker("surface=gravel", kmhAsMs(10))); wps.defaultCarSpeed = kmhAsMs(25); - way = new OSMWithTags(); + way = new OsmWithTags(); // test default speeds assertTrue(within(kmhAsMs(25), wps.getCarSpeedForWay(way, false), epsilon)); @@ -83,18 +84,18 @@ public void testCarSpeeds() { assertTrue(within(kmhAsMs(35), wps.getCarSpeedForWay(way, false), epsilon)); assertTrue(within(kmhAsMs(35), wps.getCarSpeedForWay(way, true), epsilon)); - way = new OSMWithTags(); + way = new OsmWithTags(); way.addTag("surface", "gravel"); assertTrue(within(kmhAsMs(10), wps.getCarSpeedForWay(way, false), epsilon)); assertTrue(within(kmhAsMs(10), wps.getCarSpeedForWay(way, true), epsilon)); - way = new OSMWithTags(); + way = new OsmWithTags(); way.addTag("highway", "motorway"); assertTrue(within(kmhAsMs(100), wps.getCarSpeedForWay(way, false), epsilon)); assertTrue(within(kmhAsMs(100), wps.getCarSpeedForWay(way, true), epsilon)); // make sure that 0-speed ways can't exist - way = new OSMWithTags(); + way = new OsmWithTags(); way.addTag("maxspeed", "0"); assertTrue(within(kmhAsMs(25), wps.getCarSpeedForWay(way, false), epsilon)); assertTrue(within(kmhAsMs(25), wps.getCarSpeedForWay(way, true), epsilon)); @@ -189,6 +190,15 @@ void bicycleUseSidepath() { assertEquals(4.9, useSidepathBackwardProps.bicycleSafety().back(), epsilon); } + @Test + void slopeOverrides() { + var regular = WayTestData.southeastLaBonitaWay(); + assertFalse(wps.getSlopeOverride(regular)); + + var indoor = WayTestData.southeastLaBonitaWay().addTag("indoor", "yes"); + assertTrue(wps.getSlopeOverride(indoor)); + } + /** * Test that two values are within epsilon of each other. */ diff --git a/src/test/java/org/opentripplanner/openstreetmap/tagmapping/FinlandMapperTest.java b/application/src/test/java/org/opentripplanner/osm/tagmapping/FinlandMapperTest.java similarity index 81% rename from src/test/java/org/opentripplanner/openstreetmap/tagmapping/FinlandMapperTest.java rename to application/src/test/java/org/opentripplanner/osm/tagmapping/FinlandMapperTest.java index 4dd52195acb..e3f24f64c6c 100644 --- a/src/test/java/org/opentripplanner/openstreetmap/tagmapping/FinlandMapperTest.java +++ b/application/src/test/java/org/opentripplanner/osm/tagmapping/FinlandMapperTest.java @@ -1,13 +1,13 @@ -package org.opentripplanner.openstreetmap.tagmapping; +package org.opentripplanner.osm.tagmapping; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.opentripplanner.street.model.StreetTraversalPermission.NONE; import org.junit.jupiter.api.Test; -import org.opentripplanner.openstreetmap.model.OSMWay; -import org.opentripplanner.openstreetmap.model.OSMWithTags; -import org.opentripplanner.openstreetmap.wayproperty.WayProperties; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertySet; +import org.opentripplanner.osm.model.OsmWay; +import org.opentripplanner.osm.model.OsmWithTags; +import org.opentripplanner.osm.wayproperty.WayProperties; +import org.opentripplanner.osm.wayproperty.WayPropertySet; public class FinlandMapperTest { @@ -24,60 +24,60 @@ public class FinlandMapperTest { */ @Test public void testSafety() { - OSMWithTags primaryWay = new OSMWithTags(); + OsmWithTags primaryWay = new OsmWithTags(); primaryWay.addTag("highway", "primary"); primaryWay.addTag("oneway", "no"); - OSMWithTags livingStreetWay = new OSMWithTags(); + OsmWithTags livingStreetWay = new OsmWithTags(); livingStreetWay.addTag("highway", "living_street"); - OSMWithTags footway = new OSMWithTags(); + OsmWithTags footway = new OsmWithTags(); footway.addTag("highway", "footway"); - OSMWithTags sidewalk = new OSMWithTags(); + OsmWithTags sidewalk = new OsmWithTags(); sidewalk.addTag("footway", "sidewalk"); sidewalk.addTag("highway", "footway"); - OSMWithTags segregatedCycleway = new OSMWithTags(); + OsmWithTags segregatedCycleway = new OsmWithTags(); segregatedCycleway.addTag("segregated", "yes"); segregatedCycleway.addTag("highway", "cycleway"); - OSMWithTags tunnel = new OSMWithTags(); + OsmWithTags tunnel = new OsmWithTags(); tunnel.addTag("tunnel", "yes"); tunnel.addTag("highway", "footway"); - OSMWithTags bridge = new OSMWithTags(); + OsmWithTags bridge = new OsmWithTags(); bridge.addTag("bridge", "yes"); bridge.addTag("highway", "footway"); - OSMWithTags footwayCrossing = new OSMWithTags(); + OsmWithTags footwayCrossing = new OsmWithTags(); footwayCrossing.addTag("footway", "crossing"); footwayCrossing.addTag("highway", "footway"); - OSMWithTags footwayCrossingWithTrafficLights = new OSMWithTags(); + OsmWithTags footwayCrossingWithTrafficLights = new OsmWithTags(); footwayCrossingWithTrafficLights.addTag("footway", "crossing"); footwayCrossingWithTrafficLights.addTag("highway", "footway"); footwayCrossingWithTrafficLights.addTag("crossing", "traffic_signals"); - OSMWithTags cyclewayCrossing = new OSMWithTags(); + OsmWithTags cyclewayCrossing = new OsmWithTags(); cyclewayCrossing.addTag("cycleway", "crossing"); cyclewayCrossing.addTag("highway", "cycleway"); - OSMWithTags cyclewayFootwayCrossing = new OSMWithTags(); + OsmWithTags cyclewayFootwayCrossing = new OsmWithTags(); cyclewayFootwayCrossing.addTag("footway", "crossing"); cyclewayFootwayCrossing.addTag("highway", "cycleway"); - OSMWithTags cyclewayCrossingWithTrafficLights = new OSMWithTags(); + OsmWithTags cyclewayCrossingWithTrafficLights = new OsmWithTags(); cyclewayCrossingWithTrafficLights.addTag("cycleway", "crossing"); cyclewayCrossingWithTrafficLights.addTag("highway", "cycleway"); cyclewayCrossingWithTrafficLights.addTag("crossing", "traffic_signals"); - OSMWithTags cyclewayFootwayCrossingWithTrafficLights = new OSMWithTags(); + OsmWithTags cyclewayFootwayCrossingWithTrafficLights = new OsmWithTags(); cyclewayFootwayCrossingWithTrafficLights.addTag("footway", "crossing"); cyclewayFootwayCrossingWithTrafficLights.addTag("highway", "cycleway"); cyclewayFootwayCrossingWithTrafficLights.addTag("crossing", "traffic_signals"); - OSMWithTags cyclewaySegregatedCrossing = new OSMWithTags(); + OsmWithTags cyclewaySegregatedCrossing = new OsmWithTags(); cyclewaySegregatedCrossing.addTag("cycleway", "crossing"); cyclewaySegregatedCrossing.addTag("segregated", "yes"); cyclewaySegregatedCrossing.addTag("highway", "cycleway"); - OSMWithTags cyclewaySegregatedFootwayCrossing = new OSMWithTags(); + OsmWithTags cyclewaySegregatedFootwayCrossing = new OsmWithTags(); cyclewaySegregatedFootwayCrossing.addTag("footway", "crossing"); cyclewaySegregatedFootwayCrossing.addTag("segregated", "yes"); cyclewaySegregatedFootwayCrossing.addTag("highway", "cycleway"); - OSMWithTags cyclewaySegregatedCrossingWithTrafficLights = new OSMWithTags(); + OsmWithTags cyclewaySegregatedCrossingWithTrafficLights = new OsmWithTags(); cyclewaySegregatedCrossingWithTrafficLights.addTag("cycleway", "crossing"); cyclewaySegregatedCrossingWithTrafficLights.addTag("segregated", "yes"); cyclewaySegregatedCrossingWithTrafficLights.addTag("highway", "cycleway"); cyclewaySegregatedCrossingWithTrafficLights.addTag("crossing", "traffic_signals"); - OSMWithTags cyclewaySegregatedFootwayCrossingWithTrafficLights = new OSMWithTags(); + OsmWithTags cyclewaySegregatedFootwayCrossingWithTrafficLights = new OsmWithTags(); cyclewaySegregatedFootwayCrossingWithTrafficLights.addTag("footway", "crossing"); cyclewaySegregatedFootwayCrossingWithTrafficLights.addTag("segregated", "yes"); cyclewaySegregatedFootwayCrossingWithTrafficLights.addTag("highway", "cycleway"); @@ -135,7 +135,7 @@ public void testSafety() { @Test public void testSafetyWithMixins() { - OSMWithTags wayWithMixins = new OSMWithTags(); + OsmWithTags wayWithMixins = new OsmWithTags(); // highway=service has no custom bicycle or walk safety wayWithMixins.addTag("highway", "unclassified"); // surface has mixin bicycle safety of 1.3 but no walk safety @@ -145,7 +145,7 @@ public void testSafetyWithMixins() { // 1.6 is the default walk safety for a way with ALL permissions and speed limit > 35 and <= 60 kph assertEquals(1.6, wps.getDataForWay(wayWithMixins).walkSafety().forward(), epsilon); - OSMWithTags wayWithMixinsAndCustomSafety = new OSMWithTags(); + OsmWithTags wayWithMixinsAndCustomSafety = new OsmWithTags(); // highway=service has custom bicycle safety of 1.1 but no custom walk safety wayWithMixinsAndCustomSafety.addTag("highway", "service"); // surface has mixin bicycle safety of 1.3 but no walk safety @@ -163,32 +163,32 @@ public void testSafetyWithMixins() { epsilon ); - OSMWithTags wayWithBicycleSidePath = new OSMWithTags(); + OsmWithTags wayWithBicycleSidePath = new OsmWithTags(); wayWithBicycleSidePath.addTag("bicycle", "use_sidepath"); assertEquals(8, wps.getDataForWay(wayWithBicycleSidePath).walkSafety().forward(), epsilon); - OSMWithTags wayWithFootSidePath = new OSMWithTags(); + OsmWithTags wayWithFootSidePath = new OsmWithTags(); wayWithFootSidePath.addTag("foot", "use_sidepath"); assertEquals(8, wps.getDataForWay(wayWithFootSidePath).walkSafety().forward(), epsilon); } @Test public void testTagMapping() { - OSMWithTags way; + OsmWithTags way; WayProperties wayData; - way = new OSMWay(); + way = new OsmWay(); way.addTag("highway", "unclassified"); way.addTag("seasonal", "winter"); wayData = wps.getDataForWay(way); assertEquals(wayData.getPermission(), NONE); - way = new OSMWay(); + way = new OsmWay(); way.addTag("highway", "trunk"); way.addTag("ice_road", "yes"); wayData = wps.getDataForWay(way); assertEquals(wayData.getPermission(), NONE); - way = new OSMWay(); + way = new OsmWay(); way.addTag("highway", "track"); way.addTag("winter_road", "yes"); wayData = wps.getDataForWay(way); diff --git a/src/test/java/org/opentripplanner/openstreetmap/tagmapping/GermanyMapperTest.java b/application/src/test/java/org/opentripplanner/osm/tagmapping/GermanyMapperTest.java similarity index 90% rename from src/test/java/org/opentripplanner/openstreetmap/tagmapping/GermanyMapperTest.java rename to application/src/test/java/org/opentripplanner/osm/tagmapping/GermanyMapperTest.java index 00b1049bdda..28f482a3388 100644 --- a/src/test/java/org/opentripplanner/openstreetmap/tagmapping/GermanyMapperTest.java +++ b/application/src/test/java/org/opentripplanner/osm/tagmapping/GermanyMapperTest.java @@ -1,11 +1,11 @@ -package org.opentripplanner.openstreetmap.tagmapping; +package org.opentripplanner.osm.tagmapping; import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; -import org.opentripplanner.openstreetmap.model.OSMWithTags; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertySet; +import org.opentripplanner.osm.model.OsmWithTags; +import org.opentripplanner.osm.wayproperty.WayPropertySet; import org.opentripplanner.street.model.StreetTraversalPermission; public class GermanyMapperTest { @@ -26,10 +26,10 @@ class BikeSafety { @Test void testBikeSafety() { - OSMWithTags way; + OsmWithTags way; // way 361961158 - way = new OSMWithTags(); + way = new OsmWithTags(); way.addTag("bicycle", "yes"); way.addTag("foot", "designated"); way.addTag("footway", "sidewalk"); @@ -42,7 +42,7 @@ void testBikeSafety() { @Test void cyclewayOpposite() { - var way = new OSMWithTags(); + var way = new OsmWithTags(); way.addTag("cycleway", "opposite"); way.addTag("highway", "residential"); way.addTag("lit", "yes"); @@ -65,7 +65,7 @@ void cyclewayOpposite() { @Test void bikePath() { // way332589799 (Radschnellweg BW1) - var way = new OSMWithTags(); + var way = new OsmWithTags(); way.addTag("bicycle", "designated"); way.addTag("class:bicycle", "2"); way.addTag("class:bicycle:roadcycling", "1"); @@ -85,7 +85,7 @@ void bikePath() { @Test void track() { - var way = new OSMWithTags(); + var way = new OsmWithTags(); way.addTag("highway", "track"); way.addTag("motor_vehicle", "agricultural"); way.addTag("surface", "asphalt"); @@ -99,7 +99,7 @@ void track() { @Test void testPermissions() { // https://www.openstreetmap.org/way/124263424 - var way = new OSMWithTags(); + var way = new OsmWithTags(); way.addTag("highway", "track"); way.addTag("tracktype", "grade1"); assertEquals( @@ -108,7 +108,7 @@ void testPermissions() { ); // https://www.openstreetmap.org/way/5155805 - way = new OSMWithTags(); + way = new OsmWithTags(); way.addTag("access:lanes:forward", "yes|no"); way.addTag("bicycle:lanes:forward", "|designated"); way.addTag("change:lanes:forward", "not_right|no"); @@ -142,16 +142,16 @@ void lcnAndRcnShouldNotBeAddedUp() { // https://www.openstreetmap.org/way/26443041 is part of both an lcn and rcn but that shouldn't mean that // it is to be more heavily favoured than other ways that are part of just one. - var both = new OSMWithTags(); + var both = new OsmWithTags(); both.addTag("highway", "residential"); both.addTag("rcn", "yes"); both.addTag("lcn", "yes"); - var justLcn = new OSMWithTags(); + var justLcn = new OsmWithTags(); justLcn.addTag("lcn", "yes"); justLcn.addTag("highway", "residential"); - var residential = new OSMWithTags(); + var residential = new OsmWithTags(); residential.addTag("highway", "residential"); assertEquals( @@ -170,25 +170,25 @@ void bicycleRoadAndLcnShouldNotBeAddedUp() { // https://www.openstreetmap.org/way/22201321 was tagged as bicycle_road without lcn // make it so all ways tagged as some kind of cyclestreets are considered as equally safe - var both = new OSMWithTags(); + var both = new OsmWithTags(); both.addTag("highway", "residential"); both.addTag("bicycle_road", "yes"); both.addTag("cyclestreet", "yes"); both.addTag("lcn", "yes"); - var justBicycleRoad = new OSMWithTags(); + var justBicycleRoad = new OsmWithTags(); justBicycleRoad.addTag("bicycle_road", "yes"); justBicycleRoad.addTag("highway", "residential"); - var justCyclestreet = new OSMWithTags(); + var justCyclestreet = new OsmWithTags(); justCyclestreet.addTag("cyclestreet", "yes"); justCyclestreet.addTag("highway", "residential"); - var justLcn = new OSMWithTags(); + var justLcn = new OsmWithTags(); justLcn.addTag("lcn", "yes"); justLcn.addTag("highway", "residential"); - var residential = new OSMWithTags(); + var residential = new OsmWithTags(); residential.addTag("highway", "residential"); assertEquals( @@ -224,13 +224,13 @@ void bicycleRoadAndLcnShouldNotBeAddedUp() { @Test void setCorrectPermissionsForRoundabouts() { // https://www.openstreetmap.org/way/184185551 - var residential = new OSMWithTags(); + var residential = new OsmWithTags(); residential.addTag("highway", "residential"); residential.addTag("junction", "roundabout"); assertEquals(wps.getDataForWay(residential).getPermission(), StreetTraversalPermission.ALL); //https://www.openstreetmap.org/way/31109939 - var primary = new OSMWithTags(); + var primary = new OsmWithTags(); primary.addTag("highway", "primary"); primary.addTag("junction", "roundabout"); assertEquals( @@ -242,7 +242,7 @@ void setCorrectPermissionsForRoundabouts() { @Test void setCorrectBikeSafetyValuesForBothDirections() { // https://www.openstreetmap.org/way/13420871 - var residential = new OSMWithTags(); + var residential = new OsmWithTags(); residential.addTag("highway", "residential"); residential.addTag("lit", "yes"); residential.addTag("maxspeed", "30"); @@ -258,7 +258,7 @@ void setCorrectBikeSafetyValuesForBothDirections() { @Test void setCorrectPermissionsForSteps() { // https://www.openstreetmap.org/way/64359102 - var steps = new OSMWithTags(); + var steps = new OsmWithTags(); steps.addTag("highway", "steps"); assertEquals(wps.getDataForWay(steps).getPermission(), StreetTraversalPermission.PEDESTRIAN); } @@ -266,7 +266,7 @@ void setCorrectPermissionsForSteps() { @Test void testGermanAutobahnSpeed() { // https://www.openstreetmap.org/way/10879847 - var alzentalstr = new OSMWithTags(); + var alzentalstr = new OsmWithTags(); alzentalstr.addTag("highway", "residential"); alzentalstr.addTag("lit", "yes"); alzentalstr.addTag("maxspeed", "30"); @@ -274,7 +274,7 @@ void testGermanAutobahnSpeed() { alzentalstr.addTag("surface", "asphalt"); assertEquals(8.33333969116211, wps.getCarSpeedForWay(alzentalstr, false), epsilon); - var autobahn = new OSMWithTags(); + var autobahn = new OsmWithTags(); autobahn.addTag("highway", "motorway"); autobahn.addTag("maxspeed", "none"); assertEquals(33.33000183105469, wps.getCarSpeedForWay(autobahn, false), epsilon); diff --git a/src/test/java/org/opentripplanner/openstreetmap/tagmapping/HamburgMapperTest.java b/application/src/test/java/org/opentripplanner/osm/tagmapping/HamburgMapperTest.java similarity index 87% rename from src/test/java/org/opentripplanner/openstreetmap/tagmapping/HamburgMapperTest.java rename to application/src/test/java/org/opentripplanner/osm/tagmapping/HamburgMapperTest.java index 1af3eefee18..5c8270a38b8 100644 --- a/src/test/java/org/opentripplanner/openstreetmap/tagmapping/HamburgMapperTest.java +++ b/application/src/test/java/org/opentripplanner/osm/tagmapping/HamburgMapperTest.java @@ -1,4 +1,4 @@ -package org.opentripplanner.openstreetmap.tagmapping; +package org.opentripplanner.osm.tagmapping; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -7,7 +7,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; /** * @author Maintained by HBT (geofox-team@hbt.de) @@ -23,7 +23,7 @@ void createMapper() { @Test public void shouldAllowThroughTraffic_WhenAccessCustomers_AndCustomersHVV() { - OSMWithTags way = new OSMWithTags(); + OsmWithTags way = new OsmWithTags(); way.addTag("access", "customers"); way.addTag("customers", "HVV"); @@ -38,7 +38,7 @@ public void shouldAllowThroughTraffic_WhenAccessCustomers_AndCustomersHVV() { @ParameterizedTest @ValueSource(strings = { "no", "destination", "private", "customers", "delivery" }) public void shouldDisallowThroughTraffic_WhenNoCustomersHVV(String access) { - OSMWithTags way = new OSMWithTags(); + OsmWithTags way = new OsmWithTags(); way.addTag("access", access); boolean generalNoThroughTraffic = mapper.isGeneralNoThroughTraffic(way); diff --git a/src/test/java/org/opentripplanner/openstreetmap/tagmapping/HoustonMapperTest.java b/application/src/test/java/org/opentripplanner/osm/tagmapping/HoustonMapperTest.java similarity index 87% rename from src/test/java/org/opentripplanner/openstreetmap/tagmapping/HoustonMapperTest.java rename to application/src/test/java/org/opentripplanner/osm/tagmapping/HoustonMapperTest.java index 163a206e667..8db47bbf1dc 100644 --- a/src/test/java/org/opentripplanner/openstreetmap/tagmapping/HoustonMapperTest.java +++ b/application/src/test/java/org/opentripplanner/osm/tagmapping/HoustonMapperTest.java @@ -1,4 +1,4 @@ -package org.opentripplanner.openstreetmap.tagmapping; +package org.opentripplanner.osm.tagmapping; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.opentripplanner.street.model.StreetTraversalPermission.ALL; @@ -7,8 +7,8 @@ import static org.opentripplanner.street.model.StreetTraversalPermission.PEDESTRIAN_AND_BICYCLE; import org.junit.jupiter.api.Test; -import org.opentripplanner.openstreetmap.model.OSMWithTags; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertySet; +import org.opentripplanner.osm.model.OsmWithTags; +import org.opentripplanner.osm.wayproperty.WayPropertySet; class HoustonMapperTest { @@ -22,7 +22,7 @@ class HoustonMapperTest { @Test public void lamarTunnel() { // https://www.openstreetmap.org/way/127288293 - OSMWithTags tunnel = new OSMWithTags(); + OsmWithTags tunnel = new OsmWithTags(); tunnel.addTag("highway", "footway"); tunnel.addTag("indoor", "yes"); tunnel.addTag("layer", "-1"); @@ -36,7 +36,7 @@ public void lamarTunnel() { @Test public void harrisCountyTunnel() { // https://www.openstreetmap.org/way/127288288 - OSMWithTags tunnel = new OSMWithTags(); + OsmWithTags tunnel = new OsmWithTags(); tunnel.addTag("highway", "footway"); tunnel.addTag("indoor", "yes"); tunnel.addTag("name", "Harris County Tunnel"); @@ -48,7 +48,7 @@ public void harrisCountyTunnel() { @Test public void pedestrianUnderpass() { // https://www.openstreetmap.org/way/783648925 - OSMWithTags tunnel = new OSMWithTags(); + OsmWithTags tunnel = new OsmWithTags(); tunnel.addTag("highway", "footway"); tunnel.addTag("layer", "-1"); tunnel.addTag("tunnel", "yes"); @@ -59,7 +59,7 @@ public void pedestrianUnderpass() { @Test public void cyclingTunnel() { // https://www.openstreetmap.org/way/220484967 - OSMWithTags tunnel = new OSMWithTags(); + OsmWithTags tunnel = new OsmWithTags(); tunnel.addTag("bicycle", "designated"); tunnel.addTag("foot", "designated"); tunnel.addTag("highway", "cycleway"); @@ -70,7 +70,7 @@ public void cyclingTunnel() { assertEquals(ALL, wps.getDataForWay(tunnel).getPermission()); // https://www.openstreetmap.org/way/101884176 - tunnel = new OSMWithTags(); + tunnel = new OsmWithTags(); tunnel.addTag("highway", "cycleway"); tunnel.addTag("layer", "-1"); tunnel.addTag("name", "Hogg Woods Trail"); @@ -81,7 +81,7 @@ public void cyclingTunnel() { @Test public void carTunnel() { // https://www.openstreetmap.org/way/598694756 - OSMWithTags tunnel = new OSMWithTags(); + OsmWithTags tunnel = new OsmWithTags(); tunnel.addTag("highway", "primary"); tunnel.addTag("hov", "lane"); tunnel.addTag("lanes", "4"); @@ -100,7 +100,7 @@ public void carTunnel() { @Test public void carUnderpass() { // https://www.openstreetmap.org/way/102925214 - OSMWithTags tunnel = new OSMWithTags(); + OsmWithTags tunnel = new OsmWithTags(); tunnel.addTag("highway", "motorway_link"); tunnel.addTag("lanes", "2"); tunnel.addTag("layer", "-1"); @@ -113,7 +113,7 @@ public void carUnderpass() { @Test public void serviceTunnel() { // https://www.openstreetmap.org/way/15334550 - OSMWithTags tunnel = new OSMWithTags(); + OsmWithTags tunnel = new OsmWithTags(); tunnel.addTag("highway", "service"); tunnel.addTag("layer", "-1"); tunnel.addTag("tunnel", "yes"); @@ -124,7 +124,7 @@ public void serviceTunnel() { @Test public void unclassified() { // https://www.openstreetmap.org/way/44896136 - OSMWithTags tunnel = new OSMWithTags(); + OsmWithTags tunnel = new OsmWithTags(); tunnel.addTag("highway", "unclassified"); tunnel.addTag("name", "Ross Sterling Street"); tunnel.addTag("layer", "-1"); diff --git a/src/test/java/org/opentripplanner/openstreetmap/tagmapping/NorwayMapperTest.java b/application/src/test/java/org/opentripplanner/osm/tagmapping/NorwayMapperTest.java similarity index 85% rename from src/test/java/org/opentripplanner/openstreetmap/tagmapping/NorwayMapperTest.java rename to application/src/test/java/org/opentripplanner/osm/tagmapping/NorwayMapperTest.java index cce2bf85cb4..a87103648dc 100644 --- a/src/test/java/org/opentripplanner/openstreetmap/tagmapping/NorwayMapperTest.java +++ b/application/src/test/java/org/opentripplanner/osm/tagmapping/NorwayMapperTest.java @@ -1,4 +1,4 @@ -package org.opentripplanner.openstreetmap.tagmapping; +package org.opentripplanner.osm.tagmapping; import static java.lang.Double.NaN; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -9,9 +9,9 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import org.opentripplanner.openstreetmap.model.OSMWithTags; -import org.opentripplanner.openstreetmap.wayproperty.SafetyFeatures; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertySet; +import org.opentripplanner.osm.model.OsmWithTags; +import org.opentripplanner.osm.wayproperty.SafetyFeatures; +import org.opentripplanner.osm.wayproperty.WayPropertySet; import org.opentripplanner.street.model.StreetTraversalPermission; public class NorwayMapperTest { @@ -50,7 +50,7 @@ static List createExpectedBicycleSafetyForMaxspeedCases() { var expectedSafety = expectedBicycleSafetyMatrix[i][j]; if (!Double.isNaN(expectedSafety)) { var maxspeed = expectedMaxspeeds[j]; - var way = new OSMWithTags(); + var way = new OsmWithTags(); way.addTag("highway", highway); way.addTag("maxspeed", String.valueOf(maxspeed)); argumentsList.add(Arguments.of(way, expectedSafety)); @@ -66,7 +66,7 @@ static List createBicycleSafetyWithoutExplicitMaxspeed() { for (int i = 0; i < expectedHighways.length; i++) { var highway = expectedHighways[i]; var expectedSafety = expectedBicycleSafety[i]; - var way = new OSMWithTags(); + var way = new OsmWithTags(); way.addTag("highway", highway); argumentsList.add(Arguments.of(way, expectedSafety)); } @@ -78,10 +78,10 @@ static List createLinkRoadLikeMainCases() { for (var i = 0; i < 4; i++) { var highway = expectedHighways[i]; for (var maxspeed : expectedMaxspeeds) { - var mainRoad = new OSMWithTags(); + var mainRoad = new OsmWithTags(); mainRoad.addTag("highway", highway); mainRoad.addTag("maxspeed", String.valueOf(maxspeed)); - var linkRoad = new OSMWithTags(); + var linkRoad = new OsmWithTags(); linkRoad.addTag("highway", highway.concat("_link")); linkRoad.addTag("maxspeed", String.valueOf(maxspeed)); argumentsList.add(Arguments.of(mainRoad, linkRoad)); @@ -92,7 +92,7 @@ static List createLinkRoadLikeMainCases() { @ParameterizedTest(name = "{0} should have a score of {1}") @MethodSource("createExpectedBicycleSafetyForMaxspeedCases") - public void testBicycleSafetyForMaxspeed(OSMWithTags way, Double expected) { + public void testBicycleSafetyForMaxspeed(OsmWithTags way, Double expected) { var result = wps.getDataForWay(way).bicycleSafety(); var expectedSafetyFeatures = new SafetyFeatures(expected, expected); assertEquals(expectedSafetyFeatures, result); @@ -100,7 +100,7 @@ public void testBicycleSafetyForMaxspeed(OSMWithTags way, Double expected) { @ParameterizedTest @MethodSource("createBicycleSafetyWithoutExplicitMaxspeed") - public void testBicycleSafetyWithoutMaxspeed(OSMWithTags way, Double expected) { + public void testBicycleSafetyWithoutMaxspeed(OsmWithTags way, Double expected) { var result = wps.getDataForWay(way).bicycleSafety(); var expectedSafetyFeatures = new SafetyFeatures(expected, expected); assertEquals(expectedSafetyFeatures, result); @@ -108,7 +108,7 @@ public void testBicycleSafetyWithoutMaxspeed(OSMWithTags way, Double expected) { @ParameterizedTest @MethodSource("createLinkRoadLikeMainCases") - public void testBicycleSafetyLikeLinkRoad(OSMWithTags mainRoad, OSMWithTags linkRoad) { + public void testBicycleSafetyLikeLinkRoad(OsmWithTags mainRoad, OsmWithTags linkRoad) { var resultMain = wps.getDataForWay(mainRoad).bicycleSafety(); var resultLink = wps.getDataForWay(linkRoad).bicycleSafety(); @@ -117,7 +117,7 @@ public void testBicycleSafetyLikeLinkRoad(OSMWithTags mainRoad, OSMWithTags link @Test public void testTrunkIsWalkable() { - var way = new OSMWithTags(); + var way = new OsmWithTags(); way.addTag("highway", "trunk"); assertEquals(StreetTraversalPermission.ALL, wps.getDataForWay(way).getPermission()); @@ -126,13 +126,13 @@ public void testTrunkIsWalkable() { @Test public void testMtbScaleNone() { // https://www.openstreetmap.org/way/302610220 - var way1 = new OSMWithTags(); + var way1 = new OsmWithTags(); way1.addTag("highway", "path"); way1.addTag("mtb:scale", "3"); assertEquals(StreetTraversalPermission.NONE, wps.getDataForWay(way1).getPermission()); - var way2 = new OSMWithTags(); + var way2 = new OsmWithTags(); way2.addTag("highway", "track"); way2.addTag("mtb:scale", "3"); @@ -141,13 +141,13 @@ public void testMtbScaleNone() { @Test public void testMtbScalePedestrian() { - var way1 = new OSMWithTags(); + var way1 = new OsmWithTags(); way1.addTag("highway", "path"); way1.addTag("mtb:scale", "1"); assertEquals(StreetTraversalPermission.PEDESTRIAN, wps.getDataForWay(way1).getPermission()); - var way2 = new OSMWithTags(); + var way2 = new OsmWithTags(); way2.addTag("highway", "track"); way2.addTag("mtb:scale", "1"); @@ -156,13 +156,13 @@ public void testMtbScalePedestrian() { @Test public void testMotorroad() { - var way1 = new OSMWithTags(); + var way1 = new OsmWithTags(); way1.addTag("highway", "trunk"); way1.addTag("motorroad", "yes"); assertEquals(StreetTraversalPermission.CAR, wps.getDataForWay(way1).getPermission()); - var way2 = new OSMWithTags(); + var way2 = new OsmWithTags(); way2.addTag("highway", "primary"); way2.addTag("motorroad", "yes"); diff --git a/src/test/java/org/opentripplanner/openstreetmap/tagmapping/OsmTagMapperTest.java b/application/src/test/java/org/opentripplanner/osm/tagmapping/OsmTagMapperTest.java similarity index 86% rename from src/test/java/org/opentripplanner/openstreetmap/tagmapping/OsmTagMapperTest.java rename to application/src/test/java/org/opentripplanner/osm/tagmapping/OsmTagMapperTest.java index 164faa644c2..e0c70690e91 100644 --- a/src/test/java/org/opentripplanner/openstreetmap/tagmapping/OsmTagMapperTest.java +++ b/application/src/test/java/org/opentripplanner/osm/tagmapping/OsmTagMapperTest.java @@ -1,21 +1,21 @@ -package org.opentripplanner.openstreetmap.tagmapping; +package org.opentripplanner.osm.tagmapping; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.opentripplanner.openstreetmap.wayproperty.MixinPropertiesBuilder.ofBicycleSafety; -import static org.opentripplanner.openstreetmap.wayproperty.WayPropertiesBuilder.withModes; +import static org.opentripplanner.osm.wayproperty.MixinPropertiesBuilder.ofBicycleSafety; +import static org.opentripplanner.osm.wayproperty.WayPropertiesBuilder.withModes; import static org.opentripplanner.street.model.StreetTraversalPermission.CAR; import org.junit.jupiter.api.Test; -import org.opentripplanner.openstreetmap.model.OSMWithTags; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertySet; +import org.opentripplanner.osm.model.OsmWithTags; +import org.opentripplanner.osm.wayproperty.WayPropertySet; public class OsmTagMapperTest { @Test public void isMotorThroughTrafficExplicitlyDisallowed() { - OSMWithTags o = new OSMWithTags(); + OsmWithTags o = new OsmWithTags(); OsmTagMapper osmTagMapper = new DefaultMapper(); assertFalse(osmTagMapper.isMotorVehicleThroughTrafficExplicitlyDisallowed(o)); @@ -40,11 +40,11 @@ public void isMotorThroughTrafficExplicitlyDisallowed() { public void constantSpeedCarRouting() { OsmTagMapper osmTagMapper = new ConstantSpeedFinlandMapper(20f); - var slowWay = new OSMWithTags(); + var slowWay = new OsmWithTags(); slowWay.addTag("highway", "residential"); assertEquals(20f, osmTagMapper.getCarSpeedForWay(slowWay, true)); - var fastWay = new OSMWithTags(); + var fastWay = new OsmWithTags(); fastWay.addTag("highway", "motorway"); fastWay.addTag("maxspeed", "120 kmph"); assertEquals(20f, osmTagMapper.getCarSpeedForWay(fastWay, true)); @@ -80,12 +80,12 @@ public void mixin() { wps.setMixinProperties("foo=bar", ofBicycleSafety(0.5)); source.populateProperties(wps); - var withoutFoo = new OSMWithTags(); + var withoutFoo = new OsmWithTags(); withoutFoo.addTag("tag", "imaginary"); assertEquals(2, wps.getDataForWay(withoutFoo).bicycleSafety().back()); // the mixin for foo=bar reduces the bike safety factor - var withFoo = new OSMWithTags(); + var withFoo = new OsmWithTags(); withFoo.addTag("tag", "imaginary"); withFoo.addTag("foo", "bar"); assertEquals(1, wps.getDataForWay(withFoo).bicycleSafety().back()); @@ -93,7 +93,7 @@ public void mixin() { @Test public void testAccessNo() { - OSMWithTags tags = new OSMWithTags(); + OsmWithTags tags = new OsmWithTags(); OsmTagMapper osmTagMapper = new DefaultMapper(); tags.addTag("access", "no"); @@ -105,7 +105,7 @@ public void testAccessNo() { @Test public void testAccessPrivate() { - OSMWithTags tags = new OSMWithTags(); + OsmWithTags tags = new OsmWithTags(); OsmTagMapper osmTagMapper = new DefaultMapper(); tags.addTag("access", "private"); @@ -117,7 +117,7 @@ public void testAccessPrivate() { @Test public void testFootModifier() { - OSMWithTags tags = new OSMWithTags(); + OsmWithTags tags = new OsmWithTags(); OsmTagMapper osmTagMapper = new DefaultMapper(); tags.addTag("access", "private"); @@ -130,7 +130,7 @@ public void testFootModifier() { @Test public void testVehicleDenied() { - OSMWithTags tags = new OSMWithTags(); + OsmWithTags tags = new OsmWithTags(); OsmTagMapper osmTagMapper = new DefaultMapper(); tags.addTag("vehicle", "destination"); @@ -142,7 +142,7 @@ public void testVehicleDenied() { @Test public void testVehicleDeniedMotorVehiclePermissive() { - OSMWithTags tags = new OSMWithTags(); + OsmWithTags tags = new OsmWithTags(); OsmTagMapper osmTagMapper = new DefaultMapper(); tags.addTag("vehicle", "destination"); @@ -155,7 +155,7 @@ public void testVehicleDeniedMotorVehiclePermissive() { @Test public void testVehicleDeniedBicyclePermissive() { - OSMWithTags tags = new OSMWithTags(); + OsmWithTags tags = new OsmWithTags(); OsmTagMapper osmTagMapper = new DefaultMapper(); tags.addTag("vehicle", "destination"); @@ -168,7 +168,7 @@ public void testVehicleDeniedBicyclePermissive() { @Test public void testMotorcycleModifier() { - OSMWithTags tags = new OSMWithTags(); + OsmWithTags tags = new OsmWithTags(); OsmTagMapper osmTagMapper = new DefaultMapper(); tags.addTag("access", "private"); @@ -181,7 +181,7 @@ public void testMotorcycleModifier() { @Test public void testBicycleModifier() { - OSMWithTags tags = new OSMWithTags(); + OsmWithTags tags = new OsmWithTags(); OsmTagMapper osmTagMapper = new DefaultMapper(); tags.addTag("access", "private"); @@ -194,7 +194,7 @@ public void testBicycleModifier() { @Test public void testBicyclePermissive() { - OSMWithTags tags = new OSMWithTags(); + OsmWithTags tags = new OsmWithTags(); OsmTagMapper osmTagMapper = new DefaultMapper(); tags.addTag("access", "private"); @@ -205,8 +205,8 @@ public void testBicyclePermissive() { assertTrue(osmTagMapper.isWalkNoThroughTrafficExplicitlyDisallowed(tags)); } - public OSMWithTags way(String key, String value) { - var way = new OSMWithTags(); + public OsmWithTags way(String key, String value) { + var way = new OsmWithTags(); way.addTag(key, value); return way; } diff --git a/application/src/test/java/org/opentripplanner/osm/tagmapping/PortlandMapperTest.java b/application/src/test/java/org/opentripplanner/osm/tagmapping/PortlandMapperTest.java new file mode 100644 index 00000000000..c24e311d5d3 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/osm/tagmapping/PortlandMapperTest.java @@ -0,0 +1,63 @@ +package org.opentripplanner.osm.tagmapping; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.carTunnel; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.cobblestones; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.fiveLanes; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.footwaySidewalk; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.highwayTertiary; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.highwayTertiaryWithSidewalk; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.highwayTrunk; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.noSidewalk; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.noSidewalkHighSpeed; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.pedestrianTunnel; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.sidewalkBoth; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.southeastLaBonitaWay; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.southwestMayoStreet; + +import java.util.stream.Stream; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.opentripplanner.osm.model.OsmWithTags; +import org.opentripplanner.osm.wayproperty.WayPropertySet; + +public class PortlandMapperTest { + + static double delta = 0.1; + + static WayPropertySet wps = new WayPropertySet(); + + static Stream cases() { + return Stream.of( + Arguments.of(southeastLaBonitaWay(), 0.8), + Arguments.of(southwestMayoStreet(), 0.9), + Arguments.of(sidewalkBoth(), 0.96), + Arguments.of(pedestrianTunnel(), 1.0), + Arguments.of(highwayTertiaryWithSidewalk(), 1.056), + Arguments.of(cobblestones(), 1.2), + Arguments.of(noSidewalk(), 1.2), + Arguments.of(carTunnel(), 1.2), + Arguments.of(footwaySidewalk(), 1.32), + Arguments.of(highwayTertiary(), 1.32), + Arguments.of(highwayTrunk(), 1.44), + Arguments.of(fiveLanes(), 1.584), + Arguments.of(noSidewalkHighSpeed(), 7.19) + ); + } + + static { + var source = new PortlandMapper(); + source.populateProperties(wps); + } + + @ParameterizedTest(name = "way {0} should have walk safety factor {1}") + @MethodSource("cases") + void walkSafety(OsmWithTags way, double expected) { + var score = wps.getDataForWay(way); + + var ws = score.walkSafety(); + assertEquals(expected, ws.forward(), delta); + assertEquals(expected, ws.back(), delta); + } +} diff --git a/src/test/java/org/opentripplanner/openstreetmap/wayproperty/MixinPropertiesBuilderTest.java b/application/src/test/java/org/opentripplanner/osm/wayproperty/MixinPropertiesBuilderTest.java similarity index 84% rename from src/test/java/org/opentripplanner/openstreetmap/wayproperty/MixinPropertiesBuilderTest.java rename to application/src/test/java/org/opentripplanner/osm/wayproperty/MixinPropertiesBuilderTest.java index 62d9b192a97..2c2dc5bd987 100644 --- a/src/test/java/org/opentripplanner/openstreetmap/wayproperty/MixinPropertiesBuilderTest.java +++ b/application/src/test/java/org/opentripplanner/osm/wayproperty/MixinPropertiesBuilderTest.java @@ -1,9 +1,9 @@ -package org.opentripplanner.openstreetmap.wayproperty; +package org.opentripplanner.osm.wayproperty; import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; -import org.opentripplanner.openstreetmap.wayproperty.specifier.BestMatchSpecifier; +import org.opentripplanner.osm.wayproperty.specifier.BestMatchSpecifier; class MixinPropertiesBuilderTest { diff --git a/src/test/java/org/opentripplanner/openstreetmap/wayproperty/WayPropertySetTest.java b/application/src/test/java/org/opentripplanner/osm/wayproperty/WayPropertySetTest.java similarity index 89% rename from src/test/java/org/opentripplanner/openstreetmap/wayproperty/WayPropertySetTest.java rename to application/src/test/java/org/opentripplanner/osm/wayproperty/WayPropertySetTest.java index 24360539b6f..8d460b92cc5 100644 --- a/src/test/java/org/opentripplanner/openstreetmap/wayproperty/WayPropertySetTest.java +++ b/application/src/test/java/org/opentripplanner/osm/wayproperty/WayPropertySetTest.java @@ -1,22 +1,21 @@ -package org.opentripplanner.openstreetmap.wayproperty; +package org.opentripplanner.osm.wayproperty; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.opentripplanner.openstreetmap.wayproperty.MixinPropertiesBuilder.ofBicycleSafety; -import static org.opentripplanner.openstreetmap.wayproperty.WayPropertiesBuilder.withModes; +import static org.opentripplanner.osm.wayproperty.MixinPropertiesBuilder.ofBicycleSafety; +import static org.opentripplanner.osm.wayproperty.WayPropertiesBuilder.withModes; import static org.opentripplanner.street.model.StreetTraversalPermission.CAR; import static org.opentripplanner.street.model.StreetTraversalPermission.NONE; -import javax.annotation.Nonnull; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.opentripplanner.graph_builder.module.osm.StreetTraversalPermissionPair; -import org.opentripplanner.openstreetmap.model.OSMWay; -import org.opentripplanner.openstreetmap.model.OSMWithTags; -import org.opentripplanner.openstreetmap.tagmapping.OsmTagMapper; -import org.opentripplanner.openstreetmap.wayproperty.specifier.ExactMatchSpecifier; -import org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData; +import org.opentripplanner.osm.model.OsmWay; +import org.opentripplanner.osm.model.OsmWithTags; +import org.opentripplanner.osm.tagmapping.OsmTagMapper; +import org.opentripplanner.osm.wayproperty.specifier.ExactMatchSpecifier; +import org.opentripplanner.osm.wayproperty.specifier.WayTestData; import org.opentripplanner.street.model.StreetTraversalPermission; class WayPropertySetTest { @@ -26,7 +25,7 @@ class ConditionSpecificity { @Test public void carTunnel() { - OSMWithTags tunnel = WayTestData.carTunnel(); + OsmWithTags tunnel = WayTestData.carTunnel(); WayPropertySet wps = wps(); assertEquals(CAR, wps.getDataForWay(tunnel).getPermission()); } @@ -43,7 +42,7 @@ public void carMaxSpeed() { assertEquals(0f, wps.maxUsedCarSpeed, delta); // Speed limit that is within limits should be used as the max used car speed - OSMWithTags streetWithSpeedLimit = new OSMWithTags(); + OsmWithTags streetWithSpeedLimit = new OsmWithTags(); streetWithSpeedLimit.addTag("highway", "motorway"); streetWithSpeedLimit.addTag("maxspeed", "120"); var waySpeed = wps.getCarSpeedForWay(streetWithSpeedLimit, false); @@ -52,7 +51,7 @@ public void carMaxSpeed() { // Speed limit that is higher than maxPossibleCarSpeed should be ignored and regular motorway // speed limit should be used instead - OSMWithTags streetWithTooHighSpeedLimit = new OSMWithTags(); + OsmWithTags streetWithTooHighSpeedLimit = new OsmWithTags(); streetWithTooHighSpeedLimit.addTag("highway", "motorway"); streetWithTooHighSpeedLimit.addTag("maxspeed", "200"); waySpeed = wps.getCarSpeedForWay(streetWithTooHighSpeedLimit, false); @@ -61,7 +60,7 @@ public void carMaxSpeed() { // Speed limit that is too low should be ignored and regular motorway speed limit should // be used instead - OSMWithTags streetWithTooLowSpeedLimit = new OSMWithTags(); + OsmWithTags streetWithTooLowSpeedLimit = new OsmWithTags(); streetWithTooLowSpeedLimit.addTag("highway", "motorway"); streetWithTooLowSpeedLimit.addTag("maxspeed", "0"); waySpeed = wps.getCarSpeedForWay(streetWithTooLowSpeedLimit, false); @@ -84,7 +83,6 @@ void mixinLeftSide() { assertEquals(expected, wps.getDataForWay(cycleway).bicycleSafety()); } - @Nonnull private static WayPropertySet wps() { var wps = new WayPropertySet(); var source = new OsmTagMapper() { @@ -113,7 +111,7 @@ class NoMapper { */ @Test void testCarPermission() { - OSMWay way = new OSMWay(); + OsmWay way = new OsmWay(); way.addTag("highway", "unclassified"); var permissionPair = getWayProperties(way); @@ -130,7 +128,7 @@ void testCarPermission() { */ @Test void testMotorCarTagAllowedPermissions() { - OSMWay way = new OSMWay(); + OsmWay way = new OsmWay(); way.addTag("highway", "residential"); var permissionPair = getWayProperties(way); assertTrue(permissionPair.main().allows(StreetTraversalPermission.ALL)); @@ -164,7 +162,7 @@ void testMotorCarTagAllowedPermissions() { */ @Test void testMotorCarTagDeniedPermissions() { - OSMWay way = new OSMWay(); + OsmWay way = new OsmWay(); way.addTag("highway", "residential"); var permissionPair = getWayProperties(way); assertTrue(permissionPair.main().allows(StreetTraversalPermission.ALL)); @@ -196,7 +194,7 @@ void testMotorCarTagDeniedPermissions() { */ @Test void testMotorVehicleTagAllowedPermissions() { - OSMWay way = new OSMWay(); + OsmWay way = new OsmWay(); way.addTag("highway", "residential"); var permissionPair = getWayProperties(way); assertTrue(permissionPair.main().allows(StreetTraversalPermission.ALL)); @@ -232,7 +230,7 @@ void testMotorVehicleTagAllowedPermissions() { */ @Test void testMotorVehicleTagDeniedPermissions() { - OSMWay way = new OSMWay(); + OsmWay way = new OsmWay(); way.addTag("highway", "residential"); var permissionPair = getWayProperties(way); assertTrue(permissionPair.main().allows(StreetTraversalPermission.ALL)); @@ -256,7 +254,7 @@ void testMotorVehicleTagDeniedPermissions() { assertTrue(permissionPair.main().allowsNothing());*/ } - private StreetTraversalPermissionPair getWayProperties(OSMWay way) { + private StreetTraversalPermissionPair getWayProperties(OsmWay way) { WayPropertySet wayPropertySet = new WayPropertySet(); WayProperties wayData = wayPropertySet.getDataForWay(way); diff --git a/src/test/java/org/opentripplanner/openstreetmap/wayproperty/specifier/BestMatchSpecifierTest.java b/application/src/test/java/org/opentripplanner/osm/wayproperty/specifier/BestMatchSpecifierTest.java similarity index 85% rename from src/test/java/org/opentripplanner/openstreetmap/wayproperty/specifier/BestMatchSpecifierTest.java rename to application/src/test/java/org/opentripplanner/osm/wayproperty/specifier/BestMatchSpecifierTest.java index 517e4b57bfd..3c2efa46710 100644 --- a/src/test/java/org/opentripplanner/openstreetmap/wayproperty/specifier/BestMatchSpecifierTest.java +++ b/application/src/test/java/org/opentripplanner/osm/wayproperty/specifier/BestMatchSpecifierTest.java @@ -1,15 +1,15 @@ -package org.opentripplanner.openstreetmap.wayproperty.specifier; +package org.opentripplanner.osm.wayproperty.specifier; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.cyclewayLaneTrack; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.cyclewayLeft; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.cyclewayLaneTrack; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.cyclewayLeft; import java.util.stream.Stream; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; class BestMatchSpecifierTest extends SpecifierTest { @@ -61,7 +61,7 @@ static Stream leftRightTestCases() { name = "way {0} with specifier {1} should have a backward score {2} and forward score {3}" ) @MethodSource("leftRightTestCases") - void leftRight(OSMWithTags way, OsmSpecifier spec, int expectedBackward, int expectedForward) { + void leftRight(OsmWithTags way, OsmSpecifier spec, int expectedBackward, int expectedForward) { var result = spec.matchScores(way); assertEquals(expectedBackward, result.backward()); assertEquals(expectedForward, result.forward()); diff --git a/src/test/java/org/opentripplanner/openstreetmap/wayproperty/specifier/ConditionTest.java b/application/src/test/java/org/opentripplanner/osm/wayproperty/specifier/ConditionTest.java similarity index 58% rename from src/test/java/org/opentripplanner/openstreetmap/wayproperty/specifier/ConditionTest.java rename to application/src/test/java/org/opentripplanner/osm/wayproperty/specifier/ConditionTest.java index 6386aa902e2..60adf602594 100644 --- a/src/test/java/org/opentripplanner/openstreetmap/wayproperty/specifier/ConditionTest.java +++ b/application/src/test/java/org/opentripplanner/osm/wayproperty/specifier/ConditionTest.java @@ -1,24 +1,24 @@ -package org.opentripplanner.openstreetmap.wayproperty.specifier; +package org.opentripplanner.osm.wayproperty.specifier; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.Condition.MatchResult.EXACT; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.Condition.MatchResult.NONE; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.Condition.MatchResult.WILDCARD; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.carTunnel; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.cobblestones; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.cycleway; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.cyclewayBoth; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.cyclewayLaneTrack; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.cyclewayLeft; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.excellentSmoothness; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.fiveLanes; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.highwayTertiary; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.noSidewalk; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.pedestrianTunnel; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.sidewalkBoth; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.threeLanes; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.tramsForward; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.veryBadSmoothness; +import static org.opentripplanner.osm.wayproperty.specifier.Condition.MatchResult.EXACT; +import static org.opentripplanner.osm.wayproperty.specifier.Condition.MatchResult.NONE; +import static org.opentripplanner.osm.wayproperty.specifier.Condition.MatchResult.WILDCARD; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.carTunnel; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.cobblestones; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.cycleway; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.cyclewayBoth; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.cyclewayLaneTrack; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.cyclewayLeft; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.excellentSmoothness; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.fiveLanes; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.highwayTertiary; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.noSidewalk; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.pedestrianTunnel; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.sidewalkBoth; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.threeLanes; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.tramsForward; +import static org.opentripplanner.osm.wayproperty.specifier.WayTestData.veryBadSmoothness; import java.util.stream.Stream; import org.junit.jupiter.api.Assertions; @@ -26,15 +26,15 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import org.opentripplanner.openstreetmap.model.OSMWithTags; -import org.opentripplanner.openstreetmap.wayproperty.specifier.Condition.Absent; -import org.opentripplanner.openstreetmap.wayproperty.specifier.Condition.Equals; -import org.opentripplanner.openstreetmap.wayproperty.specifier.Condition.GreaterThan; -import org.opentripplanner.openstreetmap.wayproperty.specifier.Condition.InclusiveRange; -import org.opentripplanner.openstreetmap.wayproperty.specifier.Condition.LessThan; -import org.opentripplanner.openstreetmap.wayproperty.specifier.Condition.MatchResult; -import org.opentripplanner.openstreetmap.wayproperty.specifier.Condition.OneOf; -import org.opentripplanner.openstreetmap.wayproperty.specifier.Condition.Present; +import org.opentripplanner.osm.model.OsmWithTags; +import org.opentripplanner.osm.wayproperty.specifier.Condition.Absent; +import org.opentripplanner.osm.wayproperty.specifier.Condition.Equals; +import org.opentripplanner.osm.wayproperty.specifier.Condition.GreaterThan; +import org.opentripplanner.osm.wayproperty.specifier.Condition.InclusiveRange; +import org.opentripplanner.osm.wayproperty.specifier.Condition.LessThan; +import org.opentripplanner.osm.wayproperty.specifier.Condition.MatchResult; +import org.opentripplanner.osm.wayproperty.specifier.Condition.OneOf; +import org.opentripplanner.osm.wayproperty.specifier.Condition.Present; class ConditionTest { @@ -71,7 +71,7 @@ static Stream equalsCases() { ) @MethodSource("equalsCases") void leftRight( - OSMWithTags way, + OsmWithTags way, Condition op, MatchResult backwardExpectation, MatchResult forwardExpectation @@ -108,7 +108,7 @@ static Stream otherCases() { @ParameterizedTest(name = "way {0} with op {1} should have a result {2}") @MethodSource("otherCases") - void otherTests(OSMWithTags way, Condition op, MatchResult expectation) { + void otherTests(OsmWithTags way, Condition op, MatchResult expectation) { assertEquals(expectation, op.match(way)); } diff --git a/src/test/java/org/opentripplanner/openstreetmap/wayproperty/specifier/ExactMatchSpecifierTest.java b/application/src/test/java/org/opentripplanner/osm/wayproperty/specifier/ExactMatchSpecifierTest.java similarity index 82% rename from src/test/java/org/opentripplanner/openstreetmap/wayproperty/specifier/ExactMatchSpecifierTest.java rename to application/src/test/java/org/opentripplanner/osm/wayproperty/specifier/ExactMatchSpecifierTest.java index 85898abd8f2..90fee463677 100644 --- a/src/test/java/org/opentripplanner/openstreetmap/wayproperty/specifier/ExactMatchSpecifierTest.java +++ b/application/src/test/java/org/opentripplanner/osm/wayproperty/specifier/ExactMatchSpecifierTest.java @@ -1,7 +1,7 @@ -package org.opentripplanner.openstreetmap.wayproperty.specifier; +package org.opentripplanner.osm.wayproperty.specifier; import org.junit.jupiter.api.Test; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; class ExactMatchSpecifierTest extends SpecifierTest { @@ -23,7 +23,7 @@ public void carTunnel() { @Test public void pedestrianTunnelSpecificity() { - OSMWithTags tunnel = WayTestData.pedestrianTunnel(); + OsmWithTags tunnel = WayTestData.pedestrianTunnel(); assertScore(0, highwayPrimarySpec, tunnel); assertScore(600, pedestrianUndergroundTunnelSpec, tunnel); assertScore(800, pedestrianUndergroundIndoorTunnelSpec, tunnel); diff --git a/src/test/java/org/opentripplanner/openstreetmap/wayproperty/specifier/LogicalOrSpecifierTest.java b/application/src/test/java/org/opentripplanner/osm/wayproperty/specifier/LogicalOrSpecifierTest.java similarity index 89% rename from src/test/java/org/opentripplanner/openstreetmap/wayproperty/specifier/LogicalOrSpecifierTest.java rename to application/src/test/java/org/opentripplanner/osm/wayproperty/specifier/LogicalOrSpecifierTest.java index 5375c0d920c..cc99129cec6 100644 --- a/src/test/java/org/opentripplanner/openstreetmap/wayproperty/specifier/LogicalOrSpecifierTest.java +++ b/application/src/test/java/org/opentripplanner/osm/wayproperty/specifier/LogicalOrSpecifierTest.java @@ -1,4 +1,4 @@ -package org.opentripplanner.openstreetmap.wayproperty.specifier; +package org.opentripplanner.osm.wayproperty.specifier; import org.junit.jupiter.api.Test; diff --git a/src/test/java/org/opentripplanner/openstreetmap/wayproperty/specifier/OsmSpecifierTest.java b/application/src/test/java/org/opentripplanner/osm/wayproperty/specifier/OsmSpecifierTest.java similarity index 85% rename from src/test/java/org/opentripplanner/openstreetmap/wayproperty/specifier/OsmSpecifierTest.java rename to application/src/test/java/org/opentripplanner/osm/wayproperty/specifier/OsmSpecifierTest.java index e9f9730ddfe..5467f9f709a 100644 --- a/src/test/java/org/opentripplanner/openstreetmap/wayproperty/specifier/OsmSpecifierTest.java +++ b/application/src/test/java/org/opentripplanner/osm/wayproperty/specifier/OsmSpecifierTest.java @@ -1,4 +1,4 @@ -package org.opentripplanner.openstreetmap.wayproperty.specifier; +package org.opentripplanner.osm.wayproperty.specifier; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/src/test/java/org/opentripplanner/openstreetmap/wayproperty/specifier/SpecifierTest.java b/application/src/test/java/org/opentripplanner/osm/wayproperty/specifier/SpecifierTest.java similarity index 72% rename from src/test/java/org/opentripplanner/openstreetmap/wayproperty/specifier/SpecifierTest.java rename to application/src/test/java/org/opentripplanner/osm/wayproperty/specifier/SpecifierTest.java index 2a754a1a883..5da2353bf57 100644 --- a/src/test/java/org/opentripplanner/openstreetmap/wayproperty/specifier/SpecifierTest.java +++ b/application/src/test/java/org/opentripplanner/osm/wayproperty/specifier/SpecifierTest.java @@ -1,12 +1,12 @@ -package org.opentripplanner.openstreetmap.wayproperty.specifier; +package org.opentripplanner.osm.wayproperty.specifier; import static org.junit.jupiter.api.Assertions.assertEquals; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWithTags; public class SpecifierTest { - protected void assertScore(int expectedScore, OsmSpecifier spec, OSMWithTags tunnel) { + protected void assertScore(int expectedScore, OsmSpecifier spec, OsmWithTags tunnel) { var result = spec.matchScores(tunnel); assertEquals(expectedScore, result.backward()); assertEquals(expectedScore, result.forward()); diff --git a/src/test/java/org/opentripplanner/openstreetmap/wayproperty/specifier/WayTestData.java b/application/src/test/java/org/opentripplanner/osm/wayproperty/specifier/WayTestData.java similarity index 66% rename from src/test/java/org/opentripplanner/openstreetmap/wayproperty/specifier/WayTestData.java rename to application/src/test/java/org/opentripplanner/osm/wayproperty/specifier/WayTestData.java index b09f690f794..4206b4de091 100644 --- a/src/test/java/org/opentripplanner/openstreetmap/wayproperty/specifier/WayTestData.java +++ b/application/src/test/java/org/opentripplanner/osm/wayproperty/specifier/WayTestData.java @@ -1,13 +1,13 @@ -package org.opentripplanner.openstreetmap.wayproperty.specifier; +package org.opentripplanner.osm.wayproperty.specifier; -import org.opentripplanner.openstreetmap.model.OSMWay; -import org.opentripplanner.openstreetmap.model.OSMWithTags; +import org.opentripplanner.osm.model.OsmWay; +import org.opentripplanner.osm.model.OsmWithTags; public class WayTestData { - public static OSMWithTags carTunnel() { + public static OsmWithTags carTunnel() { // https://www.openstreetmap.org/way/598694756 - OSMWithTags tunnel = new OSMWithTags(); + OsmWithTags tunnel = new OsmWithTags(); tunnel.addTag("highway", "primary"); tunnel.addTag("hov", "lane"); tunnel.addTag("lanes", "4"); @@ -22,9 +22,9 @@ public static OSMWithTags carTunnel() { return tunnel; } - public static OSMWithTags pedestrianTunnel() { + public static OsmWithTags pedestrianTunnel() { // https://www.openstreetmap.org/way/127288293 - OSMWithTags tunnel = new OSMWithTags(); + OsmWithTags tunnel = new OsmWithTags(); tunnel.addTag("highway", "footway"); tunnel.addTag("indoor", "yes"); tunnel.addTag("layer", "-1"); @@ -34,10 +34,10 @@ public static OSMWithTags pedestrianTunnel() { return tunnel; } - public static OSMWithTags streetOnBikeRoute() { + public static OsmWithTags streetOnBikeRoute() { // https://www.openstreetmap.org/way/26443041 is part of both an lcn relation - var way = new OSMWithTags(); + var way = new OsmWithTags(); way.addTag("highway", "residential"); way.addTag("lit", "yes"); way.addTag("maxspeed", "30"); @@ -50,9 +50,9 @@ public static OSMWithTags streetOnBikeRoute() { return way; } - public static OSMWithTags stairs() { + public static OsmWithTags stairs() { // https://www.openstreetmap.org/way/1058669389 - var way = new OSMWithTags(); + var way = new OsmWithTags(); way.addTag("handrail", "yes"); way.addTag("highway", "steps"); way.addTag("incline", "down"); @@ -65,9 +65,9 @@ public static OSMWithTags stairs() { return way; } - public static OSMWithTags southeastLaBonitaWay() { + public static OsmWithTags southeastLaBonitaWay() { // https://www.openstreetmap.org/way/5302874 - var way = new OSMWithTags(); + var way = new OsmWithTags(); way.addTag("highway", "residential"); way.addTag("name", "Southeast la Bonita Way"); way.addTag("sidewalk", "both"); @@ -75,9 +75,9 @@ public static OSMWithTags southeastLaBonitaWay() { return way; } - public static OSMWithTags southwestMayoStreet() { + public static OsmWithTags southwestMayoStreet() { //https://www.openstreetmap.org/way/425004690 - var way = new OSMWithTags(); + var way = new OsmWithTags(); way.addTag("highway", "residential"); way.addTag("name", "Southwest Mayo Street"); way.addTag("maxspeed", "25 mph"); @@ -86,124 +86,124 @@ public static OSMWithTags southwestMayoStreet() { return way; } - public static OSMWithTags fiveLanes() { - OSMWithTags way = new OSMWithTags(); + public static OsmWithTags fiveLanes() { + OsmWithTags way = new OsmWithTags(); way.addTag("highway", "primary"); way.addTag("lanes", "5"); return way; } - public static OSMWithTags threeLanes() { - OSMWithTags way = new OSMWithTags(); + public static OsmWithTags threeLanes() { + OsmWithTags way = new OsmWithTags(); way.addTag("highway", "primary"); way.addTag("lanes", "3"); return way; } - public static OSMWay cycleway() { - var way = new OSMWay(); + public static OsmWay cycleway() { + var way = new OsmWay(); way.addTag("highway", "residential"); way.addTag("cycleway", "lane"); return way; } - public static OSMWithTags cyclewayLeft() { - var way = new OSMWithTags(); + public static OsmWithTags cyclewayLeft() { + var way = new OsmWithTags(); way.addTag("highway", "residential"); way.addTag("cycleway:left", "lane"); return way; } - public static OSMWithTags cyclewayBoth() { - var way = new OSMWithTags(); + public static OsmWithTags cyclewayBoth() { + var way = new OsmWithTags(); way.addTag("highway", "residential"); way.addTag("cycleway:both", "lane"); return way; } - public static OSMWay footwaySidewalk() { - var way = new OSMWay(); + public static OsmWay footwaySidewalk() { + var way = new OsmWay(); way.addTag("footway", "sidewalk"); way.addTag("highway", "footway"); return way; } - public static OSMWithTags sidewalkBoth() { - var way = new OSMWithTags(); + public static OsmWithTags sidewalkBoth() { + var way = new OsmWithTags(); way.addTag("highway", "both"); way.addTag("sidewalk", "both"); return way; } - public static OSMWithTags noSidewalk() { - var way = new OSMWithTags(); + public static OsmWithTags noSidewalk() { + var way = new OsmWithTags(); way.addTag("highway", "residential"); way.addTag("sidewalk", "no"); return way; } - public static OSMWithTags noSidewalkHighSpeed() { - var way = new OSMWithTags(); + public static OsmWithTags noSidewalkHighSpeed() { + var way = new OsmWithTags(); way.addTag("highway", "residential"); way.addTag("sidewalk", "no"); way.addTag("maxspeed", "55 mph"); return way; } - public static OSMWithTags highwayTrunk() { - var way = new OSMWithTags(); + public static OsmWithTags highwayTrunk() { + var way = new OsmWithTags(); way.addTag("highway", "trunk"); return way; } - public static OSMWay highwayTertiary() { - var way = new OSMWay(); + public static OsmWay highwayTertiary() { + var way = new OsmWay(); way.addTag("highway", "tertiary"); return way; } - public static OSMWithTags highwayTertiaryWithSidewalk() { - var way = new OSMWithTags(); + public static OsmWithTags highwayTertiaryWithSidewalk() { + var way = new OsmWithTags(); way.addTag("highway", "tertiary"); way.addTag("sidewalk", "both"); return way; } - public static OSMWithTags cobblestones() { - var way = new OSMWithTags(); + public static OsmWithTags cobblestones() { + var way = new OsmWithTags(); way.addTag("highway", "residential"); way.addTag("surface", "cobblestones"); return way; } - public static OSMWithTags cyclewayLaneTrack() { - var way = new OSMWithTags(); + public static OsmWithTags cyclewayLaneTrack() { + var way = new OsmWithTags(); way.addTag("highway", "footway"); way.addTag("cycleway", "lane"); way.addTag("cycleway:right", "track"); return way; } - public static OSMWithTags tramsForward() { + public static OsmWithTags tramsForward() { // https://www.openstreetmap.org/way/108037345 - var way = new OSMWithTags(); + var way = new OsmWithTags(); way.addTag("highway", "tertiary"); way.addTag("embedded_rails:forward", "tram"); return way; } - public static OSMWithTags veryBadSmoothness() { + public static OsmWithTags veryBadSmoothness() { // https://www.openstreetmap.org/way/11402648 - var way = new OSMWithTags(); + var way = new OsmWithTags(); way.addTag("highway", "footway"); way.addTag("surface", "sett"); way.addTag("smoothness", "very_bad"); return way; } - public static OSMWithTags excellentSmoothness() { + public static OsmWithTags excellentSmoothness() { // https://www.openstreetmap.org/way/437167371 - var way = new OSMWithTags(); + var way = new OsmWithTags(); way.addTag("highway", "cycleway"); way.addTag("segregated", "no"); way.addTag("surface", "asphalt"); @@ -211,9 +211,9 @@ public static OSMWithTags excellentSmoothness() { return way; } - public static OSMWithTags zooPlatform() { + public static OsmWithTags zooPlatform() { // https://www.openstreetmap.org/way/119108622 - var way = new OSMWithTags(); + var way = new OsmWithTags(); way.addTag("public_transport", "platform"); way.addTag("usage", "tourism"); return way; diff --git a/src/test/java/org/opentripplanner/raptor/RaptorArchitectureTest.java b/application/src/test/java/org/opentripplanner/raptor/RaptorArchitectureTest.java similarity index 95% rename from src/test/java/org/opentripplanner/raptor/RaptorArchitectureTest.java rename to application/src/test/java/org/opentripplanner/raptor/RaptorArchitectureTest.java index 39022da42ca..657e060c30b 100644 --- a/src/test/java/org/opentripplanner/raptor/RaptorArchitectureTest.java +++ b/application/src/test/java/org/opentripplanner/raptor/RaptorArchitectureTest.java @@ -21,7 +21,12 @@ public class RaptorArchitectureTest { private static final Package API_PATH = API.subPackage("path"); private static final Package RAPTOR_UTIL = RAPTOR.subPackage("util"); private static final Package RAPTOR_UTIL_PARETO_SET = RAPTOR_UTIL.subPackage("paretoset"); - private static final Module RAPTOR_UTILS = Module.of(RAPTOR_UTIL, RAPTOR_UTIL_PARETO_SET); + private static final Package RAPTOR_UTIL_COMPOSITE = RAPTOR_UTIL.subPackage("composite"); + private static final Module RAPTOR_UTILS = Module.of( + RAPTOR_UTIL, + RAPTOR_UTIL_PARETO_SET, + RAPTOR_UTIL_COMPOSITE + ); private static final Package RAPTOR_SPI = RAPTOR.subPackage("spi"); private static final Package RAPTOR_PATH = RAPTOR.subPackage("path"); private static final Package CONFIGURE = RAPTOR.subPackage("configure"); @@ -78,7 +83,8 @@ void enforcePackageDependenciesRaptorSPI() { @Test void enforcePackageDependenciesUtil() { RAPTOR_UTIL.dependsOn(FRAMEWORK_UTILS, RAPTOR_SPI).verify(); - RAPTOR_UTIL_PARETO_SET.verify(); + RAPTOR_UTIL_PARETO_SET.dependsOn(RAPTOR_UTIL_COMPOSITE).verify(); + RAPTOR_UTIL_COMPOSITE.verify(); } @Test @@ -200,7 +206,8 @@ void enforcePackageDependenciesInRaptorService() { RAPTOR_UTIL, CONFIGURE, RR_INTERNAL_API, - RR_TRANSIT + RR_TRANSIT, + RANGE_RAPTOR ) .verify(); } diff --git a/src/test/java/org/opentripplanner/raptor/_data/RaptorTestConstants.java b/application/src/test/java/org/opentripplanner/raptor/_data/RaptorTestConstants.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/_data/RaptorTestConstants.java rename to application/src/test/java/org/opentripplanner/raptor/_data/RaptorTestConstants.java diff --git a/src/test/java/org/opentripplanner/raptor/_data/api/PathUtils.java b/application/src/test/java/org/opentripplanner/raptor/_data/api/PathUtils.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/_data/api/PathUtils.java rename to application/src/test/java/org/opentripplanner/raptor/_data/api/PathUtils.java diff --git a/src/test/java/org/opentripplanner/raptor/_data/api/TestPathBuilder.java b/application/src/test/java/org/opentripplanner/raptor/_data/api/TestPathBuilder.java similarity index 98% rename from src/test/java/org/opentripplanner/raptor/_data/api/TestPathBuilder.java rename to application/src/test/java/org/opentripplanner/raptor/_data/api/TestPathBuilder.java index 007018ca6c4..3c59c8543dd 100644 --- a/src/test/java/org/opentripplanner/raptor/_data/api/TestPathBuilder.java +++ b/application/src/test/java/org/opentripplanner/raptor/_data/api/TestPathBuilder.java @@ -9,8 +9,8 @@ import org.opentripplanner.raptor._data.transit.TestTripPattern; import org.opentripplanner.raptor._data.transit.TestTripSchedule; import org.opentripplanner.raptor.api.model.RaptorConstants; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; import org.opentripplanner.raptor.api.path.RaptorPath; -import org.opentripplanner.raptor.api.path.RaptorStopNameResolver; import org.opentripplanner.raptor.path.PathBuilder; import org.opentripplanner.raptor.spi.DefaultSlackProvider; import org.opentripplanner.raptor.spi.RaptorCostCalculator; diff --git a/src/test/java/org/opentripplanner/raptor/_data/api/TestPathBuilderTestRaptor.java b/application/src/test/java/org/opentripplanner/raptor/_data/api/TestPathBuilderTestRaptor.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/_data/api/TestPathBuilderTestRaptor.java rename to application/src/test/java/org/opentripplanner/raptor/_data/api/TestPathBuilderTestRaptor.java diff --git a/src/test/java/org/opentripplanner/raptor/_data/api/TestRaptorPath.java b/application/src/test/java/org/opentripplanner/raptor/_data/api/TestRaptorPath.java similarity index 97% rename from src/test/java/org/opentripplanner/raptor/_data/api/TestRaptorPath.java rename to application/src/test/java/org/opentripplanner/raptor/_data/api/TestRaptorPath.java index dab47a6d18b..b1cd2c4d411 100644 --- a/src/test/java/org/opentripplanner/raptor/_data/api/TestRaptorPath.java +++ b/application/src/test/java/org/opentripplanner/raptor/_data/api/TestRaptorPath.java @@ -4,12 +4,12 @@ import java.util.stream.Stream; import javax.annotation.Nullable; import org.opentripplanner.raptor.api.model.RaptorConstants; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.path.AccessPathLeg; import org.opentripplanner.raptor.api.path.EgressPathLeg; import org.opentripplanner.raptor.api.path.PathLeg; import org.opentripplanner.raptor.api.path.RaptorPath; -import org.opentripplanner.raptor.api.path.RaptorStopNameResolver; import org.opentripplanner.raptor.api.path.TransitPathLeg; /** diff --git a/src/test/java/org/opentripplanner/raptor/_data/multicriteria/ride/TestPatterRideBuilder.java b/application/src/test/java/org/opentripplanner/raptor/_data/multicriteria/ride/TestPatterRideBuilder.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/_data/multicriteria/ride/TestPatterRideBuilder.java rename to application/src/test/java/org/opentripplanner/raptor/_data/multicriteria/ride/TestPatterRideBuilder.java diff --git a/src/test/java/org/opentripplanner/raptor/_data/stoparrival/AbstractStopArrival.java b/application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/AbstractStopArrival.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/_data/stoparrival/AbstractStopArrival.java rename to application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/AbstractStopArrival.java diff --git a/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Access.java b/application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Access.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/_data/stoparrival/Access.java rename to application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Access.java diff --git a/src/test/java/org/opentripplanner/raptor/_data/stoparrival/BasicPathTestCase.java b/application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/BasicPathTestCase.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/_data/stoparrival/BasicPathTestCase.java rename to application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/BasicPathTestCase.java diff --git a/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Egress.java b/application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Egress.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/_data/stoparrival/Egress.java rename to application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Egress.java diff --git a/src/test/java/org/opentripplanner/raptor/_data/stoparrival/FlexAccessAndEgressPathTestCase.java b/application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/FlexAccessAndEgressPathTestCase.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/_data/stoparrival/FlexAccessAndEgressPathTestCase.java rename to application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/FlexAccessAndEgressPathTestCase.java diff --git a/src/test/java/org/opentripplanner/raptor/_data/stoparrival/TestArrivals.java b/application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/TestArrivals.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/_data/stoparrival/TestArrivals.java rename to application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/TestArrivals.java diff --git a/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Transfer.java b/application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Transfer.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/_data/stoparrival/Transfer.java rename to application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Transfer.java diff --git a/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Transit.java b/application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Transit.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/_data/stoparrival/Transit.java rename to application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Transit.java diff --git a/src/test/java/org/opentripplanner/raptor/_data/transit/TestAccessEgress.java b/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestAccessEgress.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/_data/transit/TestAccessEgress.java rename to application/src/test/java/org/opentripplanner/raptor/_data/transit/TestAccessEgress.java diff --git a/src/test/java/org/opentripplanner/raptor/_data/transit/TestConstrainedBoardingSearch.java b/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestConstrainedBoardingSearch.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/_data/transit/TestConstrainedBoardingSearch.java rename to application/src/test/java/org/opentripplanner/raptor/_data/transit/TestConstrainedBoardingSearch.java diff --git a/src/test/java/org/opentripplanner/raptor/_data/transit/TestConstrainedTransfer.java b/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestConstrainedTransfer.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/_data/transit/TestConstrainedTransfer.java rename to application/src/test/java/org/opentripplanner/raptor/_data/transit/TestConstrainedTransfer.java diff --git a/src/test/java/org/opentripplanner/raptor/_data/transit/TestRoute.java b/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestRoute.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/_data/transit/TestRoute.java rename to application/src/test/java/org/opentripplanner/raptor/_data/transit/TestRoute.java diff --git a/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransfer.java b/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransfer.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/_data/transit/TestTransfer.java rename to application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransfer.java diff --git a/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransferPoint.java b/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransferPoint.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/_data/transit/TestTransferPoint.java rename to application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransferPoint.java diff --git a/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransitData.java b/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransitData.java similarity index 99% rename from src/test/java/org/opentripplanner/raptor/_data/transit/TestTransitData.java rename to application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransitData.java index 97ad09e3bfd..4f225106ba2 100644 --- a/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransitData.java +++ b/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransitData.java @@ -10,15 +10,14 @@ import java.util.Iterator; import java.util.List; import java.util.Set; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.model.transfer.ConstrainedTransfer; import org.opentripplanner.model.transfer.TransferConstraint; import org.opentripplanner.raptor._data.RaptorTestConstants; import org.opentripplanner.raptor.api.model.RaptorConstrainedTransfer; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; import org.opentripplanner.raptor.api.model.RaptorTransfer; import org.opentripplanner.raptor.api.model.RaptorTripPattern; -import org.opentripplanner.raptor.api.path.RaptorStopNameResolver; import org.opentripplanner.raptor.api.request.RaptorRequestBuilder; import org.opentripplanner.raptor.rangeraptor.SystemErrDebugLogger; import org.opentripplanner.raptor.spi.DefaultSlackProvider; @@ -151,7 +150,6 @@ public RaptorConstrainedTransfer findConstrainedTransfer( }; } - @Nonnull @Override public RaptorStopNameResolver stopNameResolver() { // Index is translated: 1->'A', 2->'B', 3->'C' ... diff --git a/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripPattern.java b/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripPattern.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/_data/transit/TestTripPattern.java rename to application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripPattern.java diff --git a/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripSchedule.java b/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripSchedule.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/_data/transit/TestTripSchedule.java rename to application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripSchedule.java diff --git a/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripSearchTimetable.java b/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripSearchTimetable.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/_data/transit/TestTripSearchTimetable.java rename to application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripSearchTimetable.java diff --git a/src/test/java/org/opentripplanner/raptor/api/model/GeneralizedCostRelaxFunctionTest.java b/application/src/test/java/org/opentripplanner/raptor/api/model/GeneralizedCostRelaxFunctionTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/api/model/GeneralizedCostRelaxFunctionTest.java rename to application/src/test/java/org/opentripplanner/raptor/api/model/GeneralizedCostRelaxFunctionTest.java diff --git a/src/test/java/org/opentripplanner/raptor/api/path/PathTest.java b/application/src/test/java/org/opentripplanner/raptor/api/path/PathTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/api/path/PathTest.java rename to application/src/test/java/org/opentripplanner/raptor/api/path/PathTest.java diff --git a/src/test/java/org/opentripplanner/raptor/api/path/RaptorPathTest.java b/application/src/test/java/org/opentripplanner/raptor/api/path/RaptorPathTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/api/path/RaptorPathTest.java rename to application/src/test/java/org/opentripplanner/raptor/api/path/RaptorPathTest.java diff --git a/src/test/java/org/opentripplanner/raptor/api/request/MultiCriteriaRequestTest.java b/application/src/test/java/org/opentripplanner/raptor/api/request/MultiCriteriaRequestTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/api/request/MultiCriteriaRequestTest.java rename to application/src/test/java/org/opentripplanner/raptor/api/request/MultiCriteriaRequestTest.java diff --git a/src/test/java/org/opentripplanner/raptor/api/request/PassThroughPointTest.java b/application/src/test/java/org/opentripplanner/raptor/api/request/PassThroughPointTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/api/request/PassThroughPointTest.java rename to application/src/test/java/org/opentripplanner/raptor/api/request/PassThroughPointTest.java diff --git a/src/test/java/org/opentripplanner/raptor/api/request/RaptorRequestTest.java b/application/src/test/java/org/opentripplanner/raptor/api/request/RaptorRequestTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/api/request/RaptorRequestTest.java rename to application/src/test/java/org/opentripplanner/raptor/api/request/RaptorRequestTest.java diff --git a/src/test/java/org/opentripplanner/raptor/api/request/SearchParamsTest.java b/application/src/test/java/org/opentripplanner/raptor/api/request/SearchParamsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/api/request/SearchParamsTest.java rename to application/src/test/java/org/opentripplanner/raptor/api/request/SearchParamsTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/api/request/ViaLocationTest.java b/application/src/test/java/org/opentripplanner/raptor/api/request/ViaLocationTest.java new file mode 100644 index 00000000000..2aca0845ff8 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/raptor/api/request/ViaLocationTest.java @@ -0,0 +1,251 @@ +package org.opentripplanner.raptor.api.request; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.time.Duration; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.opentripplanner.raptor._data.transit.TestTransfer; +import org.opentripplanner.raptor.api.model.RaptorConstants; +import org.opentripplanner.raptor.api.model.RaptorTransfer; + +class ViaLocationTest { + + private static final int STOP_A = 12; + private static final int STOP_B = 13; + private static final int STOP_C = 14; + private static final Duration WAIT_TIME = Duration.ofMinutes(3); + private static final int WAIT_TIME_SEC = (int) WAIT_TIME.toSeconds(); + private static final int C1 = 200; + private static final int TX_DURATION = 35; + private static final RaptorTransfer TX = new TestTransfer(STOP_B, TX_DURATION, C1); + + @Test + void passThroughStop() { + var subject = RaptorViaLocation.allowPassThrough("PassThrough A").addViaStop(STOP_C).build(); + + assertEquals("PassThrough A", subject.label()); + assertTrue(subject.allowPassThrough()); + assertEquals(RaptorConstants.ZERO, subject.minimumWaitTime()); + assertEquals( + "Via{label: PassThrough A, allowPassThrough, connections: [C]}", + subject.toString(ViaLocationTest::stopName) + ); + assertEquals( + "Via{label: PassThrough A, allowPassThrough, connections: [14]}", + subject.toString() + ); + + assertEquals(1, subject.connections().size()); + + var c = subject.connections().getFirst(); + assertEquals(STOP_C, c.fromStop()); + assertEquals(STOP_C, c.toStop()); + assertTrue(c.isSameStop()); + Assertions.assertEquals(RaptorConstants.ZERO, c.durationInSeconds()); + assertEquals(RaptorConstants.ZERO, c.c1()); + } + + @Test + void viaSingleStop() { + var subject = RaptorViaLocation.via("Tx A").addViaStop(STOP_B).build(); + + assertEquals("Tx A", subject.label()); + assertFalse(subject.allowPassThrough()); + assertEquals(RaptorConstants.ZERO, subject.minimumWaitTime()); + assertEquals("Via{label: Tx A, connections: [B]}", subject.toString(ViaLocationTest::stopName)); + assertEquals("Via{label: Tx A, connections: [13]}", subject.toString()); + assertEquals(1, subject.connections().size()); + + var connection = subject.connections().getFirst(); + assertEquals(STOP_B, connection.fromStop()); + assertEquals(STOP_B, connection.toStop()); + assertTrue(connection.isSameStop()); + Assertions.assertEquals(RaptorConstants.ZERO, connection.durationInSeconds()); + assertEquals(RaptorConstants.ZERO, connection.c1()); + } + + @Test + void testCombinationOfPassThroughAndTransfer() { + var subject = RaptorViaLocation + .allowPassThrough("PassThrough A") + .addViaStop(STOP_C) + .addViaTransfer(STOP_A, TX) + .build(); + + assertEquals("PassThrough A", subject.label()); + assertTrue(subject.allowPassThrough()); + assertEquals(RaptorConstants.ZERO, subject.minimumWaitTime()); + assertEquals( + "Via{label: PassThrough A, allowPassThrough, connections: [C, A~B 35s]}", + subject.toString(ViaLocationTest::stopName) + ); + assertEquals(2, subject.connections().size()); + + var c = subject.connections().getFirst(); + assertEquals(STOP_C, c.fromStop()); + assertEquals(STOP_C, c.toStop()); + assertTrue(c.isSameStop()); + Assertions.assertEquals(RaptorConstants.ZERO, c.durationInSeconds()); + assertEquals(RaptorConstants.ZERO, c.c1()); + + c = subject.connections().getLast(); + assertEquals(STOP_A, c.fromStop()); + assertEquals(STOP_B, c.toStop()); + assertFalse(c.isSameStop()); + Assertions.assertEquals(TX_DURATION, c.durationInSeconds()); + assertEquals(C1, c.c1()); + } + + @Test + void viaStopAorCWithWaitTime() { + var subject = RaptorViaLocation + .via("Plaza", WAIT_TIME) + .addViaStop(STOP_C) + .addViaTransfer(STOP_A, TX) + .build(); + + assertEquals("Plaza", subject.label()); + assertFalse(subject.allowPassThrough()); + assertEquals(WAIT_TIME_SEC, subject.minimumWaitTime()); + assertEquals( + "Via{label: Plaza, minWaitTime: 3m, connections: [C 3m, A~B 3m35s]}", + subject.toString(ViaLocationTest::stopName) + ); + assertEquals(2, subject.connections().size()); + + var connection = subject.connections().getFirst(); + assertEquals(STOP_C, connection.fromStop()); + assertEquals(STOP_C, connection.toStop()); + assertTrue(connection.isSameStop()); + Assertions.assertEquals(WAIT_TIME_SEC, connection.durationInSeconds()); + assertEquals(RaptorConstants.ZERO, connection.c1()); + + connection = subject.connections().getLast(); + assertEquals(STOP_A, connection.fromStop()); + assertEquals(STOP_B, connection.toStop()); + assertFalse(connection.isSameStop()); + Assertions.assertEquals(WAIT_TIME_SEC + TX.durationInSeconds(), connection.durationInSeconds()); + assertEquals(C1, connection.c1()); + } + + static List isBetterThanTestCases() { + // Subject is: STOP_A, STOP_B, MIN_DURATION, C1 + return List.of( + Arguments.of(STOP_A, STOP_B, TX_DURATION, C1, true, "Same"), + Arguments.of(STOP_C, STOP_B, TX_DURATION, C1, false, "toStop differ"), + Arguments.of(STOP_A, STOP_C, TX_DURATION, C1, false, "fromStop differ"), + Arguments.of(STOP_A, STOP_B, TX_DURATION + 1, C1, true, "Wait time is better"), + Arguments.of(STOP_A, STOP_B, TX_DURATION - 1, C1, false, "Wait time is worse"), + Arguments.of(STOP_A, STOP_B, TX_DURATION, C1 + 1, true, "C1 is better"), + Arguments.of(STOP_A, STOP_B, TX_DURATION, C1 - 1, false, "C1 is worse") + ); + } + + @ParameterizedTest + @MethodSource("isBetterThanTestCases") + void isBetterThan( + int fromStop, + int toStop, + int minWaitTime, + int c1, + boolean expected, + String description + ) { + var subject = RaptorViaLocation + .via("Subject") + .addViaTransfer(STOP_A, new TestTransfer(STOP_B, TX_DURATION, C1)) + .build() + .connections() + .getFirst(); + + var candidate = RaptorViaLocation + .via("Candidate") + .addViaTransfer(fromStop, new TestTransfer(toStop, minWaitTime, c1)) + .build() + .connections() + .getFirst(); + + assertEquals(subject.isBetterOrEqual(candidate), expected, description); + } + + @Test + void throwsExceptionIfConnectionsIsNotParetoOptimal() { + var e = assertThrows( + IllegalArgumentException.class, + () -> + RaptorViaLocation + .via("S") + .addViaTransfer(STOP_A, new TestTransfer(STOP_B, TX_DURATION, C1)) + .addViaTransfer(STOP_A, new TestTransfer(STOP_B, TX_DURATION, C1)) + .build() + ); + assertEquals( + "All connection need to be pareto-optimal: (12~13 35s) <-> (12~13 35s)", + e.getMessage() + ); + } + + @Test + void testEqualsAndHashCode() { + var subject = RaptorViaLocation.via(null).addViaTransfer(STOP_A, TX).build(); + var same = RaptorViaLocation.via(null).addViaTransfer(STOP_A, TX).build(); + // Slightly less wait-time and slightly larger cost(c1) + var other = RaptorViaLocation + .via(null, Duration.ofSeconds(1)) + .addViaTransfer(STOP_A, TX) + .build(); + + assertEquals(subject, same); + assertNotEquals(subject, other); + assertNotEquals(subject, "Does not match another type"); + + assertEquals(subject.hashCode(), same.hashCode()); + assertNotEquals(subject.hashCode(), other.hashCode()); + } + + @Test + void testToString() { + var subject = RaptorViaLocation.via("A|B").addViaStop(STOP_A).addViaStop(STOP_B).build(); + assertEquals("Via{label: A|B, connections: [12, 13]}", subject.toString()); + assertEquals( + "Via{label: A|B, connections: [A, B]}", + subject.toString(ViaLocationTest::stopName) + ); + + subject = RaptorViaLocation.via(null, WAIT_TIME).addViaStop(STOP_B).build(); + assertEquals("Via{minWaitTime: 3m, connections: [13 3m]}", subject.toString()); + assertEquals( + "Via{minWaitTime: 3m, connections: [B 3m]}", + subject.toString(ViaLocationTest::stopName) + ); + + subject = RaptorViaLocation.via(null).addViaTransfer(STOP_A, TX).build(); + assertEquals("Via{connections: [12~13 35s]}", subject.toString()); + assertEquals("Via{connections: [A~B 35s]}", subject.toString(ViaLocationTest::stopName)); + + subject = RaptorViaLocation.allowPassThrough(null).addViaStop(STOP_C).build(); + assertEquals("Via{allowPassThrough, connections: [14]}", subject.toString()); + assertEquals( + "Via{allowPassThrough, connections: [C]}", + subject.toString(ViaLocationTest::stopName) + ); + } + + private static String stopName(int i) { + return switch (i) { + case 12 -> "A"; + case 13 -> "B"; + case 14 -> "C"; + default -> throw new IllegalArgumentException("Unknown stop: " + i); + }; + } +} diff --git a/src/test/java/org/opentripplanner/raptor/api/view/BoardAndAlightTimeTest.java b/application/src/test/java/org/opentripplanner/raptor/api/view/BoardAndAlightTimeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/api/view/BoardAndAlightTimeTest.java rename to application/src/test/java/org/opentripplanner/raptor/api/view/BoardAndAlightTimeTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/A01_SingleRouteTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/A01_SingleRouteTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/A01_SingleRouteTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/A01_SingleRouteTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/A04_BoardingTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/A04_BoardingTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/A04_BoardingTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/A04_BoardingTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/B01_AccessTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/B01_AccessTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/B01_AccessTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/B01_AccessTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/B02_EgressTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/B02_EgressTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/B02_EgressTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/B02_EgressTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/B03_AccessEgressTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/B03_AccessEgressTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/B03_AccessEgressTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/B03_AccessEgressTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/B04_AccessEgressBoardingTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/B04_AccessEgressBoardingTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/B04_AccessEgressBoardingTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/B04_AccessEgressBoardingTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/B05_EgressStopBoardAlightTransferCostTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/B05_EgressStopBoardAlightTransferCostTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/B05_EgressStopBoardAlightTransferCostTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/B05_EgressStopBoardAlightTransferCostTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/C01_TransferBoardAndAlightSlackTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/C01_TransferBoardAndAlightSlackTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/C01_TransferBoardAndAlightSlackTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/C01_TransferBoardAndAlightSlackTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/C02_OnStreetTransfersTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/C02_OnStreetTransfersTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/C02_OnStreetTransfersTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/C02_OnStreetTransfersTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/C03_OnBoardArrivalDominateTransfersTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/C03_OnBoardArrivalDominateTransfersTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/C03_OnBoardArrivalDominateTransfersTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/C03_OnBoardArrivalDominateTransfersTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/D01_SingeRouteBoardAlightRestrictionsTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/D01_SingeRouteBoardAlightRestrictionsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/D01_SingeRouteBoardAlightRestrictionsTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/D01_SingeRouteBoardAlightRestrictionsTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/D02_TransitModeReluctanceTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/D02_TransitModeReluctanceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/D02_TransitModeReluctanceTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/D02_TransitModeReluctanceTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/D03_UnpreferredRouteTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/D03_UnpreferredRouteTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/D03_UnpreferredRouteTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/D03_UnpreferredRouteTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/E01_StaySeatedTransferTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/E01_StaySeatedTransferTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/E01_StaySeatedTransferTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/E01_StaySeatedTransferTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/E02_GuaranteedWalkTransferTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/E02_GuaranteedWalkTransferTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/E02_GuaranteedWalkTransferTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/E02_GuaranteedWalkTransferTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/E03_NotAllowedConstrainedTransferTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/E03_NotAllowedConstrainedTransferTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/E03_NotAllowedConstrainedTransferTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/E03_NotAllowedConstrainedTransferTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/F01_AccessWithRidesTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/F01_AccessWithRidesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/F01_AccessWithRidesTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/F01_AccessWithRidesTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/F02_EgressWithRidesTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/F02_EgressWithRidesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/F02_EgressWithRidesTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/F02_EgressWithRidesTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/F03_AccessEgressWithRidesBoardAndAlightSlackTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/F03_AccessEgressWithRidesBoardAndAlightSlackTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/F03_AccessEgressWithRidesBoardAndAlightSlackTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/F03_AccessEgressWithRidesBoardAndAlightSlackTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/F04_AccessEgressWithRidesNoTransitTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/F04_AccessEgressWithRidesNoTransitTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/F04_AccessEgressWithRidesNoTransitTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/F04_AccessEgressWithRidesNoTransitTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/F05_OnBoardAccessEgressAndTransfersTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/F05_OnBoardAccessEgressAndTransfersTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/F05_OnBoardAccessEgressAndTransfersTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/F05_OnBoardAccessEgressAndTransfersTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/F11_AccessWithRidesMultipleOptimalPathsTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/F11_AccessWithRidesMultipleOptimalPathsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/F11_AccessWithRidesMultipleOptimalPathsTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/F11_AccessWithRidesMultipleOptimalPathsTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/F12_EgressWithRidesMultipleOptimalPathsTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/F12_EgressWithRidesMultipleOptimalPathsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/F12_EgressWithRidesMultipleOptimalPathsTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/F12_EgressWithRidesMultipleOptimalPathsTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/G01_AccessWithOpeningHoursTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/G01_AccessWithOpeningHoursTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/G01_AccessWithOpeningHoursTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/G01_AccessWithOpeningHoursTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/G02_EgressWithOpeningHoursTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/G02_EgressWithOpeningHoursTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/G02_EgressWithOpeningHoursTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/G02_EgressWithOpeningHoursTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/G03_AccessWithOpeningHoursMultipleOptionsTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/G03_AccessWithOpeningHoursMultipleOptionsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/G03_AccessWithOpeningHoursMultipleOptionsTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/G03_AccessWithOpeningHoursMultipleOptionsTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/G04_EgressWithOpeningHoursMultipleOptionsTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/G04_EgressWithOpeningHoursMultipleOptionsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/G04_EgressWithOpeningHoursMultipleOptionsTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/G04_EgressWithOpeningHoursMultipleOptionsTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/G05_ClosedAccessOpeningHoursTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/G05_ClosedAccessOpeningHoursTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/G05_ClosedAccessOpeningHoursTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/G05_ClosedAccessOpeningHoursTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/G06_ClosedEgressOpeningHoursTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/G06_ClosedEgressOpeningHoursTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/G06_ClosedEgressOpeningHoursTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/G06_ClosedEgressOpeningHoursTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/H11_GuaranteedTransferWithFlexAccessTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/H11_GuaranteedTransferWithFlexAccessTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/H11_GuaranteedTransferWithFlexAccessTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/H11_GuaranteedTransferWithFlexAccessTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/I01_HeuristicTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/I01_HeuristicTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/I01_HeuristicTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/I01_HeuristicTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/J01_PassThroughTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/J01_PassThroughTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/J01_PassThroughTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/J01_PassThroughTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/J02_ViaSearchTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/J02_ViaSearchTest.java new file mode 100644 index 00000000000..581cd117cb1 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/raptor/moduletests/J02_ViaSearchTest.java @@ -0,0 +1,376 @@ +package org.opentripplanner.raptor.moduletests; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.opentripplanner.model.plan.PlanTestConstants.D2m; +import static org.opentripplanner.raptor._data.RaptorTestConstants.D1m; +import static org.opentripplanner.raptor._data.RaptorTestConstants.D30s; +import static org.opentripplanner.raptor._data.RaptorTestConstants.STOP_A; +import static org.opentripplanner.raptor._data.RaptorTestConstants.STOP_B; +import static org.opentripplanner.raptor._data.RaptorTestConstants.STOP_C; +import static org.opentripplanner.raptor._data.RaptorTestConstants.STOP_D; +import static org.opentripplanner.raptor._data.RaptorTestConstants.STOP_E; +import static org.opentripplanner.raptor._data.RaptorTestConstants.STOP_F; +import static org.opentripplanner.raptor._data.RaptorTestConstants.T00_00; +import static org.opentripplanner.raptor._data.RaptorTestConstants.T01_00; +import static org.opentripplanner.raptor._data.api.PathUtils.pathsToString; +import static org.opentripplanner.raptor._data.transit.TestAccessEgress.walk; +import static org.opentripplanner.raptor._data.transit.TestRoute.route; +import static org.opentripplanner.raptor._data.transit.TestTransfer.transfer; +import static org.opentripplanner.raptor._data.transit.TestTripSchedule.schedule; +import static org.opentripplanner.raptor.api.request.RaptorViaLocation.via; + +import java.time.Duration; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.opentripplanner.raptor.RaptorService; +import org.opentripplanner.raptor._data.api.PathUtils; +import org.opentripplanner.raptor._data.transit.TestTransitData; +import org.opentripplanner.raptor._data.transit.TestTripSchedule; +import org.opentripplanner.raptor.api.request.RaptorProfile; +import org.opentripplanner.raptor.api.request.RaptorRequestBuilder; +import org.opentripplanner.raptor.api.request.RaptorViaLocation; +import org.opentripplanner.raptor.configure.RaptorConfig; + +/** + * FEATURE UNDER TEST + * + * Raptor should be able to handle route request with one or more via locations. + * If a stop is specified as via location in the request, then all the results returned + * from raptor should include the stop. The stop should be a alight, board or intermediate + * stop of one of the trips in the path. + * + * It should be possible to specify more than one connection. The result should include the + * via locations in the order as they were specified in the request. Only alternatives that pass + * through all via locations should be included in the result. + * + * To support stations and other collections of stops, Raptor should also support multiple via + * connections in one via location. + */ +class J02_ViaSearchTest { + + static final List VIA_LOCATION_STOP_B = List.of(viaLocation("B", STOP_B)); + static final List VIA_LOCATION_STOP_C = List.of(viaLocation("C", STOP_C)); + static final List VIA_LOCATION_STOP_A_OR_B = List.of( + viaLocation("B&C", STOP_A, STOP_B) + ); + + static final List VIA_LOCATION_STOP_B_THEN_D = List.of( + viaLocation("B", STOP_B), + viaLocation("D", STOP_D) + ); + static final List VIA_LOCATION_STOP_C_THEN_B = List.of( + viaLocation("B", STOP_C), + viaLocation("D", STOP_B) + ); + + private final RaptorService raptorService = new RaptorService<>( + RaptorConfig.defaultConfigForTest() + ); + + private RaptorRequestBuilder prepareRequest() { + var builder = new RaptorRequestBuilder(); + + builder + .profile(RaptorProfile.MULTI_CRITERIA) + // TODO: 2023-07-24 Currently heuristics does not work with pass-through so we + // have to turn them off. Make sure to re-enable optimization later when it's fixed + .clearOptimizations(); + + builder + .searchParams() + .earliestDepartureTime(T00_00) + .latestArrivalTime(T01_00) + .searchWindow(Duration.ofMinutes(10)) + .timetable(true); + + return builder; + } + + @Test + @DisplayName( + "Basic via search with just one route. You should be forced to get off the " + + "first trip and wait for the next one at the specified via stop." + ) + void viaSearchAlightingAtViaStop() { + var data = new TestTransitData(); + + data.withRoutes( + route("R1", STOP_A, STOP_B, STOP_C, STOP_D) + .withTimetable(schedule("0:02 0:10 0:20 0:30"), schedule("0:12 0:20 0:30 0:40")) + ); + + var requestBuilder = prepareRequest(); + + requestBuilder + .searchParams() + .addAccessPaths(walk(STOP_A, D30s)) + .addViaLocation(via("C").addViaStop(STOP_C).build()) + .addEgressPaths(walk(STOP_D, D30s)); + + var result = raptorService.route(requestBuilder.build(), data); + + // Verify that we alight the first trip at stop C and board the second trip + assertEquals( + "Walk 30s ~ A ~ BUS R1 0:02 0:20 ~ C ~ BUS R1 0:30 0:40 ~ D ~ Walk 30s [0:01:30 0:40:30 39m Tₓ1 C₁3_600]", + pathsToString(result) + ); + } + + @Test + @DisplayName( + "Basic via search with just two routes. You should be forced to get off the first route, " + + "then transfer and BOARD the second trip at the specified via stop. This test that via works " + + "at the boarding stop. We will add better options for the transfer to see that the given via " + + "stop is used over the alternatives." + ) + void viaSearchArrivingByTransferAtViaStop() { + var data = new TestTransitData(); + + data + .withRoutes( + route("R1", STOP_A, STOP_B, STOP_D, STOP_E).withTimetable(schedule("0:02 0:10 0:20 0:30")), + route("R2", STOP_C, STOP_D, STOP_E).withTimetable(schedule("0:25 0:30 0:40")) + ) + // Walk 1 minute to transfer from D to C - this is the only way to visit stop C + .withTransfer(STOP_D, transfer(STOP_C, D1m)); + + var requestBuilder = prepareRequest(); + + requestBuilder + .searchParams() + .addAccessPaths(walk(STOP_A, D30s)) + .addViaLocation(via("C").addViaStop(STOP_C).build()) + .addEgressPaths(walk(STOP_E, D30s)); + + var result = raptorService.route(requestBuilder.build(), data); + + // Verify that we alight the first trip at stop C and board the second trip + assertEquals( + "Walk 30s ~ A ~ BUS R1 0:02 0:20 ~ D ~ Walk 1m ~ C ~ BUS R2 0:25 0:40 ~ E ~ Walk 30s " + + "[0:01:30 0:40:30 39m Tₓ1 C₁3_660]", + pathsToString(result) + ); + } + + @Test + @DisplayName( + "Via stop as the first stop in the journey - only the access will be used for the first " + + "part, no transit. Access arrival should be copied over to 'next' worker." + ) + void accessWalkToViaStopWithoutTransit() { + var data = new TestTransitData(); + + data.withRoutes( + route("R1", STOP_A, STOP_B, STOP_C, STOP_D) + .withTimetable( + schedule("0:02 0:05 0:10 0:15"), + // We add another trip to allow riding trip one - via B - then ride trip two, this + // is not a pareto-optimal solution and should only appear if there is something wrong. + schedule("0:12 0:15 0:20 0:25") + ) + ); + + var requestBuilder = prepareRequest(); + + // We will add access to A, B, and C, but since the B stop is the via point we expect that to + // be used + requestBuilder + .searchParams() + .addViaLocations(VIA_LOCATION_STOP_B) + // We allow access to A, B, and C - if the via search works as expected, only access to B + // should be used - access to A would require an extra transfer; C has no valid paths. + .addAccessPaths(walk(STOP_A, D30s)) + .addAccessPaths(walk(STOP_B, D30s)) + .addAccessPaths(walk(STOP_C, D30s)) + .addEgressPaths(walk(STOP_D, D30s)); + + // Verify that the journey start by walking to the via stop, the uses one trip to the destination. + // A combination of trip one and two with a transfer is not expected. + assertEquals( + PathUtils.join( + "Walk 30s ~ B ~ BUS R1 0:05 0:15 ~ D ~ Walk 30s [0:04:30 0:15:30 11m Tₓ0 C₁1_320]", + "Walk 30s ~ B ~ BUS R1 0:15 0:25 ~ D ~ Walk 30s [0:14:30 0:25:30 11m Tₓ0 C₁1_320]" + ), + pathsToString(raptorService.route(requestBuilder.build(), data)) + ); + } + + @Test + @DisplayName( + "Via stop as the last stop in the journey - only the egress will be used for the last " + + "part, no transit. The transit arrival at the via stop should be copied over to the " + + "next worker and then this should be used to add the egress - without any transfers or" + + "more transit." + ) + void transitToViaStopThenTakeEgressWalkToDestination() { + var data = new TestTransitData(); + + data.withRoutes( + route("R1", STOP_A, STOP_B, STOP_C, STOP_D) + .withTimetable( + schedule("0:02 0:05 0:10 0:20"), + // We add another trip to check that we do not transfer to the other trip at some point. + schedule("0:12 0:15 0:20 0:25") + ) + ); + + var requestBuilder = prepareRequest(); + + // We will add access to A, B, and C, but since the B stop is the via point we expect that to + // be used + requestBuilder + .searchParams() + .addAccessPaths(walk(STOP_A, D30s)) + .addViaLocations(VIA_LOCATION_STOP_C) + // We allow egress from B, C, and D - if the via search works as expected, only egress from C + // should be used - egress from B has not visited via stop C, and egress from stop D would + // require a transfer at stop C to visit the via stop - this is not an optimal path. + .addEgressPaths(walk(STOP_B, D30s)) + .addEgressPaths(walk(STOP_C, D30s)) + .addEgressPaths(walk(STOP_D, D30s)); + + assertEquals( + PathUtils.join( + "Walk 30s ~ A ~ BUS R1 0:02 0:10 ~ C ~ Walk 30s [0:01:30 0:10:30 9m Tₓ0 C₁1_200]", + "Walk 30s ~ A ~ BUS R1 0:12 0:20 ~ C ~ Walk 30s [0:11:30 0:20:30 9m Tₓ0 C₁1_200]" + ), + pathsToString(raptorService.route(requestBuilder.build(), data)) + ); + } + + @Test + @DisplayName("Multiple via points") + void multipleViaPoints() { + var data = new TestTransitData(); + + // Create two routes. + // The first one includes one via stop point. + // The second one includes the second via point. + // Both arrive at the desired destination, so normally there should not be any transfers. + data.withRoutes( + route("R2", STOP_A, STOP_B, STOP_C, STOP_D, STOP_E, STOP_F) + .withTimetable( + schedule("0:02 0:05 0:10 0:15 0:20 0:25"), + schedule("0:12 0:15 0:20 0:25 0:30 0:35"), + schedule("0:22 0:25 0:30 0:35 0:40 0:45") + ) + ); + + data.mcCostParamsBuilder().transferCost(100); + + var requestBuilder = prepareRequest(); + + requestBuilder + .searchParams() + .addAccessPaths(walk(STOP_A, D30s)) + .addViaLocations(VIA_LOCATION_STOP_B_THEN_D) + .addEgressPaths(walk(STOP_F, D30s)); + + // Verify that both via points are included + assertEquals( + "Walk 30s ~ A " + + "~ BUS R2 0:02 0:05 ~ B " + + "~ BUS R2 0:15 0:25 ~ D " + + "~ BUS R2 0:35 0:45 ~ F " + + "~ Walk 30s " + + "[0:01:30 0:45:30 44m Tₓ2 C₁4_700]", + pathsToString(raptorService.route(requestBuilder.build(), data)) + ); + } + + @Test + @DisplayName("Multiple via points works with circular lines, visit stop C than stop B") + void viaSearchWithCircularLine() { + var data = new TestTransitData(); + + data.withRoute( + route("R1", STOP_A, STOP_B, STOP_C, STOP_B, STOP_C, STOP_B, STOP_C, STOP_B, STOP_D) + .withTimetable(schedule("0:05 0:10 0:15 0:20 0:25 0:30 0:35 0:40 0:45")) + ); + + var requestBuilder = prepareRequest(); + + requestBuilder + .searchParams() + .addAccessPaths(walk(STOP_A, D30s)) + .addViaLocations(VIA_LOCATION_STOP_C_THEN_B) + .addEgressPaths(walk(STOP_D, D30s)); + + assertEquals( + "Walk 30s ~ A " + + "~ BUS R1 0:05 0:15 ~ C " + + "~ BUS R1 0:25 0:30 ~ B " + + "~ BUS R1 0:40 0:45 ~ D " + + "~ Walk 30s " + + "[0:04:30 0:45:30 41m Tₓ2 C₁4_320]", + pathsToString(raptorService.route(requestBuilder.build(), data)) + ); + } + + @Test + @DisplayName("Multiple stops in the same via location") + void testViaSearchWithManyStopsInTheViaLocation() { + var data = new TestTransitData(); + + data.withRoutes( + route("R1", STOP_A, STOP_C).withTimetable(schedule("0:04 0:15")), + route("R2", STOP_B, STOP_C).withTimetable(schedule("0:05 0:14")) + ); + + var requestBuilder = prepareRequest(); + + requestBuilder + .searchParams() + .addAccessPaths(walk(STOP_A, D30s)) + .addAccessPaths(walk(STOP_B, D2m)) + .addViaLocations(VIA_LOCATION_STOP_A_OR_B) + .addEgressPaths(walk(STOP_C, D30s)); + + // Both routes are pareto optimal. + // Route 2 is faster, but it contains more walking + // Verify that both routes are included as a valid result + assertEquals( + PathUtils.join( + "Walk 2m ~ B ~ BUS R2 0:05 0:14 ~ C ~ Walk 30s [0:03 0:14:30 11m30s Tₓ0 C₁1_440]", + "Walk 30s ~ A ~ BUS R1 0:04 0:15 ~ C ~ Walk 30s [0:03:30 0:15:30 12m Tₓ0 C₁1_380]" + ), + pathsToString(raptorService.route(requestBuilder.build(), data)) + ); + } + + @Test + @DisplayName("Test minimum wait time") + void testMinWaitTime() { + var data = new TestTransitData(); + data.withRoutes( + route("R1", STOP_A, STOP_B).withTimetable(schedule("0:02:00 0:04:00")), + route("R2", STOP_B, STOP_C) + .withTimetable(schedule("0:05:44 0:10"), schedule("0:05:45 0:11"), schedule("0:05:46 0:12")) + ); + + var requestBuilder = prepareRequest(); + var minWaitTime = Duration.ofSeconds(45); + + requestBuilder + .searchParams() + .addAccessPaths(walk(STOP_A, D30s)) + .addViaLocations(List.of(RaptorViaLocation.via("B", minWaitTime).addViaStop(STOP_B).build())) + .addEgressPaths(walk(STOP_C, D30s)); + + // We expect to bard the second trip at 0:05:45, since the minWaitTime is 45s and the + // transfer slack is 60s. + assertEquals( + "Walk 30s ~ A ~ BUS R1 0:02 0:04 ~ B ~ BUS R2 0:05:45 0:11 ~ C ~ Walk 30s " + + "[0:01:30 0:11:30 10m Tₓ1 C₁1_860]", + pathsToString(raptorService.route(requestBuilder.build(), data)) + ); + } + + private static RaptorViaLocation viaLocation(String label, int... stops) { + var builder = RaptorViaLocation.via(label); + Arrays.stream(stops).forEach(builder::addViaStop); + return builder.build(); + } +} diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/K01_TransitPriorityTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/K01_TransitPriorityTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/K01_TransitPriorityTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/K01_TransitPriorityTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/K02_TransitPriorityDestinationTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/K02_TransitPriorityDestinationTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/K02_TransitPriorityDestinationTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/K02_TransitPriorityDestinationTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/L01_TimePenaltyAccessTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/L01_TimePenaltyAccessTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/L01_TimePenaltyAccessTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/L01_TimePenaltyAccessTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/L01_TimePenaltyEgressTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/L01_TimePenaltyEgressTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/L01_TimePenaltyEgressTest.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/L01_TimePenaltyEgressTest.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/images/F11.svg b/application/src/test/java/org/opentripplanner/raptor/moduletests/images/F11.svg similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/images/F11.svg rename to application/src/test/java/org/opentripplanner/raptor/moduletests/images/F11.svg diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/images/F12.svg b/application/src/test/java/org/opentripplanner/raptor/moduletests/images/F12.svg similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/images/F12.svg rename to application/src/test/java/org/opentripplanner/raptor/moduletests/images/F12.svg diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/images/Samples.excalidraw b/application/src/test/java/org/opentripplanner/raptor/moduletests/images/Samples.excalidraw similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/images/Samples.excalidraw rename to application/src/test/java/org/opentripplanner/raptor/moduletests/images/Samples.excalidraw diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/package-info.md b/application/src/test/java/org/opentripplanner/raptor/moduletests/package-info.md similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/package-info.md rename to application/src/test/java/org/opentripplanner/raptor/moduletests/package-info.md diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/support/ExpectedList.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/support/ExpectedList.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/support/ExpectedList.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/support/ExpectedList.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/support/ModuleTestDebugLogging.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/support/ModuleTestDebugLogging.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/support/ModuleTestDebugLogging.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/support/ModuleTestDebugLogging.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestCase.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestCase.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestCase.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestCase.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestCaseFactory.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestCaseFactory.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestCaseFactory.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestCaseFactory.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestConfig.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestConfig.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestConfig.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestConfig.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestConfigSetBuilder.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestConfigSetBuilder.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestConfigSetBuilder.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestConfigSetBuilder.java diff --git a/src/test/java/org/opentripplanner/raptor/moduletests/support/TestGroupPriorityCalculator.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/support/TestGroupPriorityCalculator.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/moduletests/support/TestGroupPriorityCalculator.java rename to application/src/test/java/org/opentripplanner/raptor/moduletests/support/TestGroupPriorityCalculator.java diff --git a/src/test/java/org/opentripplanner/raptor/package-info.md b/application/src/test/java/org/opentripplanner/raptor/package-info.md similarity index 100% rename from src/test/java/org/opentripplanner/raptor/package-info.md rename to application/src/test/java/org/opentripplanner/raptor/package-info.md diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/internalapi/NoopPassThroughPointsServiceTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/internalapi/NoopPassThroughPointsServiceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/internalapi/NoopPassThroughPointsServiceTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/internalapi/NoopPassThroughPointsServiceTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/StopArrivalStateParetoSetTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/StopArrivalStateParetoSetTest.java similarity index 88% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/StopArrivalStateParetoSetTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/StopArrivalStateParetoSetTest.java index e9c39ba6bbf..60fa14e9385 100644 --- a/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/StopArrivalStateParetoSetTest.java +++ b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/StopArrivalStateParetoSetTest.java @@ -1,8 +1,6 @@ package org.opentripplanner.raptor.rangeraptor.multicriteria; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.raptor.rangeraptor.multicriteria.StopArrivalParetoSet.createEgressStopArrivalSet; -import static org.opentripplanner.raptor.rangeraptor.multicriteria.StopArrivalParetoSet.createStopArrivalSet; import java.util.Arrays; import java.util.List; @@ -20,6 +18,7 @@ import org.opentripplanner.raptor.rangeraptor.multicriteria.arrivals.McStopArrival; import org.opentripplanner.raptor.rangeraptor.multicriteria.arrivals.c1.StopArrivalFactoryC1; import org.opentripplanner.raptor.rangeraptor.multicriteria.ride.c1.PatternRideC1; +import org.opentripplanner.raptor.util.paretoset.ParetoComparator; public class StopArrivalStateParetoSetTest { @@ -33,9 +32,9 @@ public class StopArrivalStateParetoSetTest { .schedule("10:00 10:30") .build(); - // In this test each stop is used to identify the pareto vector - it is just one - // ParetoSet "subject" with multiple "stops" in it. The stop have no effect on - // the Pareto functionality. + // In this test, each stop is used to identify the pareto vector - it is just one + // ParetoSet "subject" with multiple "stops" in it. The stop has no effect on + // the Pareto functionality - the stop is not a criteria in the pareto-function. private static final int STOP_1 = 1; private static final int STOP_2 = 2; private static final int STOP_3 = 3; @@ -72,19 +71,12 @@ public class StopArrivalStateParetoSetTest { ); private static Stream testCases() { + ParetoComparator> comparator = COMPARATOR_FACTORY.compareArrivalTimeRoundAndCost(); return Stream.of( - Arguments.of( - "Stop Arrival - regular", - createStopArrivalSet(COMPARATOR_FACTORY.compareArrivalTimeRoundAndCost(), null) - ), + Arguments.of("Stop Arrival - regular", StopArrivalParetoSet.of(comparator).build()), Arguments.of( "Stop Arrival - w/egress", - createEgressStopArrivalSet( - COMPARATOR_FACTORY.compareArrivalTimeRoundCostAndOnBoardArrival(), - List.of(), - null, - null - ) + StopArrivalParetoSet.of(comparator).withEgressListener(List.of(), null).build() ) ); } @@ -169,7 +161,8 @@ public void testRoundAndTimeDominance( */ @Test public void testTransitAndTransferDoesNotAffectDominance() { - var subject = createStopArrivalSet(COMPARATOR_FACTORY.compareArrivalTimeRoundAndCost(), null); + ParetoComparator> comparator = COMPARATOR_FACTORY.compareArrivalTimeRoundAndCost(); + var subject = StopArrivalParetoSet.of(comparator).build(); subject.add(newAccessStopState(STOP_1, 20, ANY)); subject.add(newTransitStopState(ROUND_1, STOP_2, 10, ANY)); subject.add(newTransferStopState(ROUND_1, STOP_4, 8, ANY)); @@ -184,12 +177,10 @@ public void testTransitAndTransferDoesNotAffectDominance() { */ @Test public void testTransitAndTransferDoesAffectDominanceForStopArrivalsWithEgress() { - var subject = createEgressStopArrivalSet( - COMPARATOR_FACTORY.compareArrivalTimeRoundCostAndOnBoardArrival(), - List.of(), - null, - null - ); + var subject = StopArrivalParetoSet + .of(COMPARATOR_FACTORY.compareArrivalTimeRoundCostAndOnBoardArrival()) + .withEgressListener(List.of(), null) + .build(); subject.add(newAccessStopState(STOP_1, 20, ANY)); subject.add(newTransitStopState(ROUND_1, STOP_2, 10, ANY)); subject.add(newTransferStopState(ROUND_1, STOP_4, 8, ANY)); diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/ArrivalParetoSetComparatorFactoryTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/ArrivalParetoSetComparatorFactoryTest.java similarity index 98% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/ArrivalParetoSetComparatorFactoryTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/ArrivalParetoSetComparatorFactoryTest.java index 9b6311b58bc..5fd19fc07f5 100644 --- a/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/ArrivalParetoSetComparatorFactoryTest.java +++ b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/ArrivalParetoSetComparatorFactoryTest.java @@ -305,5 +305,10 @@ public PathLegType arrivedBy() { public boolean arrivedOnBoard() { return arrivedOnBoard; } + + @Override + public McStopArrival addSlackToArrivalTime(int slack) { + throw new UnsupportedOperationException(); + } } } diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrivalTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrivalTest.java similarity index 97% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrivalTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrivalTest.java index 64593a91b2a..9cbb35ca0a6 100644 --- a/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrivalTest.java +++ b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrivalTest.java @@ -149,5 +149,10 @@ public PathLegType arrivedBy() { public boolean arrivedOnBoard() { return arrivedOnBoard; } + + @Override + public McStopArrival addSlackToArrivalTime(int slack) { + throw new UnsupportedOperationException(); + } } } diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/AccessStopArrivalTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/AccessStopArrivalTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/AccessStopArrivalTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/AccessStopArrivalTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/StopArrivalFactoryC1Test.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/StopArrivalFactoryC1Test.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/StopArrivalFactoryC1Test.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/StopArrivalFactoryC1Test.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransferStopArrivalTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransferStopArrivalTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransferStopArrivalTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransferStopArrivalTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransitStopArrivalTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransitStopArrivalTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransitStopArrivalTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransitStopArrivalTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AccessStopArrivalC2Test.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AccessStopArrivalC2Test.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AccessStopArrivalC2Test.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AccessStopArrivalC2Test.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/StopArrivalFactoryC2Test.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/StopArrivalFactoryC2Test.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/StopArrivalFactoryC2Test.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/StopArrivalFactoryC2Test.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransferStopArrivalC2Test.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransferStopArrivalC2Test.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransferStopArrivalC2Test.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransferStopArrivalC2Test.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransitStopArrivalC2Test.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransitStopArrivalC2Test.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransitStopArrivalC2Test.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransitStopArrivalC2Test.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/passthrough/BitSetPassThroughPointsServiceTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/passthrough/BitSetPassThroughPointsServiceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/passthrough/BitSetPassThroughPointsServiceTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/passthrough/BitSetPassThroughPointsServiceTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c1/PatternRideC1Test.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c1/PatternRideC1Test.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c1/PatternRideC1Test.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c1/PatternRideC1Test.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PatternRideC2Test.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PatternRideC2Test.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PatternRideC2Test.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PatternRideC2Test.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrivalTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrivalTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrivalTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrivalTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/path/PathMapperTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/path/PathMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/path/PathMapperTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/path/PathMapperTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/path/PathParetoSetComparatorsTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/path/PathParetoSetComparatorsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/path/PathParetoSetComparatorsTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/path/PathParetoSetComparatorsTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleArrivedAtDestinationCheckTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleArrivedAtDestinationCheckTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleArrivedAtDestinationCheckTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleArrivedAtDestinationCheckTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/support/IntArraySingleCriteriaArrivalsTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/support/IntArraySingleCriteriaArrivalsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/support/IntArraySingleCriteriaArrivalsTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/support/IntArraySingleCriteriaArrivalsTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessEgressFunctionsTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessEgressFunctionsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessEgressFunctionsTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessEgressFunctionsTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessPathsTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessPathsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessPathsTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessPathsTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessWithPenaltyTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessWithPenaltyTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessWithPenaltyTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessWithPenaltyTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/EgressPathsTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/EgressPathsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/transit/EgressPathsTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/EgressPathsTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/EgressWithPenaltyTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/EgressWithPenaltyTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/transit/EgressWithPenaltyTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/EgressWithPenaltyTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardRaptorTransitCalculatorTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardRaptorTransitCalculatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardRaptorTransitCalculatorTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardRaptorTransitCalculatorTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTimeCalculatorTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTimeCalculatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTimeCalculatorTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTimeCalculatorTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTransitCalculatorTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTransitCalculatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTransitCalculatorTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTransitCalculatorTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorSearchWindowCalculatorTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorSearchWindowCalculatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorSearchWindowCalculatorTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorSearchWindowCalculatorTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseRaptorTransitCalculatorTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseRaptorTransitCalculatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseRaptorTransitCalculatorTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseRaptorTransitCalculatorTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTimeCalculatorTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTimeCalculatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTimeCalculatorTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTimeCalculatorTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTransitCalculatorTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTransitCalculatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTransitCalculatorTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTransitCalculatorTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/RoundTrackerTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/RoundTrackerTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/transit/RoundTrackerTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/RoundTrackerTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/SlackProviderAdapterTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/SlackProviderAdapterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/transit/SlackProviderAdapterTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/SlackProviderAdapterTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/TripScheduleExactMatchSearchTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/TripScheduleExactMatchSearchTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/transit/TripScheduleExactMatchSearchTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/TripScheduleExactMatchSearchTest.java diff --git a/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/TripTimesSearchTest.java b/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/TripTimesSearchTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/rangeraptor/transit/TripTimesSearchTest.java rename to application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/TripTimesSearchTest.java diff --git a/src/test/java/org/opentripplanner/raptor/service/HeuristicToRunResolverTest.java b/application/src/test/java/org/opentripplanner/raptor/service/HeuristicToRunResolverTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/service/HeuristicToRunResolverTest.java rename to application/src/test/java/org/opentripplanner/raptor/service/HeuristicToRunResolverTest.java diff --git a/src/test/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEventTest.java b/application/src/test/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEventTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEventTest.java rename to application/src/test/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEventTest.java diff --git a/src/test/java/org/opentripplanner/raptor/spi/RaptorSlackProviderTest.java b/application/src/test/java/org/opentripplanner/raptor/spi/RaptorSlackProviderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/spi/RaptorSlackProviderTest.java rename to application/src/test/java/org/opentripplanner/raptor/spi/RaptorSlackProviderTest.java diff --git a/src/test/java/org/opentripplanner/raptor/spi/RaptorTripPatternTest.java b/application/src/test/java/org/opentripplanner/raptor/spi/RaptorTripPatternTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/spi/RaptorTripPatternTest.java rename to application/src/test/java/org/opentripplanner/raptor/spi/RaptorTripPatternTest.java diff --git a/src/test/java/org/opentripplanner/raptor/spi/RaptorTripScheduleTest.java b/application/src/test/java/org/opentripplanner/raptor/spi/RaptorTripScheduleTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/spi/RaptorTripScheduleTest.java rename to application/src/test/java/org/opentripplanner/raptor/spi/RaptorTripScheduleTest.java diff --git a/src/test/java/org/opentripplanner/raptor/spi/UnknownPathTest.java b/application/src/test/java/org/opentripplanner/raptor/spi/UnknownPathTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/spi/UnknownPathTest.java rename to application/src/test/java/org/opentripplanner/raptor/spi/UnknownPathTest.java diff --git a/src/test/java/org/opentripplanner/raptor/util/BitSetIteratorTest.java b/application/src/test/java/org/opentripplanner/raptor/util/BitSetIteratorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/util/BitSetIteratorTest.java rename to application/src/test/java/org/opentripplanner/raptor/util/BitSetIteratorTest.java diff --git a/src/test/java/org/opentripplanner/raptor/util/IntIteratorsTest.java b/application/src/test/java/org/opentripplanner/raptor/util/IntIteratorsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/util/IntIteratorsTest.java rename to application/src/test/java/org/opentripplanner/raptor/util/IntIteratorsTest.java diff --git a/src/test/java/org/opentripplanner/raptor/util/PathStringBuilderTest.java b/application/src/test/java/org/opentripplanner/raptor/util/PathStringBuilderTest.java similarity index 97% rename from src/test/java/org/opentripplanner/raptor/util/PathStringBuilderTest.java rename to application/src/test/java/org/opentripplanner/raptor/util/PathStringBuilderTest.java index 771efe6ab03..1179712e2fd 100644 --- a/src/test/java/org/opentripplanner/raptor/util/PathStringBuilderTest.java +++ b/application/src/test/java/org/opentripplanner/raptor/util/PathStringBuilderTest.java @@ -5,8 +5,8 @@ import static org.opentripplanner.raptor._data.transit.TestAccessEgress.free; import org.junit.jupiter.api.Test; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; import org.opentripplanner.raptor.api.path.PathStringBuilder; -import org.opentripplanner.raptor.api.path.RaptorStopNameResolver; public class PathStringBuilderTest { diff --git a/application/src/test/java/org/opentripplanner/raptor/util/composite/CompositeUtilTest.java b/application/src/test/java/org/opentripplanner/raptor/util/composite/CompositeUtilTest.java new file mode 100644 index 00000000000..6de1f8b842d --- /dev/null +++ b/application/src/test/java/org/opentripplanner/raptor/util/composite/CompositeUtilTest.java @@ -0,0 +1,76 @@ +package org.opentripplanner.raptor.util.composite; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; + +import java.util.List; +import java.util.stream.Collectors; +import org.junit.jupiter.api.Test; + +class CompositeUtilTest { + + @Test + void testOf() { + TNamed EMPTY = null; + assertNull(composite(EMPTY)); + assertNull(composite(EMPTY, EMPTY)); + + assertEquals("A", composite(tnamed("A")).name()); + assertEquals("A", composite(EMPTY, tnamed("A"), EMPTY).name()); + assertEquals("(A:B)", composite(tnamed("A"), tnamed("B")).name()); + // Nested composites are flattened into one composite + assertEquals( + "(A:B:C)", + composite(composite(tnamed("A")), composite(tnamed("B")), composite(tnamed("C"))).name() + ); + } + + TNamed composite(TNamed... children) { + return TNamedComposite.of(children); + } + + TNamed tnamed(String name) { + return new DefaultTNamed(name); + } + + interface TNamed { + String name(); + } + + static final class DefaultTNamed implements TNamed { + + private final String name; + + public DefaultTNamed(String name) { + this.name = name; + } + + @Override + public String name() { + return name; + } + } + + static final class TNamedComposite implements TNamed { + + private final List children; + + private TNamedComposite(List children) { + this.children = children; + } + + static TNamed of(TNamed... children) { + return CompositeUtil.of( + TNamedComposite::new, + TNamedComposite.class::isInstance, + it -> ((TNamedComposite) it).children, + children + ); + } + + @Override + public String name() { + return "(" + children.stream().map(TNamed::name).collect(Collectors.joining(":")) + ")"; + } + } +} diff --git a/application/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerCompositeTest.java b/application/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerCompositeTest.java new file mode 100644 index 00000000000..3fe05f80afd --- /dev/null +++ b/application/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerCompositeTest.java @@ -0,0 +1,63 @@ +package org.opentripplanner.raptor.util.paretoset; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import org.junit.jupiter.api.Test; + +class ParetoSetEventListenerCompositeTest { + + public static final String EMPTY = ""; + private final TestParetoSetEventListener l1 = new TestParetoSetEventListener<>(); + private final TestParetoSetEventListener l2 = new TestParetoSetEventListener<>(); + private final ParetoSetEventListener subject = ParetoSetEventListenerComposite.of(l1, l2); + + @Test + void notifyElementAccepted() { + assertNotNull(subject); + subject.notifyElementAccepted("A"); + assertState("A", EMPTY, EMPTY); + subject.notifyElementAccepted("B"); + assertState("A B", EMPTY, EMPTY); + } + + @Test + void notifyElementDropped() { + assertNotNull(subject); + subject.notifyElementDropped("A", "x"); + assertState(EMPTY, "A", EMPTY); + subject.notifyElementDropped("C", "y"); + assertState(EMPTY, "A C", EMPTY); + } + + @Test + void notifyElementRejected() { + assertNotNull(subject); + subject.notifyElementRejected("A", "x"); + assertState(EMPTY, EMPTY, "A"); + subject.notifyElementRejected("C", "y"); + assertState(EMPTY, EMPTY, "A C"); + } + + @Test + void verifyTheListenerStructureIsFlattenOut() { + assertNotNull(subject); + assertEquals( + subject.toString(), + "ParetoSetEventListenerComposite{listeners=[" + + "TestParetoSetEventListener, TestParetoSetEventListener" + + "]}" + ); + } + + private void assertState(String accepted, String dropped, String rejected) { + assertEquals(l1.acceptedAsString(), accepted); + assertEquals(l2.acceptedAsString(), accepted); + + assertEquals(l1.droppedAsString(), dropped); + assertEquals(l2.droppedAsString(), dropped); + + assertEquals(l1.rejectedAsString(), rejected); + assertEquals(l2.rejectedAsString(), rejected); + } +} diff --git a/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerTest.java b/application/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerTest.java similarity index 54% rename from src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerTest.java rename to application/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerTest.java index 1843d2c18ba..0f23144efc6 100644 --- a/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerTest.java +++ b/application/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerTest.java @@ -2,7 +2,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import org.junit.jupiter.api.BeforeEach; @@ -10,22 +9,20 @@ public class ParetoSetEventListenerTest { - private final List accepted = new ArrayList<>(); - private final List rejected = new ArrayList<>(); - private final List dropped = new ArrayList<>(); - // Given a set and function + private final TestParetoSetEventListener listener = new TestParetoSetEventListener(); + @SuppressWarnings("MismatchedQueryAndUpdateOfCollection") - private final ParetoSet subject = new ParetoSet<>( + private final ParetoSet subject = new ParetoSet<>( (l, r) -> l.v1 < r.v1 || l.v2 < r.v2, - eventListener() + listener ); @BeforeEach public void setup() { subject.clear(); - clearResult(); + listener.clear(); } @Test @@ -43,7 +40,7 @@ public void testAccept() { public void testReject() { // Add a initial value subject.add(vector(5, 1)); - clearResult(); + listener.clear(); // Add another value -> expect rejected subject.add(vector(6, 2)); @@ -56,7 +53,7 @@ public void testDropped() { subject.add(vector(2, 5)); subject.add(vector(4, 4)); subject.add(vector(5, 3)); - clearResult(); + listener.clear(); // Add another value -> expect rejected subject.add(vector(1, 5)); @@ -66,14 +63,8 @@ public void testDropped() { assertAcceptedRejectedAndDropped("[1, 0]", "", "[4, 4] [5, 3] [1, 5]"); } - private Vector vector(int u, int v) { - return new Vector("", u, v); - } - - private void clearResult() { - accepted.clear(); - rejected.clear(); - dropped.clear(); + private TestVector vector(int u, int v) { + return new TestVector("", u, v); } private void assertAcceptedRejectedAndDropped( @@ -81,32 +72,17 @@ private void assertAcceptedRejectedAndDropped( String expRejected, String expDropped ) { - assertEquals(expAccepted, toString(accepted)); - assertEquals(expRejected, toString(rejected)); - assertEquals(expDropped, toString(dropped)); - clearResult(); + assertEquals(expAccepted, listener.acceptedAsString()); + assertEquals(expRejected, listener.rejectedAsString()); + assertEquals(expDropped, listener.droppedAsString()); + listener.clear(); } - private String toString(List list) { - return list.stream().map(Vector::toString).collect(Collectors.joining(" ")); + private String toString(List list) { + return list.stream().map(TestVector::toString).collect(Collectors.joining(" ")); } - private ParetoSetEventListener eventListener() { - return new ParetoSetEventListener<>() { - @Override - public void notifyElementAccepted(Vector newElement) { - accepted.add(newElement); - } - - @Override - public void notifyElementDropped(Vector element, Vector droppedByElement) { - dropped.add(element); - } - - @Override - public void notifyElementRejected(Vector element, Vector rejectedByElement) { - rejected.add(element); - } - }; + private TestParetoSetEventListener eventListener() { + return new TestParetoSetEventListener<>(); } } diff --git a/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetTest.java b/application/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetTest.java similarity index 72% rename from src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetTest.java rename to application/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetTest.java index 21f998b4757..1c410c13e1c 100644 --- a/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetTest.java +++ b/application/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetTest.java @@ -16,29 +16,29 @@ public class ParetoSetTest { - private static final ParetoComparator DIFFERENT = (l, r) -> l.v1 != r.v1; - private static final ParetoComparator LESS_THEN = (l, r) -> l.v1 < r.v1; - private static final ParetoComparator LESS_LESS_THEN = (l, r) -> + private static final ParetoComparator DIFFERENT = (l, r) -> l.v1 != r.v1; + private static final ParetoComparator LESS_THEN = (l, r) -> l.v1 < r.v1; + private static final ParetoComparator LESS_LESS_THEN = (l, r) -> l.v1 < r.v1 || l.v2 < r.v2; - private static final ParetoComparator LESS_DIFFERENT_THEN = (l, r) -> + private static final ParetoComparator LESS_DIFFERENT_THEN = (l, r) -> l.v1 < r.v1 || l.v2 != r.v2; // Used to stored dropped vectors (callback from set) - private final List dropped = new ArrayList<>(); + private final List dropped = new ArrayList<>(); - private final ParetoSetEventListener listener = new ParetoSetEventListener<>() { + private final ParetoSetEventListener listener = new ParetoSetEventListener<>() { @Override - public void notifyElementAccepted(Vector newElement) { + public void notifyElementAccepted(TestVector newElement) { /* NOOP */ } @Override - public void notifyElementDropped(Vector element, Vector droppedByElement) { + public void notifyElementDropped(TestVector element, TestVector droppedByElement) { dropped.add(element); } @Override - public void notifyElementRejected(Vector element, Vector rejectedByElement) { + public void notifyElementRejected(TestVector element, TestVector rejectedByElement) { /* NOOP */ } }; @@ -46,7 +46,7 @@ public void notifyElementRejected(Vector element, Vector rejectedByElement) { @Test public void initiallyEmpty() { // Given a empty set - ParetoSet set = new ParetoSet<>(LESS_THEN); + ParetoSet set = new ParetoSet<>(LESS_THEN); assertEquals("{}", set.toString(), "The initial set should be empty."); assertTrue(set.isEmpty(), "The initial set should be empty."); @@ -54,14 +54,14 @@ public void initiallyEmpty() { @Test public void addVector() { - ParetoSet set = new ParetoSet<>((l, r) -> + ParetoSet set = new ParetoSet<>((l, r) -> l.v1 < r.v1 || // less than l.v2 != r.v2 || // different dominates l.v3 + 2 < r.v3 // at least 2 less than ); // When one element is added - addOk(set, new Vector("V0", 5, 5, 5)); + addOk(set, new TestVector("V0", 5, 5, 5)); // Then the element should be the only element in the set assertEquals("{V0[5, 5, 5]}", set.toString()); @@ -73,8 +73,8 @@ public void addVector() { @Test public void removeAVectorIsNotAllowed() { // Given a set with a vector - ParetoSet set = new ParetoSet<>(LESS_THEN); - Vector vector = new Vector("V0", 5); + ParetoSet set = new ParetoSet<>(LESS_THEN); + TestVector vector = new TestVector("V0", 5); addOk(set, vector); // When vector is removed, expect an exception @@ -84,23 +84,23 @@ public void removeAVectorIsNotAllowed() { @Test public void testLessThen() { // Given a set with one element: [5] - ParetoSet set = new ParetoSet<>(LESS_THEN); - set.add(new Vector("V0", 5)); + ParetoSet set = new ParetoSet<>(LESS_THEN); + set.add(new TestVector("V0", 5)); // When adding the same value - addRejected(set, new Vector("Not", 5)); + addRejected(set, new TestVector("Not", 5)); // Then expect no change in the set assertEquals("{V0[5]}", set.toString()); // When adding a greater value - addRejected(set, new Vector("Not", 6)); + addRejected(set, new TestVector("Not", 6)); // Then expect no change in the set assertEquals("{V0[5]}", set.toString()); // When adding the a lesser value - addOk(set, new Vector("V1", 4)); + addOk(set, new TestVector("V1", 4)); // Then the lesser value should replace the bigger one assertEquals("{V1[4]}", set.toString()); @@ -109,23 +109,23 @@ public void testLessThen() { @Test public void testDifferent() { // Given a set with one element: [5] - ParetoSet set = new ParetoSet<>(DIFFERENT); - set.add(new Vector("V0", 5)); + ParetoSet set = new ParetoSet<>(DIFFERENT); + set.add(new TestVector("V0", 5)); // When adding the same value - addRejected(set, new Vector("NOT ADDED", 5)); + addRejected(set, new TestVector("NOT ADDED", 5)); // Then expect no change in the set assertEquals("{V0[5]}", set.toString()); // When adding the a different value - addOk(set, new Vector("D1", 6)); + addOk(set, new TestVector("D1", 6)); // Then both values should be included assertEquals("{V0[5], D1[6]}", set.toString()); // When adding the several more different values - addOk(set, new Vector("D2", 3)); - addOk(set, new Vector("D3", 4)); - addOk(set, new Vector("D4", 8)); + addOk(set, new TestVector("D2", 3)); + addOk(set, new TestVector("D3", 4)); + addOk(set, new TestVector("D4", 8)); // Then all values should be included assertEquals("{V0[5], D1[6], D2[3], D3[4], D4[8]}", set.toString()); } @@ -134,8 +134,8 @@ public void testDifferent() { public void testTwoCriteriaWithLessThen() { // Given a set with one element with 2 criteria: [5, 5] // and a function where at least one value is less then to make it into the set - ParetoSet set = new ParetoSet<>(LESS_LESS_THEN); - Vector v0 = new Vector("V0", 5, 5); + ParetoSet set = new ParetoSet<>(LESS_LESS_THEN); + TestVector v0 = new TestVector("V0", 5, 5); // Cases that does NOT make it into the set testNotAdded(set, v0, vector(6, 5), "Add a new vector where 1st value disqualifies it"); @@ -154,8 +154,8 @@ public void testTwoCriteriaWithLessThen() { @Test public void testTwoCriteria_lessThen_and_different() { // Given a set with one element with 2 criteria: [5, 5] - ParetoSet set = new ParetoSet<>(LESS_DIFFERENT_THEN); - Vector v0 = new Vector("V0", 5, 5); + ParetoSet set = new ParetoSet<>(LESS_DIFFERENT_THEN); + TestVector v0 = new TestVector("V0", 5, 5); // Cases that does NOT make it into the set testNotAdded(set, v0, vector(6, 5), "1st value disqualifies it"); @@ -173,8 +173,8 @@ public void testTwoCriteria_lessThen_and_different() { @Test public void testTwoCriteria_lessThen_and_lessThenValue() { // Given a set with one element with 2 criteria: [5, 5] - ParetoSet set = new ParetoSet<>((l, r) -> l.v1 < r.v1 || l.v2 < r.v2 + 1); - Vector v0 = new Vector("V0", 5, 5); + ParetoSet set = new ParetoSet<>((l, r) -> l.v1 < r.v1 || l.v2 < r.v2 + 1); + TestVector v0 = new TestVector("V0", 5, 5); // Cases that does NOT make it into the set testNotAdded(set, v0, vector(6, 6), "1st value is to big"); @@ -194,25 +194,25 @@ public void testTwoCriteria_lessThen_and_lessThenValue() { @Test public void testOneVectorDominatesMany() { // Given a set and function - ParetoSet set = new ParetoSet<>(LESS_LESS_THEN); + ParetoSet set = new ParetoSet<>(LESS_LESS_THEN); // Add some values - all pareto optimal - set.add(new Vector("V0", 5, 1)); - set.add(new Vector("V1", 3, 3)); - set.add(new Vector("V2", 0, 7)); - set.add(new Vector("V3", 1, 5)); + set.add(new TestVector("V0", 5, 1)); + set.add(new TestVector("V1", 3, 3)); + set.add(new TestVector("V2", 0, 7)); + set.add(new TestVector("V3", 1, 5)); // Assert all vectors is there assertEquals("{V0[5, 1], V1[3, 3], V2[0, 7], V3[1, 5]}", set.toString()); // Add a vector which dominates all vectors in set, except [0, 7] - set.add(new Vector("V", 1, 1)); + set.add(new TestVector("V", 1, 1)); // Expect just 2 vectors assertEquals("{V2[0, 7], V[1, 1]}", set.toString()); // Add a vector which dominates all vectors in set - set.add(new Vector("X", 0, 1)); + set.add(new TestVector("X", 0, 1)); // Expect just 1 vector - the last assertEquals("{X[0, 1]}", set.toString()); @@ -221,19 +221,19 @@ public void testOneVectorDominatesMany() { @Test public void testRelaxedCriteriaAcceptingTheTwoSmallestValues() { // Given a set and function - ParetoSet set = new ParetoSet<>((l, r) -> l.v1 < r.v1 || l.v2 < r.v2 + 2); + ParetoSet set = new ParetoSet<>((l, r) -> l.v1 < r.v1 || l.v2 < r.v2 + 2); // Add some values - set.add(new Vector("V0", 5, 5)); - set.add(new Vector("V1", 4, 4)); - set.add(new Vector("V2", 5, 4)); - set.add(new Vector("V3", 5, 3)); - set.add(new Vector("V4", 5, 2)); - set.add(new Vector("V5", 5, 1)); - set.add(new Vector("V6", 5, 2)); - set.add(new Vector("V7", 5, 3)); - set.add(new Vector("V8", 5, 4)); - set.add(new Vector("V9", 5, 5)); + set.add(new TestVector("V0", 5, 5)); + set.add(new TestVector("V1", 4, 4)); + set.add(new TestVector("V2", 5, 4)); + set.add(new TestVector("V3", 5, 3)); + set.add(new TestVector("V4", 5, 2)); + set.add(new TestVector("V5", 5, 1)); + set.add(new TestVector("V6", 5, 2)); + set.add(new TestVector("V7", 5, 3)); + set.add(new TestVector("V8", 5, 4)); + set.add(new TestVector("V9", 5, 5)); // Expect all vectors with v1=4 or v2 in [1,2] assertEquals("{V1[4, 4], V4[5, 2], V5[5, 1], V6[5, 2]}", set.toString()); @@ -242,16 +242,16 @@ public void testRelaxedCriteriaAcceptingTheTwoSmallestValues() { @Test public void testRelaxedCriteriaAcceptingTenPercentExtra() { // Given a set and function - ParetoSet set = new ParetoSet<>((l, r) -> + ParetoSet set = new ParetoSet<>((l, r) -> l.v1 < r.v1 || l.v2 <= IntUtils.round(r.v2 * 1.1) ); // Add some values - set.add(new Vector("a", 1, 110)); - set.add(new Vector("a", 1, 111)); - set.add(new Vector("d", 1, 100)); - set.add(new Vector("g", 1, 111)); - set.add(new Vector("g", 1, 110)); + set.add(new TestVector("a", 1, 110)); + set.add(new TestVector("a", 1, 111)); + set.add(new TestVector("d", 1, 100)); + set.add(new TestVector("g", 1, 111)); + set.add(new TestVector("g", 1, 110)); assertEquals("{a[1, 110], d[1, 100], g[1, 110]}", set.toString()); } @@ -260,10 +260,10 @@ public void testRelaxedCriteriaAcceptingTenPercentExtra() { public void testFourCriteria() { // Given a set with one element with 2 criteria: [5, 5] // and the pareto function is: <, !=, >, <+2 - ParetoSet set = new ParetoSet<>((l, r) -> + ParetoSet set = new ParetoSet<>((l, r) -> l.v1 < r.v1 || l.v2 != r.v2 || l.v3 > r.v3 || l.v4 < r.v4 + 2 ); - Vector v0 = new Vector("V0", 5, 5, 5, 5); + TestVector v0 = new TestVector("V0", 5, 5, 5, 5); // Cases that does NOT make it into the set testNotAdded(set, v0, vector(5, 5, 5, 7), "same as v0"); @@ -299,7 +299,7 @@ public void testFourCriteria() { @Test public void testAutoScalingOfParetoSet() { // Given a set with 2 criteria - ParetoSet set = new ParetoSet<>(LESS_LESS_THEN); + ParetoSet set = new ParetoSet<>(LESS_LESS_THEN); // The initial size is set to 16. // Add 100 mutually dominant values @@ -319,13 +319,13 @@ public void testAutoScalingOfParetoSet() { @Test public void testAddingMultipleElements() { // Given a set with 2 criteria: LT and LT - ParetoSet set = new ParetoSet<>(LESS_LESS_THEN); - Vector v55 = new Vector("v55", 5, 5); - Vector v53 = new Vector("v53", 5, 3); - Vector v44 = new Vector("v44", 4, 4); - Vector v35 = new Vector("v35", 3, 5); - Vector v25 = new Vector("v25", 2, 5); - Vector v22 = new Vector("v22", 2, 2); + ParetoSet set = new ParetoSet<>(LESS_LESS_THEN); + TestVector v55 = new TestVector("v55", 5, 5); + TestVector v53 = new TestVector("v53", 5, 3); + TestVector v44 = new TestVector("v44", 4, 4); + TestVector v35 = new TestVector("v35", 3, 5); + TestVector v25 = new TestVector("v25", 2, 5); + TestVector v22 = new TestVector("v22", 2, 2); // A dominant vector should replace more than one other vector test(set, "v25", v25, v35); @@ -355,7 +355,7 @@ public void testAddingMultipleElements() { @Test public void elementsAreNotDroppedWhenParetoOptimalElementsAreAdded() { // Given a set with 2 criteria: LT and LT - ParetoSet set = new ParetoSet<>(LESS_LESS_THEN, listener); + ParetoSet set = new ParetoSet<>(LESS_LESS_THEN, listener); // Before any elements are added the list of dropped elements should be empty assertTrue(dropped.isEmpty()); @@ -372,7 +372,7 @@ public void elementsAreNotDroppedWhenParetoOptimalElementsAreAdded() { @Test public void firstElementIsDroppedWhenANewDominatingElementIsAdded() { // Given a set with 2 criteria: LT and LT and a vector [7, 3] - ParetoSet set = new ParetoSet<>(LESS_LESS_THEN, listener); + ParetoSet set = new ParetoSet<>(LESS_LESS_THEN, listener); set.add(vector(7, 3)); assertTrue(dropped.isEmpty()); @@ -397,7 +397,7 @@ public void firstElementIsDroppedWhenANewDominatingElementIsAdded() { @Test public void lastElementIsDroppedWhenANewDominatingElementIsAdded() { // Given a set with 2 criteria: LT and LT and a vector [7, 3] - ParetoSet set = new ParetoSet<>(LESS_LESS_THEN, listener); + ParetoSet set = new ParetoSet<>(LESS_LESS_THEN, listener); set.add(vector(5, 5)); set.add(vector(7, 3)); assertTrue(dropped.isEmpty()); @@ -411,7 +411,7 @@ public void lastElementIsDroppedWhenANewDominatingElementIsAdded() { * Test that both #add and #qualify return the same value - true. The set should contain the * vector, but that is left to the caller to verify. */ - private static void addOk(ParetoSet set, Vector v) { + private static void addOk(ParetoSet set, TestVector v) { assertTrue(set.qualify(v)); assertTrue(set.add(v)); } @@ -420,58 +420,68 @@ private static void addOk(ParetoSet set, Vector v) { * Test that both #add and #qualify return the same value - false. The set should not contain the * vector, but that is left to the caller to verify. */ - private static void addRejected(ParetoSet set, Vector v) { + private static void addRejected(ParetoSet set, TestVector v) { assertFalse(set.qualify(v)); assertFalse(set.add(v)); } - private static String names(Iterable set) { + private static String names(Iterable set) { return StreamSupport .stream(set.spliterator(), false) .map(it -> it == null ? "null" : it.name) .collect(Collectors.joining(" ")); } - private static Vector vector(int a, int b) { - return new Vector("Test", a, b); + private static TestVector vector(int a, int b) { + return new TestVector("Test", a, b); } - private static Vector vector(int a, int b, int c, int d) { - return new Vector("Test", a, b, c, d); + private static TestVector vector(int a, int b, int c, int d) { + return new TestVector("Test", a, b, c, d); } private static void testNotAdded( - ParetoSet set, - Vector v0, - Vector v1, + ParetoSet set, + TestVector v0, + TestVector v1, String description ) { test(set, v0, v1, description, v0); } - private static void testReplace(ParetoSet set, Vector v0, Vector v1, String description) { + private static void testReplace( + ParetoSet set, + TestVector v0, + TestVector v1, + String description + ) { test(set, v0, v1, description, v1); } - private static void keepBoth(ParetoSet set, Vector v0, Vector v1, String description) { + private static void keepBoth( + ParetoSet set, + TestVector v0, + TestVector v1, + String description + ) { test(set, v0, v1, description, v0, v1); } private static void test( - ParetoSet set, - Vector v0, - Vector v1, + ParetoSet set, + TestVector v0, + TestVector v1, String description, - Vector... expected + TestVector... expected ) { new TestCase(v0, v1, description, expected).run(set); } - private void test(ParetoSet set, String expected, Vector... vectorsToAdd) { + private void test(ParetoSet set, String expected, TestVector... vectorsToAdd) { set.clear(); - for (Vector v : vectorsToAdd) { + for (TestVector v : vectorsToAdd) { // Copy vector to avoid any identity pitfalls - Vector vector = new Vector(v); + TestVector vector = new TestVector(v); boolean qualify = set.qualify(vector); assertEquals(qualify, set.add(vector), "Qualify and add should return the same value."); } @@ -480,12 +490,12 @@ private void test(ParetoSet set, String expected, Vector... vectorsToAdd static class TestCase { - final Vector v0; - final Vector v1; + final TestVector v0; + final TestVector v1; final String expected; final String description; - TestCase(Vector v0, Vector v1, String description, Vector... expected) { + TestCase(TestVector v0, TestVector v1, String description, TestVector... expected) { this.v0 = v0; this.v1 = v1; this.expected = @@ -495,7 +505,7 @@ static class TestCase { this.description = description; } - void run(ParetoSet set) { + void run(ParetoSet set) { set.clear(); set.add(v0); diff --git a/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetWithMarkerTest.java b/application/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetWithMarkerTest.java similarity index 100% rename from src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetWithMarkerTest.java rename to application/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetWithMarkerTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/util/paretoset/TestParetoSetEventListener.java b/application/src/test/java/org/opentripplanner/raptor/util/paretoset/TestParetoSetEventListener.java new file mode 100644 index 00000000000..7e4bb539dc5 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/raptor/util/paretoset/TestParetoSetEventListener.java @@ -0,0 +1,58 @@ +package org.opentripplanner.raptor.util.paretoset; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * An event listener witch keeps the result for each event type. Used in tests in this package + * only! + */ +class TestParetoSetEventListener implements ParetoSetEventListener { + + private final List accepted = new ArrayList<>(); + private final List rejected = new ArrayList<>(); + private final List dropped = new ArrayList<>(); + + @Override + public void notifyElementAccepted(T newElement) { + accepted.add(newElement); + } + + @Override + public void notifyElementDropped(T element, T droppedByElement) { + dropped.add(element); + } + + @Override + public void notifyElementRejected(T element, T rejectedByElement) { + rejected.add(element); + } + + @Override + public String toString() { + return "TestParetoSetEventListener"; + } + + public String acceptedAsString() { + return toString(accepted); + } + + public String rejectedAsString() { + return toString(rejected); + } + + public String droppedAsString() { + return toString(dropped); + } + + void clear() { + accepted.clear(); + rejected.clear(); + dropped.clear(); + } + + private String toString(List list) { + return list.stream().map(Object::toString).collect(Collectors.joining(" ")); + } +} diff --git a/src/test/java/org/opentripplanner/raptor/util/paretoset/Vector.java b/application/src/test/java/org/opentripplanner/raptor/util/paretoset/TestVector.java similarity index 71% rename from src/test/java/org/opentripplanner/raptor/util/paretoset/Vector.java rename to application/src/test/java/org/opentripplanner/raptor/util/paretoset/TestVector.java index fa696b9af17..7f9998f5485 100644 --- a/src/test/java/org/opentripplanner/raptor/util/paretoset/Vector.java +++ b/application/src/test/java/org/opentripplanner/raptor/util/paretoset/TestVector.java @@ -2,29 +2,33 @@ import java.util.Objects; -class Vector { +/** + * Create a value object type to test the ParetoSet "generic" type criteria. We create a new type + * to isolate the tests in this package from any other randomly chosen type. + */ +class TestVector { private static final int NOT_SET = -999; final String name; final int v1, v2, v3, v4; - Vector(Vector o) { + TestVector(TestVector o) { this(o.name, o.v1, o.v2, o.v3, o.v4); } - Vector(String name, int v1) { + TestVector(String name, int v1) { this(name, v1, NOT_SET, NOT_SET, NOT_SET); } - Vector(String name, int v1, int v2) { + TestVector(String name, int v1, int v2) { this(name, v1, v2, NOT_SET, NOT_SET); } - Vector(String name, int v1, int v2, int v3) { + TestVector(String name, int v1, int v2, int v3) { this(name, v1, v2, v3, NOT_SET); } - Vector(String name, int v1, int v2, int v3, int v4) { + TestVector(String name, int v1, int v2, int v3, int v4) { this.name = name; this.v1 = v1; this.v2 = v2; @@ -45,7 +49,7 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - Vector v = (Vector) o; + TestVector v = (TestVector) o; return v1 == v.v1 && v2 == v.v2 && v3 == v.v3 && v4 == v.v4 && name.equals(v.name); } diff --git a/src/test/java/org/opentripplanner/routing/TestHalfEdges.java b/application/src/test/java/org/opentripplanner/routing/TestHalfEdges.java similarity index 98% rename from src/test/java/org/opentripplanner/routing/TestHalfEdges.java rename to application/src/test/java/org/opentripplanner/routing/TestHalfEdges.java index ba7e024e57a..7b6db0a5acf 100644 --- a/src/test/java/org/opentripplanner/routing/TestHalfEdges.java +++ b/application/src/test/java/org/opentripplanner/routing/TestHalfEdges.java @@ -601,8 +601,8 @@ public void testStreetLocationFinder() { assertTrue(graphFinder.findClosestStops(new Coordinate(-74.005000001, 40.01), 100).size() > 0); // test that the closest vertex finder returns the closest vertex - TemporaryStreetLocation some = (TemporaryStreetLocation) finder.getVertexForLocationForTest( - new GenericLocation(40.00, -74.00), + TemporaryStreetLocation some = (TemporaryStreetLocation) finder.createVertexForCoordinateForTest( + new Coordinate(-74.00, 40.00), StreetMode.WALK, true, tempEdges @@ -610,8 +610,8 @@ public void testStreetLocationFinder() { assertNotNull(some); // test that the closest vertex finder correctly splits streets - TemporaryStreetLocation start = (TemporaryStreetLocation) finder.getVertexForLocationForTest( - new GenericLocation(40.004, -74.01), + TemporaryStreetLocation start = (TemporaryStreetLocation) finder.createVertexForCoordinateForTest( + new Coordinate(-74.01, 40.004), StreetMode.WALK, false, tempEdges @@ -625,8 +625,8 @@ public void testStreetLocationFinder() { Collection edges = start.getOutgoing(); assertEquals(2, edges.size()); - TemporaryStreetLocation end = (TemporaryStreetLocation) finder.getVertexForLocationForTest( - new GenericLocation(40.008, -74.0), + TemporaryStreetLocation end = (TemporaryStreetLocation) finder.createVertexForCoordinateForTest( + new Coordinate(-74.0, 40.008), StreetMode.BIKE, true, tempEdges @@ -648,7 +648,8 @@ public void testTemporaryVerticesContainer() { try ( var container = new TemporaryVerticesContainer( graph, - walking, + walking.from(), + walking.to(), StreetMode.WALK, StreetMode.WALK ) diff --git a/src/test/java/org/opentripplanner/routing/alertpatch/EntitySelectorTest.java b/application/src/test/java/org/opentripplanner/routing/alertpatch/EntitySelectorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/alertpatch/EntitySelectorTest.java rename to application/src/test/java/org/opentripplanner/routing/alertpatch/EntitySelectorTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/FilterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/FilterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/FilterTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/FilterTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/GraphRoutingTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/GraphRoutingTest.java similarity index 87% rename from src/test/java/org/opentripplanner/routing/algorithm/GraphRoutingTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/GraphRoutingTest.java index 69e2ddaa944..4a09d140371 100644 --- a/src/test/java/org/opentripplanner/routing/algorithm/GraphRoutingTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/GraphRoutingTest.java @@ -3,6 +3,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.function.Consumer; +import javax.annotation.Nullable; import org.locationtech.jts.geom.Coordinate; import org.opentripplanner.TestOtpModel; import org.opentripplanner.framework.geometry.GeometryUtils; @@ -29,12 +31,14 @@ import org.opentripplanner.street.model.edge.PathwayEdge; import org.opentripplanner.street.model.edge.StreetEdge; import org.opentripplanner.street.model.edge.StreetEdgeBuilder; +import org.opentripplanner.street.model.edge.StreetStationCentroidLink; import org.opentripplanner.street.model.edge.StreetTransitEntranceLink; import org.opentripplanner.street.model.edge.StreetTransitStopLink; import org.opentripplanner.street.model.edge.StreetVehicleParkingLink; import org.opentripplanner.street.model.edge.TemporaryFreeEdge; import org.opentripplanner.street.model.vertex.ElevatorOnboardVertex; import org.opentripplanner.street.model.vertex.IntersectionVertex; +import org.opentripplanner.street.model.vertex.StationCentroidVertex; import org.opentripplanner.street.model.vertex.StreetVertex; import org.opentripplanner.street.model.vertex.TemporaryStreetLocation; import org.opentripplanner.street.model.vertex.TemporaryVertex; @@ -56,6 +60,7 @@ import org.opentripplanner.transit.model.site.PathwayMode; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.Station; +import org.opentripplanner.transit.model.site.StationBuilder; import org.opentripplanner.transit.service.StopModel; import org.opentripplanner.transit.service.TransitModel; @@ -108,6 +113,10 @@ public IntersectionVertex intersection(String label, double latitude, double lon return vertexFactory.intersection(label, longitude, latitude); } + public IntersectionVertex intersection(String label, WgsCoordinate coordinate) { + return intersection(label, coordinate.latitude(), coordinate.longitude()); + } + public StreetEdgeBuilder streetBuilder( StreetVertex from, StreetVertex to, @@ -126,6 +135,13 @@ public StreetEdgeBuilder streetBuilder( .withBack(false); } + /** + * Create a street with all permissions in both directions + */ + public List biStreet(StreetVertex from, StreetVertex to, int length) { + return street(from, to, length, StreetTraversalPermission.ALL, StreetTraversalPermission.ALL); + } + public StreetEdge street( StreetVertex from, StreetVertex to, @@ -220,20 +236,18 @@ public Entrance entranceEntity(String id, double latitude, double longitude) { .build(); } - RegularStop stopEntity(String id, double latitude, double longitude, boolean noTransfers) { + RegularStop stopEntity( + String id, + double latitude, + double longitude, + @Nullable Station parentStation + ) { var stopModelBuilder = transitModel.getStopModel().withContext(); var testModel = new TransitModelForTest(stopModelBuilder); var stopBuilder = testModel.stop(id).withCoordinate(latitude, longitude); - if (noTransfers) { - stopBuilder.withParentStation( - Station - .of(TransitModelForTest.id("1")) - .withName(new NonLocalizedString("Malmö C")) - .withCoordinate(latitude, longitude) - .withTransfersNotAllowed(true) - .build() - ); + if (parentStation != null) { + stopBuilder.withParentStation(parentStation); } var stop = stopBuilder.build(); @@ -241,18 +255,38 @@ RegularStop stopEntity(String id, double latitude, double longitude, boolean noT return stop; } + public Station stationEntity(String id, Consumer stationBuilder) { + var stopModelBuilder = transitModel.getStopModel().withContext(); + var testModel = new TransitModelForTest(stopModelBuilder); + + var builder = testModel.station(id); + stationBuilder.accept(builder); + var station = builder.build(); + + transitModel.mergeStopModels(stopModelBuilder.withStation(station).build()); + return station; + } + + public TransitStopVertex stop(String id, WgsCoordinate coordinate, Station parentStation) { + return stop(id, coordinate.latitude(), coordinate.longitude(), parentStation); + } + + public TransitStopVertex stop(String id, WgsCoordinate coordinate) { + return stop(id, coordinate, null); + } + public TransitStopVertex stop(String id, double latitude, double longitude) { - return stop(id, latitude, longitude, false); + return stop(id, latitude, longitude, null); } public TransitStopVertex stop( String id, double latitude, double longitude, - boolean noTransfers + @Nullable Station parentStation ) { return vertexFactory.transitStop( - TransitStopVertex.of().withStop(stopEntity(id, latitude, longitude, noTransfers)) + TransitStopVertex.of().withStop(stopEntity(id, latitude, longitude, parentStation)) ); } @@ -260,6 +294,10 @@ public TransitEntranceVertex entrance(String id, double latitude, double longitu return new TransitEntranceVertex(entranceEntity(id, latitude, longitude)); } + public StationCentroidVertex stationCentroid(Station station) { + return vertexFactory.stationCentroid(station); + } + public StreetTransitEntranceLink link(StreetVertex from, TransitEntranceVertex to) { return StreetTransitEntranceLink.createStreetTransitEntranceLink(from, to); } @@ -284,6 +322,18 @@ public List biLink(StreetVertex from, TransitStopVertex t return List.of(link(from, to), link(to, from)); } + public StreetStationCentroidLink link(StreetVertex from, StationCentroidVertex to) { + return StreetStationCentroidLink.createStreetStationLink(from, to); + } + + public StreetStationCentroidLink link(StationCentroidVertex from, StreetVertex to) { + return StreetStationCentroidLink.createStreetStationLink(from, to); + } + + public List biLink(StreetVertex from, StationCentroidVertex to) { + return List.of(link(from, to), link(to, from)); + } + public PathwayEdge pathway(Vertex from, Vertex to, int time, int length) { return PathwayEdge.createPathwayEdge( from, diff --git a/src/test/java/org/opentripplanner/routing/algorithm/MultiTargetTerminationStrategy.java b/application/src/test/java/org/opentripplanner/routing/algorithm/MultiTargetTerminationStrategy.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/MultiTargetTerminationStrategy.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/MultiTargetTerminationStrategy.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/StreetModeLinkingTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/StreetModeLinkingTest.java similarity index 98% rename from src/test/java/org/opentripplanner/routing/algorithm/StreetModeLinkingTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/StreetModeLinkingTest.java index 4d1b14832a9..1a098591288 100644 --- a/src/test/java/org/opentripplanner/routing/algorithm/StreetModeLinkingTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/StreetModeLinkingTest.java @@ -206,7 +206,8 @@ private void assertLinking( try ( var temporaryVertices = new TemporaryVerticesContainer( graph, - routingRequest, + routingRequest.from(), + routingRequest.to(), streetMode, streetMode ) @@ -230,7 +231,8 @@ private void assertLinking( try ( var temporaryVertices = new TemporaryVerticesContainer( graph, - routingRequest, + routingRequest.from(), + routingRequest.to(), streetMode, streetMode ) diff --git a/src/test/java/org/opentripplanner/routing/algorithm/TestBanning.java b/application/src/test/java/org/opentripplanner/routing/algorithm/TestBanning.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/TestBanning.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/TestBanning.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/TurnCostTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/TurnCostTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/TurnCostTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/TurnCostTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChainTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChainTest.java similarity index 86% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChainTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChainTest.java index d897c948e6d..2bf4afee7fb 100644 --- a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChainTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChainTest.java @@ -42,7 +42,7 @@ * This class test the whole filter chain with a few test cases. Each filter should be tested with a * unit test. This is just a some test on top of the other filter unit-tests. */ -public class ItineraryListFilterChainTest implements PlanTestConstants { +class ItineraryListFilterChainTest implements PlanTestConstants { private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); private static final Place A = Place.forStop(TEST_MODEL.stop("A").build()); @@ -59,7 +59,7 @@ public class ItineraryListFilterChainTest implements PlanTestConstants { private Itinerary i3; @BeforeEach - public void setUpItineraries() { + void setUpItineraries() { // Add some itineraries, with some none optimal options // Short walk - 2 minutes - to destination: i1 = newItinerary(A, T11_06).walk(D2m, E).build(); @@ -72,7 +72,7 @@ public void setUpItineraries() { } @Test - public void testDefaultFilterChain() { + void testDefaultFilterChain() { // Given a default chain ItineraryListFilterChain chain = createBuilder(false, false, 10).build(); @@ -80,7 +80,7 @@ public void testDefaultFilterChain() { } @Test - public void testFilterChainWithSearchWindowFilterSet() { + void testFilterChainWithSearchWindowFilterSet() { ItineraryListFilterChain chain = createBuilder(false, false, 10) .withSearchWindow(TestItineraryBuilder.newTime(T11_00).toInstant(), SW_D10m) .build(); @@ -89,7 +89,7 @@ public void testFilterChainWithSearchWindowFilterSet() { } @Test - public void withMinBikeParkingDistance() { + void withMinBikeParkingDistance() { // Given a "default" chain ItineraryListFilterChain chain = createBuilder(false, false, 10) .withMinBikeParkingDistance(500) @@ -105,7 +105,7 @@ public void withMinBikeParkingDistance() { } @Test - public void testDebugFilterChain() { + void testDebugFilterChain() { // Given a filter-chain with debugging enabled ItineraryListFilterChain chain = createBuilder(false, true, 3) .withSearchWindow(newTime(T11_00).toInstant(), SW_D10m) @@ -122,7 +122,7 @@ public void testDebugFilterChain() { } @Test - public void removeAllWalkingOnly() { + void removeAllWalkingOnly() { ItineraryListFilterChain chain = createBuilder(false, false, 20) .withRemoveWalkAllTheWayResults(true) .build(); @@ -134,7 +134,7 @@ public void removeAllWalkingOnly() { } @Test - public void groupByTheLongestItineraryAndTwoGroups() { + void groupByTheLongestItineraryAndTwoGroups() { ItineraryListFilterChain chain = createBuilder(false, false, 20) .addGroupBySimilarity(GroupBySimilarity.createWithOneItineraryPerGroup(.5)) .build(); @@ -157,7 +157,7 @@ public void groupByTheLongestItineraryAndTwoGroups() { } @Test - public void testSameFirstOrLastTripFilter() { + void testSameFirstOrLastTripFilter() { ItineraryListFilterChain chain = createBuilder(false, false, 20) .withSameFirstOrLastTripFilter(true) .build(); @@ -238,7 +238,7 @@ void transitAlertsTest() { } @Test - public void removeItinerariesWithSameRoutesAndStops() { + void removeItinerariesWithSameRoutesAndStops() { var i1 = newItinerary(A).bus(21, T11_06, T11_28, E).bus(41, T11_30, T11_32, D).build(); var i2 = newItinerary(A).bus(22, T11_09, T11_30, E).bus(42, T11_32, T11_33, D).build(); var i3 = newItinerary(A).bus(23, T11_10, T11_32, E).bus(43, T11_33, T11_50, D).build(); @@ -274,34 +274,67 @@ private ItineraryListFilterChainBuilder createBuilder( class MaxItinerariesBuilderTest { @BeforeEach - public void setUpItineraries() { + void setUpItineraries() { i1 = newItinerary(A).bus(21, T11_05, T11_10, E).build(); i2 = newItinerary(A).bus(31, T11_07, T11_12, E).build(); i3 = newItinerary(A).bus(41, T11_09, T11_14, E).build(); } @Test - public void testPostProcessorWithMaxItinerariesFilterSetToTwo() { + void testPostProcessorWithMaxItinerariesFilterSetToTwo() { // Given a default postProcessor with 'numOfItineraries=2' ItineraryListFilterChain chain = createBuilder(false, false, 2).build(); assertEquals(List.of(i1, i2), chain.filter(List.of(i1, i2, i3))); } @Test - public void testPostProcessorWithMaxItinerariesFilterSetToOneDepartAt() { + void testPostProcessorWithMaxItinerariesFilterSetToOneDepartAt() { // Given a default postProcessor with 'numOfItineraries=1' ItineraryListFilterChain chain = createBuilder(false, false, 1).build(); assertEquals(List.of(i1), chain.filter(List.of(i1, i2, i3))); } @Test - public void testPostProcessorWithMaxItinerariesFilterSetToOneArriveBy() { + void testPostProcessorWithMaxItinerariesFilterSetToOneArriveBy() { // Given a postProcessor with 'numOfItineraries=1' and 'arriveBy=true' ItineraryListFilterChain chain = createBuilder(true, false, 1).build(); assertEquals(List.of(i3), chain.filter(List.of(i1, i2, i3))); } } + @Nested + class FlexSearchWindow { + + private static final Itinerary FLEX = newItinerary(A, T11_00) + .flex(T11_00, T11_30, B) + .withIsSearchWindowAware(false) + .build(); + private static final Instant EARLIEST_DEPARTURE = FLEX.startTime().plusMinutes(10).toInstant(); + private static final Duration SEARCH_WINDOW = Duration.ofHours(7); + + /** + * When the filtering of direct flex by the transit search window is deactivated, the direct + * flex result should _not_ be filtered even though it starts before the earliest departure time. + */ + @Test + void keepDirectFlexWhenFilteringByEarliestDepartureIsDisabled() { + ItineraryListFilterChain chain = createBuilder(true, false, 10) + .withFilterDirectFlexBySearchWindow(false) + .withSearchWindow(EARLIEST_DEPARTURE, SEARCH_WINDOW) + .build(); + assertEquals(toStr(List.of(FLEX)), toStr(chain.filter(List.of(FLEX)))); + } + + @Test + void removeDirectFlexWhenFilteringByEarliestDepartureIsEnabled() { + ItineraryListFilterChain chain = createBuilder(true, false, 10) + .withFilterDirectFlexBySearchWindow(true) + .withSearchWindow(EARLIEST_DEPARTURE, SEARCH_WINDOW) + .build(); + assertEquals(toStr(List.of()), toStr(chain.filter(List.of(FLEX)))); + } + } + @Nested class RemoveTransitWithHigherCostThanBestOnStreetOnlyTest { @@ -310,7 +343,7 @@ class RemoveTransitWithHigherCostThanBestOnStreetOnlyTest { ItineraryListFilterChainBuilder builder = createBuilder(true, false, 20); @BeforeEach - public void setUpItineraries() { + void setUpItineraries() { // given // Walk for 12 minute walk = newItinerary(A, T11_06).walk(D12m, E).build(); @@ -319,7 +352,7 @@ public void setUpItineraries() { } @Test - public void removeTransitWithHigherCostThanBestOnStreetOnlyDisabled() { + void removeTransitWithHigherCostThanBestOnStreetOnlyDisabled() { // Allow non-optimal bus itinerary pass through ItineraryListFilterChain chain = builder .withRemoveTransitWithHigherCostThanBestOnStreetOnly(null) @@ -329,7 +362,7 @@ public void removeTransitWithHigherCostThanBestOnStreetOnlyDisabled() { } @Test - public void removeTransitWithHigherCostThanBestOnStreetOnlyEnabled() { + void removeTransitWithHigherCostThanBestOnStreetOnlyEnabled() { // Enable filter and remove bus itinerary ItineraryListFilterChain chain = builder .withRemoveTransitWithHigherCostThanBestOnStreetOnly( @@ -355,7 +388,7 @@ class AddEmissionsToItineraryTest { EmissionsService eService; @BeforeEach - public void setUpItineraries() { + void setUpItineraries() { bus = newItinerary(A).bus(21, T11_06, T11_09, B).build(); car = newItinerary(A).drive(T11_30, T11_50, B).build(); Map emissions = new HashMap<>(); @@ -364,7 +397,7 @@ public void setUpItineraries() { } @Test - public void emissionsTest() { + void emissionsTest() { ItineraryListFilterChain chain = builder .withEmissions(new DecorateWithEmission(eService)) .build(); diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveBikeRentalWithMostlyWalkingTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveBikeRentalWithMostlyWalkingTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveBikeRentalWithMostlyWalkingTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveBikeRentalWithMostlyWalkingTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveParkAndRideWithMostlyWalkingTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveParkAndRideWithMostlyWalkingTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveParkAndRideWithMostlyWalkingTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveParkAndRideWithMostlyWalkingTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveWalkOnlyFilterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveWalkOnlyFilterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveWalkOnlyFilterTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/street/RemoveWalkOnlyFilterTest.java diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/FlexSearchWindowFilterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/FlexSearchWindowFilterTest.java new file mode 100644 index 00000000000..30c8872b859 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/FlexSearchWindowFilterTest.java @@ -0,0 +1,74 @@ +package org.opentripplanner.routing.algorithm.filterchain.filters.system; + +import static com.google.common.truth.Truth.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.opentripplanner.framework.time.TimeUtils.time; +import static org.opentripplanner.model.plan.TestItineraryBuilder.newItinerary; + +import java.time.Duration; +import java.time.Instant; +import java.util.List; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import org.opentripplanner.model.plan.PlanTestConstants; +import org.opentripplanner.model.plan.SortOrder; +import org.opentripplanner.model.plan.TestItineraryBuilder; + +class FlexSearchWindowFilterTest implements PlanTestConstants { + + private static final Instant LATEST_DEPARTURE_TIME = TestItineraryBuilder + .newTime(time("09:20")) + .toInstant(); + + @ParameterizedTest + @ValueSource(strings = { "09:20", "09:21", "13:20" }) + void keepArriveByFlexItinerariesAfterEDT(String startTime) { + var edt = "9:20"; + var subject = new FlexSearchWindowFilter( + TestItineraryBuilder.newTime(time(edt)).toInstant(), + Duration.ofMinutes(30), + SortOrder.STREET_AND_DEPARTURE_TIME + ); + + var itin = newItinerary(A, time(startTime)) + .flex(T11_00, T11_30, B) + .withIsSearchWindowAware(false) + .build(); + + assertThat(subject.flagForRemoval(List.of(itin))).isEmpty(); + } + + @ParameterizedTest + @ValueSource(strings = { "00:00", "00:01", "09:19" }) + void removeArriveByFlexItinerariesBeforeEDT(String startTime) { + var subject = new FlexSearchWindowFilter( + LATEST_DEPARTURE_TIME, + Duration.ofMinutes(30), + SortOrder.STREET_AND_DEPARTURE_TIME + ); + + var itin = newItinerary(A, time(startTime)) + .flex(T11_00, T11_30, B) + .withIsSearchWindowAware(false) + .build(); + + assertThat(subject.flagForRemoval(List.of(itin))).isEmpty(); + } + + @ParameterizedTest + @ValueSource(strings = { "12:00" }) + void removeDepartAtFlexItinerariesAfterLAT(String startTime) { + var subject = new FlexSearchWindowFilter( + LATEST_DEPARTURE_TIME, + Duration.ofMinutes(30), + SortOrder.STREET_AND_ARRIVAL_TIME + ); + + var itin = newItinerary(A, time(startTime)) + .flex(T11_00, T11_30, B) + .withIsSearchWindowAware(false) + .build(); + + assertEquals(subject.flagForRemoval(List.of(itin)), List.of(itin)); + } +} diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/NumItinerariesFilterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/NumItinerariesFilterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/NumItinerariesFilterTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/NumItinerariesFilterTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/OutsideSearchWindowFilterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/OutsideSearchWindowFilterTest.java similarity index 64% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/OutsideSearchWindowFilterTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/OutsideSearchWindowFilterTest.java index 9752004560e..6e475ac5893 100644 --- a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/OutsideSearchWindowFilterTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/OutsideSearchWindowFilterTest.java @@ -1,17 +1,19 @@ package org.opentripplanner.routing.algorithm.filterchain.filters.system; +import static com.google.common.truth.Truth.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.opentripplanner.framework.time.TimeUtils.time; import static org.opentripplanner.model.plan.TestItineraryBuilder.newItinerary; import java.time.Duration; import java.util.List; +import java.util.stream.Stream; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import org.opentripplanner.framework.time.TimeUtils; import org.opentripplanner.model.SystemNotice; import org.opentripplanner.model.plan.Itinerary; import org.opentripplanner.model.plan.PlanTestConstants; @@ -20,8 +22,8 @@ public class OutsideSearchWindowFilterTest implements PlanTestConstants { private static final Duration SEARCH_WINDOW_10m = Duration.ofMinutes(10); - private final int startTime = TimeUtils.time("09:30"); - private final int endTime = TimeUtils.time("09:40"); + private final int startTime = time("09:30"); + private final int endTime = time("09:40"); private final Itinerary itinerary = newItinerary(A).bus(32, startTime, endTime, E).build(); private final List input = List.of(itinerary); @@ -40,7 +42,7 @@ static List filterOnSearchWindowTestCases() { public void filterOnSearchWindow(String description, String edt, boolean flaggedForRemoval) { List expected = flaggedForRemoval ? input : List.of(); var subject = new OutsideSearchWindowFilter( - TestItineraryBuilder.newTime(TimeUtils.time(edt)).toInstant(), + TestItineraryBuilder.newTime(time(edt)).toInstant(), SEARCH_WINDOW_10m ); var result = subject.flagForRemoval(input); @@ -55,4 +57,31 @@ public void testTaggedBy() { it.flagForDeletion(new SystemNotice(OutsideSearchWindowFilter.TAG, "Text")); assertTrue(OutsideSearchWindowFilter.taggedBy(it)); } + + private static Stream onStreetTestCases() { + int t9_28 = time("9:28"); + int t9_38 = time("9:38"); + return Stream + .of( + newItinerary(A, t9_28).walk(D2m, B), + newItinerary(A, t9_38).walk(D12m, B), + newItinerary(A, t9_28).bicycle(t9_28, t9_38, B), + newItinerary(A, t9_28).flex(t9_28, t9_38, B), + newItinerary(A, t9_28).flex(t9_38, time("9:48"), B), + newItinerary(A, time("9:20")).flex(time("9:20"), t9_28, B).walk(D12m, C) + ) + // results from the street & flex routers are not aware of the search window + .map(b -> b.withIsSearchWindowAware(false).build()); + } + + @ParameterizedTest + @MethodSource("onStreetTestCases") + void onStreetArriveByShouldNotBeRemoved(Itinerary itin) { + var edt = "9:20"; + var subject = new OutsideSearchWindowFilter( + TestItineraryBuilder.newTime(time(edt)).toInstant(), + SEARCH_WINDOW_10m + ); + assertThat(subject.flagForRemoval(List.of(itin))).isEmpty(); + } } diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/PagingFilterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/PagingFilterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/PagingFilterTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/PagingFilterTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/SingleCriteriaComparatorTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/SingleCriteriaComparatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/SingleCriteriaComparatorTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/SingleCriteriaComparatorTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/ItemTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/ItemTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/ItemTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/ItemTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/McMaxLimitFilterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/McMaxLimitFilterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/McMaxLimitFilterTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/McMaxLimitFilterTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveItinerariesWithShortStreetLegTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveItinerariesWithShortStreetLegTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveItinerariesWithShortStreetLegTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveItinerariesWithShortStreetLegTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveTransitIfStreetOnlyIsBetterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveTransitIfStreetOnlyIsBetterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveTransitIfStreetOnlyIsBetterTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveTransitIfStreetOnlyIsBetterTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveTransitIfWalkingIsBetterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveTransitIfWalkingIsBetterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveTransitIfWalkingIsBetterTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/RemoveTransitIfWalkingIsBetterTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/TransitAlertFilterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/TransitAlertFilterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/TransitAlertFilterTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/TransitAlertFilterTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/TransitGeneralizedCostFilterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/TransitGeneralizedCostFilterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/TransitGeneralizedCostFilterTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/TransitGeneralizedCostFilterTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/group/RemoveIfFirstOrLastTripIsTheSameTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/group/RemoveIfFirstOrLastTripIsTheSameTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/group/RemoveIfFirstOrLastTripIsTheSameTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/group/RemoveIfFirstOrLastTripIsTheSameTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/group/RemoveOtherThanSameLegsMaxGeneralizedCostTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/group/RemoveOtherThanSameLegsMaxGeneralizedCostTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/group/RemoveOtherThanSameLegsMaxGeneralizedCostTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/group/RemoveOtherThanSameLegsMaxGeneralizedCostTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/DecorateFilterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/DecorateFilterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/DecorateFilterTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/DecorateFilterTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/GroupByFilterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/GroupByFilterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/GroupByFilterTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/GroupByFilterTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/MaxLimitTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/MaxLimitTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/MaxLimitTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/MaxLimitTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/SortingFilterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/SortingFilterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/SortingFilterTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filter/SortingFilterTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filterchain/DeleteResultHandlerTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filterchain/DeleteResultHandlerTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filterchain/DeleteResultHandlerTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filterchain/DeleteResultHandlerTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filterchain/RoutingErrorsAttacherTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filterchain/RoutingErrorsAttacherTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filterchain/RoutingErrorsAttacherTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/filterchain/RoutingErrorsAttacherTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupByAllSameStationsTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupByAllSameStationsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupByAllSameStationsTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupByAllSameStationsTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupByDistanceTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupByDistanceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupByDistanceTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupByDistanceTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupBySameFirstOrLastTripTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupBySameFirstOrLastTripTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupBySameFirstOrLastTripTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupBySameFirstOrLastTripTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupBySameRoutesAndStopsTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupBySameRoutesAndStopsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupBySameRoutesAndStopsTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupBySameRoutesAndStopsTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/sort/SortOnGeneralizedCostTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/sort/SortOnGeneralizedCostTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/sort/SortOnGeneralizedCostTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/sort/SortOnGeneralizedCostTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/sort/SortOnNumberOfTransfersTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/sort/SortOnNumberOfTransfersTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/sort/SortOnNumberOfTransfersTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/sort/SortOnNumberOfTransfersTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/sort/SortOrderComparatorTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/sort/SortOrderComparatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/sort/SortOrderComparatorTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/sort/SortOrderComparatorTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/mapping/BikeRentalSnapshotTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/BikeRentalSnapshotTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/mapping/BikeRentalSnapshotTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/mapping/BikeRentalSnapshotTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/mapping/CarSnapshotTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/CarSnapshotTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/mapping/CarSnapshotTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/mapping/CarSnapshotTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/mapping/ElevationSnapshotTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/ElevationSnapshotTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/mapping/ElevationSnapshotTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/mapping/ElevationSnapshotTest.java diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/GraphPathToItineraryMapperTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/GraphPathToItineraryMapperTest.java new file mode 100644 index 00000000000..2d5c1b1770b --- /dev/null +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/GraphPathToItineraryMapperTest.java @@ -0,0 +1,40 @@ +package org.opentripplanner.routing.algorithm.mapping; + +import static org.junit.jupiter.api.Assertions.assertFalse; + +import java.util.stream.Stream; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.opentripplanner._support.time.ZoneIds; +import org.opentripplanner.astar.model.GraphPath; +import org.opentripplanner.routing.services.notes.StreetNotesService; +import org.opentripplanner.street.search.state.State; +import org.opentripplanner.street.search.state.TestStateBuilder; + +class GraphPathToItineraryMapperTest { + + private static Stream cases() { + return Stream + .of( + TestStateBuilder.ofWalking(), + TestStateBuilder.ofCycling(), + TestStateBuilder.ofDriving(), + TestStateBuilder.ofScooterRental().pickUpFreeFloatingScooter(), + TestStateBuilder.ofBikeAndRide(), + TestStateBuilder.parkAndRide() + ) + .map(b -> { + var state = b.streetEdge().streetEdge().build(); + return Arguments.argumentSet(state.currentMode().toString(), state); + }); + } + + @ParameterizedTest + @MethodSource("cases") + void isSearchWindowAware(State state) { + var mapper = new GraphPathToItineraryMapper(ZoneIds.UTC, new StreetNotesService(), 1); + var itin = mapper.generateItinerary(new GraphPath<>(state)); + assertFalse(itin.isSearchWindowAware()); + } +} diff --git a/src/test/java/org/opentripplanner/routing/algorithm/mapping/PagingServiceFactoryTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/PagingServiceFactoryTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/mapping/PagingServiceFactoryTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/mapping/PagingServiceFactoryTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapperTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapperTest.java similarity index 71% rename from src/test/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapperTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapperTest.java index 8f5d1a0208e..d10504978a4 100644 --- a/src/test/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapperTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapperTest.java @@ -1,8 +1,10 @@ package org.opentripplanner.routing.algorithm.mapping; +import static com.google.common.truth.Truth.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.opentripplanner.raptor._data.RaptorTestConstants.BOARD_SLACK; import java.time.Duration; @@ -11,6 +13,7 @@ import java.time.Month; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -18,11 +21,15 @@ import org.opentripplanner._support.time.ZoneIds; import org.opentripplanner.ext.flex.FlexAccessEgress; import org.opentripplanner.ext.flex.FlexPathDurations; +import org.opentripplanner.framework.application.OTPFeature; import org.opentripplanner.framework.model.Cost; import org.opentripplanner.framework.model.TimeAndCost; import org.opentripplanner.framework.time.TimeUtils; import org.opentripplanner.model.PickDrop; import org.opentripplanner.model.StopTime; +import org.opentripplanner.model.plan.Leg; +import org.opentripplanner.model.plan.ScheduledTransitLeg; +import org.opentripplanner.model.plan.StreetLeg; import org.opentripplanner.raptor._data.api.TestPathBuilder; import org.opentripplanner.raptor._data.transit.TestAccessEgress; import org.opentripplanner.raptor._data.transit.TestRoute; @@ -39,6 +46,7 @@ import org.opentripplanner.raptor.api.path.TransferPathLeg; import org.opentripplanner.raptor.path.Path; import org.opentripplanner.raptor.spi.RaptorCostCalculator; +import org.opentripplanner.routing.algorithm.raptoradapter.router.street.AccessEgressType; import org.opentripplanner.routing.algorithm.raptoradapter.transit.DefaultAccessEgress; import org.opentripplanner.routing.algorithm.raptoradapter.transit.DefaultRaptorTransfer; import org.opentripplanner.routing.algorithm.raptoradapter.transit.FlexAccessEgressAdapter; @@ -51,12 +59,10 @@ import org.opentripplanner.street.search.state.State; import org.opentripplanner.street.search.state.TestStateBuilder; import org.opentripplanner.transit.model._data.TransitModelForTest; -import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.network.StopPattern; import org.opentripplanner.transit.model.network.TripPattern; -import org.opentripplanner.transit.model.organization.Agency; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.timetable.booking.RoutingBookingInfo; import org.opentripplanner.transit.service.DefaultTransitService; @@ -73,8 +79,7 @@ public class RaptorPathToItineraryMapperTest { private static final int TRANSIT_START = TimeUtils.time("10:00"); private static final int TRANSIT_END = TimeUtils.time("11:00"); - - private final TestTransitData data = new TestTransitData(); + private static final Route ROUTE = TransitModelForTest.route("route").build(); public static final RaptorCostCalculator COST_CALCULATOR = new DefaultCostCalculator<>( BOARD_COST_SEC, @@ -84,9 +89,9 @@ public class RaptorPathToItineraryMapperTest { STOP_COSTS ); - private static final RegularStop S1 = TEST_MODEL.stop("STOP1", 0.0, 0.0).build(); - - private static final RegularStop S2 = TEST_MODEL.stop("STOP2", 1.0, 1.0).build(); + private static final RegularStop S1 = TEST_MODEL.stop("STOP1").build(); + private static final RegularStop S2 = TEST_MODEL.stop("STOP2").build(); + private static final RegularStop S3 = TEST_MODEL.stop("STOP3").build(); @ParameterizedTest @ValueSource(ints = { 0, 3000, -3000 }) @@ -113,6 +118,35 @@ void createItineraryTestZeroDurationEgress(int lastLegCost) { ); } + @Test + void noExtraLegWhenTransferringAtSameStop() { + var mapper = getRaptorPathToItineraryMapper(); + + var path = transferAtSameStopPath(); + var itinerary = mapper.createItinerary(path); + assertThat(itinerary.getLegs().stream().map(Object::getClass)).doesNotContain(StreetLeg.class); + } + + @Test + void extraLegWhenTransferringAtSameStop() { + RaptorPathToItineraryMapper mapper = getRaptorPathToItineraryMapper(); + + var schedule = getTestTripSchedule2(); + var path = new TestPathBuilder(COST_CALCULATOR) + .access(TRANSIT_START - BOARD_SLACK, 1) + .bus(schedule, 2) + .bus(schedule, 1) + .egress(TestAccessEgress.free(1, RaptorCostConverter.toRaptorCost(100))); + + OTPFeature.ExtraTransferLegOnSameStop.testOn(() -> { + var itinerary = mapper.createItinerary(path); + assertEquals( + List.of(ScheduledTransitLeg.class, StreetLeg.class, ScheduledTransitLeg.class), + itinerary.getLegs().stream().map(Leg::getClass).toList() + ); + }); + } + @Test @Disabled("Need to write a general test framework to enable this.") void penalty() { @@ -161,7 +195,10 @@ void createItineraryWithOnBoardFlexAccess() { true, RoutingBookingInfo.NOT_SET ); - RaptorAccessEgress access = new FlexAccessEgressAdapter(flexAccessEgress, false); + RaptorAccessEgress access = new FlexAccessEgressAdapter( + flexAccessEgress, + AccessEgressType.ACCESS + ); Transfer transfer = new Transfer(S2.getIndex(), 0); RaptorTransfer raptorTransfer = new DefaultRaptorTransfer(S1.getIndex(), 0, 0, transfer); RaptorAccessEgress egress = new DefaultAccessEgress(S2.getIndex(), state); @@ -184,6 +221,46 @@ void createItineraryWithOnBoardFlexAccess() { assertEquals(3, itinerary.getLegs().size(), "The wrong number of legs was returned"); } + private RaptorPath transferAtSameStopPath() { + var schedule = transferAtSameStopSchedule(); + return new TestPathBuilder(COST_CALCULATOR) + .access(TRANSIT_START, 1) + .bus(schedule, 2) + .bus(schedule, 1) + .egress(TestAccessEgress.free(1, RaptorCostConverter.toRaptorCost(100))); + } + + private TestTripSchedule transferAtSameStopSchedule() { + TestTransitData data = new TestTransitData(); + var pattern = TestTripPattern.pattern("TestPattern", 1, 2, 3, 2, 1).withRoute(ROUTE); + + var timetable = new TestTripSchedule.Builder() + .times( + TimeUtils.time("10:00"), + TimeUtils.time("10:05"), + TimeUtils.time("10:10"), + TimeUtils.time("10:15"), + TimeUtils.time("10:20") + ) + .pattern(pattern) + .originalPattern(getOriginalPattern(pattern)) + .build(); + + data.withRoutes(TestRoute.route("TransferAtSameStop", 1, 2, 3, 2, 1).withTimetable(timetable)); + + return data.getRoute(0).getTripSchedule(0); + } + + @Test + void isSearchWindowAware() { + var mapper = getRaptorPathToItineraryMapper(); + + var path = createTestTripSchedulePath(getTestTripSchedule()) + .egress(TestAccessEgress.free(2, RaptorCostConverter.toRaptorCost(100))); + var itinerary = mapper.createItinerary(path); + assertTrue(itinerary.isSearchWindowAware()); + } + private TripPattern getOriginalPattern(TestTripPattern pattern) { var stopModelBuilder = TEST_MODEL.stopModelBuilder(); ArrayList stopTimes = new ArrayList<>(); @@ -233,7 +310,12 @@ private static TransitLayer getTransitLayer() { new HashMap<>(), null, null, - TEST_MODEL.stopModelBuilder().withRegularStop(S1).withRegularStop(S2).build(), + TEST_MODEL + .stopModelBuilder() + .withRegularStop(S1) + .withRegularStop(S2) + .withRegularStop(S3) + .build(), null, null, null, @@ -241,21 +323,30 @@ private static TransitLayer getTransitLayer() { ); } - private TestTripSchedule getTestTripSchedule() { - var agency = Agency - .of(new FeedScopedId("TestFeed", "Auth_1")) - .withName("Test_Agency") - .withTimezone("Europe/Stockholm") - .build(); + private TestTripSchedule getTestTripSchedule2() { + TestTransitData data = new TestTransitData(); + var pattern = TestTripPattern.pattern("TestPattern", 1, 2, 3, 2, 1).withRoute(ROUTE); - var route = Route - .of(new FeedScopedId("TestFeed", "Line_1")) - .withAgency(agency) - .withMode(TransitMode.BUS) - .withShortName("Test_Bus") + var timetable = new TestTripSchedule.Builder() + .times( + TimeUtils.time("10:00"), + TimeUtils.time("10:05"), + TimeUtils.time("10:10"), + TimeUtils.time("10:15"), + TimeUtils.time("10:20") + ) + .pattern(pattern) + .originalPattern(getOriginalPattern(pattern)) .build(); - var pattern = TestTripPattern.pattern("TestPattern", 1, 2).withRoute(route); + data.withRoutes(TestRoute.route("TestRoute_1", 1, 2, 3, 2, 1).withTimetable(timetable)); + + return data.getRoute(0).getTripSchedule(0); + } + + private TestTripSchedule getTestTripSchedule() { + TestTransitData data = new TestTransitData(); + var pattern = TestTripPattern.pattern("TestPattern", 1, 2).withRoute(ROUTE); var timetable = new TestTripSchedule.Builder() .times(TRANSIT_START, TRANSIT_END) diff --git a/src/test/java/org/opentripplanner/routing/algorithm/mapping/SnapshotTestBase.java b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/SnapshotTestBase.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/mapping/SnapshotTestBase.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/mapping/SnapshotTestBase.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/mapping/StatesToWalkStepsMapperTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/StatesToWalkStepsMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/mapping/StatesToWalkStepsMapperTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/mapping/StatesToWalkStepsMapperTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/mapping/TransitSnapshotTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/TransitSnapshotTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/mapping/TransitSnapshotTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/mapping/TransitSnapshotTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/BikeRentalSnapshotTest.snap b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/BikeRentalSnapshotTest.snap similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/BikeRentalSnapshotTest.snap rename to application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/BikeRentalSnapshotTest.snap diff --git a/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/CarSnapshotTest.snap b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/CarSnapshotTest.snap similarity index 99% rename from src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/CarSnapshotTest.snap rename to application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/CarSnapshotTest.snap index 5d83d85cd7a..80614689ff4 100644 --- a/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/CarSnapshotTest.snap +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/CarSnapshotTest.snap @@ -98,13 +98,13 @@ org.opentripplanner.routing.algorithm.mapping.CarSnapshotTest.directCarPark=[ "lon" : -122.7016859, "name" : "P+R (#2)", "vehicleParking" : { - "entranceId" : "OSM:OSMWay/-102488/osm:node:-102438", + "entranceId" : "OSM:OsmWay/-102488/osm:node:-102438", "entranceName" : "P+R (#2)", "hasAnyCarPlaces" : true, "hasBicyclePlaces" : false, "hasCarPlaces" : true, "hasWheelchairAccessibleCarPlaces" : false, - "id" : "OSM:OSMWay/-102488", + "id" : "OSM:OsmWay/-102488", "name" : "P+R", "realtime" : false, "tags" : [ @@ -129,13 +129,13 @@ org.opentripplanner.routing.algorithm.mapping.CarSnapshotTest.directCarPark=[ "lon" : -122.7016931, "name" : "P+R (#1)", "vehicleParking" : { - "entranceId" : "OSM:OSMWay/-102488/osm:node:-102437", + "entranceId" : "OSM:OsmWay/-102488/osm:node:-102437", "entranceName" : "P+R (#1)", "hasAnyCarPlaces" : true, "hasBicyclePlaces" : false, "hasCarPlaces" : true, "hasWheelchairAccessibleCarPlaces" : false, - "id" : "OSM:OSMWay/-102488", + "id" : "OSM:OsmWay/-102488", "name" : "P+R", "realtime" : false, "tags" : [ diff --git a/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/ElevationSnapshotTest.snap b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/ElevationSnapshotTest.snap similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/ElevationSnapshotTest.snap rename to application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/ElevationSnapshotTest.snap diff --git a/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/TransitSnapshotTest.snap b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/TransitSnapshotTest.snap similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/TransitSnapshotTest.snap rename to application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/TransitSnapshotTest.snap diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/AdditionalSearchDaysTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/AdditionalSearchDaysTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/AdditionalSearchDaysTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/AdditionalSearchDaysTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/FilterTransitWhenDirectModeIsEmptyTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/FilterTransitWhenDirectModeIsEmptyTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/FilterTransitWhenDirectModeIsEmptyTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/FilterTransitWhenDirectModeIsEmptyTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressPenaltyDecoratorTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressPenaltyDecoratorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressPenaltyDecoratorTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressPenaltyDecoratorTest.java diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressRouterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressRouterTest.java new file mode 100644 index 00000000000..9cd2b6b913e --- /dev/null +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressRouterTest.java @@ -0,0 +1,273 @@ +package org.opentripplanner.routing.algorithm.raptoradapter.router.street; + +import static com.google.common.truth.Truth.assertThat; + +import java.time.Duration; +import java.util.Collection; +import java.util.Set; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.opentripplanner.framework.geometry.WgsCoordinate; +import org.opentripplanner.model.GenericLocation; +import org.opentripplanner.routing.algorithm.GraphRoutingTest; +import org.opentripplanner.routing.api.request.RouteRequest; +import org.opentripplanner.routing.api.request.StreetMode; +import org.opentripplanner.routing.api.request.request.StreetRequest; +import org.opentripplanner.routing.graph.Graph; +import org.opentripplanner.routing.graphfinder.NearbyStop; +import org.opentripplanner.street.model.vertex.TransitStopVertex; +import org.opentripplanner.street.search.TemporaryVerticesContainer; +import org.opentripplanner.street.search.state.State; +import org.opentripplanner.transit.model.framework.FeedScopedId; + +class AccessEgressRouterTest extends GraphRoutingTest { + + private Graph graph; + + private TransitStopVertex stopForCentroidRoutingStation; + private TransitStopVertex stopForNoCentroidRoutingStation; + + private static final WgsCoordinate origin = new WgsCoordinate(0.0, 0.0); + private static final WgsCoordinate farAwayCoordinate = origin.moveEastMeters(100000); + + @BeforeEach + protected void setUp() throws Exception { + var otpModel = modelOf( + new GraphRoutingTest.Builder() { + @Override + public void build() { + var A = intersection("A", origin); + var B = intersection("B", origin.moveEastMeters(100)); + var C = intersection("C", origin.moveEastMeters(200)); + var D = intersection("D", origin.moveEastMeters(300)); + var farAway = intersection("FarAway", farAwayCoordinate); + + biStreet(A, B, 100); + biStreet(B, C, 100); + biStreet(C, D, 100); + biStreet(farAway, A, 1000000); + + var centroidRoutingStation = stationEntity( + "CentroidRoutingStation", + b -> b.withCoordinate(A.toWgsCoordinate()).withShouldRouteToCentroid(true) + ); + var centroidRoutingStationVertex = stationCentroid(centroidRoutingStation); + + var noCentroidRoutingStation = stationEntity( + "NoCentroidRoutingStation", + b -> b.withCoordinate(D.toWgsCoordinate()) + ); + var noCentroidRoutingStationVertex = stationCentroid(noCentroidRoutingStation); + + // StopForCentroidRoutingStation is a child of centroidRoutingStation + stopForCentroidRoutingStation = + stop("StopForCentroidRoutingStation", B.toWgsCoordinate(), centroidRoutingStation); + + // StopForNoCentroidRoutingStation is a child of noCentroidRoutingStation + stopForNoCentroidRoutingStation = + stop("StopForNoCentroidRoutingStation", C.toWgsCoordinate(), noCentroidRoutingStation); + + biLink(A, centroidRoutingStationVertex); + biLink(B, stopForCentroidRoutingStation); + biLink(C, stopForNoCentroidRoutingStation); + biLink(D, noCentroidRoutingStationVertex); + } + } + ); + graph = otpModel.graph(); + } + + @Test + void findAccessEgressFromStop() { + var accesses = findAccessEgressFromTo( + location("StopForCentroidRoutingStation"), + location(farAwayCoordinate), + AccessEgressType.ACCESS + ); + assertAcessEgresses( + Set.of( + "direct[StopForCentroidRoutingStation]", + "street[StopForCentroidRoutingStation -> StopForNoCentroidRoutingStation]" + ), + accesses + ); + + var egresses = findAccessEgressFromTo( + location(farAwayCoordinate), + location("StopForCentroidRoutingStation"), + AccessEgressType.EGRESS + ); + assertAcessEgresses( + Set.of( + "direct[StopForCentroidRoutingStation]", + "street[StopForCentroidRoutingStation -> StopForNoCentroidRoutingStation]" + ), + egresses + ); + } + + @Test + void findAccessEgressStation() { + // For stations with centroid routing we should use the station centroid as source for the street search + var accesses = findAccessEgressFromTo( + location("CentroidRoutingStation"), + location(farAwayCoordinate), + AccessEgressType.ACCESS + ); + assertAcessEgresses( + Set.of( + "direct[StopForCentroidRoutingStation]", + "street[CentroidRoutingStation -> StopForNoCentroidRoutingStation]" + ), + accesses + ); + + var egresses = findAccessEgressFromTo( + location(farAwayCoordinate), + location("CentroidRoutingStation"), + AccessEgressType.EGRESS + ); + assertAcessEgresses( + Set.of( + "direct[StopForCentroidRoutingStation]", + "street[CentroidRoutingStation -> StopForNoCentroidRoutingStation]" + ), + egresses + ); + } + + @Test + void findAccessEgressStationNoCentroidRouting() { + // For stations without centroid routing we should use the quay as source for the street search + var accesses = findAccessEgressFromTo( + location("NoCentroidRoutingStation"), + location(farAwayCoordinate), + AccessEgressType.ACCESS + ); + assertAcessEgresses( + Set.of( + "direct[StopForNoCentroidRoutingStation]", + "street[StopForNoCentroidRoutingStation -> StopForCentroidRoutingStation]" + ), + accesses + ); + + var egresses = findAccessEgressFromTo( + location(farAwayCoordinate), + location("NoCentroidRoutingStation"), + AccessEgressType.EGRESS + ); + assertAcessEgresses( + Set.of( + "direct[StopForNoCentroidRoutingStation]", + "street[StopForNoCentroidRoutingStation -> StopForCentroidRoutingStation]" + ), + egresses + ); + } + + @Test + void findAccessEgressFromCoordinate() { + var coordinate = origin.moveEastMeters(5); + + // We should get street access from coordinate to quay1 and quay2 + var accesses = findAccessEgressFromTo( + location(coordinate), + location(farAwayCoordinate), + AccessEgressType.ACCESS + ); + assertAcessEgresses( + Set.of( + "street[Origin -> StopForCentroidRoutingStation]", + "street[Origin -> StopForNoCentroidRoutingStation]" + ), + accesses + ); + + // We should get street access from coordinate to quay1 and quay2 + var egresses = findAccessEgressFromTo( + location(farAwayCoordinate), + location(coordinate), + AccessEgressType.EGRESS + ); + assertAcessEgresses( + Set.of( + "street[Destination -> StopForCentroidRoutingStation]", + "street[Destination -> StopForNoCentroidRoutingStation]" + ), + egresses + ); + } + + /* Helper methods */ + + private GenericLocation location(WgsCoordinate coordinate) { + return new GenericLocation(coordinate.latitude(), coordinate.longitude()); + } + + private GenericLocation location(FeedScopedId id) { + return new GenericLocation(null, id, null, null); + } + + private GenericLocation location(String id) { + return location(new FeedScopedId("F", id)); + } + + private RouteRequest requestFromTo(GenericLocation from, GenericLocation to) { + var routeRequest = new RouteRequest(); + routeRequest.setFrom(from); + routeRequest.setTo(to); + return routeRequest; + } + + private String nearbyStopDescription(NearbyStop nearbyStop) { + if (nearbyStop.edges.isEmpty()) { + return "direct[" + nearbyStop.stop.getName() + "]"; + } else { + return "street[" + stateDescription(nearbyStop.state) + "]"; + } + } + + private String stateDescription(State state) { + var last = state; + while (last.getBackState() != null) { + last = last.getBackState(); + } + return last.getVertex().getName() + " -> " + state.getVertex().getName(); + } + + private void assertAcessEgresses(Set expected, Collection actual) { + assertThat(actual.stream().map(this::nearbyStopDescription)) + .containsExactlyElementsIn(expected); + } + + private Collection findAccessEgressFromTo( + GenericLocation from, + GenericLocation to, + AccessEgressType accessEgress + ) { + var maxStopCount = 10; + var durationLimit = Duration.ofMinutes(10); + var request = requestFromTo(from, to); + + try ( + var verticesContainer = new TemporaryVerticesContainer( + graph, + from, + to, + StreetMode.WALK, + StreetMode.WALK + ) + ) { + return AccessEgressRouter.findAccessEgresses( + request, + verticesContainer, + new StreetRequest(), + null, + accessEgress, + durationLimit, + maxStopCount + ); + } + } +} diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressTypeTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressTypeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressTypeTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressTypeTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressesTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressesTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressesTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/DefaultAccessEgressTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/DefaultAccessEgressTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/DefaultAccessEgressTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/DefaultAccessEgressTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransferTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransferTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransferTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransferTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitLayerTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitLayerTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitLayerTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitLayerTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TripPatternForDateTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TripPatternForDateTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TripPatternForDateTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TripPatternForDateTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearchTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearchTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearchTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearchTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/DefaultCostCalculatorTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/DefaultCostCalculatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/DefaultCostCalculatorTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/DefaultCostCalculatorTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/PatternCostCalculatorTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/PatternCostCalculatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/PatternCostCalculatorTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/PatternCostCalculatorTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostConverterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostConverterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostConverterTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostConverterTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostLinearFunctionTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostLinearFunctionTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostLinearFunctionTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostLinearFunctionTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/WheelchairCostCalculatorTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/WheelchairCostCalculatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/WheelchairCostCalculatorTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/WheelchairCostCalculatorTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/GeneralizedCostParametersMapperTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/GeneralizedCostParametersMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/GeneralizedCostParametersMapperTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/GeneralizedCostParametersMapperTest.java diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/LookupStopIndexCallbackTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/LookupStopIndexCallbackTest.java new file mode 100644 index 00000000000..fb39db51cd5 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/LookupStopIndexCallbackTest.java @@ -0,0 +1,53 @@ +package org.opentripplanner.routing.algorithm.raptoradapter.transit.mappers; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.opentripplanner.transit.model.framework.EntityNotFoundException; +import org.opentripplanner.transit.model.framework.FeedScopedId; + +class LookupStopIndexCallbackTest { + + private static final FeedScopedId ID_1 = FeedScopedId.ofNullable("F", "1"); + private static final FeedScopedId ID_2 = FeedScopedId.ofNullable("F", "2"); + private static final FeedScopedId ID_3 = FeedScopedId.ofNullable("F", "3"); + + private final LookupStopIndexCallback subject = new TestLookupStopIndexCallback( + Map.of(ID_1, new int[] { 1, 7, 13 }, ID_2, new int[] { 2, 7, 15 }) + ); + + /** + * This mostly verifies that the test is set up correctly, the code tested is the dummy inside + * the test. + */ + void lookupStopLocationIndexesSingleIdInput() { + assertArrayEquals(new int[] { 1, 7, 13 }, subject.lookupStopLocationIndexes(ID_1).toArray()); + var ex = Assertions.assertThrows( + EntityNotFoundException.class, + () -> subject.lookupStopLocationIndexes(ID_3).toArray() + ); + assertEquals("StopLocation does not exist for id F:3", ex.getMessage()); + } + + @Test + void lookupStopLocationIndexesCollectionInput() { + assertArrayEquals(new int[] {}, subject.lookupStopLocationIndexes(List.of())); + assertArrayEquals(new int[] { 1, 7, 13 }, subject.lookupStopLocationIndexes(List.of(ID_1))); + assertArrayEquals( + new int[] { 1, 2, 7, 13, 15 }, + subject.lookupStopLocationIndexes(List.of(ID_1, ID_2)) + ); + + // Should throw exception? + var ex = assertThrows( + EntityNotFoundException.class, + () -> subject.lookupStopLocationIndexes(List.of(ID_1, ID_3)) + ); + assertEquals("StopLocation entity not found: F:3", ex.getMessage()); + } +} diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapperTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapperTest.java similarity index 74% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapperTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapperTest.java index 47542782884..87e90e61b2e 100644 --- a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapperTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapperTest.java @@ -6,6 +6,8 @@ import java.time.Duration; import java.time.ZonedDateTime; import java.util.List; +import java.util.Map; +import java.util.stream.IntStream; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; @@ -14,10 +16,12 @@ import org.opentripplanner.raptor._data.transit.TestTripSchedule; import org.opentripplanner.raptor.api.model.RaptorAccessEgress; import org.opentripplanner.raptor.api.request.RaptorRequest; -import org.opentripplanner.routing.api.request.PassThroughPoint; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.api.request.framework.CostLinearFunction; +import org.opentripplanner.routing.api.request.via.PassThroughViaLocation; +import org.opentripplanner.routing.api.request.via.VisitViaLocation; import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.site.StopLocation; class RaptorRequestMapperTest { @@ -26,12 +30,13 @@ class RaptorRequestMapperTest { private static final StopLocation STOP_A = TEST_MODEL.stop("Stop:A").build(); private static final List ACCESS = List.of(TestAccessEgress.walk(12, 45)); private static final List EGRESS = List.of(TestAccessEgress.walk(144, 54)); - private static final Duration D0s = Duration.ofSeconds(0); private static final CostLinearFunction R1 = CostLinearFunction.of("50 + 1.0x"); private static final CostLinearFunction R2 = CostLinearFunction.of("0 + 1.5x"); private static final CostLinearFunction R3 = CostLinearFunction.of("30 + 2.0x"); + private static final Map STOPS_MAP = Map.of(STOP_A.getId(), STOP_A); + static List testCasesRelaxedCost() { return List.of( Arguments.of(CostLinearFunction.NORMAL, 0, 0), @@ -52,11 +57,29 @@ void mapRelaxCost(CostLinearFunction input, int cost, int expected) { assertEquals(expected, calcCost.relax(cost)); } + @Test + void testViaLocation() { + var req = new RouteRequest(); + var minWaitTime = Duration.ofMinutes(13); + + req.setViaLocations( + List.of(new VisitViaLocation("Via A", minWaitTime, List.of(STOP_A.getId()), List.of())) + ); + + var result = map(req); + + assertTrue(result.searchParams().hasViaLocations()); + assertEquals( + "[Via{label: Via A, minWaitTime: 13m, connections: [0 13m]}]", + result.searchParams().viaLocations().toString() + ); + } + @Test void testPassThroughPoints() { var req = new RouteRequest(); - req.setPassThroughPoints(List.of(new PassThroughPoint(List.of(STOP_A), "Via A"))); + req.setViaLocations(List.of(new PassThroughViaLocation("Via A", List.of(STOP_A.getId())))); var result = map(req); @@ -72,7 +95,7 @@ void testPassThroughPointsTurnTransitGroupPriorityOff() { var req = new RouteRequest(); // Set pass-through and relax transit-group-priority - req.setPassThroughPoints(List.of(new PassThroughPoint(List.of(STOP_A), "Via A"))); + req.setViaLocations(List.of(new PassThroughViaLocation("Via A", List.of(STOP_A.getId())))); req.withPreferences(p -> p.withTransit(t -> t.withRelaxTransitGroupPriority(CostLinearFunction.of("30m + 1.2t"))) ); @@ -90,7 +113,8 @@ private static RaptorRequest map(RouteRequest request) { false, ACCESS, EGRESS, - null + null, + id -> IntStream.of(STOPS_MAP.get(id).getIndex()) ); } } diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TestLookupStopIndexCallback.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TestLookupStopIndexCallback.java new file mode 100644 index 00000000000..f1898d69f52 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TestLookupStopIndexCallback.java @@ -0,0 +1,25 @@ +package org.opentripplanner.routing.algorithm.raptoradapter.transit.mappers; + +import java.util.Map; +import java.util.stream.IntStream; +import org.opentripplanner.transit.model.framework.EntityNotFoundException; +import org.opentripplanner.transit.model.framework.FeedScopedId; +import org.opentripplanner.transit.model.site.StopLocation; + +public class TestLookupStopIndexCallback implements LookupStopIndexCallback { + + private final Map index; + + public TestLookupStopIndexCallback(Map index) { + this.index = index; + } + + @Override + public IntStream lookupStopLocationIndexes(FeedScopedId stopLocationId) { + int[] values = index.get(stopLocationId); + if (values == null) { + throw new EntityNotFoundException(StopLocation.class, stopLocationId); + } + return IntStream.of(values); + } +} diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapperTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapperTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapperTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TripPatternForDateMapperTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TripPatternForDateMapperTest.java similarity index 97% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TripPatternForDateMapperTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TripPatternForDateMapperTest.java index 020dc6305a4..3f41c1d29c7 100644 --- a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TripPatternForDateMapperTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TripPatternForDateMapperTest.java @@ -10,7 +10,6 @@ import java.time.LocalDate; import java.util.HashMap; import java.util.Map; -import javax.annotation.Nonnull; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.opentripplanner.model.Timetable; @@ -36,7 +35,6 @@ public class TripPatternForDateMapperTest { @BeforeAll public static void setUp() throws Exception { var pattern = TEST_MODEL.pattern(BUS).build(); - timetable = new Timetable(pattern); var trip = TransitModelForTest.trip("1").build(); var tripTimes = TripTimesFactory.tripTimes( trip, @@ -44,7 +42,7 @@ public static void setUp() throws Exception { new Deduplicator() ); tripTimes.setServiceCode(SERVICE_CODE); - timetable.addTripTimes(tripTimes); + timetable = Timetable.of().withTripPattern(pattern).addTripTimes(tripTimes).build(); } /** @@ -102,7 +100,6 @@ void testTimeTableWithServiceCodesRunningNotMatchingShouldReturnNull() { assertNull(mapper.map(timetable, SERVICE_DATE)); } - @Nonnull private static TIntHashSet tintHashSet(int... numbers) { var set = new TIntHashSet(); set.addAll(numbers); diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRoutingRequestTransitDataCreatorTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRoutingRequestTransitDataCreatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRoutingRequestTransitDataCreatorTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRoutingRequestTransitDataCreatorTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RouteRequestTransitDataProviderFilterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RouteRequestTransitDataProviderFilterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RouteRequestTransitDataProviderFilterTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RouteRequestTransitDataProviderFilterTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TestRouteData.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TestRouteData.java similarity index 98% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TestRouteData.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TestRouteData.java index f57f03705fd..8648ea20324 100644 --- a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TestRouteData.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TestRouteData.java @@ -62,8 +62,8 @@ public TestRouteData(Route route, List stops, List times) { .of(TransitModelForTest.id("TP:" + route)) .withRoute(this.route) .withStopPattern(new StopPattern(stopTimesFistTrip)) + .withScheduledTimeTableBuilder(builder -> builder.addAllTripTimes(tripTimes)) .build(); - tripTimes.forEach(tripPattern::add); RoutingTripPattern routingTripPattern = tripPattern.getRoutingTripPattern(); diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TestTransitCaseData.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TestTransitCaseData.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TestTransitCaseData.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TestTransitCaseData.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripAssert.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripAssert.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripAssert.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripAssert.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleAlightSearchTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleAlightSearchTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleAlightSearchTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleAlightSearchTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleBoardSearchTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleBoardSearchTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleBoardSearchTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleBoardSearchTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/api/OptimizedPathTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/api/OptimizedPathTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/api/OptimizedPathTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/api/OptimizedPathTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/MinSafeTransferTimeCalculatorTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/MinSafeTransferTimeCalculatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/MinSafeTransferTimeCalculatorTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/MinSafeTransferTimeCalculatorTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/OptimizedPathTailTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/OptimizedPathTailTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/OptimizedPathTailTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/OptimizedPathTailTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/StopPriorityCostCalculatorTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/StopPriorityCostCalculatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/StopPriorityCostCalculatorTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/StopPriorityCostCalculatorTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/StopTimeTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/StopTimeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/StopTimeTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/StopTimeTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TransferWaitTimeCostCalculatorTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TransferWaitTimeCostCalculatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TransferWaitTimeCostCalculatorTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TransferWaitTimeCostCalculatorTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TripStopTimeTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TripStopTimeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TripStopTimeTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TripStopTimeTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/costfilter/MinCostPathTailFilterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/costfilter/MinCostPathTailFilterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/costfilter/MinCostPathTailFilterTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/costfilter/MinCostPathTailFilterTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughNoTransfersTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughNoTransfersTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughNoTransfersTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughNoTransfersTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughOneTransferTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughOneTransferTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughOneTransferTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughOneTransferTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughTwoTransfersTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughTwoTransfersTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughTwoTransfersTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughTwoTransfersTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/StopPair.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/StopPair.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/StopPair.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/StopPair.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/TestCase.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/TestCase.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/TestCase.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/TestCase.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/TestCaseBuilder.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/TestCaseBuilder.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/TestCaseBuilder.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/TestCaseBuilder.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/TestUtils.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/TestUtils.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/TestUtils.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/TestUtils.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/WalkDurationForStopCombinations.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/WalkDurationForStopCombinations.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/WalkDurationForStopCombinations.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/WalkDurationForStopCombinations.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainServiceConstrainedTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainServiceConstrainedTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainServiceConstrainedTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainServiceConstrainedTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainServiceTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainServiceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainServiceTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainServiceTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TestTransferBuilder.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TestTransferBuilder.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TestTransferBuilder.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TestTransferBuilder.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGeneratorDummy.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGeneratorDummy.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGeneratorDummy.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGeneratorDummy.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGeneratorTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGeneratorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGeneratorTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGeneratorTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransitPathLegSelectorTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransitPathLegSelectorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransitPathLegSelectorTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransitPathLegSelectorTest.java diff --git a/src/test/java/org/opentripplanner/routing/algorithm/via/ViaRoutingWorkerTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/via/ViaRoutingWorkerTest.java similarity index 98% rename from src/test/java/org/opentripplanner/routing/algorithm/via/ViaRoutingWorkerTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/via/ViaRoutingWorkerTest.java index 94c8c7b2f71..4425aa10ccd 100644 --- a/src/test/java/org/opentripplanner/routing/algorithm/via/ViaRoutingWorkerTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/via/ViaRoutingWorkerTest.java @@ -17,7 +17,7 @@ import org.opentripplanner.model.plan.TripPlan; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.api.request.RouteViaRequest; -import org.opentripplanner.routing.api.request.ViaLocation; +import org.opentripplanner.routing.api.request.ViaLocationDeprecated; import org.opentripplanner.routing.api.request.request.JourneyRequest; import org.opentripplanner.routing.api.response.RoutingResponse; import org.opentripplanner.routing.api.response.ViaRoutingResponseConnection; @@ -136,7 +136,7 @@ public RouteViaRequest createRouteViaRequest() { int minSlack = 10; int maxSlack = 45; var viaLocations = List.of( - new ViaLocation( + new ViaLocationDeprecated( location(viaC), false, Duration.ofMinutes(minSlack), diff --git a/src/test/java/org/opentripplanner/routing/api/request/DebugRaptorTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/DebugRaptorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/DebugRaptorTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/DebugRaptorTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/WheelchairPreferencesTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/WheelchairPreferencesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/WheelchairPreferencesTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/WheelchairPreferencesTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/framework/CostLinearFunctionTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/framework/CostLinearFunctionTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/framework/CostLinearFunctionTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/framework/CostLinearFunctionTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/framework/DurationForEnumTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/framework/DurationForEnumTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/framework/DurationForEnumTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/framework/DurationForEnumTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/framework/LinearFunctionSerializationTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/framework/LinearFunctionSerializationTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/framework/LinearFunctionSerializationTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/framework/LinearFunctionSerializationTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/framework/TimeAndCostPenaltyForEnumTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/framework/TimeAndCostPenaltyForEnumTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/framework/TimeAndCostPenaltyForEnumTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/framework/TimeAndCostPenaltyForEnumTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/framework/TimeAndCostPenaltyTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/framework/TimeAndCostPenaltyTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/framework/TimeAndCostPenaltyTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/framework/TimeAndCostPenaltyTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/framework/TimePenaltyTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/framework/TimePenaltyTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/framework/TimePenaltyTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/framework/TimePenaltyTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/AccessibilityPreferencesTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/preference/AccessibilityPreferencesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/preference/AccessibilityPreferencesTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/preference/AccessibilityPreferencesTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/BikePreferencesTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/preference/BikePreferencesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/preference/BikePreferencesTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/preference/BikePreferencesTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/CarPreferencesTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/preference/CarPreferencesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/preference/CarPreferencesTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/preference/CarPreferencesTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/ElevatorPreferencesTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/preference/ElevatorPreferencesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/preference/ElevatorPreferencesTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/preference/ElevatorPreferencesTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/ImmutablePreferencesAsserts.java b/application/src/test/java/org/opentripplanner/routing/api/request/preference/ImmutablePreferencesAsserts.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/preference/ImmutablePreferencesAsserts.java rename to application/src/test/java/org/opentripplanner/routing/api/request/preference/ImmutablePreferencesAsserts.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/ItineraryFilterDebugProfileTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/preference/ItineraryFilterDebugProfileTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/preference/ItineraryFilterDebugProfileTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/preference/ItineraryFilterDebugProfileTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/ItineraryFilterPreferencesTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/preference/ItineraryFilterPreferencesTest.java similarity index 94% rename from src/test/java/org/opentripplanner/routing/api/request/preference/ItineraryFilterPreferencesTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/preference/ItineraryFilterPreferencesTest.java index f59586b0af9..4c1403b0b0f 100644 --- a/src/test/java/org/opentripplanner/routing/api/request/preference/ItineraryFilterPreferencesTest.java +++ b/application/src/test/java/org/opentripplanner/routing/api/request/preference/ItineraryFilterPreferencesTest.java @@ -127,13 +127,20 @@ void testCopyOfEqualsAndHashCode() { // Create a copy, make a change and set it back again to force creating a new object var other = subject.copyOf().withGroupSimilarityKeepOne(0.95).build(); - var same = other.copyOf().withGroupSimilarityKeepOne(GROUP_SIMILARITY_KEEP_ONE).build(); + var same = other + .copyOf() + .withGroupSimilarityKeepOne(GROUP_SIMILARITY_KEEP_ONE) + .withFilterDirectFlexBySearchWindow(true) + .build(); assertEqualsAndHashCode(subject, other, same); } @Test void testToString() { - assertEquals("ItineraryFilterPreferences{}", ItineraryFilterPreferences.DEFAULT.toString()); + assertEquals( + "ItineraryFilterPreferences{filterDirectFlexBySearchWindow}", + ItineraryFilterPreferences.DEFAULT.toString() + ); assertEquals( "ItineraryFilterPreferences{" + "accessibilityScore, " + @@ -147,7 +154,8 @@ void testToString() { "nonTransitGeneralizedCostLimit: 4s + 5.0 t, " + "parkAndRideDurationRatio: 0.44, " + "transitGeneralizedCostLimit: TransitGeneralizedCostFilterParams[costLimitFunction=4s + 5.0 t, intervalRelaxFactor=3.0], " + - "removeTransitWithHigherCostThanBestOnStreetOnly: 30s + 1.30 t" + + "removeTransitWithHigherCostThanBestOnStreetOnly: 30s + 1.30 t, " + + "filterDirectFlexBySearchWindow" + "}", subject.toString() ); diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/RaptorPreferencesTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/preference/RaptorPreferencesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/preference/RaptorPreferencesTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/preference/RaptorPreferencesTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/RelaxTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/preference/RelaxTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/preference/RelaxTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/preference/RelaxTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/ScooterPreferencesTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/preference/ScooterPreferencesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/preference/ScooterPreferencesTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/preference/ScooterPreferencesTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/StreetPreferencesTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/preference/StreetPreferencesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/preference/StreetPreferencesTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/preference/StreetPreferencesTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/SystemPreferencesTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/preference/SystemPreferencesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/preference/SystemPreferencesTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/preference/SystemPreferencesTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/TimeSlopeSafetyTriangleTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/preference/TimeSlopeSafetyTriangleTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/preference/TimeSlopeSafetyTriangleTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/preference/TimeSlopeSafetyTriangleTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/TransferOptimizationPreferencesTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/preference/TransferOptimizationPreferencesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/preference/TransferOptimizationPreferencesTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/preference/TransferOptimizationPreferencesTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/TransferPreferencesTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/preference/TransferPreferencesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/preference/TransferPreferencesTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/preference/TransferPreferencesTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/TransitPreferencesTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/preference/TransitPreferencesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/preference/TransitPreferencesTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/preference/TransitPreferencesTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/VehicleParkingPreferencesTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/preference/VehicleParkingPreferencesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/preference/VehicleParkingPreferencesTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/preference/VehicleParkingPreferencesTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/VehicleRentalPreferencesTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/preference/VehicleRentalPreferencesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/preference/VehicleRentalPreferencesTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/preference/VehicleRentalPreferencesTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/VehicleWalkingPreferencesTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/preference/VehicleWalkingPreferencesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/preference/VehicleWalkingPreferencesTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/preference/VehicleWalkingPreferencesTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/WalkPreferencesTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/preference/WalkPreferencesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/preference/WalkPreferencesTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/preference/WalkPreferencesTest.java diff --git a/src/test/java/org/opentripplanner/routing/api/request/request/filter/SelectRequestTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/request/filter/SelectRequestTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/api/request/request/filter/SelectRequestTest.java rename to application/src/test/java/org/opentripplanner/routing/api/request/request/filter/SelectRequestTest.java diff --git a/application/src/test/java/org/opentripplanner/routing/api/request/via/PassThroughViaLocationTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/via/PassThroughViaLocationTest.java new file mode 100644 index 00000000000..9ed431912ac --- /dev/null +++ b/application/src/test/java/org/opentripplanner/routing/api/request/via/PassThroughViaLocationTest.java @@ -0,0 +1,64 @@ +package org.opentripplanner.routing.api.request.via; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.time.Duration; +import java.util.List; +import org.junit.jupiter.api.Test; +import org.opentripplanner._support.asserts.AssertEqualsAndHashCode; +import org.opentripplanner.transit.model.framework.FeedScopedId; + +class PassThroughViaLocationTest { + + private static final FeedScopedId ID = FeedScopedId.ofNullable("F", "1"); + + private static final String LABEL = "AName"; + + @SuppressWarnings("DataFlowIssue") + private static final ViaLocation subject = new PassThroughViaLocation(LABEL, List.of(ID)); + + @Test + void allowAsPassThroughPoint() { + assertTrue(subject.isPassThroughLocation()); + } + + @Test + void minimumWaitTime() { + assertEquals(Duration.ZERO, subject.minimumWaitTime()); + } + + @Test + void label() { + assertEquals(LABEL, subject.label()); + } + + @Test + void stopLocationIds() { + assertEquals("[F:1]", subject.stopLocationIds().toString()); + } + + @Test + void coordinates() { + assertEquals("[]", subject.coordinates().toString()); + } + + @Test + void testToString() { + assertEquals( + "PassThroughViaLocation{label: AName, stopLocationIds: [F:1]}", + subject.toString() + ); + } + + @Test + void testEqAndHashCode() { + AssertEqualsAndHashCode + .verify(subject) + .sameAs(new PassThroughViaLocation(subject.label(), subject.stopLocationIds())) + .differentFrom( + new PassThroughViaLocation("Other", subject.stopLocationIds()), + new PassThroughViaLocation(subject.label(), List.of(new FeedScopedId("F", "2"))) + ); + } +} diff --git a/application/src/test/java/org/opentripplanner/routing/api/request/via/VisitViaLocationTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/via/VisitViaLocationTest.java new file mode 100644 index 00000000000..e36ed42551e --- /dev/null +++ b/application/src/test/java/org/opentripplanner/routing/api/request/via/VisitViaLocationTest.java @@ -0,0 +1,77 @@ +package org.opentripplanner.routing.api.request.via; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; + +import java.time.Duration; +import java.util.List; +import org.junit.jupiter.api.Test; +import org.opentripplanner._support.asserts.AssertEqualsAndHashCode; +import org.opentripplanner.framework.geometry.WgsCoordinate; +import org.opentripplanner.transit.model.framework.FeedScopedId; + +class VisitViaLocationTest { + + private static final FeedScopedId ID = FeedScopedId.ofNullable("F", "1"); + private static final String LABEL = "AName"; + private static final Duration MINIMUM_WAIT_TIME = Duration.ofMinutes(5); + + @SuppressWarnings("DataFlowIssue") + private static final ViaLocation subject = new VisitViaLocation( + LABEL, + MINIMUM_WAIT_TIME, + List.of(ID), + List.of(WgsCoordinate.GREENWICH) + ); + + @Test + void allowAsPassThroughPoint() { + assertFalse(subject.isPassThroughLocation()); + } + + @Test + void minimumWaitTime() { + assertEquals(MINIMUM_WAIT_TIME, subject.minimumWaitTime()); + } + + @Test + void label() { + assertEquals(LABEL, subject.label()); + } + + @Test + void stopLocationIds() { + assertEquals("[F:1]", subject.stopLocationIds().toString()); + } + + @Test + void coordinates() { + assertEquals("[" + WgsCoordinate.GREENWICH + "]", subject.coordinates().toString()); + } + + @Test + void testToString() { + assertEquals( + "VisitViaLocation{label: AName, minimumWaitTime: 5m, stopLocationIds: [F:1], coordinates: [(51.48, 0.0)]}", + subject.toString() + ); + } + + @Test + void testEqAndHashCode() { + var l = subject.label(); + var mwt = subject.minimumWaitTime(); + var ids = subject.stopLocationIds(); + var cs = subject.coordinates(); + + AssertEqualsAndHashCode + .verify(subject) + .sameAs(new VisitViaLocation(l, mwt, ids, cs)) + .differentFrom( + new VisitViaLocation("other", mwt, ids, cs), + new VisitViaLocation(l, Duration.ZERO, ids, cs), + new VisitViaLocation(l, mwt, List.of(), cs), + new VisitViaLocation(l, mwt, ids, List.of()) + ); + } +} diff --git a/src/test/java/org/opentripplanner/routing/core/GraphTest.java b/application/src/test/java/org/opentripplanner/routing/core/GraphTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/core/GraphTest.java rename to application/src/test/java/org/opentripplanner/routing/core/GraphTest.java diff --git a/src/test/java/org/opentripplanner/routing/core/ItineraryFaresTest.java b/application/src/test/java/org/opentripplanner/routing/core/ItineraryFaresTest.java similarity index 98% rename from src/test/java/org/opentripplanner/routing/core/ItineraryFaresTest.java rename to application/src/test/java/org/opentripplanner/routing/core/ItineraryFaresTest.java index 3ad3b918ce1..2e64952d351 100644 --- a/src/test/java/org/opentripplanner/routing/core/ItineraryFaresTest.java +++ b/application/src/test/java/org/opentripplanner/routing/core/ItineraryFaresTest.java @@ -15,7 +15,6 @@ import static org.opentripplanner.transit.model._data.TransitModelForTest.id; import java.util.List; -import javax.annotation.Nonnull; import org.junit.jupiter.api.Test; import org.opentripplanner.model.fare.FareProduct; import org.opentripplanner.model.fare.FareProductUse; @@ -65,7 +64,6 @@ void empty() { assertTrue(ItineraryFares.empty().isEmpty()); } - @Nonnull private static FareProduct fareProduct(String id) { return new FareProduct(id(id), id, Money.euros(10), null, null, null); } diff --git a/src/test/java/org/opentripplanner/routing/core/MoneyTest.java b/application/src/test/java/org/opentripplanner/routing/core/MoneyTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/core/MoneyTest.java rename to application/src/test/java/org/opentripplanner/routing/core/MoneyTest.java diff --git a/src/test/java/org/opentripplanner/routing/core/RouteRequestTest.java b/application/src/test/java/org/opentripplanner/routing/core/RouteRequestTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/core/RouteRequestTest.java rename to application/src/test/java/org/opentripplanner/routing/core/RouteRequestTest.java diff --git a/src/test/java/org/opentripplanner/routing/core/RoutingPreferencesTest.java b/application/src/test/java/org/opentripplanner/routing/core/RoutingPreferencesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/core/RoutingPreferencesTest.java rename to application/src/test/java/org/opentripplanner/routing/core/RoutingPreferencesTest.java diff --git a/src/test/java/org/opentripplanner/routing/core/TemporaryVerticesContainerTest.java b/application/src/test/java/org/opentripplanner/routing/core/TemporaryVerticesContainerTest.java similarity index 96% rename from src/test/java/org/opentripplanner/routing/core/TemporaryVerticesContainerTest.java rename to application/src/test/java/org/opentripplanner/routing/core/TemporaryVerticesContainerTest.java index c01558338a4..1af45763b60 100644 --- a/src/test/java/org/opentripplanner/routing/core/TemporaryVerticesContainerTest.java +++ b/application/src/test/java/org/opentripplanner/routing/core/TemporaryVerticesContainerTest.java @@ -60,13 +60,8 @@ public void setup() { @Test public void temporaryChangesRemovedOnClose() { - // Given - A request - RouteRequest request = new RouteRequest(); - request.setFrom(from); - request.setTo(to); - // When - the container is created - subject = new TemporaryVerticesContainer(g, request, StreetMode.WALK, StreetMode.WALK); + subject = new TemporaryVerticesContainer(g, from, to, StreetMode.WALK, StreetMode.WALK); // Then: originAndDestinationInsertedCorrect(); diff --git a/src/test/java/org/opentripplanner/routing/core/TurnsTest.java b/application/src/test/java/org/opentripplanner/routing/core/TurnsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/core/TurnsTest.java rename to application/src/test/java/org/opentripplanner/routing/core/TurnsTest.java diff --git a/src/test/java/org/opentripplanner/routing/graph/DefaultRoutingServiceTest.java b/application/src/test/java/org/opentripplanner/routing/graph/DefaultRoutingServiceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/graph/DefaultRoutingServiceTest.java rename to application/src/test/java/org/opentripplanner/routing/graph/DefaultRoutingServiceTest.java diff --git a/src/test/java/org/opentripplanner/routing/graph/EdgeTest.java b/application/src/test/java/org/opentripplanner/routing/graph/EdgeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/graph/EdgeTest.java rename to application/src/test/java/org/opentripplanner/routing/graph/EdgeTest.java diff --git a/src/test/java/org/opentripplanner/routing/graph/GraphSerializationTest.java b/application/src/test/java/org/opentripplanner/routing/graph/GraphSerializationTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/graph/GraphSerializationTest.java rename to application/src/test/java/org/opentripplanner/routing/graph/GraphSerializationTest.java diff --git a/src/test/java/org/opentripplanner/routing/graph/SimpleConcreteEdge.java b/application/src/test/java/org/opentripplanner/routing/graph/SimpleConcreteEdge.java similarity index 96% rename from src/test/java/org/opentripplanner/routing/graph/SimpleConcreteEdge.java rename to application/src/test/java/org/opentripplanner/routing/graph/SimpleConcreteEdge.java index 0a3fccccda7..f36300de9ef 100644 --- a/src/test/java/org/opentripplanner/routing/graph/SimpleConcreteEdge.java +++ b/application/src/test/java/org/opentripplanner/routing/graph/SimpleConcreteEdge.java @@ -1,6 +1,5 @@ package org.opentripplanner.routing.graph; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.LineString; import org.opentripplanner.framework.geometry.SphericalDistanceLibrary; import org.opentripplanner.framework.i18n.I18NString; @@ -24,7 +23,6 @@ public static SimpleConcreteEdge createSimpleConcreteEdge(Vertex v1, Vertex v2) } @Override - @Nonnull public State[] traverse(State s0) { double d = getDistanceMeters(); TraverseMode mode = s0.currentMode(); diff --git a/src/test/java/org/opentripplanner/routing/graph/TemporaryConcreteEdge.java b/application/src/test/java/org/opentripplanner/routing/graph/TemporaryConcreteEdge.java similarity index 97% rename from src/test/java/org/opentripplanner/routing/graph/TemporaryConcreteEdge.java rename to application/src/test/java/org/opentripplanner/routing/graph/TemporaryConcreteEdge.java index 44f6b6f7298..19020fc3f4f 100644 --- a/src/test/java/org/opentripplanner/routing/graph/TemporaryConcreteEdge.java +++ b/application/src/test/java/org/opentripplanner/routing/graph/TemporaryConcreteEdge.java @@ -1,6 +1,5 @@ package org.opentripplanner.routing.graph; -import javax.annotation.Nonnull; import org.opentripplanner.framework.geometry.SphericalDistanceLibrary; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.street.model.edge.Edge; @@ -36,7 +35,6 @@ public static TemporaryConcreteEdge createTemporaryConcreteEdge(Vertex v1, Tempo } @Override - @Nonnull public State[] traverse(State s0) { double d = getDistanceMeters(); TraverseMode mode = s0.currentMode(); diff --git a/src/test/java/org/opentripplanner/routing/graphfinder/DirectGraphFinderTest.java b/application/src/test/java/org/opentripplanner/routing/graphfinder/DirectGraphFinderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/graphfinder/DirectGraphFinderTest.java rename to application/src/test/java/org/opentripplanner/routing/graphfinder/DirectGraphFinderTest.java diff --git a/src/test/java/org/opentripplanner/routing/graphfinder/NearbyStopTest.java b/application/src/test/java/org/opentripplanner/routing/graphfinder/NearbyStopTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/graphfinder/NearbyStopTest.java rename to application/src/test/java/org/opentripplanner/routing/graphfinder/NearbyStopTest.java diff --git a/src/test/java/org/opentripplanner/routing/graphfinder/PlaceFinderTraverseVisitorTest.java b/application/src/test/java/org/opentripplanner/routing/graphfinder/PlaceFinderTraverseVisitorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/graphfinder/PlaceFinderTraverseVisitorTest.java rename to application/src/test/java/org/opentripplanner/routing/graphfinder/PlaceFinderTraverseVisitorTest.java diff --git a/src/test/java/org/opentripplanner/routing/graphfinder/StopFinderTraverseVisitorTest.java b/application/src/test/java/org/opentripplanner/routing/graphfinder/StopFinderTraverseVisitorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/graphfinder/StopFinderTraverseVisitorTest.java rename to application/src/test/java/org/opentripplanner/routing/graphfinder/StopFinderTraverseVisitorTest.java diff --git a/src/test/java/org/opentripplanner/routing/graphfinder/StreetGraphFinderTest.java b/application/src/test/java/org/opentripplanner/routing/graphfinder/StreetGraphFinderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/graphfinder/StreetGraphFinderTest.java rename to application/src/test/java/org/opentripplanner/routing/graphfinder/StreetGraphFinderTest.java diff --git a/src/test/java/org/opentripplanner/routing/linking/LinkStopToPlatformTest.java b/application/src/test/java/org/opentripplanner/routing/linking/LinkStopToPlatformTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/linking/LinkStopToPlatformTest.java rename to application/src/test/java/org/opentripplanner/routing/linking/LinkStopToPlatformTest.java diff --git a/src/test/java/org/opentripplanner/routing/stoptimes/AlternativeLegsTest.java b/application/src/test/java/org/opentripplanner/routing/stoptimes/AlternativeLegsTest.java similarity index 88% rename from src/test/java/org/opentripplanner/routing/stoptimes/AlternativeLegsTest.java rename to application/src/test/java/org/opentripplanner/routing/stoptimes/AlternativeLegsTest.java index fde87776909..a4699ece2ed 100644 --- a/src/test/java/org/opentripplanner/routing/stoptimes/AlternativeLegsTest.java +++ b/application/src/test/java/org/opentripplanner/routing/stoptimes/AlternativeLegsTest.java @@ -55,9 +55,7 @@ void testPreviousLegs() { AlternativeLegsFilter.NO_FILTER ); - var legs = Itinerary.toStr( - alternativeLegs.stream().map(Leg.class::cast).map(List::of).map(Itinerary::new).toList() - ); + var legs = toString(alternativeLegs); var expected = "B ~ BUS 2 0:20 0:30 ~ C [C₁-1], " + @@ -91,9 +89,7 @@ void testNextLegs() { AlternativeLegsFilter.NO_FILTER ); - var legs = Itinerary.toStr( - alternativeLegs.stream().map(Leg.class::cast).map(List::of).map(Itinerary::new).toList() - ); + var legs = toString(alternativeLegs); var expected = "B ~ BUS 3 1:00 1:10 ~ C [C₁-1], " + @@ -126,9 +122,8 @@ void testCircularRoutes() { false, AlternativeLegsFilter.NO_FILTER ); - var legs = Itinerary.toStr( - alternativeLegs.stream().map(Leg.class::cast).map(List::of).map(Itinerary::new).toList() - ); + + var legs = toString(alternativeLegs); assertEquals("X ~ BUS 19 10:30 10:40 ~ Y [C₁-1], X ~ BUS 19 10:00 10:10 ~ Y [C₁-1]", legs); } @@ -155,11 +150,20 @@ void testComplexCircularRoutes() { false, AlternativeLegsFilter.NO_FILTER ); - var legs = Itinerary.toStr( - alternativeLegs.stream().map(Leg.class::cast).map(List::of).map(Itinerary::new).toList() - ); + var legs = toString(alternativeLegs); var expected = String.join(", ", List.of("X ~ BUS 19 10:30 11:00 ~ B [C₁-1]")); assertEquals(expected, legs); } + + private static String toString(List alternativeLegs) { + return Itinerary.toStr( + alternativeLegs + .stream() + .map(Leg.class::cast) + .map(List::of) + .map(Itinerary::createScheduledTransitItinerary) + .toList() + ); + } } diff --git a/src/test/java/org/opentripplanner/routing/stoptimes/StopTimesHelperTest.java b/application/src/test/java/org/opentripplanner/routing/stoptimes/StopTimesHelperTest.java similarity index 94% rename from src/test/java/org/opentripplanner/routing/stoptimes/StopTimesHelperTest.java rename to application/src/test/java/org/opentripplanner/routing/stoptimes/StopTimesHelperTest.java index 1432c68fd49..61fffd7a905 100644 --- a/src/test/java/org/opentripplanner/routing/stoptimes/StopTimesHelperTest.java +++ b/application/src/test/java/org/opentripplanner/routing/stoptimes/StopTimesHelperTest.java @@ -33,14 +33,21 @@ public static void setUp() throws Exception { transitService = new DefaultTransitService(transitModel); feedId = transitModel.getFeedIds().iterator().next(); stopId = new FeedScopedId(feedId, "J"); - pattern = - transitService.getPatternForTrip( - transitService.getTripForId(new FeedScopedId(feedId, "5.1")) - ); - var tt = transitService.getTimetableForTripPattern(pattern, LocalDate.now()); + var originalPattern = transitService.getPatternForTrip( + transitService.getTripForId(new FeedScopedId(feedId, "5.1")) + ); + var tt = originalPattern.getScheduledTimetable(); var newTripTimes = tt.getTripTimes(0).copyScheduledTimes(); newTripTimes.cancelTrip(); - tt.setTripTimes(0, newTripTimes); + pattern = + originalPattern + .copy() + .withScheduledTimeTableBuilder(builder -> builder.addOrUpdateTripTimes(newTripTimes)) + .build(); + // replace the original pattern by the updated pattern in the transit model + transitModel.addTripPattern(pattern.getId(), pattern); + transitModel.index(); + transitService = new DefaultTransitService(transitModel); } /** diff --git a/src/test/java/org/opentripplanner/routing/trippattern/DeduplicatorTest.java b/application/src/test/java/org/opentripplanner/routing/trippattern/DeduplicatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/trippattern/DeduplicatorTest.java rename to application/src/test/java/org/opentripplanner/routing/trippattern/DeduplicatorTest.java diff --git a/src/test/java/org/opentripplanner/routing/trippattern/FrequencyEntryTest.java b/application/src/test/java/org/opentripplanner/routing/trippattern/FrequencyEntryTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/trippattern/FrequencyEntryTest.java rename to application/src/test/java/org/opentripplanner/routing/trippattern/FrequencyEntryTest.java diff --git a/src/test/java/org/opentripplanner/routing/util/DiffToolTest.java b/application/src/test/java/org/opentripplanner/routing/util/DiffToolTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/util/DiffToolTest.java rename to application/src/test/java/org/opentripplanner/routing/util/DiffToolTest.java diff --git a/src/test/java/org/opentripplanner/routing/util/FastDistanceTest.java b/application/src/test/java/org/opentripplanner/routing/util/FastDistanceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/util/FastDistanceTest.java rename to application/src/test/java/org/opentripplanner/routing/util/FastDistanceTest.java diff --git a/src/test/java/org/opentripplanner/routing/util/TestElevationUtils.java b/application/src/test/java/org/opentripplanner/routing/util/TestElevationUtils.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/util/TestElevationUtils.java rename to application/src/test/java/org/opentripplanner/routing/util/TestElevationUtils.java diff --git a/src/test/java/org/opentripplanner/routing/util/elevation/ToblersHikingFunctionTest.java b/application/src/test/java/org/opentripplanner/routing/util/elevation/ToblersHikingFunctionTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/util/elevation/ToblersHikingFunctionTest.java rename to application/src/test/java/org/opentripplanner/routing/util/elevation/ToblersHikingFunctionTest.java diff --git a/src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingHelperTest.java b/application/src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingHelperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingHelperTest.java rename to application/src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingHelperTest.java diff --git a/src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingTestGraphData.java b/application/src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingTestGraphData.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingTestGraphData.java rename to application/src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingTestGraphData.java diff --git a/src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingTestUtil.java b/application/src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingTestUtil.java similarity index 100% rename from src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingTestUtil.java rename to application/src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingTestUtil.java diff --git a/src/test/java/org/opentripplanner/service/paging/PS1_LegacyMetaDataTest.java b/application/src/test/java/org/opentripplanner/service/paging/PS1_LegacyMetaDataTest.java similarity index 100% rename from src/test/java/org/opentripplanner/service/paging/PS1_LegacyMetaDataTest.java rename to application/src/test/java/org/opentripplanner/service/paging/PS1_LegacyMetaDataTest.java diff --git a/src/test/java/org/opentripplanner/service/paging/PS2_ManyParetoOptimalItinerariesTest.java b/application/src/test/java/org/opentripplanner/service/paging/PS2_ManyParetoOptimalItinerariesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/service/paging/PS2_ManyParetoOptimalItinerariesTest.java rename to application/src/test/java/org/opentripplanner/service/paging/PS2_ManyParetoOptimalItinerariesTest.java diff --git a/src/test/java/org/opentripplanner/service/paging/PS3_FewItinerariesOnSearchWindowLimitTest.java b/application/src/test/java/org/opentripplanner/service/paging/PS3_FewItinerariesOnSearchWindowLimitTest.java similarity index 100% rename from src/test/java/org/opentripplanner/service/paging/PS3_FewItinerariesOnSearchWindowLimitTest.java rename to application/src/test/java/org/opentripplanner/service/paging/PS3_FewItinerariesOnSearchWindowLimitTest.java diff --git a/src/test/java/org/opentripplanner/service/paging/TestDriver.java b/application/src/test/java/org/opentripplanner/service/paging/TestDriver.java similarity index 100% rename from src/test/java/org/opentripplanner/service/paging/TestDriver.java rename to application/src/test/java/org/opentripplanner/service/paging/TestDriver.java diff --git a/src/test/java/org/opentripplanner/service/paging/TestPagingModel.java b/application/src/test/java/org/opentripplanner/service/paging/TestPagingModel.java similarity index 100% rename from src/test/java/org/opentripplanner/service/paging/TestPagingModel.java rename to application/src/test/java/org/opentripplanner/service/paging/TestPagingModel.java diff --git a/src/test/java/org/opentripplanner/service/paging/TestPagingUtils.java b/application/src/test/java/org/opentripplanner/service/paging/TestPagingUtils.java similarity index 100% rename from src/test/java/org/opentripplanner/service/paging/TestPagingUtils.java rename to application/src/test/java/org/opentripplanner/service/paging/TestPagingUtils.java diff --git a/src/test/java/org/opentripplanner/service/realtimevehicles/internal/DefaultRealtimeVehicleServiceTest.java b/application/src/test/java/org/opentripplanner/service/realtimevehicles/internal/DefaultRealtimeVehicleServiceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/service/realtimevehicles/internal/DefaultRealtimeVehicleServiceTest.java rename to application/src/test/java/org/opentripplanner/service/realtimevehicles/internal/DefaultRealtimeVehicleServiceTest.java diff --git a/src/test/java/org/opentripplanner/service/vehiclerental/internal/DefaultVehicleRentalServiceTest.java b/application/src/test/java/org/opentripplanner/service/vehiclerental/internal/DefaultVehicleRentalServiceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/service/vehiclerental/internal/DefaultVehicleRentalServiceTest.java rename to application/src/test/java/org/opentripplanner/service/vehiclerental/internal/DefaultVehicleRentalServiceTest.java diff --git a/src/test/java/org/opentripplanner/service/vehiclerental/model/TestFreeFloatingRentalVehicleBuilder.java b/application/src/test/java/org/opentripplanner/service/vehiclerental/model/TestFreeFloatingRentalVehicleBuilder.java similarity index 98% rename from src/test/java/org/opentripplanner/service/vehiclerental/model/TestFreeFloatingRentalVehicleBuilder.java rename to application/src/test/java/org/opentripplanner/service/vehiclerental/model/TestFreeFloatingRentalVehicleBuilder.java index c3837942426..a9b2398f686 100644 --- a/src/test/java/org/opentripplanner/service/vehiclerental/model/TestFreeFloatingRentalVehicleBuilder.java +++ b/application/src/test/java/org/opentripplanner/service/vehiclerental/model/TestFreeFloatingRentalVehicleBuilder.java @@ -1,6 +1,5 @@ package org.opentripplanner.service.vehiclerental.model; -import javax.annotation.Nonnull; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.street.model.RentalFormFactor; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -65,7 +64,6 @@ public TestFreeFloatingRentalVehicleBuilder withVehicleCar() { return buildVehicleType(RentalFormFactor.CAR); } - @Nonnull private TestFreeFloatingRentalVehicleBuilder buildVehicleType(RentalFormFactor rentalFormFactor) { this.vehicleType = new RentalVehicleType( diff --git a/src/test/java/org/opentripplanner/service/vehiclerental/model/TestVehicleRentalStationBuilder.java b/application/src/test/java/org/opentripplanner/service/vehiclerental/model/TestVehicleRentalStationBuilder.java similarity index 99% rename from src/test/java/org/opentripplanner/service/vehiclerental/model/TestVehicleRentalStationBuilder.java rename to application/src/test/java/org/opentripplanner/service/vehiclerental/model/TestVehicleRentalStationBuilder.java index 0fb9f8b620f..ea8af5ade6f 100644 --- a/src/test/java/org/opentripplanner/service/vehiclerental/model/TestVehicleRentalStationBuilder.java +++ b/application/src/test/java/org/opentripplanner/service/vehiclerental/model/TestVehicleRentalStationBuilder.java @@ -2,7 +2,6 @@ import java.util.HashMap; import java.util.Map; -import javax.annotation.Nonnull; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.street.model.RentalFormFactor; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -105,7 +104,6 @@ public TestVehicleRentalStationBuilder withVehicleTypeCar(int numAvailable, int ); } - @Nonnull private TestVehicleRentalStationBuilder buildVehicleType( RentalFormFactor rentalFormFactor, RentalVehicleType.PropulsionType propulsionType, diff --git a/src/test/java/org/opentripplanner/service/worldenvelope/internal/WorldEnvelopeRepositoryTest.java b/application/src/test/java/org/opentripplanner/service/worldenvelope/internal/WorldEnvelopeRepositoryTest.java similarity index 100% rename from src/test/java/org/opentripplanner/service/worldenvelope/internal/WorldEnvelopeRepositoryTest.java rename to application/src/test/java/org/opentripplanner/service/worldenvelope/internal/WorldEnvelopeRepositoryTest.java diff --git a/src/test/java/org/opentripplanner/service/worldenvelope/internal/WorldEnvelopeServiceTest.java b/application/src/test/java/org/opentripplanner/service/worldenvelope/internal/WorldEnvelopeServiceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/service/worldenvelope/internal/WorldEnvelopeServiceTest.java rename to application/src/test/java/org/opentripplanner/service/worldenvelope/internal/WorldEnvelopeServiceTest.java diff --git a/src/test/java/org/opentripplanner/service/worldenvelope/model/MedianCalcForDoublesTest.java b/application/src/test/java/org/opentripplanner/service/worldenvelope/model/MedianCalcForDoublesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/service/worldenvelope/model/MedianCalcForDoublesTest.java rename to application/src/test/java/org/opentripplanner/service/worldenvelope/model/MedianCalcForDoublesTest.java diff --git a/src/test/java/org/opentripplanner/service/worldenvelope/model/WorldEnvelopeTest.java b/application/src/test/java/org/opentripplanner/service/worldenvelope/model/WorldEnvelopeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/service/worldenvelope/model/WorldEnvelopeTest.java rename to application/src/test/java/org/opentripplanner/service/worldenvelope/model/WorldEnvelopeTest.java diff --git a/src/test/java/org/opentripplanner/standalone/config/BuildConfigTest.java b/application/src/test/java/org/opentripplanner/standalone/config/BuildConfigTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/BuildConfigTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/BuildConfigTest.java diff --git a/src/test/java/org/opentripplanner/standalone/config/CommandLineParametersTest.java b/application/src/test/java/org/opentripplanner/standalone/config/CommandLineParametersTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/CommandLineParametersTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/CommandLineParametersTest.java diff --git a/src/test/java/org/opentripplanner/standalone/config/ExampleConfigTest.java b/application/src/test/java/org/opentripplanner/standalone/config/ExampleConfigTest.java similarity index 88% rename from src/test/java/org/opentripplanner/standalone/config/ExampleConfigTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/ExampleConfigTest.java index 12b8749c1fe..06b0d8ed592 100644 --- a/src/test/java/org/opentripplanner/standalone/config/ExampleConfigTest.java +++ b/application/src/test/java/org/opentripplanner/standalone/config/ExampleConfigTest.java @@ -22,7 +22,12 @@ @GeneratesDocumentation public class ExampleConfigTest { - @FilePatternSource(pattern = "doc/user/examples/**/" + ROUTER_CONFIG_FILENAME) + @FilePatternSource( + pattern = { + "doc/user/examples/**/" + ROUTER_CONFIG_FILENAME, + "application/src/test/resources/standalone/config/**/" + ROUTER_CONFIG_FILENAME, + } + ) @ParameterizedTest(name = "Check validity of {0}") void routerConfig(Path filename) { testConfig(filename, a -> new RouterConfig(a, true)); @@ -31,7 +36,7 @@ void routerConfig(Path filename) { @FilePatternSource( pattern = { "doc/user/examples/**/" + BUILD_CONFIG_FILENAME, - "test/performance/**/" + BUILD_CONFIG_FILENAME, + "application/src/test/resources/standalone/config/**/" + BUILD_CONFIG_FILENAME, } ) @ParameterizedTest(name = "Check validity of {0}") @@ -55,7 +60,9 @@ void otpConfig(Path filename) { testConfig(filename, nodeAdapter -> new OtpConfig(nodeAdapter, true)); } - @FilePatternSource(pattern = { "src/test/resources/standalone/config/invalid-config.json" }) + @FilePatternSource( + pattern = { "application/src/test/resources/standalone/config/invalid-config.json" } + ) @ParameterizedTest(name = "Fail when parsing an invalid config from {0}") void failInvalidConfig(Path filename) { Assertions.assertThrows( diff --git a/src/test/java/org/opentripplanner/standalone/config/OtpConfigLoaderTest.java b/application/src/test/java/org/opentripplanner/standalone/config/OtpConfigLoaderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/OtpConfigLoaderTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/OtpConfigLoaderTest.java diff --git a/src/test/java/org/opentripplanner/standalone/config/RouterConfigDocTest.java b/application/src/test/java/org/opentripplanner/standalone/config/RouterConfigDocTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/RouterConfigDocTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/RouterConfigDocTest.java diff --git a/src/test/java/org/opentripplanner/standalone/config/RouterConfigTest.java b/application/src/test/java/org/opentripplanner/standalone/config/RouterConfigTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/RouterConfigTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/RouterConfigTest.java diff --git a/src/test/java/org/opentripplanner/standalone/config/buildconfig/DemConfigTest.java b/application/src/test/java/org/opentripplanner/standalone/config/buildconfig/DemConfigTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/buildconfig/DemConfigTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/buildconfig/DemConfigTest.java diff --git a/src/test/java/org/opentripplanner/standalone/config/buildconfig/GtfsConfigTest.java b/application/src/test/java/org/opentripplanner/standalone/config/buildconfig/GtfsConfigTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/buildconfig/GtfsConfigTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/buildconfig/GtfsConfigTest.java diff --git a/src/test/java/org/opentripplanner/standalone/config/buildconfig/NetexConfigTest.java b/application/src/test/java/org/opentripplanner/standalone/config/buildconfig/NetexConfigTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/buildconfig/NetexConfigTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/buildconfig/NetexConfigTest.java diff --git a/src/test/java/org/opentripplanner/standalone/config/buildconfig/OsmConfigTest.java b/application/src/test/java/org/opentripplanner/standalone/config/buildconfig/OsmConfigTest.java similarity index 98% rename from src/test/java/org/opentripplanner/standalone/config/buildconfig/OsmConfigTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/buildconfig/OsmConfigTest.java index 41c3dc186a1..c771655bdbb 100644 --- a/src/test/java/org/opentripplanner/standalone/config/buildconfig/OsmConfigTest.java +++ b/application/src/test/java/org/opentripplanner/standalone/config/buildconfig/OsmConfigTest.java @@ -7,7 +7,7 @@ import org.junit.jupiter.api.Test; import org.opentripplanner._support.time.ZoneIds; import org.opentripplanner.graph_builder.module.osm.parameters.OsmExtractParametersList; -import org.opentripplanner.openstreetmap.tagmapping.OsmTagMapperSource; +import org.opentripplanner.osm.tagmapping.OsmTagMapperSource; import org.opentripplanner.standalone.config.framework.json.NodeAdapter; class OsmConfigTest { diff --git a/src/test/java/org/opentripplanner/standalone/config/framework/file/ConfigFileLoaderTest.java b/application/src/test/java/org/opentripplanner/standalone/config/framework/file/ConfigFileLoaderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/framework/file/ConfigFileLoaderTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/framework/file/ConfigFileLoaderTest.java diff --git a/src/test/java/org/opentripplanner/standalone/config/framework/file/IncludeFileDirectiveTest.java b/application/src/test/java/org/opentripplanner/standalone/config/framework/file/IncludeFileDirectiveTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/framework/file/IncludeFileDirectiveTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/framework/file/IncludeFileDirectiveTest.java diff --git a/src/test/java/org/opentripplanner/standalone/config/framework/json/ConfigTypeTest.java b/application/src/test/java/org/opentripplanner/standalone/config/framework/json/ConfigTypeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/framework/json/ConfigTypeTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/framework/json/ConfigTypeTest.java diff --git a/src/test/java/org/opentripplanner/standalone/config/framework/json/EnumMapperTest.java b/application/src/test/java/org/opentripplanner/standalone/config/framework/json/EnumMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/framework/json/EnumMapperTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/framework/json/EnumMapperTest.java diff --git a/src/test/java/org/opentripplanner/standalone/config/framework/json/JsonSupport.java b/application/src/test/java/org/opentripplanner/standalone/config/framework/json/JsonSupport.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/framework/json/JsonSupport.java rename to application/src/test/java/org/opentripplanner/standalone/config/framework/json/JsonSupport.java diff --git a/src/test/java/org/opentripplanner/standalone/config/framework/json/NodeAdapterTest.java b/application/src/test/java/org/opentripplanner/standalone/config/framework/json/NodeAdapterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/framework/json/NodeAdapterTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/framework/json/NodeAdapterTest.java diff --git a/src/test/java/org/opentripplanner/standalone/config/framework/json/NodeInfoTest.java b/application/src/test/java/org/opentripplanner/standalone/config/framework/json/NodeInfoTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/framework/json/NodeInfoTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/framework/json/NodeInfoTest.java diff --git a/src/test/java/org/opentripplanner/standalone/config/framework/project/EnvironmentVariableReplacerTest.java b/application/src/test/java/org/opentripplanner/standalone/config/framework/project/EnvironmentVariableReplacerTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/framework/project/EnvironmentVariableReplacerTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/framework/project/EnvironmentVariableReplacerTest.java diff --git a/src/test/java/org/opentripplanner/standalone/config/routerconfig/ServerConfigTest.java b/application/src/test/java/org/opentripplanner/standalone/config/routerconfig/ServerConfigTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/routerconfig/ServerConfigTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/routerconfig/ServerConfigTest.java diff --git a/src/test/java/org/opentripplanner/standalone/config/routerequest/RouteRequestConfigTest.java b/application/src/test/java/org/opentripplanner/standalone/config/routerequest/RouteRequestConfigTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/routerequest/RouteRequestConfigTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/routerequest/RouteRequestConfigTest.java diff --git a/src/test/java/org/opentripplanner/standalone/config/routerequest/TimeAndCostPenaltyMapperTest.java b/application/src/test/java/org/opentripplanner/standalone/config/routerequest/TimeAndCostPenaltyMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/routerequest/TimeAndCostPenaltyMapperTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/routerequest/TimeAndCostPenaltyMapperTest.java diff --git a/src/test/java/org/opentripplanner/standalone/config/routerequest/WheelchairConfigTest.java b/application/src/test/java/org/opentripplanner/standalone/config/routerequest/WheelchairConfigTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/routerequest/WheelchairConfigTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/routerequest/WheelchairConfigTest.java diff --git a/src/test/java/org/opentripplanner/standalone/config/sandbox/DataOverlayConfigMapperTest.java b/application/src/test/java/org/opentripplanner/standalone/config/sandbox/DataOverlayConfigMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/sandbox/DataOverlayConfigMapperTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/sandbox/DataOverlayConfigMapperTest.java diff --git a/src/test/java/org/opentripplanner/standalone/config/services/RideHailingServicesConfigTest.java b/application/src/test/java/org/opentripplanner/standalone/config/services/RideHailingServicesConfigTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/config/services/RideHailingServicesConfigTest.java rename to application/src/test/java/org/opentripplanner/standalone/config/services/RideHailingServicesConfigTest.java diff --git a/src/test/java/org/opentripplanner/standalone/server/EtagRequestFilterTest.java b/application/src/test/java/org/opentripplanner/standalone/server/EtagRequestFilterTest.java similarity index 98% rename from src/test/java/org/opentripplanner/standalone/server/EtagRequestFilterTest.java rename to application/src/test/java/org/opentripplanner/standalone/server/EtagRequestFilterTest.java index ae19643db72..100edd8f5ae 100644 --- a/src/test/java/org/opentripplanner/standalone/server/EtagRequestFilterTest.java +++ b/application/src/test/java/org/opentripplanner/standalone/server/EtagRequestFilterTest.java @@ -7,7 +7,6 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.stream.Stream; -import javax.annotation.Nonnull; import org.glassfish.jersey.message.internal.OutboundJaxrsResponse; import org.glassfish.jersey.message.internal.OutboundMessageContext; import org.glassfish.jersey.message.internal.Statuses; @@ -84,7 +83,6 @@ void ifNoneMatch(String ifNoneMatch, int expectedStatus, byte[] expectedEntity) assertArrayEquals(expectedEntity, (byte[]) response.getEntity()); } - @Nonnull private static ContainerResponse response(int status, ContainerRequest request) { return new ContainerResponse( request, @@ -92,7 +90,6 @@ private static ContainerResponse response(int status, ContainerRequest request) ); } - @Nonnull private static byte[] bytes(String input) { return input.getBytes(StandardCharsets.UTF_8); } diff --git a/src/test/java/org/opentripplanner/standalone/server/RequestTraceFilterTest.java b/application/src/test/java/org/opentripplanner/standalone/server/RequestTraceFilterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/standalone/server/RequestTraceFilterTest.java rename to application/src/test/java/org/opentripplanner/standalone/server/RequestTraceFilterTest.java diff --git a/src/test/java/org/opentripplanner/street/integration/BarrierRoutingTest.java b/application/src/test/java/org/opentripplanner/street/integration/BarrierRoutingTest.java similarity index 99% rename from src/test/java/org/opentripplanner/street/integration/BarrierRoutingTest.java rename to application/src/test/java/org/opentripplanner/street/integration/BarrierRoutingTest.java index d1ea3c8e59d..f969c5d18ed 100644 --- a/src/test/java/org/opentripplanner/street/integration/BarrierRoutingTest.java +++ b/application/src/test/java/org/opentripplanner/street/integration/BarrierRoutingTest.java @@ -179,7 +179,7 @@ private static String computePolyline( options.accept(request); - var temporaryVertices = new TemporaryVerticesContainer(graph, request, streetMode, streetMode); + var temporaryVertices = new TemporaryVerticesContainer(graph, from, to, streetMode, streetMode); var gpf = new GraphPathFinder(null); var paths = gpf.graphPathFinderEntryPoint(request, temporaryVertices); diff --git a/src/test/java/org/opentripplanner/street/integration/BicycleParkAndRideTest.java b/application/src/test/java/org/opentripplanner/street/integration/BicycleParkAndRideTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/integration/BicycleParkAndRideTest.java rename to application/src/test/java/org/opentripplanner/street/integration/BicycleParkAndRideTest.java diff --git a/src/test/java/org/opentripplanner/street/integration/BicycleRoutingTest.java b/application/src/test/java/org/opentripplanner/street/integration/BicycleRoutingTest.java similarity index 99% rename from src/test/java/org/opentripplanner/street/integration/BicycleRoutingTest.java rename to application/src/test/java/org/opentripplanner/street/integration/BicycleRoutingTest.java index db937ff2a6e..2c52d0649f5 100644 --- a/src/test/java/org/opentripplanner/street/integration/BicycleRoutingTest.java +++ b/application/src/test/java/org/opentripplanner/street/integration/BicycleRoutingTest.java @@ -82,7 +82,8 @@ private static String computePolyline(Graph graph, GenericLocation from, Generic request.journey().direct().setMode(StreetMode.BIKE); var temporaryVertices = new TemporaryVerticesContainer( graph, - request, + request.from(), + request.to(), request.journey().direct().mode(), request.journey().direct().mode() ); diff --git a/src/test/java/org/opentripplanner/street/integration/BikeRentalTest.java b/application/src/test/java/org/opentripplanner/street/integration/BikeRentalTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/integration/BikeRentalTest.java rename to application/src/test/java/org/opentripplanner/street/integration/BikeRentalTest.java diff --git a/src/test/java/org/opentripplanner/street/integration/BikeWalkingTest.java b/application/src/test/java/org/opentripplanner/street/integration/BikeWalkingTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/integration/BikeWalkingTest.java rename to application/src/test/java/org/opentripplanner/street/integration/BikeWalkingTest.java diff --git a/src/test/java/org/opentripplanner/street/integration/CarParkAndRideTest.java b/application/src/test/java/org/opentripplanner/street/integration/CarParkAndRideTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/integration/CarParkAndRideTest.java rename to application/src/test/java/org/opentripplanner/street/integration/CarParkAndRideTest.java diff --git a/src/test/java/org/opentripplanner/street/integration/CarPickupTest.java b/application/src/test/java/org/opentripplanner/street/integration/CarPickupTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/integration/CarPickupTest.java rename to application/src/test/java/org/opentripplanner/street/integration/CarPickupTest.java diff --git a/src/test/java/org/opentripplanner/street/integration/CarRoutingTest.java b/application/src/test/java/org/opentripplanner/street/integration/CarRoutingTest.java similarity index 99% rename from src/test/java/org/opentripplanner/street/integration/CarRoutingTest.java rename to application/src/test/java/org/opentripplanner/street/integration/CarRoutingTest.java index 471d6bf80ce..caddf972e86 100644 --- a/src/test/java/org/opentripplanner/street/integration/CarRoutingTest.java +++ b/application/src/test/java/org/opentripplanner/street/integration/CarRoutingTest.java @@ -133,7 +133,8 @@ private static String computePolyline(Graph graph, GenericLocation from, Generic request.journey().direct().setMode(StreetMode.CAR); var temporaryVertices = new TemporaryVerticesContainer( graph, - request, + from, + to, StreetMode.CAR, StreetMode.CAR ); diff --git a/src/test/java/org/opentripplanner/street/integration/ParkAndRideTest.java b/application/src/test/java/org/opentripplanner/street/integration/ParkAndRideTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/integration/ParkAndRideTest.java rename to application/src/test/java/org/opentripplanner/street/integration/ParkAndRideTest.java diff --git a/src/test/java/org/opentripplanner/street/integration/SplitEdgeTurnRestrictionsTest.java b/application/src/test/java/org/opentripplanner/street/integration/SplitEdgeTurnRestrictionsTest.java similarity index 99% rename from src/test/java/org/opentripplanner/street/integration/SplitEdgeTurnRestrictionsTest.java rename to application/src/test/java/org/opentripplanner/street/integration/SplitEdgeTurnRestrictionsTest.java index 28ab5e91725..e664b3fe2b7 100644 --- a/src/test/java/org/opentripplanner/street/integration/SplitEdgeTurnRestrictionsTest.java +++ b/application/src/test/java/org/opentripplanner/street/integration/SplitEdgeTurnRestrictionsTest.java @@ -156,7 +156,8 @@ private static String computeCarPolyline(Graph graph, GenericLocation from, Gene request.journey().direct().setMode(StreetMode.CAR); var temporaryVertices = new TemporaryVerticesContainer( graph, - request, + from, + to, StreetMode.CAR, StreetMode.CAR ); diff --git a/src/test/java/org/opentripplanner/street/integration/WalkRoutingTest.java b/application/src/test/java/org/opentripplanner/street/integration/WalkRoutingTest.java similarity index 98% rename from src/test/java/org/opentripplanner/street/integration/WalkRoutingTest.java rename to application/src/test/java/org/opentripplanner/street/integration/WalkRoutingTest.java index 3fbb546c3f7..1dad09faec4 100644 --- a/src/test/java/org/opentripplanner/street/integration/WalkRoutingTest.java +++ b/application/src/test/java/org/opentripplanner/street/integration/WalkRoutingTest.java @@ -62,7 +62,8 @@ private static List> route( try ( var temporaryVertices = new TemporaryVerticesContainer( graph, - request, + request.from(), + request.to(), request.journey().direct().mode(), request.journey().direct().mode() ) diff --git a/src/test/java/org/opentripplanner/street/model/StreetTraversalPermissionTest.java b/application/src/test/java/org/opentripplanner/street/model/StreetTraversalPermissionTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/model/StreetTraversalPermissionTest.java rename to application/src/test/java/org/opentripplanner/street/model/StreetTraversalPermissionTest.java diff --git a/src/test/java/org/opentripplanner/street/model/TurnRestrictionTest.java b/application/src/test/java/org/opentripplanner/street/model/TurnRestrictionTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/model/TurnRestrictionTest.java rename to application/src/test/java/org/opentripplanner/street/model/TurnRestrictionTest.java diff --git a/src/test/java/org/opentripplanner/street/model/_data/StreetModelForTest.java b/application/src/test/java/org/opentripplanner/street/model/_data/StreetModelForTest.java similarity index 99% rename from src/test/java/org/opentripplanner/street/model/_data/StreetModelForTest.java rename to application/src/test/java/org/opentripplanner/street/model/_data/StreetModelForTest.java index 4a0a0d1b848..a57e4227a6b 100644 --- a/src/test/java/org/opentripplanner/street/model/_data/StreetModelForTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/_data/StreetModelForTest.java @@ -2,7 +2,6 @@ import static org.opentripplanner.transit.model._data.TransitModelForTest.id; -import javax.annotation.Nonnull; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.LineString; import org.opentripplanner.framework.geometry.GeometryUtils; @@ -42,7 +41,6 @@ public static IntersectionVertex intersectionVertex(String label, double lat, do return new LabelledIntersectionVertex(label, lon, lat, false, false); } - @Nonnull public static TransitEntranceVertex transitEntranceVertex(String id, double lat, double lon) { var entrance = Entrance .of(id(id)) diff --git a/src/test/java/org/opentripplanner/street/model/edge/AreaEdgeBuilderTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/AreaEdgeBuilderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/model/edge/AreaEdgeBuilderTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/AreaEdgeBuilderTest.java diff --git a/src/test/java/org/opentripplanner/street/model/edge/ElevatorHopEdgeTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/ElevatorHopEdgeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/model/edge/ElevatorHopEdgeTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/ElevatorHopEdgeTest.java diff --git a/src/test/java/org/opentripplanner/street/model/edge/EscalatorEdgeTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/EscalatorEdgeTest.java similarity index 88% rename from src/test/java/org/opentripplanner/street/model/edge/EscalatorEdgeTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/EscalatorEdgeTest.java index 60859290646..1cfff635c45 100644 --- a/src/test/java/org/opentripplanner/street/model/edge/EscalatorEdgeTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/edge/EscalatorEdgeTest.java @@ -1,5 +1,6 @@ package org.opentripplanner.street.model.edge; +import static com.google.common.truth.Truth.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.Locale; @@ -42,7 +43,7 @@ void testCycling() { var edge = EscalatorEdge.createEscalatorEdge(from, to, 10); var req = StreetSearchRequest.of().withMode(StreetMode.BIKE); var res = edge.traverse(new State(from, req.build())); - assertEquals(res.length, 0); + assertThat(res).isEmpty(); } @Test @@ -50,7 +51,7 @@ void testWheelchair() { var edge = EscalatorEdge.createEscalatorEdge(from, to, 10); var req = StreetSearchRequest.of().withMode(StreetMode.WALK).withWheelchair(true); var res = edge.traverse(new State(from, req.build())); - assertEquals(res.length, 0); + assertThat(res).isEmpty(); } @Test @@ -59,4 +60,10 @@ void name() { assertEquals("Rolltreppe", edge.getName().toString(Locale.GERMANY)); assertEquals("escalator", edge.getName().toString(Locale.ENGLISH)); } + + @Test + void geometry() { + var edge = EscalatorEdge.createEscalatorEdge(from, to, 10); + assertThat(edge.getGeometry().getCoordinates()).isNotEmpty(); + } } diff --git a/src/test/java/org/opentripplanner/street/model/edge/PathwayEdgeTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/PathwayEdgeTest.java similarity index 99% rename from src/test/java/org/opentripplanner/street/model/edge/PathwayEdgeTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/PathwayEdgeTest.java index 6929f665938..6d5574b8027 100644 --- a/src/test/java/org/opentripplanner/street/model/edge/PathwayEdgeTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/edge/PathwayEdgeTest.java @@ -7,7 +7,6 @@ import java.util.Optional; import java.util.stream.Stream; -import javax.annotation.Nonnull; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -241,7 +240,6 @@ void emptySignpostedAs() { assertEquals(PathwayEdge.DEFAULT_NAME, edge.getName()); } - @Nonnull private PathwayEdge pathwayEdge(I18NString sign) { return PathwayEdge.createPathwayEdge( from, diff --git a/src/test/java/org/opentripplanner/street/model/edge/RentalRestrictionExtensionTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/RentalRestrictionExtensionTest.java similarity index 99% rename from src/test/java/org/opentripplanner/street/model/edge/RentalRestrictionExtensionTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/RentalRestrictionExtensionTest.java index 2a5589d58bf..41b648cea64 100644 --- a/src/test/java/org/opentripplanner/street/model/edge/RentalRestrictionExtensionTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/edge/RentalRestrictionExtensionTest.java @@ -13,7 +13,6 @@ import static org.opentripplanner.street.search.state.VehicleRentalState.RENTING_FLOATING; import java.util.Set; -import javax.annotation.Nonnull; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.opentripplanner.routing.api.request.StreetMode; @@ -167,7 +166,6 @@ private State[] traverse(StreetEdge edge) { return edge.traverse(state); } - @Nonnull private State state(String network) { var req = StreetSearchRequest.of().withMode(StreetMode.SCOOTER_RENTAL).build(); var editor = new StateEditor(V1, req); diff --git a/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeBuilderTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeBuilderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/model/edge/StreetEdgeBuilderTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeBuilderTest.java diff --git a/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeCostTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeCostTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/model/edge/StreetEdgeCostTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeCostTest.java diff --git a/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeGeofencingTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeGeofencingTest.java similarity index 99% rename from src/test/java/org/opentripplanner/street/model/edge/StreetEdgeGeofencingTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeGeofencingTest.java index cc38b04230a..3375d94f5af 100644 --- a/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeGeofencingTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeGeofencingTest.java @@ -14,7 +14,6 @@ import static org.opentripplanner.street.search.state.VehicleRentalState.RENTING_FLOATING; import java.util.Set; -import javax.annotation.Nonnull; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.opentripplanner.routing.api.request.StreetMode; @@ -297,7 +296,6 @@ private static StreetSearchRequest defaultArriveByRequest() { } } - @Nonnull private static GeofencingZoneExtension noDropOffRestriction(String networkTier) { return new GeofencingZoneExtension( new GeofencingZone(new FeedScopedId(networkTier, "a-park"), null, true, false) @@ -309,12 +307,10 @@ private State[] traverseFromV1(StreetEdge edge) { return edge.traverse(state); } - @Nonnull private State forwardState(String network) { return initialState(V1, network, false); } - @Nonnull private State initialState(Vertex startVertex, String network, boolean arriveBy) { var req = StreetSearchRequest .of() diff --git a/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeRentalTraversalTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeRentalTraversalTest.java similarity index 98% rename from src/test/java/org/opentripplanner/street/model/edge/StreetEdgeRentalTraversalTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeRentalTraversalTest.java index 44de661f327..e2187acad18 100644 --- a/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeRentalTraversalTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeRentalTraversalTest.java @@ -14,7 +14,6 @@ import static org.opentripplanner.street.model._data.StreetModelForTest.streetEdge; import java.util.stream.Stream; -import javax.annotation.Nonnull; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; @@ -31,7 +30,6 @@ public class StreetEdgeRentalTraversalTest { StreetVertex v0 = intersectionVertex(0.0, 0.0); StreetVertex v1 = intersectionVertex(2.0, 2.0); - @Nonnull private static Stream baseCases(StreetTraversalPermission p) { return Stream.of( of(SCOOTER, SCOOTER_RENTAL, p), diff --git a/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeScooterTraversalTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeScooterTraversalTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/model/edge/StreetEdgeScooterTraversalTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeScooterTraversalTest.java diff --git a/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeSplittingTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeSplittingTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/model/edge/StreetEdgeSplittingTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeSplittingTest.java diff --git a/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/model/edge/StreetEdgeTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeTest.java diff --git a/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeWheelchairCostTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeWheelchairCostTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/model/edge/StreetEdgeWheelchairCostTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeWheelchairCostTest.java diff --git a/src/test/java/org/opentripplanner/street/model/edge/StreetElevationExtensionBuilderTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/StreetElevationExtensionBuilderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/model/edge/StreetElevationExtensionBuilderTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/StreetElevationExtensionBuilderTest.java diff --git a/src/test/java/org/opentripplanner/street/model/edge/StreetTransitEntityLinkTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/StreetTransitEntityLinkTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/model/edge/StreetTransitEntityLinkTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/StreetTransitEntityLinkTest.java diff --git a/src/test/java/org/opentripplanner/street/model/edge/StreetTransitEntranceLinkTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/StreetTransitEntranceLinkTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/model/edge/StreetTransitEntranceLinkTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/StreetTransitEntranceLinkTest.java diff --git a/src/test/java/org/opentripplanner/street/model/edge/StreetVehicleParkingLinkTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/StreetVehicleParkingLinkTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/model/edge/StreetVehicleParkingLinkTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/StreetVehicleParkingLinkTest.java diff --git a/src/test/java/org/opentripplanner/street/model/edge/TemporaryPartialStreetEdgeBuilderTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/TemporaryPartialStreetEdgeBuilderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/model/edge/TemporaryPartialStreetEdgeBuilderTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/TemporaryPartialStreetEdgeBuilderTest.java diff --git a/src/test/java/org/opentripplanner/street/model/edge/TemporaryPartialStreetEdgeTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/TemporaryPartialStreetEdgeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/model/edge/TemporaryPartialStreetEdgeTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/TemporaryPartialStreetEdgeTest.java diff --git a/src/test/java/org/opentripplanner/street/model/edge/VehicleParkingEdgeTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/VehicleParkingEdgeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/model/edge/VehicleParkingEdgeTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/VehicleParkingEdgeTest.java diff --git a/src/test/java/org/opentripplanner/street/model/edge/VehicleParkingPreferredTagsTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/VehicleParkingPreferredTagsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/model/edge/VehicleParkingPreferredTagsTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/VehicleParkingPreferredTagsTest.java diff --git a/src/test/java/org/opentripplanner/street/model/edge/VehicleRentalEdgeTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/VehicleRentalEdgeTest.java similarity index 99% rename from src/test/java/org/opentripplanner/street/model/edge/VehicleRentalEdgeTest.java rename to application/src/test/java/org/opentripplanner/street/model/edge/VehicleRentalEdgeTest.java index a3fbfcb018e..e8a1282327c 100644 --- a/src/test/java/org/opentripplanner/street/model/edge/VehicleRentalEdgeTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/edge/VehicleRentalEdgeTest.java @@ -6,7 +6,6 @@ import static org.junit.jupiter.api.Assertions.fail; import java.util.Set; -import javax.annotation.Nonnull; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.opentripplanner.routing.api.request.StreetMode; @@ -254,7 +253,6 @@ void startedOutsideNoDropOffZone() { assertEquals(VehicleRentalState.BEFORE_RENTING, afterTraversal.getVehicleRentalState()); } - @Nonnull private GeofencingZoneExtension noDropOffZone() { return new GeofencingZoneExtension( new GeofencingZone(new FeedScopedId(NETWORK, "zone"), null, true, false) diff --git a/src/test/java/org/opentripplanner/street/model/vertex/BarrierVertexTest.java b/application/src/test/java/org/opentripplanner/street/model/vertex/BarrierVertexTest.java similarity index 97% rename from src/test/java/org/opentripplanner/street/model/vertex/BarrierVertexTest.java rename to application/src/test/java/org/opentripplanner/street/model/vertex/BarrierVertexTest.java index a92d69b39f0..a4bef911312 100644 --- a/src/test/java/org/opentripplanner/street/model/vertex/BarrierVertexTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/vertex/BarrierVertexTest.java @@ -8,7 +8,7 @@ import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.LineString; import org.opentripplanner.framework.geometry.GeometryUtils; -import org.opentripplanner.openstreetmap.model.OSMNode; +import org.opentripplanner.osm.model.OsmNode; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.street.model.StreetTraversalPermission; import org.opentripplanner.street.model._data.StreetModelForTest; @@ -24,7 +24,7 @@ public class BarrierVertexTest { @Test public void testBarrierPermissions() { - OSMNode simpleBarrier = new OSMNode(); + OsmNode simpleBarrier = new OsmNode(); assertFalse(simpleBarrier.isMotorVehicleBarrier()); simpleBarrier.addTag("barrier", "bollard"); assertTrue(simpleBarrier.isMotorVehicleBarrier()); @@ -63,7 +63,7 @@ public void testBarrierPermissions() { ); assertEquals(StreetTraversalPermission.PEDESTRIAN, bv.getBarrierPermissions()); - OSMNode complexBarrier = new OSMNode(); + OsmNode complexBarrier = new OsmNode(); complexBarrier.addTag("barrier", "bollard"); complexBarrier.addTag("access", "no"); @@ -72,7 +72,7 @@ public void testBarrierPermissions() { ); assertEquals(StreetTraversalPermission.NONE, bv.getBarrierPermissions()); - OSMNode noBikeBollard = new OSMNode(); + OsmNode noBikeBollard = new OsmNode(); noBikeBollard.addTag("barrier", "bollard"); noBikeBollard.addTag("bicycle", "no"); @@ -82,7 +82,7 @@ public void testBarrierPermissions() { assertEquals(StreetTraversalPermission.PEDESTRIAN, bv.getBarrierPermissions()); /* test that traversal limitations work also without barrier tag */ - OSMNode accessBarrier = new OSMNode(); + OsmNode accessBarrier = new OsmNode(); accessBarrier.addTag("access", "no"); bv.setBarrierPermissions( diff --git a/src/test/java/org/opentripplanner/street/model/vertex/IntersectionVertexTest.java b/application/src/test/java/org/opentripplanner/street/model/vertex/IntersectionVertexTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/model/vertex/IntersectionVertexTest.java rename to application/src/test/java/org/opentripplanner/street/model/vertex/IntersectionVertexTest.java diff --git a/src/test/java/org/opentripplanner/street/model/vertex/OsmVertexTest.java b/application/src/test/java/org/opentripplanner/street/model/vertex/OsmVertexTest.java similarity index 96% rename from src/test/java/org/opentripplanner/street/model/vertex/OsmVertexTest.java rename to application/src/test/java/org/opentripplanner/street/model/vertex/OsmVertexTest.java index b3a2b0baebb..61da00ed2c6 100644 --- a/src/test/java/org/opentripplanner/street/model/vertex/OsmVertexTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/vertex/OsmVertexTest.java @@ -5,7 +5,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; -import javax.annotation.Nonnull; import org.junit.jupiter.api.Test; import org.opentripplanner.transit.model._data.TransitModelForTest; import org.opentripplanner.transit.model.site.AreaStop; @@ -38,7 +37,6 @@ void addAreaStop() { assertEquals(2, vertex.areaStops().size()); } - @Nonnull private static OsmVertex vertex() { return new OsmVertex(1, 2, 1); } diff --git a/src/test/java/org/opentripplanner/street/model/vertex/RentalRestrictionExtensionTest.java b/application/src/test/java/org/opentripplanner/street/model/vertex/RentalRestrictionExtensionTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/model/vertex/RentalRestrictionExtensionTest.java rename to application/src/test/java/org/opentripplanner/street/model/vertex/RentalRestrictionExtensionTest.java diff --git a/src/test/java/org/opentripplanner/street/model/vertex/SimpleVertex.java b/application/src/test/java/org/opentripplanner/street/model/vertex/SimpleVertex.java similarity index 91% rename from src/test/java/org/opentripplanner/street/model/vertex/SimpleVertex.java rename to application/src/test/java/org/opentripplanner/street/model/vertex/SimpleVertex.java index 294bed335cc..b2df8bc6d16 100644 --- a/src/test/java/org/opentripplanner/street/model/vertex/SimpleVertex.java +++ b/application/src/test/java/org/opentripplanner/street/model/vertex/SimpleVertex.java @@ -1,6 +1,5 @@ package org.opentripplanner.street.model.vertex; -import javax.annotation.Nonnull; import org.opentripplanner.framework.i18n.I18NString; public class SimpleVertex extends StreetVertex { @@ -12,7 +11,6 @@ public SimpleVertex(String label, double lat, double lon) { this.label = label; } - @Nonnull @Override public I18NString getName() { return I18NString.of(label); diff --git a/src/test/java/org/opentripplanner/street/model/vertex/TemporaryVertexDisposeTest.java b/application/src/test/java/org/opentripplanner/street/model/vertex/TemporaryVertexDisposeTest.java similarity index 99% rename from src/test/java/org/opentripplanner/street/model/vertex/TemporaryVertexDisposeTest.java rename to application/src/test/java/org/opentripplanner/street/model/vertex/TemporaryVertexDisposeTest.java index 7f559f2ad35..e4880f891e2 100644 --- a/src/test/java/org/opentripplanner/street/model/vertex/TemporaryVertexDisposeTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/vertex/TemporaryVertexDisposeTest.java @@ -2,7 +2,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import javax.annotation.Nonnull; import org.junit.jupiter.api.Test; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.street.model.edge.FreeEdge; @@ -232,7 +231,6 @@ public String toString() { return getLabelString(); } - @Nonnull @Override public I18NString getName() { return NO_NAME; diff --git a/src/test/java/org/opentripplanner/street/model/vertex/VertexTest.java b/application/src/test/java/org/opentripplanner/street/model/vertex/VertexTest.java similarity index 74% rename from src/test/java/org/opentripplanner/street/model/vertex/VertexTest.java rename to application/src/test/java/org/opentripplanner/street/model/vertex/VertexTest.java index 62194fdbc41..c839386f872 100644 --- a/src/test/java/org/opentripplanner/street/model/vertex/VertexTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/vertex/VertexTest.java @@ -1,9 +1,11 @@ package org.opentripplanner.street.model.vertex; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; +import org.opentripplanner.framework.geometry.WgsCoordinate; class VertexTest { @@ -25,4 +27,10 @@ void testDifferentLocation() { Vertex v2 = new SimpleVertex("", LAT + EPSILON_10_E_MINUS_7, LON); assertFalse(v1.sameLocation(v2)); } + + @Test + void testWgsCoordinate() { + Vertex v1 = new SimpleVertex("", LAT, LON); + assertEquals(new WgsCoordinate(LAT, LON), v1.toWgsCoordinate()); + } } diff --git a/src/test/java/org/opentripplanner/street/search/TraverseModeSetTest.java b/application/src/test/java/org/opentripplanner/street/search/TraverseModeSetTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/search/TraverseModeSetTest.java rename to application/src/test/java/org/opentripplanner/street/search/TraverseModeSetTest.java diff --git a/src/test/java/org/opentripplanner/street/search/intersection_model/SimpleIntersectionTraversalCalculatorTest.java b/application/src/test/java/org/opentripplanner/street/search/intersection_model/SimpleIntersectionTraversalCalculatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/search/intersection_model/SimpleIntersectionTraversalCalculatorTest.java rename to application/src/test/java/org/opentripplanner/street/search/intersection_model/SimpleIntersectionTraversalCalculatorTest.java diff --git a/src/test/java/org/opentripplanner/street/search/request/StreetSearchRequestMapperTest.java b/application/src/test/java/org/opentripplanner/street/search/request/StreetSearchRequestMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/search/request/StreetSearchRequestMapperTest.java rename to application/src/test/java/org/opentripplanner/street/search/request/StreetSearchRequestMapperTest.java diff --git a/src/test/java/org/opentripplanner/street/search/state/StateDataTest.java b/application/src/test/java/org/opentripplanner/street/search/state/StateDataTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/search/state/StateDataTest.java rename to application/src/test/java/org/opentripplanner/street/search/state/StateDataTest.java diff --git a/src/test/java/org/opentripplanner/street/search/state/StateEditorTest.java b/application/src/test/java/org/opentripplanner/street/search/state/StateEditorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/search/state/StateEditorTest.java rename to application/src/test/java/org/opentripplanner/street/search/state/StateEditorTest.java diff --git a/src/test/java/org/opentripplanner/street/search/state/StateTest.java b/application/src/test/java/org/opentripplanner/street/search/state/StateTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/search/state/StateTest.java rename to application/src/test/java/org/opentripplanner/street/search/state/StateTest.java diff --git a/src/test/java/org/opentripplanner/street/search/state/TestStateBuilder.java b/application/src/test/java/org/opentripplanner/street/search/state/TestStateBuilder.java similarity index 99% rename from src/test/java/org/opentripplanner/street/search/state/TestStateBuilder.java rename to application/src/test/java/org/opentripplanner/street/search/state/TestStateBuilder.java index 3750c4619b9..1b66152ec09 100644 --- a/src/test/java/org/opentripplanner/street/search/state/TestStateBuilder.java +++ b/application/src/test/java/org/opentripplanner/street/search/state/TestStateBuilder.java @@ -8,7 +8,6 @@ import java.time.OffsetDateTime; import java.util.Arrays; import java.util.List; -import javax.annotation.Nonnull; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.routing.algorithm.raptoradapter.router.street.AccessEgressType; @@ -277,7 +276,6 @@ public TestStateBuilder pathway(String s) { return this; } - @Nonnull private TestStateBuilder arriveAtStop(RegularStop stop) { var from = (StreetVertex) currentState.vertex; var to = TransitStopVertex.of().withStop(stop).build(); @@ -296,7 +294,6 @@ private TestStateBuilder arriveAtStop(RegularStop stop) { return this; } - @Nonnull private static ElevatorOffboardVertex elevatorOffBoard(int count, String suffix) { return new ElevatorOffboardVertex( StreetModelForTest.intersectionVertex(count, count), @@ -305,7 +302,6 @@ private static ElevatorOffboardVertex elevatorOffBoard(int count, String suffix) ); } - @Nonnull private static ElevatorOnboardVertex elevatorOnBoard(int count, String suffix) { return new ElevatorOnboardVertex( StreetModelForTest.intersectionVertex(count, count), diff --git a/src/test/java/org/opentripplanner/street/search/strategy/DominanceFunctionTest.java b/application/src/test/java/org/opentripplanner/street/search/strategy/DominanceFunctionTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/search/strategy/DominanceFunctionTest.java rename to application/src/test/java/org/opentripplanner/street/search/strategy/DominanceFunctionTest.java diff --git a/src/test/java/org/opentripplanner/street/service/DefaultStreetLimitationParametersServiceTest.java b/application/src/test/java/org/opentripplanner/street/service/DefaultStreetLimitationParametersServiceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/street/service/DefaultStreetLimitationParametersServiceTest.java rename to application/src/test/java/org/opentripplanner/street/service/DefaultStreetLimitationParametersServiceTest.java diff --git a/src/test/java/org/opentripplanner/test/support/FilePatternArgumentsProvider.java b/application/src/test/java/org/opentripplanner/test/support/FilePatternArgumentsProvider.java similarity index 97% rename from src/test/java/org/opentripplanner/test/support/FilePatternArgumentsProvider.java rename to application/src/test/java/org/opentripplanner/test/support/FilePatternArgumentsProvider.java index c084a81a73f..9c0887c1da7 100644 --- a/src/test/java/org/opentripplanner/test/support/FilePatternArgumentsProvider.java +++ b/application/src/test/java/org/opentripplanner/test/support/FilePatternArgumentsProvider.java @@ -35,12 +35,12 @@ public Stream provideArguments(ExtensionContext context) { } private static Stream resolvePaths(String pattern) { - var pathMatcher = FileSystems.getDefault().getPathMatcher("glob:./" + pattern); + var pathMatcher = FileSystems.getDefault().getPathMatcher("glob:../" + pattern); var pathsFound = new ArrayList(); try { Files.walkFileTree( - Paths.get("."), + Paths.get(".."), new SimpleFileVisitor<>() { @Override public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) { diff --git a/src/test/java/org/opentripplanner/test/support/FilePatternSource.java b/application/src/test/java/org/opentripplanner/test/support/FilePatternSource.java similarity index 100% rename from src/test/java/org/opentripplanner/test/support/FilePatternSource.java rename to application/src/test/java/org/opentripplanner/test/support/FilePatternSource.java diff --git a/src/test/java/org/opentripplanner/test/support/GeoJsonIo.java b/application/src/test/java/org/opentripplanner/test/support/GeoJsonIo.java similarity index 100% rename from src/test/java/org/opentripplanner/test/support/GeoJsonIo.java rename to application/src/test/java/org/opentripplanner/test/support/GeoJsonIo.java diff --git a/src/test/java/org/opentripplanner/test/support/HttpForTest.java b/application/src/test/java/org/opentripplanner/test/support/HttpForTest.java similarity index 100% rename from src/test/java/org/opentripplanner/test/support/HttpForTest.java rename to application/src/test/java/org/opentripplanner/test/support/HttpForTest.java diff --git a/src/test/java/org/opentripplanner/test/support/JsonAssertions.java b/application/src/test/java/org/opentripplanner/test/support/JsonAssertions.java similarity index 100% rename from src/test/java/org/opentripplanner/test/support/JsonAssertions.java rename to application/src/test/java/org/opentripplanner/test/support/JsonAssertions.java diff --git a/src/test/java/org/opentripplanner/test/support/PolylineAssert.java b/application/src/test/java/org/opentripplanner/test/support/PolylineAssert.java similarity index 100% rename from src/test/java/org/opentripplanner/test/support/PolylineAssert.java rename to application/src/test/java/org/opentripplanner/test/support/PolylineAssert.java diff --git a/src/test/java/org/opentripplanner/test/support/ResourceLoader.java b/application/src/test/java/org/opentripplanner/test/support/ResourceLoader.java similarity index 100% rename from src/test/java/org/opentripplanner/test/support/ResourceLoader.java rename to application/src/test/java/org/opentripplanner/test/support/ResourceLoader.java diff --git a/src/test/java/org/opentripplanner/test/support/TestTableParser.java b/application/src/test/java/org/opentripplanner/test/support/TestTableParser.java similarity index 100% rename from src/test/java/org/opentripplanner/test/support/TestTableParser.java rename to application/src/test/java/org/opentripplanner/test/support/TestTableParser.java diff --git a/src/test/java/org/opentripplanner/transit/model/TransitModelArchitectureTest.java b/application/src/test/java/org/opentripplanner/transit/model/TransitModelArchitectureTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/TransitModelArchitectureTest.java rename to application/src/test/java/org/opentripplanner/transit/model/TransitModelArchitectureTest.java diff --git a/application/src/test/java/org/opentripplanner/transit/model/_data/PatternTestModel.java b/application/src/test/java/org/opentripplanner/transit/model/_data/PatternTestModel.java new file mode 100644 index 00000000000..0b149ae4ee4 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/transit/model/_data/PatternTestModel.java @@ -0,0 +1,45 @@ +package org.opentripplanner.transit.model._data; + +import static org.opentripplanner.transit.model._data.TransitModelForTest.id; + +import org.opentripplanner.transit.model.framework.FeedScopedId; +import org.opentripplanner.transit.model.network.Route; +import org.opentripplanner.transit.model.network.StopPattern; +import org.opentripplanner.transit.model.network.TripPattern; +import org.opentripplanner.transit.model.site.RegularStop; +import org.opentripplanner.transit.model.timetable.ScheduledTripTimes; +import org.opentripplanner.transit.model.timetable.Trip; +import org.opentripplanner.transit.service.StopModel; + +public class PatternTestModel { + + public static final Route ROUTE_1 = TransitModelForTest.route("1").build(); + + private static final FeedScopedId SERVICE_ID = id("service"); + private static final Trip TRIP = TransitModelForTest + .trip("t1") + .withRoute(ROUTE_1) + .withServiceId(SERVICE_ID) + .build(); + private static final TransitModelForTest MODEL = new TransitModelForTest(StopModel.of()); + private static final RegularStop STOP_1 = MODEL.stop("1").build(); + private static final StopPattern STOP_PATTERN = TransitModelForTest.stopPattern(STOP_1, STOP_1); + + /** + * Creates a trip pattern that has a stop pattern, trip times and a trip with a service id. + */ + public static TripPattern pattern() { + var tt = ScheduledTripTimes + .of() + .withTrip(TRIP) + .withArrivalTimes("10:00 10:05") + .withDepartureTimes("10:00 10:05") + .build(); + + return TransitModelForTest + .tripPattern("1", ROUTE_1) + .withStopPattern(STOP_PATTERN) + .withScheduledTimeTableBuilder(builder -> builder.addTripTimes(tt)) + .build(); + } +} diff --git a/src/test/java/org/opentripplanner/transit/model/_data/TransitModelForTest.java b/application/src/test/java/org/opentripplanner/transit/model/_data/TransitModelForTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/_data/TransitModelForTest.java rename to application/src/test/java/org/opentripplanner/transit/model/_data/TransitModelForTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/basic/MainAndSubModeTest.java b/application/src/test/java/org/opentripplanner/transit/model/basic/MainAndSubModeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/basic/MainAndSubModeTest.java rename to application/src/test/java/org/opentripplanner/transit/model/basic/MainAndSubModeTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/basic/NoticeTest.java b/application/src/test/java/org/opentripplanner/transit/model/basic/NoticeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/basic/NoticeTest.java rename to application/src/test/java/org/opentripplanner/transit/model/basic/NoticeTest.java diff --git a/application/src/test/java/org/opentripplanner/transit/model/filter/expr/AndMatcherTest.java b/application/src/test/java/org/opentripplanner/transit/model/filter/expr/AndMatcherTest.java new file mode 100644 index 00000000000..c79260193ff --- /dev/null +++ b/application/src/test/java/org/opentripplanner/transit/model/filter/expr/AndMatcherTest.java @@ -0,0 +1,39 @@ +package org.opentripplanner.transit.model.filter.expr; + +import static org.junit.jupiter.api.Assertions.*; + +import java.util.List; +import org.junit.jupiter.api.Test; + +class AndMatcherTest { + + @Test + void testMatchSingleMatcher() { + var matcher = AndMatcher.of(List.of(new EqualityMatcher<>("int", 42, i -> i))); + assertTrue(matcher.match(42)); + assertFalse(matcher.match(43)); + } + + @Test + void testMatchMultiple() { + var matcher = AndMatcher.of( + List.of(new EqualityMatcher<>("int", 42, i -> i), new EqualityMatcher<>("int", 43, i -> i)) + ); + assertFalse(matcher.match(42)); + assertFalse(matcher.match(43)); + assertFalse(matcher.match(44)); + } + + @Test + void testMatchComposites() { + var matcher = AndMatcher.of( + List.of( + OrMatcher.of(List.of(new EqualityMatcher<>("int", 42, i -> i))), + OrMatcher.of(List.of(new EqualityMatcher<>("int", 43, i -> i))) + ) + ); + assertFalse(matcher.match(42)); + assertFalse(matcher.match(43)); + assertFalse(matcher.match(44)); + } +} diff --git a/application/src/test/java/org/opentripplanner/transit/model/filter/expr/ContainsMatcherTest.java b/application/src/test/java/org/opentripplanner/transit/model/filter/expr/ContainsMatcherTest.java new file mode 100644 index 00000000000..1709fc7bf86 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/transit/model/filter/expr/ContainsMatcherTest.java @@ -0,0 +1,33 @@ +package org.opentripplanner.transit.model.filter.expr; + +import static org.junit.jupiter.api.Assertions.*; + +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Test; + +class ContainsMatcherTest { + + private static final Map> integerListMap = Map.of( + 1, + List.of("foo"), + 2, + List.of("bar"), + 3, + List.of("foo", "bar") + ); + + @Test + void testMatch() { + var matcher = new ContainsMatcher<>( + "contains", + integerListMap::get, + new EqualityMatcher<>("string", "foo", s -> s) + ); + + assertTrue(matcher.match(1)); + assertFalse(matcher.match(2)); + assertTrue(matcher.match(3)); + assertFalse(matcher.match(4)); + } +} diff --git a/application/src/test/java/org/opentripplanner/transit/model/filter/expr/EqualityMatcherTest.java b/application/src/test/java/org/opentripplanner/transit/model/filter/expr/EqualityMatcherTest.java new file mode 100644 index 00000000000..31d208a768a --- /dev/null +++ b/application/src/test/java/org/opentripplanner/transit/model/filter/expr/EqualityMatcherTest.java @@ -0,0 +1,22 @@ +package org.opentripplanner.transit.model.filter.expr; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; + +class EqualityMatcherTest { + + @Test + void testMatchesPrimitive() { + var matcher = new EqualityMatcher<>("int", 42, i -> i); + assertTrue(matcher.match(42)); + assertFalse(matcher.match(43)); + } + + @Test + void testMatchesObject() { + var matcher = new EqualityMatcher<>("string", "foo", s -> s); + assertTrue(matcher.match("foo")); + assertFalse(matcher.match("bar")); + } +} diff --git a/application/src/test/java/org/opentripplanner/transit/model/filter/expr/OrMatcherTest.java b/application/src/test/java/org/opentripplanner/transit/model/filter/expr/OrMatcherTest.java new file mode 100644 index 00000000000..415f64e40ed --- /dev/null +++ b/application/src/test/java/org/opentripplanner/transit/model/filter/expr/OrMatcherTest.java @@ -0,0 +1,31 @@ +package org.opentripplanner.transit.model.filter.expr; + +import static org.junit.jupiter.api.Assertions.*; + +import java.util.List; +import org.junit.jupiter.api.Test; + +class OrMatcherTest { + + @Test + void testMatch() { + var matcher = OrMatcher.of( + new EqualityMatcher<>("int", 42, i -> i), + new EqualityMatcher<>("int", 43, i -> i) + ); + assertTrue(matcher.match(42)); + assertTrue(matcher.match(43)); + assertFalse(matcher.match(44)); + } + + @Test + void testMatchComposites() { + var matcher = OrMatcher.of( + AndMatcher.of(List.of(new EqualityMatcher<>("int", 42, i -> i))), + AndMatcher.of(List.of(new EqualityMatcher<>("int", 43, i -> i))) + ); + assertTrue(matcher.match(42)); + assertTrue(matcher.match(43)); + assertFalse(matcher.match(44)); + } +} diff --git a/application/src/test/java/org/opentripplanner/transit/model/filter/transit/TripOnServiceDateMatcherFactoryTest.java b/application/src/test/java/org/opentripplanner/transit/model/filter/transit/TripOnServiceDateMatcherFactoryTest.java new file mode 100644 index 00000000000..b7cb7aa6698 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/transit/model/filter/transit/TripOnServiceDateMatcherFactoryTest.java @@ -0,0 +1,151 @@ +package org.opentripplanner.transit.model.filter.transit; + +import static org.junit.jupiter.api.Assertions.*; + +import java.time.LocalDate; +import java.util.List; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.opentripplanner.transit.api.request.TripOnServiceDateRequest; +import org.opentripplanner.transit.model.basic.TransitMode; +import org.opentripplanner.transit.model.filter.expr.Matcher; +import org.opentripplanner.transit.model.framework.FeedScopedId; +import org.opentripplanner.transit.model.network.Route; +import org.opentripplanner.transit.model.organization.Agency; +import org.opentripplanner.transit.model.timetable.Trip; +import org.opentripplanner.transit.model.timetable.TripOnServiceDate; + +class TripOnServiceDateMatcherFactoryTest { + + private TripOnServiceDate tripOnServiceDateRut; + private TripOnServiceDate tripOnServiceDateRut2; + private TripOnServiceDate tripOnServiceDateAkt; + + @BeforeEach + void setup() { + tripOnServiceDateRut = + TripOnServiceDate + .of(new FeedScopedId("RUT:route:trip:date", "123")) + .withTrip( + Trip + .of(new FeedScopedId("RUT:route:trip", "1")) + .withRoute( + Route + .of(new FeedScopedId("RUT:route", "2")) + .withAgency( + Agency + .of(new FeedScopedId("RUT", "3")) + .withName("RUT") + .withTimezone("Europe/Oslo") + .build() + ) + .withMode(TransitMode.BUS) + .withShortName("BUS") + .build() + ) + .build() + ) + .withServiceDate(LocalDate.of(2024, 2, 22)) + .build(); + + tripOnServiceDateRut2 = + TripOnServiceDate + .of(new FeedScopedId("RUT:route:trip:date", "123")) + .withTrip( + Trip + .of(new FeedScopedId("RUT:route:trip2", "1")) + .withRoute( + Route + .of(new FeedScopedId("RUT:route", "2")) + .withAgency( + Agency + .of(new FeedScopedId("RUT", "3")) + .withName("RUT") + .withTimezone("Europe/Oslo") + .build() + ) + .withMode(TransitMode.BUS) + .withShortName("BUS") + .build() + ) + .build() + ) + .withServiceDate(LocalDate.of(2024, 2, 22)) + .build(); + + tripOnServiceDateAkt = + TripOnServiceDate + .of(new FeedScopedId("AKT:route:trip:date", "123")) + .withTrip( + Trip + .of(new FeedScopedId("AKT:route:trip", "1")) + .withRoute( + Route + .of(new FeedScopedId("AKT:route", "2")) + .withAgency( + Agency + .of(new FeedScopedId("AKT", "3")) + .withName("AKT") + .withTimezone("Europe/Oslo") + .build() + ) + .withMode(TransitMode.BUS) + .withShortName("BUS") + .build() + ) + .build() + ) + .withServiceDate(LocalDate.of(2024, 2, 22)) + .build(); + } + + @Test + void testMatchOperatingDays() { + TripOnServiceDateRequest request = TripOnServiceDateRequest + .of() + .withOperatingDays(List.of(LocalDate.of(2024, 2, 22))) + .build(); + + Matcher matcher = TripOnServiceDateMatcherFactory.of(request); + + assertTrue(matcher.match(tripOnServiceDateRut)); + assertTrue(matcher.match(tripOnServiceDateRut2)); + assertTrue(matcher.match(tripOnServiceDateAkt)); + } + + @Test + void testMatchMultiple() { + TripOnServiceDateRequest request = TripOnServiceDateRequest + .of() + .withOperatingDays(List.of(LocalDate.of(2024, 2, 22))) + .withAuthorities(List.of(new FeedScopedId("RUT", "3"))) + .withLines(List.of(new FeedScopedId("RUT:route", "2"))) + .withServiceJourneys(List.of(new FeedScopedId("RUT:route:trip", "1"))) + .build(); + + Matcher matcher = TripOnServiceDateMatcherFactory.of(request); + + assertTrue(matcher.match(tripOnServiceDateRut)); + assertFalse(matcher.match(tripOnServiceDateRut2)); + assertFalse(matcher.match(tripOnServiceDateAkt)); + } + + @Test + void testMatchMultipleServiceJourneyMatchers() { + TripOnServiceDateRequest request = TripOnServiceDateRequest + .of() + .withOperatingDays(List.of(LocalDate.of(2024, 2, 22))) + .withAuthorities(List.of(new FeedScopedId("RUT", "3"))) + .withLines(List.of(new FeedScopedId("RUT:route", "2"))) + .withServiceJourneys( + List.of(new FeedScopedId("RUT:route:trip", "1"), new FeedScopedId("RUT:route:trip2", "1")) + ) + .build(); + + Matcher matcher = TripOnServiceDateMatcherFactory.of(request); + + assertTrue(matcher.match(tripOnServiceDateRut)); + assertTrue(matcher.match(tripOnServiceDateRut2)); + assertFalse(matcher.match(tripOnServiceDateAkt)); + } +} diff --git a/src/test/java/org/opentripplanner/transit/model/framework/EntityByIdTest.java b/application/src/test/java/org/opentripplanner/transit/model/framework/EntityByIdTest.java similarity index 96% rename from src/test/java/org/opentripplanner/transit/model/framework/EntityByIdTest.java rename to application/src/test/java/org/opentripplanner/transit/model/framework/EntityByIdTest.java index 146c2c9e5ae..f7f1aed4666 100644 --- a/src/test/java/org/opentripplanner/transit/model/framework/EntityByIdTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/framework/EntityByIdTest.java @@ -5,7 +5,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collections; -import javax.annotation.Nonnull; import org.junit.jupiter.api.Test; import org.opentripplanner.transit.model._data.TransitModelForTest; @@ -84,11 +83,10 @@ public static TestEntityBuilder of(FeedScopedId id) { } @Override - public boolean sameAs(@Nonnull TestEntity other) { + public boolean sameAs(TestEntity other) { return getId().equals(other.getId()); } - @Nonnull @Override public TransitBuilder copy() { return new TestEntityBuilder(this); diff --git a/application/src/test/java/org/opentripplanner/transit/model/framework/EntityNotFoundExceptionTest.java b/application/src/test/java/org/opentripplanner/transit/model/framework/EntityNotFoundExceptionTest.java new file mode 100644 index 00000000000..f33eb389a37 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/transit/model/framework/EntityNotFoundExceptionTest.java @@ -0,0 +1,22 @@ +package org.opentripplanner.transit.model.framework; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +class EntityNotFoundExceptionTest { + + private static final FeedScopedId ID = FeedScopedId.ofNullable("F", "1"); + + @Test + void getMessage() { + assertEquals( + "Integer entity not found: F:1", + new EntityNotFoundException(Integer.class, ID).getMessage() + ); + assertEquals( + "Stop or Station entity not found: F:1", + new EntityNotFoundException("Stop or Station", ID).getMessage() + ); + } +} diff --git a/src/test/java/org/opentripplanner/transit/model/framework/FeedScopedIdTest.java b/application/src/test/java/org/opentripplanner/transit/model/framework/FeedScopedIdTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/framework/FeedScopedIdTest.java rename to application/src/test/java/org/opentripplanner/transit/model/framework/FeedScopedIdTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/framework/ResultTest.java b/application/src/test/java/org/opentripplanner/transit/model/framework/ResultTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/framework/ResultTest.java rename to application/src/test/java/org/opentripplanner/transit/model/framework/ResultTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/network/GroupOfRoutesTest.java b/application/src/test/java/org/opentripplanner/transit/model/network/GroupOfRoutesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/network/GroupOfRoutesTest.java rename to application/src/test/java/org/opentripplanner/transit/model/network/GroupOfRoutesTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/network/RouteTest.java b/application/src/test/java/org/opentripplanner/transit/model/network/RouteTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/network/RouteTest.java rename to application/src/test/java/org/opentripplanner/transit/model/network/RouteTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/network/StopPatternTest.java b/application/src/test/java/org/opentripplanner/transit/model/network/StopPatternTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/network/StopPatternTest.java rename to application/src/test/java/org/opentripplanner/transit/model/network/StopPatternTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/network/SubModeTest.java b/application/src/test/java/org/opentripplanner/transit/model/network/SubModeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/network/SubModeTest.java rename to application/src/test/java/org/opentripplanner/transit/model/network/SubModeTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/network/TripPatternTest.java b/application/src/test/java/org/opentripplanner/transit/model/network/TripPatternTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/network/TripPatternTest.java rename to application/src/test/java/org/opentripplanner/transit/model/network/TripPatternTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/network/grouppriority/DefaultTransitGroupPriorityCalculatorTest.java b/application/src/test/java/org/opentripplanner/transit/model/network/grouppriority/DefaultTransitGroupPriorityCalculatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/network/grouppriority/DefaultTransitGroupPriorityCalculatorTest.java rename to application/src/test/java/org/opentripplanner/transit/model/network/grouppriority/DefaultTransitGroupPriorityCalculatorTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/network/grouppriority/MatchersTest.java b/application/src/test/java/org/opentripplanner/transit/model/network/grouppriority/MatchersTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/network/grouppriority/MatchersTest.java rename to application/src/test/java/org/opentripplanner/transit/model/network/grouppriority/MatchersTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/network/grouppriority/TransitGroupPriority32nTest.java b/application/src/test/java/org/opentripplanner/transit/model/network/grouppriority/TransitGroupPriority32nTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/network/grouppriority/TransitGroupPriority32nTest.java rename to application/src/test/java/org/opentripplanner/transit/model/network/grouppriority/TransitGroupPriority32nTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/network/grouppriority/TransitGroupPriorityServiceTest.java b/application/src/test/java/org/opentripplanner/transit/model/network/grouppriority/TransitGroupPriorityServiceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/network/grouppriority/TransitGroupPriorityServiceTest.java rename to application/src/test/java/org/opentripplanner/transit/model/network/grouppriority/TransitGroupPriorityServiceTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/network/grouppriority/TripAdapterTest.java b/application/src/test/java/org/opentripplanner/transit/model/network/grouppriority/TripAdapterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/network/grouppriority/TripAdapterTest.java rename to application/src/test/java/org/opentripplanner/transit/model/network/grouppriority/TripAdapterTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/organization/AgencyTest.java b/application/src/test/java/org/opentripplanner/transit/model/organization/AgencyTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/organization/AgencyTest.java rename to application/src/test/java/org/opentripplanner/transit/model/organization/AgencyTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/organization/BrandingTest.java b/application/src/test/java/org/opentripplanner/transit/model/organization/BrandingTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/organization/BrandingTest.java rename to application/src/test/java/org/opentripplanner/transit/model/organization/BrandingTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/organization/ContactInfoTest.java b/application/src/test/java/org/opentripplanner/transit/model/organization/ContactInfoTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/organization/ContactInfoTest.java rename to application/src/test/java/org/opentripplanner/transit/model/organization/ContactInfoTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/organization/OperatorTest.java b/application/src/test/java/org/opentripplanner/transit/model/organization/OperatorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/organization/OperatorTest.java rename to application/src/test/java/org/opentripplanner/transit/model/organization/OperatorTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/site/AreaStopTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/AreaStopTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/site/AreaStopTest.java rename to application/src/test/java/org/opentripplanner/transit/model/site/AreaStopTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/site/BoardingAreaTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/BoardingAreaTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/site/BoardingAreaTest.java rename to application/src/test/java/org/opentripplanner/transit/model/site/BoardingAreaTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/site/EntranceTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/EntranceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/site/EntranceTest.java rename to application/src/test/java/org/opentripplanner/transit/model/site/EntranceTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/site/FareZoneTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/FareZoneTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/site/FareZoneTest.java rename to application/src/test/java/org/opentripplanner/transit/model/site/FareZoneTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/site/GroupOfStationsTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/GroupOfStationsTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/site/GroupOfStationsTest.java rename to application/src/test/java/org/opentripplanner/transit/model/site/GroupOfStationsTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/site/GroupStopTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/GroupStopTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/site/GroupStopTest.java rename to application/src/test/java/org/opentripplanner/transit/model/site/GroupStopTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/site/MultiModalStationTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/MultiModalStationTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/site/MultiModalStationTest.java rename to application/src/test/java/org/opentripplanner/transit/model/site/MultiModalStationTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/site/PathwayNodeTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/PathwayNodeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/site/PathwayNodeTest.java rename to application/src/test/java/org/opentripplanner/transit/model/site/PathwayNodeTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/site/PathwayTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/PathwayTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/site/PathwayTest.java rename to application/src/test/java/org/opentripplanner/transit/model/site/PathwayTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/site/RegularStopTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/RegularStopTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/site/RegularStopTest.java rename to application/src/test/java/org/opentripplanner/transit/model/site/RegularStopTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/site/StationTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/StationTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/site/StationTest.java rename to application/src/test/java/org/opentripplanner/transit/model/site/StationTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/timetable/RealTimeTripTimesTest.java b/application/src/test/java/org/opentripplanner/transit/model/timetable/RealTimeTripTimesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/timetable/RealTimeTripTimesTest.java rename to application/src/test/java/org/opentripplanner/transit/model/timetable/RealTimeTripTimesTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/timetable/ScheduledTripTimesTest.java b/application/src/test/java/org/opentripplanner/transit/model/timetable/ScheduledTripTimesTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/timetable/ScheduledTripTimesTest.java rename to application/src/test/java/org/opentripplanner/transit/model/timetable/ScheduledTripTimesTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/timetable/StopTimeKeyTest.java b/application/src/test/java/org/opentripplanner/transit/model/timetable/StopTimeKeyTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/timetable/StopTimeKeyTest.java rename to application/src/test/java/org/opentripplanner/transit/model/timetable/StopTimeKeyTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/timetable/TimetableValidationErrorTest.java b/application/src/test/java/org/opentripplanner/transit/model/timetable/TimetableValidationErrorTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/timetable/TimetableValidationErrorTest.java rename to application/src/test/java/org/opentripplanner/transit/model/timetable/TimetableValidationErrorTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/timetable/TripOnServiceDateTest.java b/application/src/test/java/org/opentripplanner/transit/model/timetable/TripOnServiceDateTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/timetable/TripOnServiceDateTest.java rename to application/src/test/java/org/opentripplanner/transit/model/timetable/TripOnServiceDateTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/timetable/TripTest.java b/application/src/test/java/org/opentripplanner/transit/model/timetable/TripTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/timetable/TripTest.java rename to application/src/test/java/org/opentripplanner/transit/model/timetable/TripTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/timetable/booking/BookingInfoTest.java b/application/src/test/java/org/opentripplanner/transit/model/timetable/booking/BookingInfoTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/timetable/booking/BookingInfoTest.java rename to application/src/test/java/org/opentripplanner/transit/model/timetable/booking/BookingInfoTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/timetable/booking/BookingTimeTest.java b/application/src/test/java/org/opentripplanner/transit/model/timetable/booking/BookingTimeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/timetable/booking/BookingTimeTest.java rename to application/src/test/java/org/opentripplanner/transit/model/timetable/booking/BookingTimeTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/timetable/booking/RoutingBookingInfoTest.java b/application/src/test/java/org/opentripplanner/transit/model/timetable/booking/RoutingBookingInfoTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/timetable/booking/RoutingBookingInfoTest.java rename to application/src/test/java/org/opentripplanner/transit/model/timetable/booking/RoutingBookingInfoTest.java diff --git a/src/test/java/org/opentripplanner/transit/service/DefaultTransitServiceTest.java b/application/src/test/java/org/opentripplanner/transit/service/DefaultTransitServiceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/service/DefaultTransitServiceTest.java rename to application/src/test/java/org/opentripplanner/transit/service/DefaultTransitServiceTest.java diff --git a/src/test/java/org/opentripplanner/apis/gtfs/PatternByServiceDatesFilterTest.java b/application/src/test/java/org/opentripplanner/transit/service/PatternByServiceDatesFilterTest.java similarity index 66% rename from src/test/java/org/opentripplanner/apis/gtfs/PatternByServiceDatesFilterTest.java rename to application/src/test/java/org/opentripplanner/transit/service/PatternByServiceDatesFilterTest.java index f01bac12006..93f50ce5b1e 100644 --- a/src/test/java/org/opentripplanner/apis/gtfs/PatternByServiceDatesFilterTest.java +++ b/application/src/test/java/org/opentripplanner/transit/service/PatternByServiceDatesFilterTest.java @@ -1,12 +1,12 @@ -package org.opentripplanner.apis.gtfs; +package org.opentripplanner.transit.service; import static java.time.LocalDate.parse; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.opentripplanner.apis.gtfs.PatternByServiceDatesFilterTest.FilterExpectation.NOT_REMOVED; -import static org.opentripplanner.apis.gtfs.PatternByServiceDatesFilterTest.FilterExpectation.REMOVED; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.PatternTestModel.ROUTE_1; +import static org.opentripplanner.transit.service.PatternByServiceDatesFilterTest.FilterExpectation.NOT_REMOVED; +import static org.opentripplanner.transit.service.PatternByServiceDatesFilterTest.FilterExpectation.REMOVED; import java.time.LocalDate; import java.util.List; @@ -14,51 +14,18 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import org.opentripplanner.apis.gtfs.model.LocalDateRange; -import org.opentripplanner.transit.model._data.TransitModelForTest; -import org.opentripplanner.transit.model.framework.FeedScopedId; -import org.opentripplanner.transit.model.network.Route; -import org.opentripplanner.transit.model.network.StopPattern; +import org.opentripplanner.transit.model._data.PatternTestModel; import org.opentripplanner.transit.model.network.TripPattern; -import org.opentripplanner.transit.model.site.RegularStop; -import org.opentripplanner.transit.model.timetable.ScheduledTripTimes; -import org.opentripplanner.transit.model.timetable.Trip; -import org.opentripplanner.transit.service.StopModel; class PatternByServiceDatesFilterTest { - private static final Route ROUTE_1 = TransitModelForTest.route("1").build(); - private static final FeedScopedId SERVICE_ID = id("service"); - private static final Trip TRIP = TransitModelForTest - .trip("t1") - .withRoute(ROUTE_1) - .withServiceId(SERVICE_ID) - .build(); - private static final TransitModelForTest MODEL = new TransitModelForTest(StopModel.of()); - private static final RegularStop STOP_1 = MODEL.stop("1").build(); - private static final StopPattern STOP_PATTERN = TransitModelForTest.stopPattern(STOP_1, STOP_1); - private static final TripPattern PATTERN_1 = pattern(); + private static final TripPattern PATTERN_1 = PatternTestModel.pattern(); enum FilterExpectation { REMOVED, NOT_REMOVED, } - private static TripPattern pattern() { - var pattern = TransitModelForTest - .tripPattern("1", ROUTE_1) - .withStopPattern(STOP_PATTERN) - .build(); - - var tt = ScheduledTripTimes - .of() - .withTrip(TRIP) - .withArrivalTimes("10:00 10:05") - .withDepartureTimes("10:00 10:05") - .build(); - pattern.add(tt); - return pattern; - } - static List invalidRangeCases() { return List.of( Arguments.of(null, null), @@ -140,7 +107,7 @@ void filterRoutes(LocalDate start, LocalDate end, FilterExpectation expectation) var filter = defaultFilter(start, end); var filterInput = List.of(ROUTE_1); - var filterOutput = filter.filterRoutes(filterInput.stream()); + var filterOutput = filter.filterRoutes(filterInput); if (expectation == NOT_REMOVED) { assertEquals(filterOutput, filterInput); diff --git a/src/test/java/org/opentripplanner/transit/service/StopModelMock.java b/application/src/test/java/org/opentripplanner/transit/service/StopModelMock.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/service/StopModelMock.java rename to application/src/test/java/org/opentripplanner/transit/service/StopModelMock.java diff --git a/src/test/java/org/opentripplanner/transit/service/StopModelTest.java b/application/src/test/java/org/opentripplanner/transit/service/StopModelTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/service/StopModelTest.java rename to application/src/test/java/org/opentripplanner/transit/service/StopModelTest.java diff --git a/src/test/java/org/opentripplanner/transit/service/TransitModelTest.java b/application/src/test/java/org/opentripplanner/transit/service/TransitModelTest.java similarity index 91% rename from src/test/java/org/opentripplanner/transit/service/TransitModelTest.java rename to application/src/test/java/org/opentripplanner/transit/service/TransitModelTest.java index 95c20245f9a..213d1f7b514 100644 --- a/src/test/java/org/opentripplanner/transit/service/TransitModelTest.java +++ b/application/src/test/java/org/opentripplanner/transit/service/TransitModelTest.java @@ -42,8 +42,8 @@ void validateTimeZones() { // Then trip times should be same as in input data TransitModelIndex transitModelIndex = transitModel.getTransitModelIndex(); - Trip trip = transitModelIndex.getTripForId().get(SAMPLE_TRIP_ID); - Timetable timetable = transitModelIndex.getPatternForTrip().get(trip).getScheduledTimetable(); + Trip trip = transitModelIndex.getTripForId(SAMPLE_TRIP_ID); + Timetable timetable = transitModelIndex.getPatternForTrip(trip).getScheduledTimetable(); assertEquals(20 * 60, timetable.getTripTimes(trip).getDepartureTime(0)); // Should throw on second bundle, with different agency time zone @@ -101,8 +101,8 @@ void validateTimeZonesWithExplicitTimeZone() { assertEquals("America/Chicago", transitModel.getTimeZone().getId()); // Then trip times should be on hour less than in input data - Trip trip = transitModelIndex.getTripForId().get(SAMPLE_TRIP_ID); - Timetable timetable = transitModelIndex.getPatternForTrip().get(trip).getScheduledTimetable(); + Trip trip = transitModelIndex.getTripForId(SAMPLE_TRIP_ID); + Timetable timetable = transitModelIndex.getPatternForTrip(trip).getScheduledTimetable(); assertEquals(20 * 60 - 60 * 60, timetable.getTripTimes(trip).getDepartureTime(0)); } } diff --git a/src/test/java/org/opentripplanner/transit/speed_test/ResultPrinter.java b/application/src/test/java/org/opentripplanner/transit/speed_test/ResultPrinter.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/ResultPrinter.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/ResultPrinter.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/SpeedIntegrationTest.java b/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedIntegrationTest.java similarity index 95% rename from src/test/java/org/opentripplanner/transit/speed_test/SpeedIntegrationTest.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/SpeedIntegrationTest.java index e5006d949b6..61a23b10ff6 100644 --- a/src/test/java/org/opentripplanner/transit/speed_test/SpeedIntegrationTest.java +++ b/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedIntegrationTest.java @@ -24,14 +24,14 @@ import org.opentripplanner.transit.speed_test.options.SpeedTestConfig; /** - * This test run the SpeedTest on the Portland dataset. It tests all SpeedTest + * This test runs the SpeedTest on the Portland dataset. It tests all SpeedTest * profiles. This is also a good integration-test for the OTP routing query. */ public class SpeedIntegrationTest { /** - * We need to use a relative path here, because the test will update the results files in case - * the results differ. This make it easy to maintain the test. + * We need to use a relative path here, because the test will update the result files in case + * the results differ. This makes it easy to maintain the test. */ private static final File BASE_DIR = Path.of("src", "test", "resources", "speedtest").toFile(); diff --git a/src/test/java/org/opentripplanner/transit/speed_test/SpeedTest.java b/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/SpeedTest.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/SpeedTest.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/SpeedTestRequest.java b/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedTestRequest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/SpeedTestRequest.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/SpeedTestRequest.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/model/SpeedTestProfile.java b/application/src/test/java/org/opentripplanner/transit/speed_test/model/SpeedTestProfile.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/model/SpeedTestProfile.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/model/SpeedTestProfile.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/CsvFileSupport.java b/application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/CsvFileSupport.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/model/testcase/CsvFileSupport.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/CsvFileSupport.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/ExpectedResults.java b/application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/ExpectedResults.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/model/testcase/ExpectedResults.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/ExpectedResults.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/ItineraryResultMapper.java b/application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/ItineraryResultMapper.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/model/testcase/ItineraryResultMapper.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/ItineraryResultMapper.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/Result.java b/application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/Result.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/model/testcase/Result.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/Result.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TableTestReport.java b/application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TableTestReport.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TableTestReport.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TableTestReport.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestCase.java b/application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestCase.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestCase.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestCase.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestCaseDefinition.java b/application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestCaseDefinition.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestCaseDefinition.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestCaseDefinition.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestCaseFailedException.java b/application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestCaseFailedException.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestCaseFailedException.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestCaseFailedException.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestCaseResults.java b/application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestCaseResults.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestCaseResults.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestCaseResults.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestCases.java b/application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestCases.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestCases.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestCases.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestStatus.java b/application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestStatus.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestStatus.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestStatus.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestStatusTest.java b/application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestStatusTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestStatusTest.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/TestStatusTest.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/io/AbstractCsvFile.java b/application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/io/AbstractCsvFile.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/model/testcase/io/AbstractCsvFile.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/io/AbstractCsvFile.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/io/ResultCsvFile.java b/application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/io/ResultCsvFile.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/model/testcase/io/ResultCsvFile.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/io/ResultCsvFile.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/io/TestCaseDefinitionCsvFile.java b/application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/io/TestCaseDefinitionCsvFile.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/model/testcase/io/TestCaseDefinitionCsvFile.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/model/testcase/io/TestCaseDefinitionCsvFile.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/model/timer/MeterRegistrySetup.java b/application/src/test/java/org/opentripplanner/transit/speed_test/model/timer/MeterRegistrySetup.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/model/timer/MeterRegistrySetup.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/model/timer/MeterRegistrySetup.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/model/timer/SpeedTestTimer.java b/application/src/test/java/org/opentripplanner/transit/speed_test/model/timer/SpeedTestTimer.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/model/timer/SpeedTestTimer.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/model/timer/SpeedTestTimer.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/options/SpeedTestCmdLineOpts.java b/application/src/test/java/org/opentripplanner/transit/speed_test/options/SpeedTestCmdLineOpts.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/options/SpeedTestCmdLineOpts.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/options/SpeedTestCmdLineOpts.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/options/SpeedTestCmdLineOptsBuilder.java b/application/src/test/java/org/opentripplanner/transit/speed_test/options/SpeedTestCmdLineOptsBuilder.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/options/SpeedTestCmdLineOptsBuilder.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/options/SpeedTestCmdLineOptsBuilder.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/options/SpeedTestConfig.java b/application/src/test/java/org/opentripplanner/transit/speed_test/options/SpeedTestConfig.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/options/SpeedTestConfig.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/options/SpeedTestConfig.java diff --git a/src/test/java/org/opentripplanner/transit/speed_test/package.md b/application/src/test/java/org/opentripplanner/transit/speed_test/package.md similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/package.md rename to application/src/test/java/org/opentripplanner/transit/speed_test/package.md diff --git a/src/test/java/org/opentripplanner/transit/speed_test/support/AssertSpeedTestSetup.java b/application/src/test/java/org/opentripplanner/transit/speed_test/support/AssertSpeedTestSetup.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/speed_test/support/AssertSpeedTestSetup.java rename to application/src/test/java/org/opentripplanner/transit/speed_test/support/AssertSpeedTestSetup.java diff --git a/src/test/java/org/opentripplanner/updater/GtfsRealtimeFuzzyTripMatcherTest.java b/application/src/test/java/org/opentripplanner/updater/GtfsRealtimeFuzzyTripMatcherTest.java similarity index 100% rename from src/test/java/org/opentripplanner/updater/GtfsRealtimeFuzzyTripMatcherTest.java rename to application/src/test/java/org/opentripplanner/updater/GtfsRealtimeFuzzyTripMatcherTest.java diff --git a/src/test/java/org/opentripplanner/updater/alert/AlertsUpdateHandlerTest.java b/application/src/test/java/org/opentripplanner/updater/alert/AlertsUpdateHandlerTest.java similarity index 100% rename from src/test/java/org/opentripplanner/updater/alert/AlertsUpdateHandlerTest.java rename to application/src/test/java/org/opentripplanner/updater/alert/AlertsUpdateHandlerTest.java diff --git a/src/ext-test/java/org/opentripplanner/ext/siri/AddedTripBuilderTest.java b/application/src/test/java/org/opentripplanner/updater/siri/AddedTripBuilderTest.java similarity index 99% rename from src/ext-test/java/org/opentripplanner/ext/siri/AddedTripBuilderTest.java rename to application/src/test/java/org/opentripplanner/updater/siri/AddedTripBuilderTest.java index 364d6215252..6a36bbe12dd 100644 --- a/src/ext-test/java/org/opentripplanner/ext/siri/AddedTripBuilderTest.java +++ b/application/src/test/java/org/opentripplanner/updater/siri/AddedTripBuilderTest.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri; +package org.opentripplanner.updater.siri; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -16,7 +16,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; -import org.opentripplanner.ext.siri.mapper.SiriTransportModeMapper; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.model.calendar.CalendarServiceData; import org.opentripplanner.transit.model._data.TransitModelForTest; @@ -37,6 +36,7 @@ import org.opentripplanner.transit.service.StopModel; import org.opentripplanner.transit.service.TransitEditorService; import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.updater.siri.mapper.SiriTransportModeMapper; import org.opentripplanner.updater.spi.UpdateError; import uk.org.siri.siri20.VehicleModesEnumeration; diff --git a/src/ext-test/java/org/opentripplanner/ext/siri/ModifiedTripBuilderTest.java b/application/src/test/java/org/opentripplanner/updater/siri/ModifiedTripBuilderTest.java similarity index 99% rename from src/ext-test/java/org/opentripplanner/ext/siri/ModifiedTripBuilderTest.java rename to application/src/test/java/org/opentripplanner/updater/siri/ModifiedTripBuilderTest.java index 2bba22b3283..3323aaee74c 100644 --- a/src/ext-test/java/org/opentripplanner/ext/siri/ModifiedTripBuilderTest.java +++ b/application/src/test/java/org/opentripplanner/updater/siri/ModifiedTripBuilderTest.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri; +package org.opentripplanner.updater.siri; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; diff --git a/src/ext-test/java/org/opentripplanner/ext/siri/SiriAlertsUpdateHandlerTest.java b/application/src/test/java/org/opentripplanner/updater/siri/SiriAlertsUpdateHandlerTest.java similarity index 99% rename from src/ext-test/java/org/opentripplanner/ext/siri/SiriAlertsUpdateHandlerTest.java rename to application/src/test/java/org/opentripplanner/updater/siri/SiriAlertsUpdateHandlerTest.java index e861ca81c95..12bdcbbedce 100644 --- a/src/ext-test/java/org/opentripplanner/ext/siri/SiriAlertsUpdateHandlerTest.java +++ b/application/src/test/java/org/opentripplanner/updater/siri/SiriAlertsUpdateHandlerTest.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri; +package org.opentripplanner.updater.siri; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -34,6 +34,7 @@ import org.opentripplanner.updater.DefaultRealTimeUpdateContext; import org.opentripplanner.updater.GraphUpdaterManager; import org.opentripplanner.updater.RealTimeUpdateContext; +import org.opentripplanner.updater.siri.SiriAlertsUpdateHandler; import uk.org.ifopt.siri20.StopPlaceRef; import uk.org.siri.siri20.AffectedLineStructure; import uk.org.siri.siri20.AffectedRouteStructure; diff --git a/src/ext-test/java/org/opentripplanner/ext/siri/SiriEtBuilder.java b/application/src/test/java/org/opentripplanner/updater/siri/SiriEtBuilder.java similarity index 99% rename from src/ext-test/java/org/opentripplanner/ext/siri/SiriEtBuilder.java rename to application/src/test/java/org/opentripplanner/updater/siri/SiriEtBuilder.java index 3b54809b0a3..b9517e987c4 100644 --- a/src/ext-test/java/org/opentripplanner/ext/siri/SiriEtBuilder.java +++ b/application/src/test/java/org/opentripplanner/updater/siri/SiriEtBuilder.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri; +package org.opentripplanner.updater.siri; import java.math.BigInteger; import java.time.LocalDate; diff --git a/src/ext-test/java/org/opentripplanner/ext/siri/SiriTimetableSnapshotSourceTest.java b/application/src/test/java/org/opentripplanner/updater/siri/SiriTimetableSnapshotSourceTest.java similarity index 72% rename from src/ext-test/java/org/opentripplanner/ext/siri/SiriTimetableSnapshotSourceTest.java rename to application/src/test/java/org/opentripplanner/updater/siri/SiriTimetableSnapshotSourceTest.java index cf29eec8f49..83076998f4d 100644 --- a/src/ext-test/java/org/opentripplanner/ext/siri/SiriTimetableSnapshotSourceTest.java +++ b/application/src/test/java/org/opentripplanner/updater/siri/SiriTimetableSnapshotSourceTest.java @@ -1,13 +1,12 @@ -package org.opentripplanner.ext.siri; +package org.opentripplanner.updater.siri; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.opentripplanner.transit.model._data.TransitModelForTest.id; import static org.opentripplanner.updater.spi.UpdateResultAssertions.assertFailure; -import static org.opentripplanner.updater.trip.RealtimeTestEnvironment.SERVICE_DATE; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.timetable.RealTimeState; @@ -15,33 +14,48 @@ import org.opentripplanner.transit.model.timetable.TripIdAndServiceDate; import org.opentripplanner.transit.service.TransitService; import org.opentripplanner.updater.spi.UpdateError; +import org.opentripplanner.updater.trip.RealtimeTestConstants; import org.opentripplanner.updater.trip.RealtimeTestEnvironment; -import uk.org.siri.siri20.EstimatedTimetableDeliveryStructure; +import org.opentripplanner.updater.trip.TripInput; -class SiriTimetableSnapshotSourceTest { +class SiriTimetableSnapshotSourceTest implements RealtimeTestConstants { + + private static final TripInput TRIP_1_INPUT = TripInput + .of(TRIP_1_ID) + .withRoute(ROUTE_1.copy().withOperator(OPERATOR1).build()) + .addStop(STOP_A1, "0:00:10", "0:00:11") + .addStop(STOP_B1, "0:00:20", "0:00:21") + .build(); + + private static final TripInput TRIP_2_INPUT = TripInput + .of(TRIP_2_ID) + .addStop(STOP_A1, "0:01:00", "0:01:01") + .addStop(STOP_B1, "0:01:10", "0:01:11") + .addStop(STOP_C1, "0:01:20", "0:01:21") + .build(); @Test void testCancelTrip() { - var env = RealtimeTestEnvironment.siri(); + var env = RealtimeTestEnvironment.siri().addTrip(TRIP_1_INPUT).build(); - assertEquals(RealTimeState.SCHEDULED, env.getTripTimesForTrip(env.trip1).getRealTimeState()); + assertEquals(RealTimeState.SCHEDULED, env.getTripTimesForTrip(TRIP_1_ID).getRealTimeState()); var updates = new SiriEtBuilder(env.getDateTimeHelper()) - .withDatedVehicleJourneyRef(env.trip1.getId().getId()) + .withDatedVehicleJourneyRef(TRIP_1_ID) .withCancellation(true) .buildEstimatedTimetableDeliveries(); var result = env.applyEstimatedTimetable(updates); assertEquals(1, result.successful()); - assertEquals(RealTimeState.CANCELED, env.getTripTimesForTrip(env.trip1).getRealTimeState()); + assertEquals(RealTimeState.CANCELED, env.getTripTimesForTrip(TRIP_1_ID).getRealTimeState()); } @Test void testAddJourneyWithExistingRoute() { - var env = RealtimeTestEnvironment.siri(); + var env = RealtimeTestEnvironment.siri().addTrip(TRIP_1_INPUT).build(); - Route route = env.getTransitService().getRouteForId(env.route1Id); + Route route = ROUTE_1; int numPatternForRoute = env.getTransitService().getPatternsForRoute(route).size(); String newJourneyId = "newJourney"; @@ -55,7 +69,7 @@ void testAddJourneyWithExistingRoute() { "SCHEDULED | C1 0:01 0:01 | D1 0:03 0:03", env.getScheduledTimetable(newJourneyId) ); - FeedScopedId tripId = TransitModelForTest.id(newJourneyId); + FeedScopedId tripId = id(newJourneyId); TransitService transitService = env.getTransitService(); Trip trip = transitService.getTripForId(tripId); assertNotNull(trip); @@ -75,7 +89,8 @@ void testAddJourneyWithExistingRoute() { @Test void testAddJourneyWithNewRoute() { - var env = RealtimeTestEnvironment.siri(); + // we actually don't need the trip, but it's the only way to add a route to the index + var env = RealtimeTestEnvironment.siri().addTrip(TRIP_1_INPUT).build(); String newRouteRef = "new route ref"; var updates = createValidAddedJourney(env) @@ -93,7 +108,7 @@ void testAddJourneyWithNewRoute() { ); TransitService transitService = env.getTransitService(); assertEquals(numRoutes + 1, transitService.getAllRoutes().size()); - FeedScopedId newRouteId = TransitModelForTest.id(newRouteRef); + FeedScopedId newRouteId = id(newRouteRef); Route newRoute = transitService.getRouteForId(newRouteId); assertNotNull(newRoute); assertEquals(1, transitService.getPatternsForRoute(newRoute).size()); @@ -101,7 +116,8 @@ void testAddJourneyWithNewRoute() { @Test void testAddJourneyMultipleTimes() { - var env = RealtimeTestEnvironment.siri(); + // we actually don't need the trip, but it's the only way to add a route to the index + var env = RealtimeTestEnvironment.siri().addTrip(TRIP_1_INPUT).build(); var updates = createValidAddedJourney(env).buildEstimatedTimetableDeliveries(); int numTrips = env.getTransitService().getAllTrips().size(); @@ -115,20 +131,21 @@ void testAddJourneyMultipleTimes() { @Test void testAddedJourneyWithInvalidScheduledData() { - var env = RealtimeTestEnvironment.siri(); + // we actually don't need the trip, but it's the only way to add a route to the index + var env = RealtimeTestEnvironment.siri().addTrip(TRIP_1_INPUT).build(); // Create an extra journey with invalid planned data (travel back in time) // and valid real time data var createExtraJourney = new SiriEtBuilder(env.getDateTimeHelper()) .withEstimatedVehicleJourneyCode("newJourney") .withIsExtraJourney(true) - .withOperatorRef(env.operator1Id.getId()) - .withLineRef(env.route1Id.getId()) + .withOperatorRef(OPERATOR_1_ID) + .withLineRef(ROUTE_1_ID) .withEstimatedCalls(builder -> builder - .call(env.stopA1) + .call(STOP_A1) .departAimedExpected("10:58", "10:48") - .call(env.stopB1) + .call(STOP_B1) .arriveAimedExpected("10:08", "10:58") ) .buildEstimatedTimetableDeliveries(); @@ -140,7 +157,7 @@ void testAddedJourneyWithInvalidScheduledData() { @Test void testAddedJourneyWithUnresolvableAgency() { - var env = RealtimeTestEnvironment.siri(); + var env = RealtimeTestEnvironment.siri().build(); // Create an extra journey with unknown line and operator var createExtraJourney = new SiriEtBuilder(env.getDateTimeHelper()) @@ -150,9 +167,9 @@ void testAddedJourneyWithUnresolvableAgency() { .withLineRef("unknown line") .withEstimatedCalls(builder -> builder - .call(env.stopA1) + .call(STOP_A1) .departAimedExpected("10:58", "10:48") - .call(env.stopB1) + .call(STOP_B1) .arriveAimedExpected("10:08", "10:58") ) .buildEstimatedTimetableDeliveries(); @@ -164,17 +181,17 @@ void testAddedJourneyWithUnresolvableAgency() { @Test void testReplaceJourney() { - var env = RealtimeTestEnvironment.siri(); + var env = RealtimeTestEnvironment.siri().addTrip(TRIP_1_INPUT).build(); var updates = new SiriEtBuilder(env.getDateTimeHelper()) .withEstimatedVehicleJourneyCode("newJourney") .withIsExtraJourney(true) // replace trip1 - .withVehicleJourneyRef(env.trip1.getId().getId()) - .withOperatorRef(env.operator1Id.getId()) - .withLineRef(env.route1Id.getId()) - .withRecordedCalls(builder -> builder.call(env.stopA1).departAimedActual("00:01", "00:02")) - .withEstimatedCalls(builder -> builder.call(env.stopC1).arriveAimedExpected("00:03", "00:04")) + .withVehicleJourneyRef(TRIP_1_ID) + .withOperatorRef(OPERATOR_1_ID) + .withLineRef(ROUTE_1_ID) + .withRecordedCalls(builder -> builder.call(STOP_A1).departAimedActual("00:01", "00:02")) + .withEstimatedCalls(builder -> builder.call(STOP_C1).arriveAimedExpected("00:03", "00:04")) .buildEstimatedTimetableDeliveries(); var result = env.applyEstimatedTimetable(updates); @@ -188,7 +205,7 @@ void testReplaceJourney() { ); // Original trip should not get canceled - var originalTripTimes = env.getTripTimesForTrip(env.trip1); + var originalTripTimes = env.getTripTimesForTrip(TRIP_1_ID); assertEquals(RealTimeState.SCHEDULED, originalTripTimes.getRealTimeState()); } @@ -197,17 +214,17 @@ void testReplaceJourney() { */ @Test void testUpdateJourneyWithDatedVehicleJourneyRef() { - var env = RealtimeTestEnvironment.siri(); + var env = RealtimeTestEnvironment.siri().addTrip(TRIP_1_INPUT).build(); var updates = updatedJourneyBuilder(env) - .withDatedVehicleJourneyRef(env.trip1.getId().getId()) + .withDatedVehicleJourneyRef(TRIP_1_ID) .buildEstimatedTimetableDeliveries(); var result = env.applyEstimatedTimetable(updates); assertEquals(1, result.successful()); assertTripUpdated(env); assertEquals( "UPDATED | A1 0:00:15 0:00:15 | B1 0:00:25 0:00:25", - env.getRealtimeTimetable(env.trip1) + env.getRealtimeTimetable(TRIP_1_ID) ); } @@ -216,11 +233,11 @@ void testUpdateJourneyWithDatedVehicleJourneyRef() { */ @Test void testUpdateJourneyWithFramedVehicleJourneyRef() { - var env = RealtimeTestEnvironment.siri(); + var env = RealtimeTestEnvironment.siri().addTrip(TRIP_1_INPUT).build(); var updates = updatedJourneyBuilder(env) .withFramedVehicleJourneyRef(builder -> - builder.withServiceDate(SERVICE_DATE).withVehicleJourneyRef(env.trip1.getId().getId()) + builder.withServiceDate(SERVICE_DATE).withVehicleJourneyRef(TRIP_1_ID) ) .buildEstimatedTimetableDeliveries(); var result = env.applyEstimatedTimetable(updates); @@ -233,7 +250,7 @@ void testUpdateJourneyWithFramedVehicleJourneyRef() { */ @Test void testUpdateJourneyWithoutJourneyRef() { - var env = RealtimeTestEnvironment.siri(); + var env = RealtimeTestEnvironment.siri().addTrip(TRIP_1_INPUT).build(); var updates = updatedJourneyBuilder(env).buildEstimatedTimetableDeliveries(); var result = env.applyEstimatedTimetable(updates); @@ -246,7 +263,7 @@ void testUpdateJourneyWithoutJourneyRef() { */ @Test void testUpdateJourneyWithFuzzyMatching() { - var env = RealtimeTestEnvironment.siri(); + var env = RealtimeTestEnvironment.siri().addTrip(TRIP_1_INPUT).build(); var updates = updatedJourneyBuilder(env).buildEstimatedTimetableDeliveries(); var result = env.applyEstimatedTimetableWithFuzzyMatcher(updates); @@ -260,17 +277,17 @@ void testUpdateJourneyWithFuzzyMatching() { */ @Test void testUpdateJourneyWithFuzzyMatchingAndMissingAimedDepartureTime() { - var env = RealtimeTestEnvironment.siri(); + var env = RealtimeTestEnvironment.siri().addTrip(TRIP_1_INPUT).build(); var updates = new SiriEtBuilder(env.getDateTimeHelper()) .withFramedVehicleJourneyRef(builder -> - builder.withServiceDate(RealtimeTestEnvironment.SERVICE_DATE).withVehicleJourneyRef("XXX") + builder.withServiceDate(SERVICE_DATE).withVehicleJourneyRef("XXX") ) .withEstimatedCalls(builder -> builder - .call(env.stopA1) + .call(STOP_A1) .departAimedExpected(null, "00:00:12") - .call(env.stopB1) + .call(STOP_B1) .arriveAimedExpected("00:00:20", "00:00:22") ) .buildEstimatedTimetableDeliveries(); @@ -285,15 +302,13 @@ void testUpdateJourneyWithFuzzyMatchingAndMissingAimedDepartureTime() { */ @Test void testChangeQuay() { - var env = RealtimeTestEnvironment.siri(); + var env = RealtimeTestEnvironment.siri().addTrip(TRIP_1_INPUT).build(); var updates = new SiriEtBuilder(env.getDateTimeHelper()) - .withDatedVehicleJourneyRef(env.trip1.getId().getId()) - .withRecordedCalls(builder -> - builder.call(env.stopA1).departAimedActual("00:00:11", "00:00:15") - ) + .withDatedVehicleJourneyRef(TRIP_1_ID) + .withRecordedCalls(builder -> builder.call(STOP_A1).departAimedActual("00:00:11", "00:00:15")) .withEstimatedCalls(builder -> - builder.call(env.stopB2).arriveAimedExpected("00:00:20", "00:00:33") + builder.call(STOP_B2).arriveAimedExpected("00:00:20", "00:00:33") ) .buildEstimatedTimetableDeliveries(); @@ -302,23 +317,23 @@ void testChangeQuay() { assertEquals(1, result.successful()); assertEquals( "MODIFIED | A1 [R] 0:00:15 0:00:15 | B2 0:00:33 0:00:33", - env.getRealtimeTimetable(env.trip1) + env.getRealtimeTimetable(TRIP_1_ID) ); } @Test void testCancelStop() { - var env = RealtimeTestEnvironment.siri(); + var env = RealtimeTestEnvironment.siri().addTrip(TRIP_2_INPUT).build(); var updates = new SiriEtBuilder(env.getDateTimeHelper()) - .withDatedVehicleJourneyRef(env.trip2.getId().getId()) + .withDatedVehicleJourneyRef(TRIP_2_ID) .withEstimatedCalls(builder -> builder - .call(env.stopA1) + .call(STOP_A1) .departAimedExpected("00:01:01", "00:01:01") - .call(env.stopB1) + .call(STOP_B1) .withIsCancellation(true) - .call(env.stopC1) + .call(STOP_C1) .arriveAimedExpected("00:01:30", "00:01:30") ) .buildEstimatedTimetableDeliveries(); @@ -328,7 +343,7 @@ void testCancelStop() { assertEquals(1, result.successful()); assertEquals( "MODIFIED | A1 0:01:01 0:01:01 | B1 [C] 0:01:10 0:01:11 | C1 0:01:30 0:01:30", - env.getRealtimeTimetable(env.trip2) + env.getRealtimeTimetable(TRIP_2_ID) ); } @@ -336,20 +351,18 @@ void testCancelStop() { @Test @Disabled("Not supported yet") void testAddStop() { - var env = RealtimeTestEnvironment.siri(); + var env = RealtimeTestEnvironment.siri().addTrip(TRIP_1_INPUT).build(); var updates = new SiriEtBuilder(env.getDateTimeHelper()) - .withDatedVehicleJourneyRef(env.trip1.getId().getId()) - .withRecordedCalls(builder -> - builder.call(env.stopA1).departAimedActual("00:00:11", "00:00:15") - ) + .withDatedVehicleJourneyRef(TRIP_1_ID) + .withRecordedCalls(builder -> builder.call(STOP_A1).departAimedActual("00:00:11", "00:00:15")) .withEstimatedCalls(builder -> builder - .call(env.stopD1) + .call(STOP_D1) .withIsExtraCall(true) .arriveAimedExpected("00:00:19", "00:00:20") .departAimedExpected("00:00:24", "00:00:25") - .call(env.stopB1) + .call(STOP_B1) .arriveAimedExpected("00:00:20", "00:00:33") ) .buildEstimatedTimetableDeliveries(); @@ -359,7 +372,7 @@ void testAddStop() { assertEquals(1, result.successful()); assertEquals( "MODIFIED | A1 0:00:15 0:00:15 | D1 [C] 0:00:20 0:00:25 | B1 0:00:33 0:00:33", - env.getRealtimeTimetable(env.trip1) + env.getRealtimeTimetable(TRIP_1_ID) ); } @@ -369,7 +382,7 @@ void testAddStop() { @Test void testNotMonitored() { - var env = RealtimeTestEnvironment.siri(); + var env = RealtimeTestEnvironment.siri().addTrip(TRIP_1_INPUT).build(); var updates = new SiriEtBuilder(env.getDateTimeHelper()) .withMonitored(false) @@ -382,19 +395,19 @@ void testNotMonitored() { @Test void testReplaceJourneyWithoutEstimatedVehicleJourneyCode() { - var env = RealtimeTestEnvironment.siri(); + var env = RealtimeTestEnvironment.siri().addTrip(TRIP_1_INPUT).build(); var updates = new SiriEtBuilder(env.getDateTimeHelper()) .withDatedVehicleJourneyRef("newJourney") .withIsExtraJourney(true) - .withVehicleJourneyRef(env.trip1.getId().getId()) - .withOperatorRef(env.operator1Id.getId()) - .withLineRef(env.route1Id.getId()) + .withVehicleJourneyRef(TRIP_1_ID) + .withOperatorRef(OPERATOR_1_ID) + .withLineRef(ROUTE_1_ID) .withEstimatedCalls(builder -> builder - .call(env.stopA1) + .call(STOP_A1) .departAimedExpected("00:01", "00:02") - .call(env.stopC1) + .call(STOP_C1) .arriveAimedExpected("00:03", "00:04") ) .buildEstimatedTimetableDeliveries(); @@ -407,15 +420,15 @@ void testReplaceJourneyWithoutEstimatedVehicleJourneyCode() { @Test void testNegativeHopTime() { - var env = RealtimeTestEnvironment.siri(); + var env = RealtimeTestEnvironment.siri().addTrip(TRIP_1_INPUT).build(); var updates = new SiriEtBuilder(env.getDateTimeHelper()) - .withDatedVehicleJourneyRef(env.trip1.getId().getId()) + .withDatedVehicleJourneyRef(TRIP_1_ID) .withRecordedCalls(builder -> builder - .call(env.stopA1) + .call(STOP_A1) .departAimedActual("00:00:11", "00:00:15") - .call(env.stopB1) + .call(STOP_B1) .arriveAimedActual("00:00:20", "00:00:14") ) .buildEstimatedTimetableDeliveries(); @@ -427,18 +440,18 @@ void testNegativeHopTime() { @Test void testNegativeDwellTime() { - var env = RealtimeTestEnvironment.siri(); + var env = RealtimeTestEnvironment.siri().addTrip(TRIP_2_INPUT).build(); var updates = new SiriEtBuilder(env.getDateTimeHelper()) - .withDatedVehicleJourneyRef(env.trip2.getId().getId()) + .withDatedVehicleJourneyRef(TRIP_2_ID) .withRecordedCalls(builder -> builder - .call(env.stopA1) + .call(STOP_A1) .departAimedActual("00:01:01", "00:01:01") - .call(env.stopB1) + .call(STOP_B1) .arriveAimedActual("00:01:10", "00:01:13") .departAimedActual("00:01:11", "00:01:12") - .call(env.stopB1) + .call(STOP_B1) .arriveAimedActual("00:01:20", "00:01:20") ) .buildEstimatedTimetableDeliveries(); @@ -452,19 +465,19 @@ void testNegativeDwellTime() { @Test @Disabled("Not supported yet") void testExtraUnknownStop() { - var env = RealtimeTestEnvironment.siri(); + var env = RealtimeTestEnvironment.siri().addTrip(TRIP_1_INPUT).build(); var updates = new SiriEtBuilder(env.getDateTimeHelper()) - .withDatedVehicleJourneyRef(env.trip1.getId().getId()) + .withDatedVehicleJourneyRef(TRIP_1_ID) .withEstimatedCalls(builder -> builder - .call(env.stopA1) + .call(STOP_A1) .departAimedExpected("00:00:11", "00:00:15") // Unexpected extra stop without isExtraCall flag - .call(env.stopD1) + .call(STOP_D1) .arriveAimedExpected("00:00:19", "00:00:20") .departAimedExpected("00:00:24", "00:00:25") - .call(env.stopB1) + .call(STOP_B1) .arriveAimedExpected("00:00:20", "00:00:33") ) .buildEstimatedTimetableDeliveries(); @@ -478,20 +491,19 @@ private static SiriEtBuilder createValidAddedJourney(RealtimeTestEnvironment env return new SiriEtBuilder(env.getDateTimeHelper()) .withEstimatedVehicleJourneyCode("newJourney") .withIsExtraJourney(true) - .withOperatorRef(env.operator1Id.getId()) - .withLineRef(env.route1Id.getId()) - .withRecordedCalls(builder -> builder.call(env.stopC1).departAimedActual("00:01", "00:02")) - .withEstimatedCalls(builder -> builder.call(env.stopD1).arriveAimedExpected("00:03", "00:04") - ); + .withOperatorRef(OPERATOR_1_ID) + .withLineRef(ROUTE_1_ID) + .withRecordedCalls(builder -> builder.call(STOP_C1).departAimedActual("00:01", "00:02")) + .withEstimatedCalls(builder -> builder.call(STOP_D1).arriveAimedExpected("00:03", "00:04")); } private static SiriEtBuilder updatedJourneyBuilder(RealtimeTestEnvironment env) { return new SiriEtBuilder(env.getDateTimeHelper()) .withEstimatedCalls(builder -> builder - .call(env.stopA1) + .call(STOP_A1) .departAimedExpected("00:00:11", "00:00:15") - .call(env.stopB1) + .call(STOP_B1) .arriveAimedExpected("00:00:20", "00:00:25") ); } @@ -499,7 +511,7 @@ private static SiriEtBuilder updatedJourneyBuilder(RealtimeTestEnvironment env) private static void assertTripUpdated(RealtimeTestEnvironment env) { assertEquals( "UPDATED | A1 0:00:15 0:00:15 | B1 0:00:25 0:00:25", - env.getRealtimeTimetable(env.trip1) + env.getRealtimeTimetable(TRIP_1_ID) ); } } diff --git a/src/ext-test/java/org/opentripplanner/ext/siri/TestCall.java b/application/src/test/java/org/opentripplanner/updater/siri/TestCall.java similarity index 99% rename from src/ext-test/java/org/opentripplanner/ext/siri/TestCall.java rename to application/src/test/java/org/opentripplanner/updater/siri/TestCall.java index 55d1fa4591f..62e0f64d30f 100644 --- a/src/ext-test/java/org/opentripplanner/ext/siri/TestCall.java +++ b/application/src/test/java/org/opentripplanner/updater/siri/TestCall.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri; +package org.opentripplanner.updater.siri; import java.time.ZonedDateTime; import java.util.List; diff --git a/src/ext-test/java/org/opentripplanner/ext/siri/TimetableHelperTest.java b/application/src/test/java/org/opentripplanner/updater/siri/TimetableHelperTest.java similarity index 99% rename from src/ext-test/java/org/opentripplanner/ext/siri/TimetableHelperTest.java rename to application/src/test/java/org/opentripplanner/updater/siri/TimetableHelperTest.java index dde2677a952..c89ef594fdc 100644 --- a/src/ext-test/java/org/opentripplanner/ext/siri/TimetableHelperTest.java +++ b/application/src/test/java/org/opentripplanner/updater/siri/TimetableHelperTest.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri; +package org.opentripplanner.updater.siri; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/src/ext-test/java/org/opentripplanner/ext/siri/mapper/PickDropMapperTest.java b/application/src/test/java/org/opentripplanner/updater/siri/mapper/PickDropMapperTest.java similarity index 98% rename from src/ext-test/java/org/opentripplanner/ext/siri/mapper/PickDropMapperTest.java rename to application/src/test/java/org/opentripplanner/updater/siri/mapper/PickDropMapperTest.java index c45ef87efea..9508709c36d 100644 --- a/src/ext-test/java/org/opentripplanner/ext/siri/mapper/PickDropMapperTest.java +++ b/application/src/test/java/org/opentripplanner/updater/siri/mapper/PickDropMapperTest.java @@ -1,4 +1,4 @@ -package org.opentripplanner.ext.siri.mapper; +package org.opentripplanner.updater.siri.mapper; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -9,8 +9,8 @@ import static uk.org.siri.siri20.DepartureBoardingActivityEnumeration.NO_BOARDING; import org.junit.jupiter.api.Test; -import org.opentripplanner.ext.siri.TestCall; import org.opentripplanner.model.PickDrop; +import org.opentripplanner.updater.siri.TestCall; import uk.org.siri.siri20.CallStatusEnumeration; class PickDropMapperTest { diff --git a/src/test/java/org/opentripplanner/updater/spi/HttpHeadersTest.java b/application/src/test/java/org/opentripplanner/updater/spi/HttpHeadersTest.java similarity index 100% rename from src/test/java/org/opentripplanner/updater/spi/HttpHeadersTest.java rename to application/src/test/java/org/opentripplanner/updater/spi/HttpHeadersTest.java diff --git a/src/test/java/org/opentripplanner/updater/spi/UpdateResultAssertions.java b/application/src/test/java/org/opentripplanner/updater/spi/UpdateResultAssertions.java similarity index 100% rename from src/test/java/org/opentripplanner/updater/spi/UpdateResultAssertions.java rename to application/src/test/java/org/opentripplanner/updater/spi/UpdateResultAssertions.java diff --git a/src/test/java/org/opentripplanner/updater/trip/GtfsRealtimeTripUpdateSourceTest.java b/application/src/test/java/org/opentripplanner/updater/trip/GtfsRealtimeTripUpdateSourceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/updater/trip/GtfsRealtimeTripUpdateSourceTest.java rename to application/src/test/java/org/opentripplanner/updater/trip/GtfsRealtimeTripUpdateSourceTest.java diff --git a/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestConstants.java b/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestConstants.java new file mode 100644 index 00000000000..bad0c1982e9 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestConstants.java @@ -0,0 +1,48 @@ +package org.opentripplanner.updater.trip; + +import static org.opentripplanner.transit.model._data.TransitModelForTest.id; + +import java.time.LocalDate; +import java.time.ZoneId; +import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model.framework.FeedScopedId; +import org.opentripplanner.transit.model.network.Route; +import org.opentripplanner.transit.model.organization.Operator; +import org.opentripplanner.transit.model.site.RegularStop; +import org.opentripplanner.transit.model.site.Station; +import org.opentripplanner.transit.service.StopModel; + +public interface RealtimeTestConstants { + LocalDate SERVICE_DATE = LocalDate.of(2024, 5, 8); + FeedScopedId SERVICE_ID = TransitModelForTest.id("CAL_1"); + String STOP_A1_ID = "A1"; + String STOP_B1_ID = "B1"; + String STOP_C1_ID = "C1"; + String TRIP_1_ID = "TestTrip1"; + String TRIP_2_ID = "TestTrip2"; + String OPERATOR_1_ID = "TestOperator1"; + Operator OPERATOR1 = Operator.of(id(OPERATOR_1_ID)).withName(OPERATOR_1_ID).build(); + String ROUTE_1_ID = "TestRoute1"; + + TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + ZoneId TIME_ZONE = ZoneId.of(TransitModelForTest.TIME_ZONE_ID); + Station STATION_A = TEST_MODEL.station("A").build(); + Station STATION_B = TEST_MODEL.station("B").build(); + Station STATION_C = TEST_MODEL.station("C").build(); + Station STATION_D = TEST_MODEL.station("D").build(); + RegularStop STOP_A1 = TEST_MODEL.stop(STOP_A1_ID).withParentStation(STATION_A).build(); + RegularStop STOP_B1 = TEST_MODEL.stop(STOP_B1_ID).withParentStation(STATION_B).build(); + RegularStop STOP_B2 = TEST_MODEL.stop("B2").withParentStation(STATION_B).build(); + RegularStop STOP_C1 = TEST_MODEL.stop(STOP_C1_ID).withParentStation(STATION_C).build(); + RegularStop STOP_D1 = TEST_MODEL.stop("D1").withParentStation(STATION_D).build(); + StopModel STOP_MODEL = TEST_MODEL + .stopModelBuilder() + .withRegularStop(STOP_A1) + .withRegularStop(STOP_B1) + .withRegularStop(STOP_B2) + .withRegularStop(STOP_C1) + .withRegularStop(STOP_D1) + .build(); + + Route ROUTE_1 = TransitModelForTest.route(ROUTE_1_ID).build(); +} diff --git a/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironment.java b/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironment.java similarity index 51% rename from src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironment.java rename to application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironment.java index a40bd8bd797..543bc6d3a17 100644 --- a/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironment.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironment.java @@ -1,45 +1,29 @@ package org.opentripplanner.updater.trip; +import static org.opentripplanner.transit.model._data.TransitModelForTest.id; import static org.opentripplanner.updater.trip.UpdateIncrementality.DIFFERENTIAL; import static org.opentripplanner.updater.trip.UpdateIncrementality.FULL_DATASET; import com.google.transit.realtime.GtfsRealtime; import java.time.Duration; import java.time.LocalDate; -import java.time.ZoneId; import java.util.List; import java.util.Objects; -import java.util.stream.Collectors; -import java.util.stream.IntStream; import org.opentripplanner.DateTimeHelper; -import org.opentripplanner.ext.siri.SiriTimetableSnapshotSource; -import org.opentripplanner.ext.siri.updater.EstimatedTimetableHandler; -import org.opentripplanner.framework.i18n.I18NString; -import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; -import org.opentripplanner.model.StopTime; import org.opentripplanner.model.TimetableSnapshot; -import org.opentripplanner.model.calendar.CalendarServiceData; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.transit.model._data.TransitModelForTest; -import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; -import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.network.TripPattern; -import org.opentripplanner.transit.model.organization.Operator; -import org.opentripplanner.transit.model.site.RegularStop; -import org.opentripplanner.transit.model.site.Station; -import org.opentripplanner.transit.model.site.StopLocation; -import org.opentripplanner.transit.model.timetable.Trip; -import org.opentripplanner.transit.model.timetable.TripOnServiceDate; import org.opentripplanner.transit.model.timetable.TripTimes; -import org.opentripplanner.transit.model.timetable.TripTimesFactory; import org.opentripplanner.transit.model.timetable.TripTimesStringBuilder; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.StopModel; import org.opentripplanner.transit.service.TransitModel; import org.opentripplanner.transit.service.TransitService; import org.opentripplanner.updater.DefaultRealTimeUpdateContext; import org.opentripplanner.updater.TimetableSnapshotSourceParameters; +import org.opentripplanner.updater.siri.SiriTimetableSnapshotSource; +import org.opentripplanner.updater.siri.updater.EstimatedTimetableHandler; import org.opentripplanner.updater.spi.UpdateResult; import uk.org.siri.siri20.EstimatedTimetableDeliveryStructure; @@ -50,47 +34,20 @@ *

    * It is however a goal to change that and then these two can be combined. */ -public final class RealtimeTestEnvironment { +public final class RealtimeTestEnvironment implements RealtimeTestConstants { + // static constants private static final TimetableSnapshotSourceParameters PARAMETERS = new TimetableSnapshotSourceParameters( Duration.ZERO, false ); - public static final LocalDate SERVICE_DATE = LocalDate.of(2024, 5, 8); - public static final FeedScopedId SERVICE_ID = TransitModelForTest.id("CAL_1"); - public static final String STOP_A1_ID = "A1"; - public static final String STOP_B1_ID = "B1"; - public static final String STOP_C1_ID = "C1"; - private final TransitModelForTest testModel = TransitModelForTest.of(); - public final ZoneId timeZone = ZoneId.of(TransitModelForTest.TIME_ZONE_ID); - public final Station stationA = testModel.station("A").build(); - public final Station stationB = testModel.station("B").build(); - public final Station stationC = testModel.station("C").build(); - public final Station stationD = testModel.station("D").build(); - public final RegularStop stopA1 = testModel.stop(STOP_A1_ID).withParentStation(stationA).build(); - public final RegularStop stopB1 = testModel.stop(STOP_B1_ID).withParentStation(stationB).build(); - public final RegularStop stopB2 = testModel.stop("B2").withParentStation(stationB).build(); - public final RegularStop stopC1 = testModel.stop(STOP_C1_ID).withParentStation(stationC).build(); - public final RegularStop stopD1 = testModel.stop("D1").withParentStation(stationD).build(); - public final StopModel stopModel = testModel - .stopModelBuilder() - .withRegularStop(stopA1) - .withRegularStop(stopB1) - .withRegularStop(stopB2) - .withRegularStop(stopC1) - .withRegularStop(stopD1) - .build(); - public final FeedScopedId operator1Id = TransitModelForTest.id("TestOperator1"); - public final FeedScopedId route1Id = TransitModelForTest.id("TestRoute1"); - public final Trip trip1; - public final Trip trip2; - public final Operator operator1; + public final TransitModel transitModel; private final SiriTimetableSnapshotSource siriSource; private final TimetableSnapshotSource gtfsSource; private final DateTimeHelper dateTimeHelper; - private enum SourceType { + enum SourceType { GTFS_RT, SIRI, } @@ -98,54 +55,22 @@ private enum SourceType { /** * Siri and GTFS-RT cannot be run at the same time, so you need to decide. */ - public static RealtimeTestEnvironment siri() { - return new RealtimeTestEnvironment(SourceType.SIRI); + public static RealtimeTestEnvironmentBuilder siri() { + return new RealtimeTestEnvironmentBuilder().withSourceType(SourceType.SIRI); } /** * Siri and GTFS-RT cannot be run at the same time, so you need to decide. */ - public static RealtimeTestEnvironment gtfs() { - return new RealtimeTestEnvironment(SourceType.GTFS_RT); + public static RealtimeTestEnvironmentBuilder gtfs() { + return new RealtimeTestEnvironmentBuilder().withSourceType(SourceType.GTFS_RT); } - private RealtimeTestEnvironment(SourceType sourceType) { - transitModel = new TransitModel(stopModel, new Deduplicator()); - transitModel.initTimeZone(timeZone); - transitModel.addAgency(TransitModelForTest.AGENCY); - - operator1 = Operator.of(operator1Id).withName("Operator 1").build(); - transitModel.getOperators().add(operator1); - - Route route1 = TransitModelForTest.route(route1Id).withOperator(operator1).build(); - - trip1 = - createTrip( - "TestTrip1", - route1, - List.of(new StopCall(stopA1, 10, 11), new StopCall(stopB1, 20, 21)) - ); - trip2 = - createTrip( - "TestTrip2", - route1, - List.of( - new StopCall(stopA1, 60, 61), - new StopCall(stopB1, 70, 71), - new StopCall(stopC1, 80, 81) - ) - ); - - CalendarServiceData calendarServiceData = new CalendarServiceData(); - calendarServiceData.putServiceDatesForServiceId( - SERVICE_ID, - List.of(SERVICE_DATE.minusDays(1), SERVICE_DATE, SERVICE_DATE.plusDays(1)) - ); - transitModel.getServiceCodes().put(SERVICE_ID, 0); - transitModel.updateCalendarServiceData(true, calendarServiceData, DataImportIssueStore.NOOP); - - transitModel.index(); + RealtimeTestEnvironment(SourceType sourceType, TransitModel transitModel) { + Objects.requireNonNull(sourceType); + this.transitModel = transitModel; + this.transitModel.index(); // SIRI and GTFS-RT cannot be registered with the transit model at the same time // we are actively refactoring to remove this restriction // for the time being you cannot run a SIRI and GTFS-RT test at the same time @@ -156,11 +81,7 @@ private RealtimeTestEnvironment(SourceType sourceType) { gtfsSource = new TimetableSnapshotSource(PARAMETERS, transitModel); siriSource = null; } - dateTimeHelper = new DateTimeHelper(timeZone, RealtimeTestEnvironment.SERVICE_DATE); - } - - public static FeedScopedId id(String id) { - return TransitModelForTest.id(id); + dateTimeHelper = new DateTimeHelper(TIME_ZONE, SERVICE_DATE); } /** @@ -190,7 +111,11 @@ private EstimatedTimetableHandler getEstimatedTimetableHandler(boolean fuzzyMatc } public TripPattern getPatternForTrip(FeedScopedId tripId) { - return getPatternForTrip(tripId, RealtimeTestEnvironment.SERVICE_DATE); + return getPatternForTrip(tripId, SERVICE_DATE); + } + + public TripPattern getPatternForTrip(String id) { + return getPatternForTrip(id(id)); } public TripPattern getPatternForTrip(FeedScopedId tripId, LocalDate serviceDate) { @@ -199,13 +124,6 @@ public TripPattern getPatternForTrip(FeedScopedId tripId, LocalDate serviceDate) return transitService.getPatternForTrip(trip.getTrip(), serviceDate); } - /** - * Find the current TripTimes for a trip id on the default serviceDate - */ - public TripTimes getTripTimesForTrip(Trip trip) { - return getTripTimesForTrip(trip.getId(), SERVICE_DATE); - } - /** * Find the current TripTimes for a trip id on the default serviceDate */ @@ -217,10 +135,6 @@ public DateTimeHelper getDateTimeHelper() { return dateTimeHelper; } - public TripPattern getPatternForTrip(Trip trip) { - return getTransitService().getPatternForTrip(trip); - } - public TimetableSnapshot getTimetableSnapshot() { if (siriSource != null) { return siriSource.getTimetableSnapshot(); @@ -233,10 +147,6 @@ public String getRealtimeTimetable(String tripId) { return getRealtimeTimetable(id(tripId), SERVICE_DATE); } - public String getRealtimeTimetable(Trip trip) { - return getRealtimeTimetable(trip.getId(), SERVICE_DATE); - } - public String getRealtimeTimetable(FeedScopedId tripId, LocalDate serviceDate) { var tt = getTripTimesForTrip(tripId, serviceDate); var pattern = getPatternForTrip(tripId); @@ -325,59 +235,4 @@ private void commitTimetableSnapshot() { gtfsSource.flushBuffer(); } } - - private Trip createTrip(String id, Route route, List stops) { - var trip = Trip - .of(id(id)) - .withRoute(route) - .withHeadsign(I18NString.of("Headsign of %s".formatted(id))) - .withServiceId(SERVICE_ID) - .build(); - - var tripOnServiceDate = TripOnServiceDate - .of(trip.getId()) - .withTrip(trip) - .withServiceDate(SERVICE_DATE) - .build(); - - transitModel.addTripOnServiceDate(tripOnServiceDate.getId(), tripOnServiceDate); - - var stopTimes = IntStream - .range(0, stops.size()) - .mapToObj(i -> { - var stop = stops.get(i); - return createStopTime(trip, i, stop.stop(), stop.arrivalTime(), stop.departureTime()); - }) - .collect(Collectors.toList()); - - TripTimes tripTimes = TripTimesFactory.tripTimes(trip, stopTimes, null); - - final TripPattern pattern = TransitModelForTest - .tripPattern(id + "Pattern", route) - .withStopPattern(TransitModelForTest.stopPattern(stops.stream().map(StopCall::stop).toList())) - .build(); - pattern.add(tripTimes); - - transitModel.addTripPattern(pattern.getId(), pattern); - - return trip; - } - - private StopTime createStopTime( - Trip trip, - int stopSequence, - StopLocation stop, - int arrivalTime, - int departureTime - ) { - var st = new StopTime(); - st.setTrip(trip); - st.setStopSequence(stopSequence); - st.setStop(stop); - st.setArrivalTime(arrivalTime); - st.setDepartureTime(departureTime); - return st; - } - - private record StopCall(RegularStop stop, int arrivalTime, int departureTime) {} } diff --git a/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironmentBuilder.java b/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironmentBuilder.java new file mode 100644 index 00000000000..3203d7d49fc --- /dev/null +++ b/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironmentBuilder.java @@ -0,0 +1,114 @@ +package org.opentripplanner.updater.trip; + +import static org.opentripplanner.transit.model._data.TransitModelForTest.id; + +import java.util.List; +import java.util.Objects; +import java.util.stream.IntStream; +import org.opentripplanner.framework.i18n.I18NString; +import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; +import org.opentripplanner.model.StopTime; +import org.opentripplanner.model.calendar.CalendarServiceData; +import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model.framework.Deduplicator; +import org.opentripplanner.transit.model.network.TripPattern; +import org.opentripplanner.transit.model.site.StopLocation; +import org.opentripplanner.transit.model.timetable.Trip; +import org.opentripplanner.transit.model.timetable.TripOnServiceDate; +import org.opentripplanner.transit.model.timetable.TripTimes; +import org.opentripplanner.transit.model.timetable.TripTimesFactory; +import org.opentripplanner.transit.service.TransitModel; + +public class RealtimeTestEnvironmentBuilder implements RealtimeTestConstants { + + private RealtimeTestEnvironment.SourceType sourceType; + private final TransitModel transitModel = new TransitModel(STOP_MODEL, new Deduplicator()); + + RealtimeTestEnvironmentBuilder withSourceType(RealtimeTestEnvironment.SourceType sourceType) { + this.sourceType = sourceType; + return this; + } + + public RealtimeTestEnvironmentBuilder addTrip(TripInput trip) { + createTrip(trip); + transitModel.index(); + return this; + } + + public RealtimeTestEnvironment build() { + Objects.requireNonNull(sourceType, "sourceType cannot be null"); + transitModel.initTimeZone(TIME_ZONE); + transitModel.addAgency(TransitModelForTest.AGENCY); + + CalendarServiceData calendarServiceData = new CalendarServiceData(); + calendarServiceData.putServiceDatesForServiceId( + SERVICE_ID, + List.of(SERVICE_DATE.minusDays(1), SERVICE_DATE, SERVICE_DATE.plusDays(1)) + ); + transitModel.getServiceCodes().put(SERVICE_ID, 0); + transitModel.updateCalendarServiceData(true, calendarServiceData, DataImportIssueStore.NOOP); + + return new RealtimeTestEnvironment(sourceType, transitModel); + } + + private Trip createTrip(TripInput tripInput) { + var trip = Trip + .of(id(tripInput.id())) + .withRoute(tripInput.route()) + .withHeadsign(I18NString.of("Headsign of %s".formatted(tripInput.id()))) + .withServiceId(SERVICE_ID) + .build(); + + var tripOnServiceDate = TripOnServiceDate + .of(trip.getId()) + .withTrip(trip) + .withServiceDate(SERVICE_DATE) + .build(); + + transitModel.addTripOnServiceDate(tripOnServiceDate); + + if (tripInput.route().getOperator() != null) { + transitModel.addOperators(List.of(tripInput.route().getOperator())); + } + + var stopTimes = IntStream + .range(0, tripInput.stops().size()) + .mapToObj(i -> { + var stop = tripInput.stops().get(i); + return createStopTime(trip, i, stop.stop(), stop.arrivalTime(), stop.departureTime()); + }) + .toList(); + + TripTimes tripTimes = TripTimesFactory.tripTimes(trip, stopTimes, null); + + final TripPattern pattern = TransitModelForTest + .tripPattern(tripInput.id() + "Pattern", tripInput.route()) + .withStopPattern( + TransitModelForTest.stopPattern( + tripInput.stops().stream().map(TripInput.StopCall::stop).toList() + ) + ) + .withScheduledTimeTableBuilder(builder -> builder.addTripTimes(tripTimes)) + .build(); + + transitModel.addTripPattern(pattern.getId(), pattern); + + return trip; + } + + private static StopTime createStopTime( + Trip trip, + int stopSequence, + StopLocation stop, + int arrivalTime, + int departureTime + ) { + var st = new StopTime(); + st.setTrip(trip); + st.setStopSequence(stopSequence); + st.setStop(stop); + st.setArrivalTime(arrivalTime); + st.setDepartureTime(departureTime); + return st; + } +} diff --git a/src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotManagerTest.java b/application/src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotManagerTest.java similarity index 100% rename from src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotManagerTest.java rename to application/src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotManagerTest.java diff --git a/src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotSourceTest.java b/application/src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotSourceTest.java similarity index 98% rename from src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotSourceTest.java rename to application/src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotSourceTest.java index e53ba07cbcf..c3050cf11fe 100644 --- a/src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotSourceTest.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotSourceTest.java @@ -19,7 +19,6 @@ import java.time.Duration; import java.time.LocalDate; import java.util.List; -import javax.annotation.Nonnull; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.opentripplanner.ConstantsForTests; @@ -251,7 +250,7 @@ public void testHandleModifiedTrip() { // New trip pattern { - final TripPattern newTripPattern = snapshot.getRealtimeAddedTripPattern( + final TripPattern newTripPattern = snapshot.getNewTripPatternForModifiedTrip( new FeedScopedId(feedId, modifiedTripId), SERVICE_DATE ); @@ -282,7 +281,6 @@ public void testHandleModifiedTrip() { } } - @Nonnull private TimetableSnapshotSource defaultUpdater() { return new TimetableSnapshotSource( new TimetableSnapshotSourceParameters(Duration.ZERO, true), diff --git a/application/src/test/java/org/opentripplanner/updater/trip/TripInput.java b/application/src/test/java/org/opentripplanner/updater/trip/TripInput.java new file mode 100644 index 00000000000..e4d9309061a --- /dev/null +++ b/application/src/test/java/org/opentripplanner/updater/trip/TripInput.java @@ -0,0 +1,47 @@ +package org.opentripplanner.updater.trip; + +import java.util.ArrayList; +import java.util.List; +import org.opentripplanner.framework.time.TimeUtils; +import org.opentripplanner.transit.model.network.Route; +import org.opentripplanner.transit.model.site.RegularStop; + +/** + * A simple data structure that is used by the {@link RealtimeTestEnvironment} to create + * trips, trips on date and patterns. + */ +public record TripInput(String id, Route route, List stops) { + public static TripInputBuilder of(String id) { + return new TripInputBuilder(id); + } + + public static class TripInputBuilder implements RealtimeTestConstants { + + private final String id; + private final List stops = new ArrayList<>(); + // can be made configurable if needed + private Route route = ROUTE_1; + + TripInputBuilder(String id) { + this.id = id; + } + + public TripInputBuilder addStop(RegularStop stopId, String arrivalTime, String departureTime) { + this.stops.add( + new StopCall(stopId, TimeUtils.time(arrivalTime), TimeUtils.time(departureTime)) + ); + return this; + } + + public TripInput build() { + return new TripInput(id, route, stops); + } + + public TripInputBuilder withRoute(Route route) { + this.route = route; + return this; + } + } + + record StopCall(RegularStop stop, int arrivalTime, int departureTime) {} +} diff --git a/src/test/java/org/opentripplanner/updater/trip/TripUpdateBuilder.java b/application/src/test/java/org/opentripplanner/updater/trip/TripUpdateBuilder.java similarity index 100% rename from src/test/java/org/opentripplanner/updater/trip/TripUpdateBuilder.java rename to application/src/test/java/org/opentripplanner/updater/trip/TripUpdateBuilder.java diff --git a/src/test/java/org/opentripplanner/updater/trip/moduletests/addition/AddedTest.java b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/addition/AddedTest.java similarity index 89% rename from src/test/java/org/opentripplanner/updater/trip/moduletests/addition/AddedTest.java rename to application/src/test/java/org/opentripplanner/updater/trip/moduletests/addition/AddedTest.java index 2e0b9d3d88e..6b662e8c8f3 100644 --- a/src/test/java/org/opentripplanner/updater/trip/moduletests/addition/AddedTest.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/addition/AddedTest.java @@ -7,10 +7,6 @@ import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.opentripplanner.updater.spi.UpdateResultAssertions.assertSuccess; -import static org.opentripplanner.updater.trip.RealtimeTestEnvironment.SERVICE_DATE; -import static org.opentripplanner.updater.trip.RealtimeTestEnvironment.STOP_A1_ID; -import static org.opentripplanner.updater.trip.RealtimeTestEnvironment.STOP_B1_ID; -import static org.opentripplanner.updater.trip.RealtimeTestEnvironment.STOP_C1_ID; import de.mfdz.MfdzRealtimeExtensions.StopTimePropertiesExtension.DropOffPickupType; import java.util.List; @@ -23,18 +19,19 @@ import org.opentripplanner.transit.model.timetable.Trip; import org.opentripplanner.transit.service.TransitService; import org.opentripplanner.updater.spi.UpdateSuccess; +import org.opentripplanner.updater.trip.RealtimeTestConstants; import org.opentripplanner.updater.trip.RealtimeTestEnvironment; import org.opentripplanner.updater.trip.TripUpdateBuilder; -class AddedTest { +class AddedTest implements RealtimeTestConstants { final String ADDED_TRIP_ID = "added_trip"; @Test void addedTrip() { - var env = RealtimeTestEnvironment.gtfs(); + var env = RealtimeTestEnvironment.gtfs().build(); - var tripUpdate = new TripUpdateBuilder(ADDED_TRIP_ID, SERVICE_DATE, ADDED, env.timeZone) + var tripUpdate = new TripUpdateBuilder(ADDED_TRIP_ID, SERVICE_DATE, ADDED, TIME_ZONE) .addStopTime(STOP_A1_ID, 30) .addStopTime(STOP_B1_ID, 40) .addStopTime(STOP_C1_ID, 55) @@ -46,8 +43,8 @@ void addedTrip() { @Test void addedTripWithNewRoute() { - var env = RealtimeTestEnvironment.gtfs(); - var tripUpdate = new TripUpdateBuilder(ADDED_TRIP_ID, SERVICE_DATE, ADDED, env.timeZone) + var env = RealtimeTestEnvironment.gtfs().build(); + var tripUpdate = new TripUpdateBuilder(ADDED_TRIP_ID, SERVICE_DATE, ADDED, TIME_ZONE) .addTripExtension() .addStopTime(STOP_A1_ID, 30, DropOffPickupType.PHONE_AGENCY) .addStopTime(STOP_B1_ID, 40, DropOffPickupType.COORDINATE_WITH_DRIVER) @@ -81,8 +78,8 @@ void addedTripWithNewRoute() { @Test void addedWithUnknownStop() { - var env = RealtimeTestEnvironment.gtfs(); - var tripUpdate = new TripUpdateBuilder(ADDED_TRIP_ID, SERVICE_DATE, ADDED, env.timeZone) + var env = RealtimeTestEnvironment.gtfs().build(); + var tripUpdate = new TripUpdateBuilder(ADDED_TRIP_ID, SERVICE_DATE, ADDED, TIME_ZONE) // add extension to set route name, url, mode .addTripExtension() .addStopTime(STOP_A1_ID, 30, DropOffPickupType.PHONE_AGENCY) @@ -105,8 +102,8 @@ void addedWithUnknownStop() { @Test void repeatedlyAddedTripWithNewRoute() { - var env = RealtimeTestEnvironment.gtfs(); - var tripUpdate = new TripUpdateBuilder(ADDED_TRIP_ID, SERVICE_DATE, ADDED, env.timeZone) + var env = RealtimeTestEnvironment.gtfs().build(); + var tripUpdate = new TripUpdateBuilder(ADDED_TRIP_ID, SERVICE_DATE, ADDED, TIME_ZONE) // add extension to set route name, url, mode .addTripExtension() .addStopTime(STOP_A1_ID, 30, DropOffPickupType.PHONE_AGENCY) @@ -135,7 +132,7 @@ private TripPattern assertAddedTrip(String tripId, RealtimeTestEnvironment env) assertNotNull(trip); assertNotNull(transitService.getPatternForTrip(trip)); - var stopA = env.transitModel.getStopModel().getRegularStop(env.stopA1.getId()); + var stopA = env.transitModel.getStopModel().getRegularStop(STOP_A1.getId()); // Get the trip pattern of the added trip which goes through stopA var patternsAtA = env.getTimetableSnapshot().getPatternsForStop(stopA); diff --git a/src/test/java/org/opentripplanner/updater/trip/moduletests/cancellation/CancellationDeletionTest.java b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/cancellation/CancellationDeletionTest.java similarity index 77% rename from src/test/java/org/opentripplanner/updater/trip/moduletests/cancellation/CancellationDeletionTest.java rename to application/src/test/java/org/opentripplanner/updater/trip/moduletests/cancellation/CancellationDeletionTest.java index c85225b7828..b8bd5c4574b 100644 --- a/src/test/java/org/opentripplanner/updater/trip/moduletests/cancellation/CancellationDeletionTest.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/cancellation/CancellationDeletionTest.java @@ -4,6 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.opentripplanner.transit.model._data.TransitModelForTest.id; import static org.opentripplanner.updater.spi.UpdateResultAssertions.assertSuccess; import static org.opentripplanner.updater.trip.UpdateIncrementality.DIFFERENTIAL; @@ -13,14 +14,16 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import org.opentripplanner.transit.model.timetable.RealTimeState; +import org.opentripplanner.updater.trip.RealtimeTestConstants; import org.opentripplanner.updater.trip.RealtimeTestEnvironment; +import org.opentripplanner.updater.trip.TripInput; import org.opentripplanner.updater.trip.TripUpdateBuilder; /** * Cancellations and deletions should end up in the internal data model and make trips unavailable * for routing. */ -public class CancellationDeletionTest { +public class CancellationDeletionTest implements RealtimeTestConstants { static List cases() { return List.of( @@ -32,22 +35,25 @@ static List cases() { @ParameterizedTest @MethodSource("cases") void cancelledTrip(ScheduleRelationship relationship, RealTimeState state) { - var env = RealtimeTestEnvironment.gtfs(); - var pattern1 = env.getPatternForTrip(env.trip1); + var env = RealtimeTestEnvironment + .gtfs() + .addTrip( + TripInput + .of(TRIP_1_ID) + .addStop(STOP_A1, "0:00:10", "0:00:11") + .addStop(STOP_B1, "0:00:20", "0:00:21") + .build() + ) + .build(); + var pattern1 = env.getPatternForTrip(TRIP_1_ID); - final int tripIndex1 = pattern1.getScheduledTimetable().getTripIndex(env.trip1.getId()); + final int tripIndex1 = pattern1.getScheduledTimetable().getTripIndex(id(TRIP_1_ID)); - var update = new TripUpdateBuilder( - env.trip1.getId().getId(), - RealtimeTestEnvironment.SERVICE_DATE, - relationship, - env.timeZone - ) - .build(); + var update = new TripUpdateBuilder(TRIP_1_ID, SERVICE_DATE, relationship, TIME_ZONE).build(); assertSuccess(env.applyTripUpdate(update)); var snapshot = env.getTimetableSnapshot(); - var forToday = snapshot.resolve(pattern1, RealtimeTestEnvironment.SERVICE_DATE); + var forToday = snapshot.resolve(pattern1, SERVICE_DATE); var schedule = snapshot.resolve(pattern1, null); assertNotSame(forToday, schedule); assertNotSame(forToday.getTripTimes(tripIndex1), schedule.getTripTimes(tripIndex1)); @@ -71,41 +77,34 @@ void cancelledTrip(ScheduleRelationship relationship, RealTimeState state) { @ParameterizedTest @MethodSource("cases") void cancelingAddedTrip(ScheduleRelationship relationship, RealTimeState state) { - var env = RealtimeTestEnvironment.gtfs(); + var env = RealtimeTestEnvironment.gtfs().build(); var addedTripId = "added-trip"; // First add ADDED trip var update = new TripUpdateBuilder( addedTripId, - RealtimeTestEnvironment.SERVICE_DATE, + SERVICE_DATE, ScheduleRelationship.ADDED, - env.timeZone + TIME_ZONE ) - .addStopTime(env.stopA1.getId().getId(), 30) - .addStopTime(env.stopB1.getId().getId(), 40) - .addStopTime(env.stopC1.getId().getId(), 55) + .addStopTime(STOP_A1_ID, 30) + .addStopTime(STOP_B1_ID, 40) + .addStopTime(STOP_C1_ID, 55) .build(); assertSuccess(env.applyTripUpdate(update, DIFFERENTIAL)); // Cancel or delete the added trip - update = - new TripUpdateBuilder( - addedTripId, - RealtimeTestEnvironment.SERVICE_DATE, - relationship, - env.timeZone - ) - .build(); + update = new TripUpdateBuilder(addedTripId, SERVICE_DATE, relationship, TIME_ZONE).build(); assertSuccess(env.applyTripUpdate(update, DIFFERENTIAL)); var snapshot = env.getTimetableSnapshot(); // Get the trip pattern of the added trip which goes through stopA - var patternsAtA = snapshot.getPatternsForStop(env.stopA1); + var patternsAtA = snapshot.getPatternsForStop(STOP_A1); assertNotNull(patternsAtA, "Added trip pattern should be found"); var tripPattern = patternsAtA.stream().findFirst().get(); - var forToday = snapshot.resolve(tripPattern, RealtimeTestEnvironment.SERVICE_DATE); + var forToday = snapshot.resolve(tripPattern, SERVICE_DATE); var schedule = snapshot.resolve(tripPattern, null); assertNotSame(forToday, schedule); diff --git a/src/test/java/org/opentripplanner/updater/trip/moduletests/delay/DelayedTest.java b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/delay/DelayedTest.java similarity index 69% rename from src/test/java/org/opentripplanner/updater/trip/moduletests/delay/DelayedTest.java rename to application/src/test/java/org/opentripplanner/updater/trip/moduletests/delay/DelayedTest.java index 5298853f36d..f45a82b9ba0 100644 --- a/src/test/java/org/opentripplanner/updater/trip/moduletests/delay/DelayedTest.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/delay/DelayedTest.java @@ -5,34 +5,34 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.opentripplanner.transit.model._data.TransitModelForTest.id; import static org.opentripplanner.updater.spi.UpdateResultAssertions.assertSuccess; -import static org.opentripplanner.updater.trip.RealtimeTestEnvironment.SERVICE_DATE; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.timetable.RealTimeState; -import org.opentripplanner.transit.model.timetable.TripTimes; +import org.opentripplanner.updater.trip.RealtimeTestConstants; import org.opentripplanner.updater.trip.RealtimeTestEnvironment; +import org.opentripplanner.updater.trip.TripInput; import org.opentripplanner.updater.trip.TripUpdateBuilder; /** * Delays should be applied to the first trip but should leave the second trip untouched. */ -class DelayedTest { +class DelayedTest implements RealtimeTestConstants { private static final int DELAY = 1; private static final int STOP_SEQUENCE = 1; @Test void singleStopDelay() { - var env = RealtimeTestEnvironment.gtfs(); - - var tripUpdate = new TripUpdateBuilder( - env.trip1.getId().getId(), - RealtimeTestEnvironment.SERVICE_DATE, - SCHEDULED, - env.timeZone - ) + var TRIP_INPUT = TripInput + .of(TRIP_1_ID) + .addStop(STOP_A1, "0:00:10", "0:00:11") + .addStop(STOP_B1, "0:00:20", "0:00:21") + .build(); + var env = RealtimeTestEnvironment.gtfs().addTrip(TRIP_INPUT).build(); + + var tripUpdate = new TripUpdateBuilder(TRIP_1_ID, SERVICE_DATE, SCHEDULED, TIME_ZONE) .addDelayedStopTime(STOP_SEQUENCE, DELAY) .build(); @@ -40,11 +40,11 @@ void singleStopDelay() { assertEquals(1, result.successful()); - var pattern1 = env.getPatternForTrip(env.trip1); - int trip1Index = pattern1.getScheduledTimetable().getTripIndex(env.trip1.getId()); + var pattern1 = env.getPatternForTrip(TRIP_1_ID); + int trip1Index = pattern1.getScheduledTimetable().getTripIndex(id(TRIP_1_ID)); var snapshot = env.getTimetableSnapshot(); - var trip1Realtime = snapshot.resolve(pattern1, RealtimeTestEnvironment.SERVICE_DATE); + var trip1Realtime = snapshot.resolve(pattern1, SERVICE_DATE); var trip1Scheduled = snapshot.resolve(pattern1, null); assertNotSame(trip1Realtime, trip1Scheduled); @@ -59,11 +59,11 @@ void singleStopDelay() { assertEquals( "SCHEDULED | A1 0:00:10 0:00:11 | B1 0:00:20 0:00:21", - env.getScheduledTimetable(env.trip1.getId()) + env.getScheduledTimetable(TRIP_1_ID) ); assertEquals( "UPDATED | A1 [ND] 0:00:10 0:00:11 | B1 0:00:21 0:00:22", - env.getRealtimeTimetable(env.trip1.getId().getId()) + env.getRealtimeTimetable(TRIP_1_ID) ); } @@ -72,11 +72,15 @@ void singleStopDelay() { */ @Test void complexDelay() { - var env = RealtimeTestEnvironment.gtfs(); - - var tripId = env.trip2.getId().getId(); + var tripInput = TripInput + .of(TRIP_2_ID) + .addStop(STOP_A1, "0:01:00", "0:01:01") + .addStop(STOP_B1, "0:01:10", "0:01:11") + .addStop(STOP_C1, "0:01:20", "0:01:21") + .build(); + var env = RealtimeTestEnvironment.gtfs().addTrip(tripInput).build(); - var tripUpdate = new TripUpdateBuilder(tripId, SERVICE_DATE, SCHEDULED, env.timeZone) + var tripUpdate = new TripUpdateBuilder(TRIP_2_ID, SERVICE_DATE, SCHEDULED, TIME_ZONE) .addDelayedStopTime(0, 0) .addDelayedStopTime(1, 60, 80) .addDelayedStopTime(2, 90, 90) @@ -86,19 +90,20 @@ void complexDelay() { var snapshot = env.getTimetableSnapshot(); - final TripPattern originalTripPattern = env.getTransitService().getPatternForTrip(env.trip2); + var trip2 = env.getTransitService().getTripForId(id(TRIP_2_ID)); + var originalTripPattern = env.getTransitService().getPatternForTrip(trip2); var originalTimetableForToday = snapshot.resolve(originalTripPattern, SERVICE_DATE); var originalTimetableScheduled = snapshot.resolve(originalTripPattern, null); assertNotSame(originalTimetableForToday, originalTimetableScheduled); - final int originalTripIndexScheduled = originalTimetableScheduled.getTripIndex(tripId); + final int originalTripIndexScheduled = originalTimetableScheduled.getTripIndex(TRIP_2_ID); assertTrue( originalTripIndexScheduled > -1, "Original trip should be found in scheduled time table" ); - final TripTimes originalTripTimesScheduled = originalTimetableScheduled.getTripTimes( + var originalTripTimesScheduled = originalTimetableScheduled.getTripTimes( originalTripIndexScheduled ); assertFalse( @@ -107,7 +112,7 @@ void complexDelay() { ); assertEquals(RealTimeState.SCHEDULED, originalTripTimesScheduled.getRealTimeState()); - final int originalTripIndexForToday = originalTimetableForToday.getTripIndex(tripId); + final int originalTripIndexForToday = originalTimetableForToday.getTripIndex(TRIP_2_ID); assertTrue( originalTripIndexForToday > -1, "Original trip should be found in time table for service date" @@ -115,11 +120,11 @@ void complexDelay() { assertEquals( "SCHEDULED | A1 0:01 0:01:01 | B1 0:01:10 0:01:11 | C1 0:01:20 0:01:21", - env.getScheduledTimetable(env.trip2.getId()) + env.getScheduledTimetable(TRIP_2_ID) ); assertEquals( "UPDATED | A1 0:01 0:01:01 | B1 0:02:10 0:02:31 | C1 0:02:50 0:02:51", - env.getRealtimeTimetable(env.trip2) + env.getRealtimeTimetable(TRIP_2_ID) ); } } diff --git a/src/test/java/org/opentripplanner/updater/trip/moduletests/delay/SkippedTest.java b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/delay/SkippedTest.java similarity index 78% rename from src/test/java/org/opentripplanner/updater/trip/moduletests/delay/SkippedTest.java rename to application/src/test/java/org/opentripplanner/updater/trip/moduletests/delay/SkippedTest.java index de699324bb6..45304af5130 100644 --- a/src/test/java/org/opentripplanner/updater/trip/moduletests/delay/SkippedTest.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/delay/SkippedTest.java @@ -6,28 +6,35 @@ import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.opentripplanner.transit.model._data.TransitModelForTest.id; import static org.opentripplanner.updater.spi.UpdateResultAssertions.assertSuccess; -import static org.opentripplanner.updater.trip.RealtimeTestEnvironment.SERVICE_DATE; import static org.opentripplanner.updater.trip.UpdateIncrementality.DIFFERENTIAL; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.timetable.RealTimeState; import org.opentripplanner.transit.model.timetable.TripTimesStringBuilder; +import org.opentripplanner.updater.trip.RealtimeTestConstants; import org.opentripplanner.updater.trip.RealtimeTestEnvironment; +import org.opentripplanner.updater.trip.TripInput; import org.opentripplanner.updater.trip.TripUpdateBuilder; /** * A mixture of delayed and skipped stops should result in both delayed and cancelled stops. */ -public class SkippedTest { +class SkippedTest implements RealtimeTestConstants { + + private static final TripInput TRIP_INPUT = TripInput + .of(TRIP_2_ID) + .addStop(STOP_A1, "0:01:00", "0:01:01") + .addStop(STOP_B1, "0:01:10", "0:01:11") + .addStop(STOP_C1, "0:01:20", "0:01:21") + .build(); @Test void scheduledTripWithSkippedAndScheduled() { - var env = RealtimeTestEnvironment.gtfs(); - String scheduledTripId = env.trip2.getId().getId(); + var env = RealtimeTestEnvironment.gtfs().addTrip(TRIP_INPUT).build(); - var tripUpdate = new TripUpdateBuilder(scheduledTripId, SERVICE_DATE, SCHEDULED, env.timeZone) + var tripUpdate = new TripUpdateBuilder(TRIP_2_ID, SERVICE_DATE, SCHEDULED, TIME_ZONE) .addDelayedStopTime(0, 0) .addSkippedStop(1) .addDelayedStopTime(2, 90) @@ -35,13 +42,13 @@ void scheduledTripWithSkippedAndScheduled() { assertSuccess(env.applyTripUpdate(tripUpdate)); - assertOriginalTripPatternIsDeleted(env, env.trip2.getId()); + assertOriginalTripPatternIsDeleted(env, TRIP_2_ID); - assertNewTripTimesIsUpdated(env, env.trip2.getId()); + assertNewTripTimesIsUpdated(env, TRIP_2_ID); assertEquals( "UPDATED | A1 0:01 0:01:01 | B1 [C] 0:01:52 0:01:58 | C1 0:02:50 0:02:51", - env.getRealtimeTimetable(scheduledTripId) + env.getRealtimeTimetable(TRIP_2_ID) ); } @@ -56,10 +63,9 @@ void scheduledTripWithSkippedAndScheduled() { */ @Test void scheduledTripWithPreviouslySkipped() { - var env = RealtimeTestEnvironment.gtfs(); - var tripId = env.trip2.getId(); + var env = RealtimeTestEnvironment.gtfs().addTrip(TRIP_INPUT).build(); - var tripUpdate = new TripUpdateBuilder(tripId.getId(), SERVICE_DATE, SCHEDULED, env.timeZone) + var tripUpdate = new TripUpdateBuilder(TRIP_2_ID, SERVICE_DATE, SCHEDULED, TIME_ZONE) .addDelayedStopTime(0, 0) .addSkippedStop(1) .addDelayedStopTime(2, 90) @@ -68,12 +74,7 @@ void scheduledTripWithPreviouslySkipped() { assertSuccess(env.applyTripUpdate(tripUpdate, DIFFERENTIAL)); // Create update to the same trip but now the skipped stop is no longer skipped - var scheduledBuilder = new TripUpdateBuilder( - tripId.getId(), - SERVICE_DATE, - SCHEDULED, - env.timeZone - ) + var scheduledBuilder = new TripUpdateBuilder(TRIP_2_ID, SERVICE_DATE, SCHEDULED, TIME_ZONE) .addDelayedStopTime(0, 0) .addDelayedStopTime(1, 50) .addDelayedStopTime(2, 90); @@ -87,17 +88,17 @@ void scheduledTripWithPreviouslySkipped() { // stoptime updates have gone through var snapshot = env.getTimetableSnapshot(); - assertNull(snapshot.getRealtimeAddedTripPattern(tripId, SERVICE_DATE)); + assertNull(snapshot.getNewTripPatternForModifiedTrip(id(TRIP_2_ID), SERVICE_DATE)); - assertNewTripTimesIsUpdated(env, tripId); + assertNewTripTimesIsUpdated(env, TRIP_2_ID); assertEquals( "SCHEDULED | A1 0:01 0:01:01 | B1 0:01:10 0:01:11 | C1 0:01:20 0:01:21", - env.getScheduledTimetable(tripId) + env.getScheduledTimetable(TRIP_2_ID) ); assertEquals( "UPDATED | A1 0:01 0:01:01 | B1 0:02 0:02:01 | C1 0:02:50 0:02:51", - env.getRealtimeTimetable(tripId, SERVICE_DATE) + env.getRealtimeTimetable(id(TRIP_2_ID), SERVICE_DATE) ); } @@ -106,11 +107,11 @@ void scheduledTripWithPreviouslySkipped() { */ @Test void skippedNoData() { - var env = RealtimeTestEnvironment.gtfs(); + var env = RealtimeTestEnvironment.gtfs().addTrip(TRIP_INPUT).build(); - final FeedScopedId tripId = env.trip2.getId(); + String tripId = TRIP_2_ID; - var tripUpdate = new TripUpdateBuilder(tripId.getId(), SERVICE_DATE, SCHEDULED, env.timeZone) + var tripUpdate = new TripUpdateBuilder(tripId, SERVICE_DATE, SCHEDULED, TIME_ZONE) .addNoDataStop(0) .addSkippedStop(1) .addNoDataStop(2) @@ -124,15 +125,15 @@ void skippedNoData() { assertEquals( "UPDATED | A1 [ND] 0:01 0:01:01 | B1 [C] 0:01:10 0:01:11 | C1 [ND] 0:01:20 0:01:21", - env.getRealtimeTimetable(env.trip2) + env.getRealtimeTimetable(tripId) ); } private static void assertOriginalTripPatternIsDeleted( RealtimeTestEnvironment env, - FeedScopedId tripId + String tripId ) { - var trip = env.getTransitService().getTripForId(tripId); + var trip = env.getTransitService().getTripForId(id(tripId)); var originalTripPattern = env.getTransitService().getPatternForTrip(trip); var snapshot = env.getTimetableSnapshot(); var originalTimetableForToday = snapshot.resolve(originalTripPattern, SERVICE_DATE); @@ -174,11 +175,9 @@ private static void assertOriginalTripPatternIsDeleted( assertEquals(RealTimeState.DELETED, originalTripTimesForToday.getRealTimeState()); } - private static void assertNewTripTimesIsUpdated( - RealtimeTestEnvironment env, - FeedScopedId tripId - ) { - var originalTripPattern = env.getTransitService().getPatternForTrip(env.trip2); + private static void assertNewTripTimesIsUpdated(RealtimeTestEnvironment env, String tripId) { + var trip = env.getTransitService().getTripForId(id(tripId)); + var originalTripPattern = env.getTransitService().getPatternForTrip(trip); var snapshot = env.getTimetableSnapshot(); var originalTimetableForToday = snapshot.resolve(originalTripPattern, SERVICE_DATE); diff --git a/src/test/java/org/opentripplanner/updater/trip/moduletests/rejection/InvalidInputTest.java b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/rejection/InvalidInputTest.java similarity index 72% rename from src/test/java/org/opentripplanner/updater/trip/moduletests/rejection/InvalidInputTest.java rename to application/src/test/java/org/opentripplanner/updater/trip/moduletests/rejection/InvalidInputTest.java index da362451753..2ba6749b4b0 100644 --- a/src/test/java/org/opentripplanner/updater/trip/moduletests/rejection/InvalidInputTest.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/rejection/InvalidInputTest.java @@ -4,20 +4,21 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.opentripplanner.updater.spi.UpdateError.UpdateErrorType.NO_SERVICE_ON_DATE; import static org.opentripplanner.updater.spi.UpdateResultAssertions.assertFailure; -import static org.opentripplanner.updater.trip.RealtimeTestEnvironment.SERVICE_DATE; import java.time.LocalDate; import java.util.List; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; +import org.opentripplanner.updater.trip.RealtimeTestConstants; import org.opentripplanner.updater.trip.RealtimeTestEnvironment; +import org.opentripplanner.updater.trip.TripInput; import org.opentripplanner.updater.trip.TripUpdateBuilder; /** * A trip with start date that is outside the service period shouldn't throw an exception and is * ignored instead. */ -class InvalidInputTest { +class InvalidInputTest implements RealtimeTestConstants { public static List cases() { return List.of(SERVICE_DATE.minusYears(10), SERVICE_DATE.plusYears(10)); @@ -26,9 +27,14 @@ public static List cases() { @ParameterizedTest @MethodSource("cases") void invalidTripDate(LocalDate date) { - var env = RealtimeTestEnvironment.gtfs(); + var tripInput = TripInput + .of(TRIP_1_ID) + .addStop(STOP_A1, "0:00:10", "0:00:11") + .addStop(STOP_B1, "0:00:20", "0:00:21") + .build(); + var env = RealtimeTestEnvironment.gtfs().addTrip(tripInput).build(); - var update = new TripUpdateBuilder(env.trip1.getId().getId(), date, SCHEDULED, env.timeZone) + var update = new TripUpdateBuilder(TRIP_1_ID, date, SCHEDULED, TIME_ZONE) .addDelayedStopTime(2, 60, 80) .build(); diff --git a/src/test/java/org/opentripplanner/updater/trip/moduletests/rejection/InvalidTripIdTest.java b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/rejection/InvalidTripIdTest.java similarity index 96% rename from src/test/java/org/opentripplanner/updater/trip/moduletests/rejection/InvalidTripIdTest.java rename to application/src/test/java/org/opentripplanner/updater/trip/moduletests/rejection/InvalidTripIdTest.java index 83c2547dbc7..699e8fe865c 100644 --- a/src/test/java/org/opentripplanner/updater/trip/moduletests/rejection/InvalidTripIdTest.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/rejection/InvalidTripIdTest.java @@ -22,7 +22,7 @@ static Stream invalidCases() { @ParameterizedTest(name = "tripId=\"{0}\"") @MethodSource("invalidCases") void invalidTripId(String tripId) { - var env = RealtimeTestEnvironment.gtfs(); + var env = RealtimeTestEnvironment.gtfs().build(); var tripDescriptorBuilder = GtfsRealtime.TripDescriptor.newBuilder(); if (tripId != null) { tripDescriptorBuilder.setTripId(tripId); diff --git a/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdaterTest.java b/application/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdaterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdaterTest.java rename to application/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdaterTest.java diff --git a/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdaterTest.java b/application/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdaterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdaterTest.java rename to application/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdaterTest.java diff --git a/src/test/java/org/opentripplanner/updater/vehicle_position/RealtimeVehicleMatcherTest.java b/application/src/test/java/org/opentripplanner/updater/vehicle_position/RealtimeVehicleMatcherTest.java similarity index 98% rename from src/test/java/org/opentripplanner/updater/vehicle_position/RealtimeVehicleMatcherTest.java rename to application/src/test/java/org/opentripplanner/updater/vehicle_position/RealtimeVehicleMatcherTest.java index ea5d86cd0e1..4f10fb2d64b 100644 --- a/src/test/java/org/opentripplanner/updater/vehicle_position/RealtimeVehicleMatcherTest.java +++ b/application/src/test/java/org/opentripplanner/updater/vehicle_position/RealtimeVehicleMatcherTest.java @@ -383,10 +383,10 @@ private static TripPattern tripPattern(Trip trip, List stopTimes) { .of(trip.getId()) .withStopPattern(stopPattern) .withRoute(ROUTE) + .withScheduledTimeTableBuilder(builder -> + builder.addTripTimes(TripTimesFactory.tripTimes(trip, stopTimes, new Deduplicator())) + ) .build(); - pattern - .getScheduledTimetable() - .addTripTimes(TripTimesFactory.tripTimes(trip, stopTimes, new Deduplicator())); return pattern; } diff --git a/src/test/java/org/opentripplanner/updater/vehicle_position/VehiclePositionParsingTest.java b/application/src/test/java/org/opentripplanner/updater/vehicle_position/VehiclePositionParsingTest.java similarity index 100% rename from src/test/java/org/opentripplanner/updater/vehicle_position/VehiclePositionParsingTest.java rename to application/src/test/java/org/opentripplanner/updater/vehicle_position/VehiclePositionParsingTest.java diff --git a/src/test/java/org/opentripplanner/updater/vehicle_rental/GeofencingVertexUpdaterTest.java b/application/src/test/java/org/opentripplanner/updater/vehicle_rental/GeofencingVertexUpdaterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/updater/vehicle_rental/GeofencingVertexUpdaterTest.java rename to application/src/test/java/org/opentripplanner/updater/vehicle_rental/GeofencingVertexUpdaterTest.java diff --git a/src/test/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdaterTest.java b/application/src/test/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdaterTest.java similarity index 97% rename from src/test/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdaterTest.java rename to application/src/test/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdaterTest.java index 0016bf4c00c..17eb3fb3c63 100644 --- a/src/test/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdaterTest.java +++ b/application/src/test/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdaterTest.java @@ -9,7 +9,6 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.junit.jupiter.api.Test; import org.opentripplanner.routing.graph.Graph; @@ -81,7 +80,6 @@ private boolean hasFailed() { static class FakeParams implements VehicleRentalDataSourceParameters { - @Nonnull @Override public String url() { return "https://example.com"; @@ -93,13 +91,11 @@ public String network() { return "Test"; } - @Nonnull @Override public VehicleRentalSourceType sourceType() { return VehicleRentalSourceType.GBFS; } - @Nonnull @Override public HttpHeaders httpHeaders() { return HttpHeaders.empty(); diff --git a/src/test/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsFeedLoaderTest.java b/application/src/test/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsFeedLoaderTest.java similarity index 100% rename from src/test/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsFeedLoaderTest.java rename to application/src/test/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsFeedLoaderTest.java diff --git a/src/test/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsFreeVehicleStatusMapperTest.java b/application/src/test/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsFreeVehicleStatusMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsFreeVehicleStatusMapperTest.java rename to application/src/test/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsFreeVehicleStatusMapperTest.java diff --git a/src/test/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsVehicleRentalDataSourceTest.java b/application/src/test/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsVehicleRentalDataSourceTest.java similarity index 100% rename from src/test/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsVehicleRentalDataSourceTest.java rename to application/src/test/java/org/opentripplanner/updater/vehicle_rental/datasources/GbfsVehicleRentalDataSourceTest.java diff --git a/src/test/resources/gbfs/helsinki/gbfs.json b/application/src/test/resources/gbfs/helsinki/gbfs.json similarity index 100% rename from src/test/resources/gbfs/helsinki/gbfs.json rename to application/src/test/resources/gbfs/helsinki/gbfs.json diff --git a/src/test/resources/gbfs/helsinki/station_information.json b/application/src/test/resources/gbfs/helsinki/station_information.json similarity index 100% rename from src/test/resources/gbfs/helsinki/station_information.json rename to application/src/test/resources/gbfs/helsinki/station_information.json diff --git a/src/test/resources/gbfs/helsinki/station_status.json b/application/src/test/resources/gbfs/helsinki/station_status.json similarity index 100% rename from src/test/resources/gbfs/helsinki/station_status.json rename to application/src/test/resources/gbfs/helsinki/station_status.json diff --git a/src/test/resources/gbfs/helsinki/system_information.json b/application/src/test/resources/gbfs/helsinki/system_information.json similarity index 100% rename from src/test/resources/gbfs/helsinki/system_information.json rename to application/src/test/resources/gbfs/helsinki/system_information.json diff --git a/src/test/resources/gbfs/lillestrombysykkel/gbfs.json b/application/src/test/resources/gbfs/lillestrombysykkel/gbfs.json similarity index 100% rename from src/test/resources/gbfs/lillestrombysykkel/gbfs.json rename to application/src/test/resources/gbfs/lillestrombysykkel/gbfs.json diff --git a/src/test/resources/gbfs/lillestrombysykkel/station_information.json b/application/src/test/resources/gbfs/lillestrombysykkel/station_information.json similarity index 100% rename from src/test/resources/gbfs/lillestrombysykkel/station_information.json rename to application/src/test/resources/gbfs/lillestrombysykkel/station_information.json diff --git a/src/test/resources/gbfs/lillestrombysykkel/station_status.json b/application/src/test/resources/gbfs/lillestrombysykkel/station_status.json similarity index 100% rename from src/test/resources/gbfs/lillestrombysykkel/station_status.json rename to application/src/test/resources/gbfs/lillestrombysykkel/station_status.json diff --git a/src/test/resources/gbfs/lillestrombysykkel/system_information.json b/application/src/test/resources/gbfs/lillestrombysykkel/system_information.json similarity index 100% rename from src/test/resources/gbfs/lillestrombysykkel/system_information.json rename to application/src/test/resources/gbfs/lillestrombysykkel/system_information.json diff --git a/src/test/resources/gbfs/lillestrombysykkel/system_pricing_plans.json b/application/src/test/resources/gbfs/lillestrombysykkel/system_pricing_plans.json similarity index 100% rename from src/test/resources/gbfs/lillestrombysykkel/system_pricing_plans.json rename to application/src/test/resources/gbfs/lillestrombysykkel/system_pricing_plans.json diff --git a/src/test/resources/gbfs/lillestrombysykkel/vehicle_types.json b/application/src/test/resources/gbfs/lillestrombysykkel/vehicle_types.json similarity index 100% rename from src/test/resources/gbfs/lillestrombysykkel/vehicle_types.json rename to application/src/test/resources/gbfs/lillestrombysykkel/vehicle_types.json diff --git a/src/test/resources/gbfs/tieroslo/gbfs.json b/application/src/test/resources/gbfs/tieroslo/gbfs.json similarity index 100% rename from src/test/resources/gbfs/tieroslo/gbfs.json rename to application/src/test/resources/gbfs/tieroslo/gbfs.json diff --git a/src/test/resources/gbfs/tieroslo/geofencing_zones.json b/application/src/test/resources/gbfs/tieroslo/geofencing_zones.json similarity index 100% rename from src/test/resources/gbfs/tieroslo/geofencing_zones.json rename to application/src/test/resources/gbfs/tieroslo/geofencing_zones.json diff --git a/src/test/resources/gbfs/tieroslo/system_information.json b/application/src/test/resources/gbfs/tieroslo/system_information.json similarity index 100% rename from src/test/resources/gbfs/tieroslo/system_information.json rename to application/src/test/resources/gbfs/tieroslo/system_information.json diff --git a/src/test/resources/gtfs/caltrain_gtfs.zip b/application/src/test/resources/gtfs/caltrain_gtfs.zip similarity index 100% rename from src/test/resources/gtfs/caltrain_gtfs.zip rename to application/src/test/resources/gtfs/caltrain_gtfs.zip diff --git a/src/test/resources/gtfs/interlining/agency.txt b/application/src/test/resources/gtfs/interlining/agency.txt similarity index 100% rename from src/test/resources/gtfs/interlining/agency.txt rename to application/src/test/resources/gtfs/interlining/agency.txt diff --git a/src/test/resources/gtfs/interlining/calendar_dates.txt b/application/src/test/resources/gtfs/interlining/calendar_dates.txt similarity index 100% rename from src/test/resources/gtfs/interlining/calendar_dates.txt rename to application/src/test/resources/gtfs/interlining/calendar_dates.txt diff --git a/src/test/resources/gtfs/interlining/description.txt b/application/src/test/resources/gtfs/interlining/description.txt similarity index 100% rename from src/test/resources/gtfs/interlining/description.txt rename to application/src/test/resources/gtfs/interlining/description.txt diff --git a/src/test/resources/gtfs/interlining/routes.txt b/application/src/test/resources/gtfs/interlining/routes.txt similarity index 100% rename from src/test/resources/gtfs/interlining/routes.txt rename to application/src/test/resources/gtfs/interlining/routes.txt diff --git a/src/test/resources/gtfs/interlining/stop_times.txt b/application/src/test/resources/gtfs/interlining/stop_times.txt similarity index 100% rename from src/test/resources/gtfs/interlining/stop_times.txt rename to application/src/test/resources/gtfs/interlining/stop_times.txt diff --git a/src/test/resources/gtfs/interlining/stops.txt b/application/src/test/resources/gtfs/interlining/stops.txt similarity index 100% rename from src/test/resources/gtfs/interlining/stops.txt rename to application/src/test/resources/gtfs/interlining/stops.txt diff --git a/src/test/resources/gtfs/interlining/transfers.txt b/application/src/test/resources/gtfs/interlining/transfers.txt similarity index 100% rename from src/test/resources/gtfs/interlining/transfers.txt rename to application/src/test/resources/gtfs/interlining/transfers.txt diff --git a/src/test/resources/gtfs/interlining/trips.txt b/application/src/test/resources/gtfs/interlining/trips.txt similarity index 100% rename from src/test/resources/gtfs/interlining/trips.txt rename to application/src/test/resources/gtfs/interlining/trips.txt diff --git a/src/test/resources/gtfs/shape_dist_traveled/agency.txt b/application/src/test/resources/gtfs/shape_dist_traveled/agency.txt similarity index 100% rename from src/test/resources/gtfs/shape_dist_traveled/agency.txt rename to application/src/test/resources/gtfs/shape_dist_traveled/agency.txt diff --git a/src/test/resources/gtfs/shape_dist_traveled/calendar.txt b/application/src/test/resources/gtfs/shape_dist_traveled/calendar.txt similarity index 100% rename from src/test/resources/gtfs/shape_dist_traveled/calendar.txt rename to application/src/test/resources/gtfs/shape_dist_traveled/calendar.txt diff --git a/src/test/resources/gtfs/shape_dist_traveled/routes.txt b/application/src/test/resources/gtfs/shape_dist_traveled/routes.txt similarity index 100% rename from src/test/resources/gtfs/shape_dist_traveled/routes.txt rename to application/src/test/resources/gtfs/shape_dist_traveled/routes.txt diff --git a/src/test/resources/gtfs/shape_dist_traveled/shapes.txt b/application/src/test/resources/gtfs/shape_dist_traveled/shapes.txt similarity index 100% rename from src/test/resources/gtfs/shape_dist_traveled/shapes.txt rename to application/src/test/resources/gtfs/shape_dist_traveled/shapes.txt diff --git a/src/test/resources/gtfs/shape_dist_traveled/stop_times.txt b/application/src/test/resources/gtfs/shape_dist_traveled/stop_times.txt similarity index 100% rename from src/test/resources/gtfs/shape_dist_traveled/stop_times.txt rename to application/src/test/resources/gtfs/shape_dist_traveled/stop_times.txt diff --git a/src/test/resources/gtfs/shape_dist_traveled/stops.txt b/application/src/test/resources/gtfs/shape_dist_traveled/stops.txt similarity index 100% rename from src/test/resources/gtfs/shape_dist_traveled/stops.txt rename to application/src/test/resources/gtfs/shape_dist_traveled/stops.txt diff --git a/src/test/resources/gtfs/shape_dist_traveled/trips.txt b/application/src/test/resources/gtfs/shape_dist_traveled/trips.txt similarity index 100% rename from src/test/resources/gtfs/shape_dist_traveled/trips.txt rename to application/src/test/resources/gtfs/shape_dist_traveled/trips.txt diff --git a/src/test/resources/gtfs/simple/agency.txt b/application/src/test/resources/gtfs/simple/agency.txt similarity index 100% rename from src/test/resources/gtfs/simple/agency.txt rename to application/src/test/resources/gtfs/simple/agency.txt diff --git a/src/test/resources/gtfs/simple/calendar.txt b/application/src/test/resources/gtfs/simple/calendar.txt similarity index 100% rename from src/test/resources/gtfs/simple/calendar.txt rename to application/src/test/resources/gtfs/simple/calendar.txt diff --git a/src/test/resources/gtfs/simple/frequencies.txt b/application/src/test/resources/gtfs/simple/frequencies.txt similarity index 100% rename from src/test/resources/gtfs/simple/frequencies.txt rename to application/src/test/resources/gtfs/simple/frequencies.txt diff --git a/src/test/resources/gtfs/simple/pathways.txt b/application/src/test/resources/gtfs/simple/pathways.txt similarity index 100% rename from src/test/resources/gtfs/simple/pathways.txt rename to application/src/test/resources/gtfs/simple/pathways.txt diff --git a/src/test/resources/gtfs/simple/routes.txt b/application/src/test/resources/gtfs/simple/routes.txt similarity index 100% rename from src/test/resources/gtfs/simple/routes.txt rename to application/src/test/resources/gtfs/simple/routes.txt diff --git a/src/test/resources/gtfs/simple/shapes.txt b/application/src/test/resources/gtfs/simple/shapes.txt similarity index 100% rename from src/test/resources/gtfs/simple/shapes.txt rename to application/src/test/resources/gtfs/simple/shapes.txt diff --git a/src/test/resources/gtfs/simple/stop_times.txt b/application/src/test/resources/gtfs/simple/stop_times.txt similarity index 100% rename from src/test/resources/gtfs/simple/stop_times.txt rename to application/src/test/resources/gtfs/simple/stop_times.txt diff --git a/src/test/resources/gtfs/simple/stops.txt b/application/src/test/resources/gtfs/simple/stops.txt similarity index 100% rename from src/test/resources/gtfs/simple/stops.txt rename to application/src/test/resources/gtfs/simple/stops.txt diff --git a/src/test/resources/gtfs/simple/transfers.txt b/application/src/test/resources/gtfs/simple/transfers.txt similarity index 100% rename from src/test/resources/gtfs/simple/transfers.txt rename to application/src/test/resources/gtfs/simple/transfers.txt diff --git a/src/test/resources/gtfs/simple/trips.txt b/application/src/test/resources/gtfs/simple/trips.txt similarity index 100% rename from src/test/resources/gtfs/simple/trips.txt rename to application/src/test/resources/gtfs/simple/trips.txt diff --git a/src/test/resources/gtfs/stopgen.py b/application/src/test/resources/gtfs/stopgen.py similarity index 100% rename from src/test/resources/gtfs/stopgen.py rename to application/src/test/resources/gtfs/stopgen.py diff --git a/src/test/resources/logback.xml b/application/src/test/resources/logback.xml similarity index 100% rename from src/test/resources/logback.xml rename to application/src/test/resources/logback.xml diff --git a/src/test/resources/mmri/1g/agency.txt b/application/src/test/resources/mmri/1g/agency.txt similarity index 100% rename from src/test/resources/mmri/1g/agency.txt rename to application/src/test/resources/mmri/1g/agency.txt diff --git a/src/test/resources/mmri/1g/calendar_dates.txt b/application/src/test/resources/mmri/1g/calendar_dates.txt similarity index 100% rename from src/test/resources/mmri/1g/calendar_dates.txt rename to application/src/test/resources/mmri/1g/calendar_dates.txt diff --git a/src/test/resources/mmri/1g/routes.txt b/application/src/test/resources/mmri/1g/routes.txt similarity index 100% rename from src/test/resources/mmri/1g/routes.txt rename to application/src/test/resources/mmri/1g/routes.txt diff --git a/src/test/resources/mmri/1g/stop_times.txt b/application/src/test/resources/mmri/1g/stop_times.txt similarity index 100% rename from src/test/resources/mmri/1g/stop_times.txt rename to application/src/test/resources/mmri/1g/stop_times.txt diff --git a/src/test/resources/mmri/1g/stops.txt b/application/src/test/resources/mmri/1g/stops.txt similarity index 100% rename from src/test/resources/mmri/1g/stops.txt rename to application/src/test/resources/mmri/1g/stops.txt diff --git a/src/test/resources/mmri/1g/trips.txt b/application/src/test/resources/mmri/1g/trips.txt similarity index 100% rename from src/test/resources/mmri/1g/trips.txt rename to application/src/test/resources/mmri/1g/trips.txt diff --git a/src/test/resources/mmri/2a1/agency.txt b/application/src/test/resources/mmri/2a1/agency.txt similarity index 100% rename from src/test/resources/mmri/2a1/agency.txt rename to application/src/test/resources/mmri/2a1/agency.txt diff --git a/src/test/resources/mmri/2a1/calendar_dates.txt b/application/src/test/resources/mmri/2a1/calendar_dates.txt similarity index 100% rename from src/test/resources/mmri/2a1/calendar_dates.txt rename to application/src/test/resources/mmri/2a1/calendar_dates.txt diff --git a/src/test/resources/mmri/2a1/routes.txt b/application/src/test/resources/mmri/2a1/routes.txt similarity index 100% rename from src/test/resources/mmri/2a1/routes.txt rename to application/src/test/resources/mmri/2a1/routes.txt diff --git a/src/test/resources/mmri/2a1/stop_times.txt b/application/src/test/resources/mmri/2a1/stop_times.txt similarity index 100% rename from src/test/resources/mmri/2a1/stop_times.txt rename to application/src/test/resources/mmri/2a1/stop_times.txt diff --git a/src/test/resources/mmri/2a1/stops.txt b/application/src/test/resources/mmri/2a1/stops.txt similarity index 100% rename from src/test/resources/mmri/2a1/stops.txt rename to application/src/test/resources/mmri/2a1/stops.txt diff --git a/src/test/resources/mmri/2a1/trips.txt b/application/src/test/resources/mmri/2a1/trips.txt similarity index 100% rename from src/test/resources/mmri/2a1/trips.txt rename to application/src/test/resources/mmri/2a1/trips.txt diff --git a/src/test/resources/mmri/2b/agency.txt b/application/src/test/resources/mmri/2b/agency.txt similarity index 100% rename from src/test/resources/mmri/2b/agency.txt rename to application/src/test/resources/mmri/2b/agency.txt diff --git a/src/test/resources/mmri/2b/calendar_dates.txt b/application/src/test/resources/mmri/2b/calendar_dates.txt similarity index 100% rename from src/test/resources/mmri/2b/calendar_dates.txt rename to application/src/test/resources/mmri/2b/calendar_dates.txt diff --git a/src/test/resources/mmri/2b/routes.txt b/application/src/test/resources/mmri/2b/routes.txt similarity index 100% rename from src/test/resources/mmri/2b/routes.txt rename to application/src/test/resources/mmri/2b/routes.txt diff --git a/src/test/resources/mmri/2b/stop_times.txt b/application/src/test/resources/mmri/2b/stop_times.txt similarity index 100% rename from src/test/resources/mmri/2b/stop_times.txt rename to application/src/test/resources/mmri/2b/stop_times.txt diff --git a/src/test/resources/mmri/2b/stops.txt b/application/src/test/resources/mmri/2b/stops.txt similarity index 100% rename from src/test/resources/mmri/2b/stops.txt rename to application/src/test/resources/mmri/2b/stops.txt diff --git a/src/test/resources/mmri/2b/trips.txt b/application/src/test/resources/mmri/2b/trips.txt similarity index 100% rename from src/test/resources/mmri/2b/trips.txt rename to application/src/test/resources/mmri/2b/trips.txt diff --git a/src/test/resources/mmri/2c/agency.txt b/application/src/test/resources/mmri/2c/agency.txt similarity index 100% rename from src/test/resources/mmri/2c/agency.txt rename to application/src/test/resources/mmri/2c/agency.txt diff --git a/src/test/resources/mmri/2c/calendar_dates.txt b/application/src/test/resources/mmri/2c/calendar_dates.txt similarity index 100% rename from src/test/resources/mmri/2c/calendar_dates.txt rename to application/src/test/resources/mmri/2c/calendar_dates.txt diff --git a/src/test/resources/mmri/2c/routes.txt b/application/src/test/resources/mmri/2c/routes.txt similarity index 100% rename from src/test/resources/mmri/2c/routes.txt rename to application/src/test/resources/mmri/2c/routes.txt diff --git a/src/test/resources/mmri/2c/stop_times.txt b/application/src/test/resources/mmri/2c/stop_times.txt similarity index 100% rename from src/test/resources/mmri/2c/stop_times.txt rename to application/src/test/resources/mmri/2c/stop_times.txt diff --git a/src/test/resources/mmri/2c/stops.txt b/application/src/test/resources/mmri/2c/stops.txt similarity index 100% rename from src/test/resources/mmri/2c/stops.txt rename to application/src/test/resources/mmri/2c/stops.txt diff --git a/src/test/resources/mmri/2c/transfers.txt b/application/src/test/resources/mmri/2c/transfers.txt similarity index 100% rename from src/test/resources/mmri/2c/transfers.txt rename to application/src/test/resources/mmri/2c/transfers.txt diff --git a/src/test/resources/mmri/2c/trips.txt b/application/src/test/resources/mmri/2c/trips.txt similarity index 100% rename from src/test/resources/mmri/2c/trips.txt rename to application/src/test/resources/mmri/2c/trips.txt diff --git a/src/test/resources/mmri/2d/agency.txt b/application/src/test/resources/mmri/2d/agency.txt similarity index 100% rename from src/test/resources/mmri/2d/agency.txt rename to application/src/test/resources/mmri/2d/agency.txt diff --git a/src/test/resources/mmri/2d/calendar_dates.txt b/application/src/test/resources/mmri/2d/calendar_dates.txt similarity index 100% rename from src/test/resources/mmri/2d/calendar_dates.txt rename to application/src/test/resources/mmri/2d/calendar_dates.txt diff --git a/src/test/resources/mmri/2d/routes.txt b/application/src/test/resources/mmri/2d/routes.txt similarity index 100% rename from src/test/resources/mmri/2d/routes.txt rename to application/src/test/resources/mmri/2d/routes.txt diff --git a/src/test/resources/mmri/2d/stop_times.txt b/application/src/test/resources/mmri/2d/stop_times.txt similarity index 100% rename from src/test/resources/mmri/2d/stop_times.txt rename to application/src/test/resources/mmri/2d/stop_times.txt diff --git a/src/test/resources/mmri/2d/stops.txt b/application/src/test/resources/mmri/2d/stops.txt similarity index 100% rename from src/test/resources/mmri/2d/stops.txt rename to application/src/test/resources/mmri/2d/stops.txt diff --git a/src/test/resources/mmri/2d/transfers.txt b/application/src/test/resources/mmri/2d/transfers.txt similarity index 100% rename from src/test/resources/mmri/2d/transfers.txt rename to application/src/test/resources/mmri/2d/transfers.txt diff --git a/src/test/resources/mmri/2d/trips.txt b/application/src/test/resources/mmri/2d/trips.txt similarity index 100% rename from src/test/resources/mmri/2d/trips.txt rename to application/src/test/resources/mmri/2d/trips.txt diff --git a/src/test/resources/mmri/2e1/agency.txt b/application/src/test/resources/mmri/2e1/agency.txt similarity index 100% rename from src/test/resources/mmri/2e1/agency.txt rename to application/src/test/resources/mmri/2e1/agency.txt diff --git a/src/test/resources/mmri/2e1/calendar_dates.txt b/application/src/test/resources/mmri/2e1/calendar_dates.txt similarity index 100% rename from src/test/resources/mmri/2e1/calendar_dates.txt rename to application/src/test/resources/mmri/2e1/calendar_dates.txt diff --git a/src/test/resources/mmri/2e1/routes.txt b/application/src/test/resources/mmri/2e1/routes.txt similarity index 100% rename from src/test/resources/mmri/2e1/routes.txt rename to application/src/test/resources/mmri/2e1/routes.txt diff --git a/src/test/resources/mmri/2e1/stop_times.txt b/application/src/test/resources/mmri/2e1/stop_times.txt similarity index 100% rename from src/test/resources/mmri/2e1/stop_times.txt rename to application/src/test/resources/mmri/2e1/stop_times.txt diff --git a/src/test/resources/mmri/2e1/stops.txt b/application/src/test/resources/mmri/2e1/stops.txt similarity index 100% rename from src/test/resources/mmri/2e1/stops.txt rename to application/src/test/resources/mmri/2e1/stops.txt diff --git a/src/test/resources/mmri/2e1/transfers.txt b/application/src/test/resources/mmri/2e1/transfers.txt similarity index 100% rename from src/test/resources/mmri/2e1/transfers.txt rename to application/src/test/resources/mmri/2e1/transfers.txt diff --git a/src/test/resources/mmri/2e1/trips.txt b/application/src/test/resources/mmri/2e1/trips.txt similarity index 100% rename from src/test/resources/mmri/2e1/trips.txt rename to application/src/test/resources/mmri/2e1/trips.txt diff --git a/src/test/resources/mmri/2e2/agency.txt b/application/src/test/resources/mmri/2e2/agency.txt similarity index 100% rename from src/test/resources/mmri/2e2/agency.txt rename to application/src/test/resources/mmri/2e2/agency.txt diff --git a/src/test/resources/mmri/2e2/calendar_dates.txt b/application/src/test/resources/mmri/2e2/calendar_dates.txt similarity index 100% rename from src/test/resources/mmri/2e2/calendar_dates.txt rename to application/src/test/resources/mmri/2e2/calendar_dates.txt diff --git a/src/test/resources/mmri/2e2/routes.txt b/application/src/test/resources/mmri/2e2/routes.txt similarity index 100% rename from src/test/resources/mmri/2e2/routes.txt rename to application/src/test/resources/mmri/2e2/routes.txt diff --git a/src/test/resources/mmri/2e2/stop_times.txt b/application/src/test/resources/mmri/2e2/stop_times.txt similarity index 100% rename from src/test/resources/mmri/2e2/stop_times.txt rename to application/src/test/resources/mmri/2e2/stop_times.txt diff --git a/src/test/resources/mmri/2e2/stops.txt b/application/src/test/resources/mmri/2e2/stops.txt similarity index 100% rename from src/test/resources/mmri/2e2/stops.txt rename to application/src/test/resources/mmri/2e2/stops.txt diff --git a/src/test/resources/mmri/2e2/transfers.txt b/application/src/test/resources/mmri/2e2/transfers.txt similarity index 100% rename from src/test/resources/mmri/2e2/transfers.txt rename to application/src/test/resources/mmri/2e2/transfers.txt diff --git a/src/test/resources/mmri/2e2/trips.txt b/application/src/test/resources/mmri/2e2/trips.txt similarity index 100% rename from src/test/resources/mmri/2e2/trips.txt rename to application/src/test/resources/mmri/2e2/trips.txt diff --git a/src/test/resources/mmri/2e3/agency.txt b/application/src/test/resources/mmri/2e3/agency.txt similarity index 100% rename from src/test/resources/mmri/2e3/agency.txt rename to application/src/test/resources/mmri/2e3/agency.txt diff --git a/src/test/resources/mmri/2e3/calendar_dates.txt b/application/src/test/resources/mmri/2e3/calendar_dates.txt similarity index 100% rename from src/test/resources/mmri/2e3/calendar_dates.txt rename to application/src/test/resources/mmri/2e3/calendar_dates.txt diff --git a/src/test/resources/mmri/2e3/routes.txt b/application/src/test/resources/mmri/2e3/routes.txt similarity index 100% rename from src/test/resources/mmri/2e3/routes.txt rename to application/src/test/resources/mmri/2e3/routes.txt diff --git a/src/test/resources/mmri/2e3/stop_times.txt b/application/src/test/resources/mmri/2e3/stop_times.txt similarity index 100% rename from src/test/resources/mmri/2e3/stop_times.txt rename to application/src/test/resources/mmri/2e3/stop_times.txt diff --git a/src/test/resources/mmri/2e3/stops.txt b/application/src/test/resources/mmri/2e3/stops.txt similarity index 100% rename from src/test/resources/mmri/2e3/stops.txt rename to application/src/test/resources/mmri/2e3/stops.txt diff --git a/src/test/resources/mmri/2e3/transfers.txt b/application/src/test/resources/mmri/2e3/transfers.txt similarity index 100% rename from src/test/resources/mmri/2e3/transfers.txt rename to application/src/test/resources/mmri/2e3/transfers.txt diff --git a/src/test/resources/mmri/2e3/trips.txt b/application/src/test/resources/mmri/2e3/trips.txt similarity index 100% rename from src/test/resources/mmri/2e3/trips.txt rename to application/src/test/resources/mmri/2e3/trips.txt diff --git a/src/test/resources/mmri/2e4/agency.txt b/application/src/test/resources/mmri/2e4/agency.txt similarity index 100% rename from src/test/resources/mmri/2e4/agency.txt rename to application/src/test/resources/mmri/2e4/agency.txt diff --git a/src/test/resources/mmri/2e4/calendar_dates.txt b/application/src/test/resources/mmri/2e4/calendar_dates.txt similarity index 100% rename from src/test/resources/mmri/2e4/calendar_dates.txt rename to application/src/test/resources/mmri/2e4/calendar_dates.txt diff --git a/src/test/resources/mmri/2e4/routes.txt b/application/src/test/resources/mmri/2e4/routes.txt similarity index 100% rename from src/test/resources/mmri/2e4/routes.txt rename to application/src/test/resources/mmri/2e4/routes.txt diff --git a/src/test/resources/mmri/2e4/stop_times.txt b/application/src/test/resources/mmri/2e4/stop_times.txt similarity index 100% rename from src/test/resources/mmri/2e4/stop_times.txt rename to application/src/test/resources/mmri/2e4/stop_times.txt diff --git a/src/test/resources/mmri/2e4/stops.txt b/application/src/test/resources/mmri/2e4/stops.txt similarity index 100% rename from src/test/resources/mmri/2e4/stops.txt rename to application/src/test/resources/mmri/2e4/stops.txt diff --git a/src/test/resources/mmri/2e4/transfers.txt b/application/src/test/resources/mmri/2e4/transfers.txt similarity index 100% rename from src/test/resources/mmri/2e4/transfers.txt rename to application/src/test/resources/mmri/2e4/transfers.txt diff --git a/src/test/resources/mmri/2e4/trips.txt b/application/src/test/resources/mmri/2e4/trips.txt similarity index 100% rename from src/test/resources/mmri/2e4/trips.txt rename to application/src/test/resources/mmri/2e4/trips.txt diff --git a/src/test/resources/mmri/3b.pb b/application/src/test/resources/mmri/3b.pb similarity index 100% rename from src/test/resources/mmri/3b.pb rename to application/src/test/resources/mmri/3b.pb diff --git a/src/test/resources/mmri/3b/agency.txt b/application/src/test/resources/mmri/3b/agency.txt similarity index 100% rename from src/test/resources/mmri/3b/agency.txt rename to application/src/test/resources/mmri/3b/agency.txt diff --git a/src/test/resources/mmri/3b/calendar_dates.txt b/application/src/test/resources/mmri/3b/calendar_dates.txt similarity index 100% rename from src/test/resources/mmri/3b/calendar_dates.txt rename to application/src/test/resources/mmri/3b/calendar_dates.txt diff --git a/src/test/resources/mmri/3b/routes.txt b/application/src/test/resources/mmri/3b/routes.txt similarity index 100% rename from src/test/resources/mmri/3b/routes.txt rename to application/src/test/resources/mmri/3b/routes.txt diff --git a/src/test/resources/mmri/3b/stop_times.txt b/application/src/test/resources/mmri/3b/stop_times.txt similarity index 100% rename from src/test/resources/mmri/3b/stop_times.txt rename to application/src/test/resources/mmri/3b/stop_times.txt diff --git a/src/test/resources/mmri/3b/stops.txt b/application/src/test/resources/mmri/3b/stops.txt similarity index 100% rename from src/test/resources/mmri/3b/stops.txt rename to application/src/test/resources/mmri/3b/stops.txt diff --git a/src/test/resources/mmri/3b/trips.txt b/application/src/test/resources/mmri/3b/trips.txt similarity index 100% rename from src/test/resources/mmri/3b/trips.txt rename to application/src/test/resources/mmri/3b/trips.txt diff --git a/src/test/resources/mmri/3c.pb b/application/src/test/resources/mmri/3c.pb similarity index 100% rename from src/test/resources/mmri/3c.pb rename to application/src/test/resources/mmri/3c.pb diff --git a/src/test/resources/mmri/3c/agency.txt b/application/src/test/resources/mmri/3c/agency.txt similarity index 100% rename from src/test/resources/mmri/3c/agency.txt rename to application/src/test/resources/mmri/3c/agency.txt diff --git a/src/test/resources/mmri/3c/calendar_dates.txt b/application/src/test/resources/mmri/3c/calendar_dates.txt similarity index 100% rename from src/test/resources/mmri/3c/calendar_dates.txt rename to application/src/test/resources/mmri/3c/calendar_dates.txt diff --git a/src/test/resources/mmri/3c/routes.txt b/application/src/test/resources/mmri/3c/routes.txt similarity index 100% rename from src/test/resources/mmri/3c/routes.txt rename to application/src/test/resources/mmri/3c/routes.txt diff --git a/src/test/resources/mmri/3c/stop_times.txt b/application/src/test/resources/mmri/3c/stop_times.txt similarity index 100% rename from src/test/resources/mmri/3c/stop_times.txt rename to application/src/test/resources/mmri/3c/stop_times.txt diff --git a/src/test/resources/mmri/3c/stops.txt b/application/src/test/resources/mmri/3c/stops.txt similarity index 100% rename from src/test/resources/mmri/3c/stops.txt rename to application/src/test/resources/mmri/3c/stops.txt diff --git a/src/test/resources/mmri/3c/trips.txt b/application/src/test/resources/mmri/3c/trips.txt similarity index 100% rename from src/test/resources/mmri/3c/trips.txt rename to application/src/test/resources/mmri/3c/trips.txt diff --git a/src/test/resources/mmri/3d/agency.txt b/application/src/test/resources/mmri/3d/agency.txt similarity index 100% rename from src/test/resources/mmri/3d/agency.txt rename to application/src/test/resources/mmri/3d/agency.txt diff --git a/src/test/resources/mmri/3d/calendar_dates.txt b/application/src/test/resources/mmri/3d/calendar_dates.txt similarity index 100% rename from src/test/resources/mmri/3d/calendar_dates.txt rename to application/src/test/resources/mmri/3d/calendar_dates.txt diff --git a/src/test/resources/mmri/3d/routes.txt b/application/src/test/resources/mmri/3d/routes.txt similarity index 100% rename from src/test/resources/mmri/3d/routes.txt rename to application/src/test/resources/mmri/3d/routes.txt diff --git a/src/test/resources/mmri/3d/stop_times.txt b/application/src/test/resources/mmri/3d/stop_times.txt similarity index 100% rename from src/test/resources/mmri/3d/stop_times.txt rename to application/src/test/resources/mmri/3d/stop_times.txt diff --git a/src/test/resources/mmri/3d/stops.txt b/application/src/test/resources/mmri/3d/stops.txt similarity index 100% rename from src/test/resources/mmri/3d/stops.txt rename to application/src/test/resources/mmri/3d/stops.txt diff --git a/src/test/resources/mmri/3d/trips.txt b/application/src/test/resources/mmri/3d/trips.txt similarity index 100% rename from src/test/resources/mmri/3d/trips.txt rename to application/src/test/resources/mmri/3d/trips.txt diff --git a/src/test/resources/mmri/3e.pb b/application/src/test/resources/mmri/3e.pb similarity index 100% rename from src/test/resources/mmri/3e.pb rename to application/src/test/resources/mmri/3e.pb diff --git a/src/test/resources/mmri/3e/agency.txt b/application/src/test/resources/mmri/3e/agency.txt similarity index 100% rename from src/test/resources/mmri/3e/agency.txt rename to application/src/test/resources/mmri/3e/agency.txt diff --git a/src/test/resources/mmri/3e/calendar_dates.txt b/application/src/test/resources/mmri/3e/calendar_dates.txt similarity index 100% rename from src/test/resources/mmri/3e/calendar_dates.txt rename to application/src/test/resources/mmri/3e/calendar_dates.txt diff --git a/src/test/resources/mmri/3e/routes.txt b/application/src/test/resources/mmri/3e/routes.txt similarity index 100% rename from src/test/resources/mmri/3e/routes.txt rename to application/src/test/resources/mmri/3e/routes.txt diff --git a/src/test/resources/mmri/3e/stop_times.txt b/application/src/test/resources/mmri/3e/stop_times.txt similarity index 100% rename from src/test/resources/mmri/3e/stop_times.txt rename to application/src/test/resources/mmri/3e/stop_times.txt diff --git a/src/test/resources/mmri/3e/stops.txt b/application/src/test/resources/mmri/3e/stops.txt similarity index 100% rename from src/test/resources/mmri/3e/stops.txt rename to application/src/test/resources/mmri/3e/stops.txt diff --git a/src/test/resources/mmri/3e/trips.txt b/application/src/test/resources/mmri/3e/trips.txt similarity index 100% rename from src/test/resources/mmri/3e/trips.txt rename to application/src/test/resources/mmri/3e/trips.txt diff --git a/src/test/resources/mmri/3g1/agency.txt b/application/src/test/resources/mmri/3g1/agency.txt similarity index 100% rename from src/test/resources/mmri/3g1/agency.txt rename to application/src/test/resources/mmri/3g1/agency.txt diff --git a/src/test/resources/mmri/3g1/calendar_dates.txt b/application/src/test/resources/mmri/3g1/calendar_dates.txt similarity index 100% rename from src/test/resources/mmri/3g1/calendar_dates.txt rename to application/src/test/resources/mmri/3g1/calendar_dates.txt diff --git a/src/test/resources/mmri/3g1/routes.txt b/application/src/test/resources/mmri/3g1/routes.txt similarity index 100% rename from src/test/resources/mmri/3g1/routes.txt rename to application/src/test/resources/mmri/3g1/routes.txt diff --git a/src/test/resources/mmri/3g1/stop_times.txt b/application/src/test/resources/mmri/3g1/stop_times.txt similarity index 100% rename from src/test/resources/mmri/3g1/stop_times.txt rename to application/src/test/resources/mmri/3g1/stop_times.txt diff --git a/src/test/resources/mmri/3g1/stops.txt b/application/src/test/resources/mmri/3g1/stops.txt similarity index 100% rename from src/test/resources/mmri/3g1/stops.txt rename to application/src/test/resources/mmri/3g1/stops.txt diff --git a/src/test/resources/mmri/3g1/transfers.txt b/application/src/test/resources/mmri/3g1/transfers.txt similarity index 100% rename from src/test/resources/mmri/3g1/transfers.txt rename to application/src/test/resources/mmri/3g1/transfers.txt diff --git a/src/test/resources/mmri/3g1/trips.txt b/application/src/test/resources/mmri/3g1/trips.txt similarity index 100% rename from src/test/resources/mmri/3g1/trips.txt rename to application/src/test/resources/mmri/3g1/trips.txt diff --git a/src/test/resources/mmri/3g2/agency.txt b/application/src/test/resources/mmri/3g2/agency.txt similarity index 100% rename from src/test/resources/mmri/3g2/agency.txt rename to application/src/test/resources/mmri/3g2/agency.txt diff --git a/src/test/resources/mmri/3g2/calendar_dates.txt b/application/src/test/resources/mmri/3g2/calendar_dates.txt similarity index 100% rename from src/test/resources/mmri/3g2/calendar_dates.txt rename to application/src/test/resources/mmri/3g2/calendar_dates.txt diff --git a/src/test/resources/mmri/3g2/routes.txt b/application/src/test/resources/mmri/3g2/routes.txt similarity index 100% rename from src/test/resources/mmri/3g2/routes.txt rename to application/src/test/resources/mmri/3g2/routes.txt diff --git a/src/test/resources/mmri/3g2/stop_times.txt b/application/src/test/resources/mmri/3g2/stop_times.txt similarity index 100% rename from src/test/resources/mmri/3g2/stop_times.txt rename to application/src/test/resources/mmri/3g2/stop_times.txt diff --git a/src/test/resources/mmri/3g2/stops.txt b/application/src/test/resources/mmri/3g2/stops.txt similarity index 100% rename from src/test/resources/mmri/3g2/stops.txt rename to application/src/test/resources/mmri/3g2/stops.txt diff --git a/src/test/resources/mmri/3g2/transfers.txt b/application/src/test/resources/mmri/3g2/transfers.txt similarity index 100% rename from src/test/resources/mmri/3g2/transfers.txt rename to application/src/test/resources/mmri/3g2/transfers.txt diff --git a/src/test/resources/mmri/3g2/trips.txt b/application/src/test/resources/mmri/3g2/trips.txt similarity index 100% rename from src/test/resources/mmri/3g2/trips.txt rename to application/src/test/resources/mmri/3g2/trips.txt diff --git a/src/test/resources/netex/epip/build-config.json b/application/src/test/resources/netex/epip/build-config.json similarity index 100% rename from src/test/resources/netex/epip/build-config.json rename to application/src/test/resources/netex/epip/build-config.json diff --git a/src/test/resources/netex/epip/netex_epip_minimal/NX-PI-01_DE_NAP_LINE_HHA-B-HHA-B-X86_20230203.xml b/application/src/test/resources/netex/epip/netex_epip_minimal/NX-PI-01_DE_NAP_LINE_HHA-B-HHA-B-X86_20230203.xml similarity index 100% rename from src/test/resources/netex/epip/netex_epip_minimal/NX-PI-01_DE_NAP_LINE_HHA-B-HHA-B-X86_20230203.xml rename to application/src/test/resources/netex/epip/netex_epip_minimal/NX-PI-01_DE_NAP_LINE_HHA-B-HHA-B-X86_20230203.xml diff --git a/src/test/resources/netex/epip/netex_epip_minimal/NX-PI-01_DE_NAP_LINE_VHH-VHH-688_20230203.xml b/application/src/test/resources/netex/epip/netex_epip_minimal/NX-PI-01_DE_NAP_LINE_VHH-VHH-688_20230203.xml similarity index 100% rename from src/test/resources/netex/epip/netex_epip_minimal/NX-PI-01_DE_NAP_LINE_VHH-VHH-688_20230203.xml rename to application/src/test/resources/netex/epip/netex_epip_minimal/NX-PI-01_DE_NAP_LINE_VHH-VHH-688_20230203.xml diff --git a/src/test/resources/netex/nordic/build-config.json b/application/src/test/resources/netex/nordic/build-config.json similarity index 100% rename from src/test/resources/netex/nordic/build-config.json rename to application/src/test/resources/netex/nordic/build-config.json diff --git a/src/test/resources/netex/nordic/netex_minimal.zip b/application/src/test/resources/netex/nordic/netex_minimal.zip similarity index 100% rename from src/test/resources/netex/nordic/netex_minimal.zip rename to application/src/test/resources/netex/nordic/netex_minimal.zip diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/alerts.json b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/alerts.json similarity index 100% rename from src/test/resources/org/opentripplanner/apis/gtfs/expectations/alerts.json rename to application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/alerts.json diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/feedinfo.json b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/feedinfo.json similarity index 100% rename from src/test/resources/org/opentripplanner/apis/gtfs/expectations/feedinfo.json rename to application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/feedinfo.json diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/nearest.json b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/nearest.json similarity index 100% rename from src/test/resources/org/opentripplanner/apis/gtfs/expectations/nearest.json rename to application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/nearest.json diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/patterns.json b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/patterns.json similarity index 100% rename from src/test/resources/org/opentripplanner/apis/gtfs/expectations/patterns.json rename to application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/patterns.json diff --git a/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/plan.json b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/plan.json new file mode 100644 index 00000000000..879c1503438 --- /dev/null +++ b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/plan.json @@ -0,0 +1,74 @@ +{ + "data" : { + "plan" : { + "itineraries" : [ + { + "start" : "2020-02-02T11:00:00Z", + "end" : "2020-02-02T12:00:00Z", + "legs" : [ + { + "mode" : "WALK", + "start" : { + "scheduledTime" : "2020-02-02T11:00:00Z" + }, + "end" : { + "scheduledTime" : "2020-02-02T11:00:20Z" + }, + "from" : { + "name" : "A" + }, + "to" : { + "name" : "B" + } + }, + { + "mode" : "BUS", + "start" : { + "scheduledTime" : "2020-02-02T10:51:00Z" + }, + "end" : { + "scheduledTime" : "2020-02-02T11:05:00Z" + }, + "from" : { + "name" : "B" + }, + "to" : { + "name" : "C" + } + }, + { + "mode" : "RAIL", + "start" : { + "scheduledTime" : "2020-02-02T11:20:00Z" + }, + "end" : { + "scheduledTime" : "2020-02-02T11:40:00Z" + }, + "from" : { + "name" : "C" + }, + "to" : { + "name" : "D" + } + }, + { + "mode" : "CAR", + "start" : { + "scheduledTime" : "2020-02-02T11:50:00Z" + }, + "end" : { + "scheduledTime" : "2020-02-02T12:00:00Z" + }, + "from" : { + "name" : "D" + }, + "to" : { + "name" : "E" + } + } + ] + } + ] + } + } +} \ No newline at end of file diff --git a/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/planConnection-extended.json b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/planConnection-extended.json new file mode 100644 index 00000000000..07f613ebd7f --- /dev/null +++ b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/planConnection-extended.json @@ -0,0 +1,364 @@ +{ + "data" : { + "planConnection" : { + "searchDateTime" : "2023-01-27T21:08:35+01:00", + "routingErrors" : [ ], + "pageInfo" : { + "hasNextPage" : false, + "hasPreviousPage" : false, + "startCursor" : null, + "endCursor" : null, + "searchWindowUsed" : null + }, + "edges" : [ + { + "cursor" : "NoCursor", + "node" : { + "start" : "2020-02-02T11:00:00Z", + "end" : "2020-02-02T12:00:00Z", + "startTime" : 1580641200000, + "endTime" : 1580644800000, + "generalizedCost" : 4072, + "accessibilityScore" : 0.5, + "emissionsPerPerson" : { + "co2" : 123.0 + }, + "numberOfTransfers" : 1, + "walkDistance" : 28.0, + "walkTime" : 20, + "legs" : [ + { + "mode" : "WALK", + "start" : { + "scheduledTime" : "2020-02-02T11:00:00Z", + "estimated" : null + }, + "end" : { + "scheduledTime" : "2020-02-02T11:00:20Z", + "estimated" : null + }, + "from" : { + "name" : "A", + "lat" : 5.0, + "lon" : 8.0, + "arrival" : { + "scheduledTime" : "2020-02-02T11:00:00Z", + "estimated" : null + }, + "departure" : { + "scheduledTime" : "2020-02-02T11:00:00Z", + "estimated" : null + }, + "departureTime" : 1580641200000, + "arrivalTime" : 1580641200000 + }, + "to" : { + "name" : "B", + "lat" : 6.0, + "lon" : 8.5, + "arrival" : { + "scheduledTime" : "2020-02-02T11:00:20Z", + "estimated" : null + }, + "departure" : { + "scheduledTime" : "2020-02-02T11:00:20Z", + "estimated" : null + }, + "departureTime" : 1580641220000, + "arrivalTime" : 1580641220000 + }, + "startTime" : 1580641200000, + "endTime" : 1580641220000, + "generalizedCost" : 40, + "headsign" : null, + "trip" : null, + "intermediatePlaces" : null, + "alerts" : [ ], + "rideHailingEstimate" : null, + "accessibilityScore" : null, + "id" : null, + "realtimeState" : null + }, + { + "mode" : "BUS", + "start" : { + "scheduledTime" : "2020-02-02T10:51:00Z", + "estimated" : { + "time" : "2020-02-02T11:01:00Z", + "delay" : "PT10M" + } + }, + "end" : { + "scheduledTime" : "2020-02-02T11:05:00Z", + "estimated" : { + "time" : "2020-02-02T11:15:00Z", + "delay" : "PT10M" + } + }, + "from" : { + "name" : "B", + "lat" : 6.0, + "lon" : 8.5, + "arrival" : { + "scheduledTime" : "2020-02-02T10:51:00Z", + "estimated" : { + "delay" : "PT10M", + "time" : "2020-02-02T11:01:00Z" + } + }, + "departure" : { + "scheduledTime" : "2020-02-02T10:51:00Z", + "estimated" : { + "delay" : "PT10M", + "time" : "2020-02-02T11:01:00Z" + } + }, + "departureTime" : 1580641260000, + "arrivalTime" : 1580641260000 + }, + "to" : { + "name" : "C", + "lat" : 7.0, + "lon" : 9.0, + "arrival" : { + "scheduledTime" : "2020-02-02T11:05:00Z", + "estimated" : { + "delay" : "PT10M", + "time" : "2020-02-02T11:15:00Z" + } + }, + "departure" : { + "scheduledTime" : "2020-02-02T11:05:00Z", + "estimated" : { + "delay" : "PT10M", + "time" : "2020-02-02T11:15:00Z" + } + }, + "departureTime" : 1580642100000, + "arrivalTime" : 1580642100000 + }, + "startTime" : 1580641260000, + "endTime" : 1580642100000, + "generalizedCost" : 992, + "headsign" : "Headsign at boarding (stop index 5)", + "trip" : { + "tripHeadsign" : "Trip headsign 122" + }, + "intermediatePlaces" : [ + { + "arrival" : { + "scheduledTime" : "2020-02-02T11:01:00Z", + "estimated" : { + "time" : "2020-02-02T11:11:00Z", + "delay" : "PT10M" + } + }, + "departure" : { + "scheduledTime" : "2020-02-02T11:01:00Z", + "estimated" : { + "time" : "2020-02-02T11:11:00Z", + "delay" : "PT10M" + } + }, + "stop" : { + "name" : "B" + } + } + ], + "alerts" : [ ], + "rideHailingEstimate" : null, + "accessibilityScore" : null, + "id" : "rO0ABXdBABhTQ0hFRFVMRURfVFJBTlNJVF9MRUdfVjMABUY6MTIyAAoyMDIwLTAyLTAyAAAABQAAAAcAA0Y6QgADRjpDAAA=", + "realtimeState" : "UPDATED" + }, + { + "mode" : "RAIL", + "start" : { + "scheduledTime" : "2020-02-02T11:20:00Z", + "estimated" : { + "time" : "2020-02-02T11:30:00Z", + "delay" : "PT10M" + } + }, + "end" : { + "scheduledTime" : "2020-02-02T11:40:00Z", + "estimated" : { + "time" : "2020-02-02T11:50:00Z", + "delay" : "PT10M" + } + }, + "from" : { + "name" : "C", + "lat" : 7.0, + "lon" : 9.0, + "arrival" : { + "scheduledTime" : "2020-02-02T11:20:00Z", + "estimated" : { + "delay" : "PT10M", + "time" : "2020-02-02T11:30:00Z" + } + }, + "departure" : { + "scheduledTime" : "2020-02-02T11:20:00Z", + "estimated" : { + "delay" : "PT10M", + "time" : "2020-02-02T11:30:00Z" + } + }, + "departureTime" : 1580643000000, + "arrivalTime" : 1580643000000 + }, + "to" : { + "name" : "D", + "lat" : 8.0, + "lon" : 9.5, + "arrival" : { + "scheduledTime" : "2020-02-02T11:40:00Z", + "estimated" : { + "delay" : "PT10M", + "time" : "2020-02-02T11:50:00Z" + } + }, + "departure" : { + "scheduledTime" : "2020-02-02T11:40:00Z", + "estimated" : { + "delay" : "PT10M", + "time" : "2020-02-02T11:50:00Z" + } + }, + "departureTime" : 1580644200000, + "arrivalTime" : 1580644200000 + }, + "startTime" : 1580643000000, + "endTime" : 1580644200000, + "generalizedCost" : 2040, + "headsign" : "Headsign at boarding (stop index 5)", + "trip" : { + "tripHeadsign" : "Trip headsign 439" + }, + "intermediatePlaces" : [ + { + "arrival" : { + "scheduledTime" : "2020-02-02T11:30:00Z", + "estimated" : { + "time" : "2020-02-02T11:40:00Z", + "delay" : "PT10M" + } + }, + "departure" : { + "scheduledTime" : "2020-02-02T11:30:00Z", + "estimated" : { + "time" : "2020-02-02T11:40:00Z", + "delay" : "PT10M" + } + }, + "stop" : { + "name" : "C" + } + } + ], + "alerts" : [ + { + "id" : "QWxlcnQ6Rjphbi1hbGVydA", + "alertHeaderText" : "A header", + "alertDescriptionText" : "A description", + "alertEffect" : "REDUCED_SERVICE", + "alertCause" : "MAINTENANCE", + "alertSeverityLevel" : "SEVERE", + "alertUrl" : "https://example.com", + "effectiveStartDate" : 1676459008, + "effectiveEndDate" : 1676545408, + "entities" : [ + { + "name" : "A", + "gtfsId" : "F:A", + "lat" : 5.0, + "lon" : 8.0 + } + ] + } + ], + "rideHailingEstimate" : null, + "accessibilityScore" : null, + "id" : "rO0ABXdBABhTQ0hFRFVMRURfVFJBTlNJVF9MRUdfVjMABUY6NDM5AAoyMDIwLTAyLTAyAAAABQAAAAcAA0Y6QwADRjpEAAA=", + "realtimeState" : "UPDATED" + }, + { + "mode" : "CAR", + "start" : { + "scheduledTime" : "2020-02-02T11:50:00Z", + "estimated" : null + }, + "end" : { + "scheduledTime" : "2020-02-02T12:00:00Z", + "estimated" : null + }, + "from" : { + "name" : "D", + "lat" : 8.0, + "lon" : 9.5, + "arrival" : { + "scheduledTime" : "2020-02-02T11:50:00Z", + "estimated" : null + }, + "departure" : { + "scheduledTime" : "2020-02-02T11:50:00Z", + "estimated" : null + }, + "departureTime" : 1580644200000, + "arrivalTime" : 1580644200000 + }, + "to" : { + "name" : "E", + "lat" : 9.0, + "lon" : 10.0, + "arrival" : { + "scheduledTime" : "2020-02-02T12:00:00Z", + "estimated" : null + }, + "departure" : { + "scheduledTime" : "2020-02-02T12:00:00Z", + "estimated" : null + }, + "departureTime" : 1580644800000, + "arrivalTime" : 1580644800000 + }, + "startTime" : 1580644200000, + "endTime" : 1580644800000, + "generalizedCost" : 1000, + "headsign" : null, + "trip" : null, + "intermediatePlaces" : null, + "alerts" : [ ], + "rideHailingEstimate" : { + "provider" : { + "id" : "uber" + }, + "productName" : "UberX", + "minPrice" : { + "currency" : { + "code" : "EUR", + "digits" : 2 + }, + "amount" : 10.0 + }, + "maxPrice" : { + "currency" : { + "code" : "EUR", + "digits" : 2 + }, + "amount" : 20.0 + }, + "arrival" : "PT10M" + }, + "accessibilityScore" : null, + "id" : null, + "realtimeState" : null + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/planConnection-fares.json b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/planConnection-fares.json new file mode 100644 index 00000000000..d56142820b5 --- /dev/null +++ b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/planConnection-fares.json @@ -0,0 +1,168 @@ +{ + "data" : { + "planConnection" : { + "edges" : [ + { + "node" : { + "legs" : [ + { + "mode" : "WALK", + "from" : { + "name" : "A", + "lat" : 5.0, + "lon" : 8.0 + }, + "to" : { + "name" : "B", + "lat" : 6.0, + "lon" : 8.5 + }, + "generalizedCost" : 40, + "fareProducts" : [ ] + }, + { + "mode" : "BUS", + "from" : { + "name" : "B", + "lat" : 6.0, + "lon" : 8.5 + }, + "to" : { + "name" : "C", + "lat" : 7.0, + "lon" : 9.0 + }, + "generalizedCost" : 992, + "fareProducts" : [ + { + "id" : "5d8f889c-42cb-3bcc-89d5-480b995c78c8", + "product" : { + "id" : "F:day-pass", + "name" : "day-pass", + "__typename" : "DefaultFareProduct", + "price" : { + "currency" : { + "digits" : 2, + "code" : "EUR" + }, + "amount" : 10.0 + }, + "riderCategory" : { + "id" : "F:senior-citizens", + "name" : "Senior citizens" + }, + "medium" : { + "id" : "F:oyster", + "name" : "TfL Oyster Card" + } + } + }, + { + "id" : "09bb5f2b-6af9-3355-8b5d-5e93a27ce280", + "product" : { + "id" : "F:single-ticket", + "name" : "single-ticket", + "__typename" : "DefaultFareProduct", + "price" : { + "currency" : { + "digits" : 2, + "code" : "EUR" + }, + "amount" : 10.0 + }, + "riderCategory" : { + "id" : "F:senior-citizens", + "name" : "Senior citizens" + }, + "medium" : { + "id" : "F:oyster", + "name" : "TfL Oyster Card" + } + } + } + ] + }, + { + "mode" : "RAIL", + "from" : { + "name" : "C", + "lat" : 7.0, + "lon" : 9.0 + }, + "to" : { + "name" : "D", + "lat" : 8.0, + "lon" : 9.5 + }, + "generalizedCost" : 2040, + "fareProducts" : [ + { + "id" : "5d8f889c-42cb-3bcc-89d5-480b995c78c8", + "product" : { + "id" : "F:day-pass", + "name" : "day-pass", + "__typename" : "DefaultFareProduct", + "price" : { + "currency" : { + "digits" : 2, + "code" : "EUR" + }, + "amount" : 10.0 + }, + "riderCategory" : { + "id" : "F:senior-citizens", + "name" : "Senior citizens" + }, + "medium" : { + "id" : "F:oyster", + "name" : "TfL Oyster Card" + } + } + }, + { + "id" : "46190ddd-93b0-3136-adb7-a18394f8b0ef", + "product" : { + "id" : "F:single-ticket", + "name" : "single-ticket", + "__typename" : "DefaultFareProduct", + "price" : { + "currency" : { + "digits" : 2, + "code" : "EUR" + }, + "amount" : 10.0 + }, + "riderCategory" : { + "id" : "F:senior-citizens", + "name" : "Senior citizens" + }, + "medium" : { + "id" : "F:oyster", + "name" : "TfL Oyster Card" + } + } + } + ] + }, + { + "mode" : "CAR", + "from" : { + "name" : "D", + "lat" : 8.0, + "lon" : 9.5 + }, + "to" : { + "name" : "E", + "lat" : 9.0, + "lon" : 10.0 + }, + "generalizedCost" : 1000, + "fareProducts" : [ ] + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/planConnection-stop-positions.json b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/planConnection-stop-positions.json new file mode 100644 index 00000000000..dbf73734975 --- /dev/null +++ b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/planConnection-stop-positions.json @@ -0,0 +1,94 @@ +{ + "data" : { + "planConnection" : { + "edges" : [ + { + "node" : { + "start" : "2020-02-02T11:00:00Z", + "end" : "2020-02-02T12:00:00Z", + "generalizedCost" : 4072, + "accessibilityScore" : 0.5, + "legs" : [ + { + "mode" : "WALK", + "from" : { + "name" : "A", + "lat" : 5.0, + "lon" : 8.0, + "stopPosition" : null + }, + "to" : { + "name" : "B", + "lat" : 6.0, + "lon" : 8.5, + "stopPosition" : null + }, + "generalizedCost" : 40 + }, + { + "mode" : "BUS", + "from" : { + "name" : "B", + "lat" : 6.0, + "lon" : 8.5, + "stopPosition" : { + "__typename" : "PositionAtStop", + "position" : 0 + } + }, + "to" : { + "name" : "C", + "lat" : 7.0, + "lon" : 9.0, + "stopPosition" : { + "__typename" : "PositionAtStop", + "position" : 0 + } + }, + "generalizedCost" : 992 + }, + { + "mode" : "RAIL", + "from" : { + "name" : "C", + "lat" : 7.0, + "lon" : 9.0, + "stopPosition" : { + "__typename" : "PositionAtStop", + "position" : 0 + } + }, + "to" : { + "name" : "D", + "lat" : 8.0, + "lon" : 9.5, + "stopPosition" : { + "__typename" : "PositionAtStop", + "position" : 0 + } + }, + "generalizedCost" : 2040 + }, + { + "mode" : "CAR", + "from" : { + "name" : "D", + "lat" : 8.0, + "lon" : 9.5, + "stopPosition" : null + }, + "to" : { + "name" : "E", + "lat" : 9.0, + "lon" : 10.0, + "stopPosition" : null + }, + "generalizedCost" : 1000 + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/planConnection-tutorial.json b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/planConnection-tutorial.json new file mode 100644 index 00000000000..eff2b223eff --- /dev/null +++ b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/planConnection-tutorial.json @@ -0,0 +1,132 @@ +{ + "data" : { + "planConnection" : { + "edges" : [ + { + "node" : { + "start" : "2020-02-02T11:00:00Z", + "end" : "2020-02-02T12:00:00Z", + "legs" : [ + { + "mode" : "WALK", + "from" : { + "name" : "A", + "lat" : 5.0, + "lon" : 8.0, + "departure" : { + "scheduledTime" : "2020-02-02T11:00:00Z", + "estimated" : null + } + }, + "to" : { + "name" : "B", + "lat" : 6.0, + "lon" : 8.5, + "arrival" : { + "scheduledTime" : "2020-02-02T11:00:20Z", + "estimated" : null + } + }, + "route" : null, + "legGeometry" : null + }, + { + "mode" : "BUS", + "from" : { + "name" : "B", + "lat" : 6.0, + "lon" : 8.5, + "departure" : { + "scheduledTime" : "2020-02-02T10:51:00Z", + "estimated" : { + "time" : "2020-02-02T11:01:00Z", + "delay" : "PT10M" + } + } + }, + "to" : { + "name" : "C", + "lat" : 7.0, + "lon" : 9.0, + "arrival" : { + "scheduledTime" : "2020-02-02T11:05:00Z", + "estimated" : { + "time" : "2020-02-02T11:15:00Z", + "delay" : "PT10M" + } + } + }, + "route" : { + "gtfsId" : "F:BUS", + "longName" : "Long name for BUS", + "shortName" : "RBUS" + }, + "legGeometry" : { + "points" : "_{rc@_d{r@????_ibE_t`B" + } + }, + { + "mode" : "RAIL", + "from" : { + "name" : "C", + "lat" : 7.0, + "lon" : 9.0, + "departure" : { + "scheduledTime" : "2020-02-02T11:20:00Z", + "estimated" : { + "time" : "2020-02-02T11:30:00Z", + "delay" : "PT10M" + } + } + }, + "to" : { + "name" : "D", + "lat" : 8.0, + "lon" : 9.5, + "arrival" : { + "scheduledTime" : "2020-02-02T11:40:00Z", + "estimated" : { + "time" : "2020-02-02T11:50:00Z", + "delay" : "PT10M" + } + } + }, + "route" : { + "gtfsId" : "F:2", + "longName" : null, + "shortName" : "R2" + }, + "legGeometry" : { + "points" : "_evi@_y|u@????_ibE_t`B" + } + }, + { + "mode" : "CAR", + "from" : { + "name" : "D", + "lat" : 8.0, + "lon" : 9.5, + "departure" : { + "scheduledTime" : "2020-02-02T11:50:00Z", + "estimated" : null + } + }, + "to" : { + "name" : "E", + "lat" : 9.0, + "lon" : 10.0, + "arrival" : { + "scheduledTime" : "2020-02-02T12:00:00Z", + "estimated" : null + } + }, + "route" : null, + "legGeometry" : null + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/rental-vehicle.json b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/rental-vehicle.json similarity index 100% rename from src/test/resources/org/opentripplanner/apis/gtfs/expectations/rental-vehicle.json rename to application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/rental-vehicle.json diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/routes-extended.json b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/routes-extended.json similarity index 100% rename from src/test/resources/org/opentripplanner/apis/gtfs/expectations/routes-extended.json rename to application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/routes-extended.json diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/routes-tutorial.json b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/routes-tutorial.json similarity index 100% rename from src/test/resources/org/opentripplanner/apis/gtfs/expectations/routes-tutorial.json rename to application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/routes-tutorial.json diff --git a/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/stops.json b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/stops.json new file mode 100644 index 00000000000..4e3d4c8a18c --- /dev/null +++ b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/stops.json @@ -0,0 +1,126 @@ +{ + "data" : { + "stops" : [ + { + "gtfsId" : "F:A", + "lat" : 5.0, + "lon" : 8.0, + "name" : "A", + "vehicleMode" : "BUS", + "allRoutes" : [ + { + "gtfsId" : "F:a-route", + "longName" : null, + "shortName" : "Ra-route" + } + ], + "routesWithinRange" : [ ] + }, + { + "gtfsId" : "F:B", + "lat" : 6.0, + "lon" : 8.5, + "name" : "B", + "vehicleMode" : "BUS", + "allRoutes" : [ + { + "gtfsId" : "F:a-route", + "longName" : null, + "shortName" : "Ra-route" + } + ], + "routesWithinRange" : [ ] + }, + { + "gtfsId" : "F:C", + "lat" : 7.0, + "lon" : 9.0, + "name" : "C", + "vehicleMode" : "BUS", + "allRoutes" : [ + { + "gtfsId" : "F:a-route", + "longName" : null, + "shortName" : "Ra-route" + } + ], + "routesWithinRange" : [ ] + }, + { + "gtfsId" : "F:D", + "lat" : 8.0, + "lon" : 9.5, + "name" : "D", + "vehicleMode" : "BUS", + "allRoutes" : [ + { + "gtfsId" : "F:a-route", + "longName" : null, + "shortName" : "Ra-route" + } + ], + "routesWithinRange" : [ ] + }, + { + "gtfsId" : "F:E", + "lat" : 9.0, + "lon" : 10.0, + "name" : "E", + "vehicleMode" : "BUS", + "allRoutes" : [ + { + "gtfsId" : "F:a-route", + "longName" : null, + "shortName" : "Ra-route" + } + ], + "routesWithinRange" : [ ] + }, + { + "gtfsId" : "F:F", + "lat" : 9.0, + "lon" : 10.5, + "name" : "F", + "vehicleMode" : "BUS", + "allRoutes" : [ + { + "gtfsId" : "F:a-route", + "longName" : null, + "shortName" : "Ra-route" + } + ], + "routesWithinRange" : [ ] + }, + { + "gtfsId" : "F:G", + "lat" : 9.5, + "lon" : 11.0, + "name" : "G", + "vehicleMode" : "BUS", + "allRoutes" : [ + { + "gtfsId" : "F:a-route", + "longName" : null, + "shortName" : "Ra-route" + } + ], + "routesWithinRange" : [ ] + }, + { + "gtfsId" : "F:H", + "lat" : 10.0, + "lon" : 11.5, + "name" : "H", + "vehicleMode" : "BUS", + "allRoutes" : [ + { + "gtfsId" : "F:a-route", + "longName" : null, + "shortName" : "Ra-route" + } + ], + "routesWithinRange" : [ ] + } + ] + } +} \ No newline at end of file diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/vehicle-parking.json b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/vehicle-parking.json similarity index 100% rename from src/test/resources/org/opentripplanner/apis/gtfs/expectations/vehicle-parking.json rename to application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/vehicle-parking.json diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/vehicle-rental-station.json b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/vehicle-rental-station.json similarity index 100% rename from src/test/resources/org/opentripplanner/apis/gtfs/expectations/vehicle-rental-station.json rename to application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/vehicle-rental-station.json diff --git a/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/walk-steps.json b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/walk-steps.json new file mode 100644 index 00000000000..be584a875be --- /dev/null +++ b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/walk-steps.json @@ -0,0 +1,39 @@ +{ + "data" : { + "planConnection" : { + "edges" : [ + { + "node" : { + "legs" : [ + { + "steps" : [ + { + "streetName" : "street", + "area" : false, + "relativeDirection" : "DEPART", + "absoluteDirection" : "NORTHEAST" + }, + { + "streetName" : "elevator", + "area" : false, + "relativeDirection" : "ELEVATOR", + "absoluteDirection" : null + } + ] + }, + { + "steps" : [ ] + }, + { + "steps" : [ ] + }, + { + "steps" : [ ] + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/queries/alerts.graphql b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/alerts.graphql similarity index 100% rename from src/test/resources/org/opentripplanner/apis/gtfs/queries/alerts.graphql rename to application/src/test/resources/org/opentripplanner/apis/gtfs/queries/alerts.graphql diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/queries/feedinfo.graphql b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/feedinfo.graphql similarity index 100% rename from src/test/resources/org/opentripplanner/apis/gtfs/queries/feedinfo.graphql rename to application/src/test/resources/org/opentripplanner/apis/gtfs/queries/feedinfo.graphql diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/queries/nearest.graphql b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/nearest.graphql similarity index 100% rename from src/test/resources/org/opentripplanner/apis/gtfs/queries/nearest.graphql rename to application/src/test/resources/org/opentripplanner/apis/gtfs/queries/nearest.graphql diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/queries/patterns.graphql b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/patterns.graphql similarity index 100% rename from src/test/resources/org/opentripplanner/apis/gtfs/queries/patterns.graphql rename to application/src/test/resources/org/opentripplanner/apis/gtfs/queries/patterns.graphql diff --git a/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/plan.graphql b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/plan.graphql new file mode 100644 index 00000000000..6a51cc10d2c --- /dev/null +++ b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/plan.graphql @@ -0,0 +1,35 @@ +{ + plan( + from: { lat: 52.3092, lon: 13.0291 } + to: { lat: 52.5147, lon: 13.3927 } + date: "2023-02-15" + time: "11:37" + parking: { + unpreferredCost: 555 + preferred: [{ not: [{ tags: ["a", "b", "c"] }] }] + filters: [{ select: [{ tags: ["e"] }] }] + } + transportModes: [{ mode: CAR, qualifier: HAIL }] + ) { + itineraries { + start + end + legs { + mode + start { + scheduledTime + } + end { + scheduledTime + } + from { + name + } + to { + name + } + mode + } + } + } +} diff --git a/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/planConnection-extended.graphql b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/planConnection-extended.graphql new file mode 100644 index 00000000000..e0266281aa4 --- /dev/null +++ b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/planConnection-extended.graphql @@ -0,0 +1,240 @@ +{ + planConnection( + dateTime: { earliestDeparture: "2023-06-13T14:30+03:00" } + searchWindow: "PT2H30M" + first: 5 + origin: { + location: { coordinate: { latitude: 45.5552, longitude: -122.6534 } } + label: "Home" + } + destination: { + location: { coordinate: { latitude: 45.4908, longitude: -122.5519 } } + label: "Work" + } + modes: { + directOnly: false + transitOnly: false + direct: [WALK] + transit: { + access: [BICYCLE_RENTAL, WALK] + transfer: [WALK] + egress: [BICYCLE_RENTAL, WALK] + transit: [{ mode: TRAM, cost: { reluctance: 1.3 } }, { mode: BUS }] + } + } + preferences: { + accessibility: { wheelchair: { enabled: true } } + street: { + car: { + reluctance: 6.5 + rental: { + allowedNetworks: ["foo", "bar"] + bannedNetworks: ["foobar"] + } + parking: { + unpreferredCost: 200 + preferred: [{ select: [{ tags: ["best-park"] }] }] + filters: [{ not: [{ tags: ["worst-park"] }] }] + } + } + bicycle: { + reluctance: 3.0 + speed: 7.4 + optimization: { type: SAFEST_STREETS } + boardCost: 200 + walk: { + speed: 1.3 + cost: { mountDismountCost: 100, reluctance: 3.5 } + mountDismountTime: "PT5S" + } + rental: { + destinationBicyclePolicy: { allowKeeping: true, keepingCost: 300 } + allowedNetworks: ["foo", "bar"] + bannedNetworks: ["foobar"] + } + parking: { + unpreferredCost: 200 + preferred: [{ select: [{ tags: ["best-park"] }] }] + filters: [{ not: [{ tags: ["worst-park"] }] }] + } + } + walk: { speed: 2.4, reluctance: 1.5, safetyFactor: 0.5, boardCost: 200 } + } + transit: { + board: { waitReluctance: 3.2, slack: "PT1M30S" } + alight: { slack: "PT0S" } + transfer: { + cost: 200 + slack: "PT2M" + maximumAdditionalTransfers: 2 + maximumTransfers: 5 + } + timetable: { + excludeRealTimeUpdates: false + includePlannedCancellations: false + includeRealTimeCancellations: true + } + } + } + locale: "en" + ) { + searchDateTime + routingErrors { + code + } + pageInfo { + hasNextPage + hasPreviousPage + startCursor + endCursor + searchWindowUsed + } + edges { + cursor + node { + start + end + # next two are deprecated + startTime + endTime + generalizedCost + accessibilityScore + emissionsPerPerson { + co2 + } + numberOfTransfers + walkDistance + walkTime + legs { + mode + start { + scheduledTime + estimated { + time + delay + } + } + end { + scheduledTime + estimated { + time + delay + } + } + from { + name + lat + lon + arrival { + scheduledTime + estimated { + delay + time + } + } + departure { + scheduledTime + estimated { + delay + time + } + } + departureTime + arrivalTime + } + to { + name + lat + lon + arrival { + scheduledTime + estimated { + delay + time + } + } + departure { + scheduledTime + estimated { + delay + time + } + } + departureTime + arrivalTime + } + startTime + endTime + mode + generalizedCost + headsign + trip { + tripHeadsign + } + intermediatePlaces { + arrival { + scheduledTime + estimated { + time + delay + } + } + departure { + scheduledTime + estimated { + time + delay + } + } + stop { + name + } + } + alerts { + id + alertHeaderText + alertDescriptionText + alertEffect + alertCause + alertSeverityLevel + alertUrl + effectiveStartDate + effectiveEndDate + entities { + ... on Stop { + name + gtfsId + lat + lon + } + } + } + rideHailingEstimate { + provider { + id + } + productName + minPrice { + currency { + code + digits + } + amount + } + maxPrice { + currency { + code + digits + } + amount + } + arrival + } + accessibilityScore + id + realtimeState + } + } + } + } +} diff --git a/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/planConnection-fares.graphql b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/planConnection-fares.graphql new file mode 100644 index 00000000000..7f8972ff208 --- /dev/null +++ b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/planConnection-fares.graphql @@ -0,0 +1,60 @@ +{ + planConnection( + origin: { + location: { coordinate: { latitude: 45.5552, longitude: -122.6534 } } + } + destination: { + location: { coordinate: { latitude: 45.4908, longitude: -122.5519 } } + } + dateTime: { earliestDeparture: "2023-06-13T14:30-07:00" } + modes: { + direct: [WALK] + transit: { transit: [{ mode: BUS }, { mode: RAIL }] } + } + ) { + edges { + node { + legs { + mode + from { + name + lat + lon + } + to { + name + lat + lon + } + mode + generalizedCost + fareProducts { + id + product { + id + name + __typename + ... on DefaultFareProduct { + price { + currency { + digits + code + } + amount + } + } + riderCategory { + id + name + } + medium { + id + name + } + } + } + } + } + } + } +} diff --git a/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/planConnection-stop-positions.graphql b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/planConnection-stop-positions.graphql new file mode 100644 index 00000000000..74063a93d81 --- /dev/null +++ b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/planConnection-stop-positions.graphql @@ -0,0 +1,51 @@ +{ + planConnection( + origin: { + location: { coordinate: { latitude: 45.5552, longitude: -122.6534 } } + } + destination: { + location: { coordinate: { latitude: 45.4908, longitude: -122.5519 } } + } + dateTime: { earliestDeparture: "2023-06-13T14:30-07:00" } + modes: { + direct: [WALK] + transit: { transit: [{ mode: BUS }, { mode: RAIL }] } + } + ) { + edges { + node { + start + end + generalizedCost + accessibilityScore + legs { + mode + from { + name + lat + lon + stopPosition { + __typename + ... on PositionAtStop { + position + } + } + } + to { + name + lat + lon + stopPosition { + __typename + ... on PositionAtStop { + position + } + } + } + mode + generalizedCost + } + } + } + } +} diff --git a/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/planConnection-tutorial.graphql b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/planConnection-tutorial.graphql new file mode 100644 index 00000000000..43b0be615c5 --- /dev/null +++ b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/planConnection-tutorial.graphql @@ -0,0 +1,61 @@ +{ + planConnection( + origin: { + # these coordinates are in Portland, change this to YOUR origin + location: { coordinate: { latitude: 45.5552, longitude: -122.6534 } } + } + destination: { + # these coordinates are in Portland, change this to YOUR destination + location: { coordinate: { latitude: 45.4908, longitude: -122.5519 } } + } + # use the correct date and time of your request + dateTime: { earliestDeparture: "2023-06-13T14:30-07:00" } + # choose the transport modes you need + modes: { + direct: [WALK] + transit: { transit: [{ mode: BUS }, { mode: RAIL }] } + } + ) { + edges { + node { + start + end + legs { + mode + from { + name + lat + lon + departure { + scheduledTime + estimated { + time + delay + } + } + } + to { + name + lat + lon + arrival { + scheduledTime + estimated { + time + delay + } + } + } + route { + gtfsId + longName + shortName + } + legGeometry { + points + } + } + } + } + } +} diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/queries/rental-vehicle.graphql b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/rental-vehicle.graphql similarity index 100% rename from src/test/resources/org/opentripplanner/apis/gtfs/queries/rental-vehicle.graphql rename to application/src/test/resources/org/opentripplanner/apis/gtfs/queries/rental-vehicle.graphql diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/queries/routes-extended.graphql b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/routes-extended.graphql similarity index 100% rename from src/test/resources/org/opentripplanner/apis/gtfs/queries/routes-extended.graphql rename to application/src/test/resources/org/opentripplanner/apis/gtfs/queries/routes-extended.graphql diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/queries/routes-tutorial.graphql b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/routes-tutorial.graphql similarity index 100% rename from src/test/resources/org/opentripplanner/apis/gtfs/queries/routes-tutorial.graphql rename to application/src/test/resources/org/opentripplanner/apis/gtfs/queries/routes-tutorial.graphql diff --git a/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/stops.graphql b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/stops.graphql new file mode 100644 index 00000000000..af4fd904096 --- /dev/null +++ b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/stops.graphql @@ -0,0 +1,21 @@ +{ + stops { + gtfsId + lat + lon + name + vehicleMode + allRoutes: routes { + gtfsId + longName + shortName + } + routesWithinRange: routes( + serviceDates: { start: "2024-09-10", end: "2024-09-10" } + ) { + gtfsId + longName + shortName + } + } +} diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/queries/vehicle-parking.graphql b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/vehicle-parking.graphql similarity index 100% rename from src/test/resources/org/opentripplanner/apis/gtfs/queries/vehicle-parking.graphql rename to application/src/test/resources/org/opentripplanner/apis/gtfs/queries/vehicle-parking.graphql diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/queries/vehicle-rental-station.graphql b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/vehicle-rental-station.graphql similarity index 100% rename from src/test/resources/org/opentripplanner/apis/gtfs/queries/vehicle-rental-station.graphql rename to application/src/test/resources/org/opentripplanner/apis/gtfs/queries/vehicle-rental-station.graphql diff --git a/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/walk-steps.graphql b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/walk-steps.graphql new file mode 100644 index 00000000000..dd2b96395ad --- /dev/null +++ b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/walk-steps.graphql @@ -0,0 +1,28 @@ +{ + planConnection( + origin: { + location: { coordinate: { latitude: 45.5552, longitude: -122.6534 } } + } + destination: { + location: { coordinate: { latitude: 45.4908, longitude: -122.5519 } } + } + dateTime: { earliestDeparture: "2023-06-13T14:30-07:00" } + modes: { + direct: [WALK] + transit: { transit: [{ mode: BUS }, { mode: RAIL }] } + } + ) { + edges { + node { + legs { + steps { + streetName + area + relativeDirection + absoluteDirection + } + } + } + } + } +} diff --git a/src/test/resources/org/opentripplanner/apis/vectortiles/style.json b/application/src/test/resources/org/opentripplanner/apis/vectortiles/style.json similarity index 92% rename from src/test/resources/org/opentripplanner/apis/vectortiles/style.json rename to application/src/test/resources/org/opentripplanner/apis/vectortiles/style.json index 5a2ed9572e2..f15bc45b2e8 100644 --- a/src/test/resources/org/opentripplanner/apis/vectortiles/style.json +++ b/application/src/test/resources/org/opentripplanner/apis/vectortiles/style.json @@ -45,6 +45,19 @@ 10.0 ] ] + }, + "line-offset" : { + "base" : 1.3, + "stops" : [ + [ + 13, + 0.3 + ], + [ + 23, + 6.0 + ] + ] } }, "filter" : [ @@ -134,6 +147,19 @@ 10.0 ] ] + }, + "line-offset" : { + "base" : 1.3, + "stops" : [ + [ + 13, + 0.3 + ], + [ + 23, + 6.0 + ] + ] } }, "filter" : [ @@ -143,7 +169,8 @@ "StreetTransitEntranceLink", "BoardingLocationToStopLink", "StreetVehicleRentalLink", - "StreetVehicleParkingLink" + "StreetVehicleParkingLink", + "StreetStationCentroidLink" ], "layout" : { "line-cap" : "round", diff --git a/src/test/resources/org/opentripplanner/datastore/file/umlaut-cp437.zip b/application/src/test/resources/org/opentripplanner/datastore/file/umlaut-cp437.zip similarity index 100% rename from src/test/resources/org/opentripplanner/datastore/file/umlaut-cp437.zip rename to application/src/test/resources/org/opentripplanner/datastore/file/umlaut-cp437.zip diff --git a/src/test/resources/org/opentripplanner/datastore/file/umlaut-utf8-no-efs.zip b/application/src/test/resources/org/opentripplanner/datastore/file/umlaut-utf8-no-efs.zip similarity index 100% rename from src/test/resources/org/opentripplanner/datastore/file/umlaut-utf8-no-efs.zip rename to application/src/test/resources/org/opentripplanner/datastore/file/umlaut-utf8-no-efs.zip diff --git a/src/test/resources/org/opentripplanner/datastore/file/umlaut-utf8.zip b/application/src/test/resources/org/opentripplanner/datastore/file/umlaut-utf8.zip similarity index 100% rename from src/test/resources/org/opentripplanner/datastore/file/umlaut-utf8.zip rename to application/src/test/resources/org/opentripplanner/datastore/file/umlaut-utf8.zip diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/herrenberg-minimal.osm.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/herrenberg-minimal.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/herrenberg-minimal.osm.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/herrenberg-minimal.osm.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/islandpruning/herrenberg-island-prune-nothru.osm.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/islandpruning/herrenberg-island-prune-nothru.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/islandpruning/herrenberg-island-prune-nothru.osm.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/islandpruning/herrenberg-island-prune-nothru.osm.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/islandpruning/isoiiluoto.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/islandpruning/isoiiluoto.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/islandpruning/isoiiluoto.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/islandpruning/isoiiluoto.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/islandpruning/matinkyla-escalator.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/islandpruning/matinkyla-escalator.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/islandpruning/matinkyla-escalator.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/islandpruning/matinkyla-escalator.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/linking/columbus.osm.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/linking/columbus.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/linking/columbus.osm.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/linking/columbus.osm.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/osm/B+R.osm.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/osm/B+R.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/osm/B+R.osm.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/osm/B+R.osm.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/osm/NYC_small.osm.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/osm/NYC_small.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/osm/NYC_small.osm.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/osm/NYC_small.osm.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/osm/P+R.osm.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/osm/P+R.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/osm/P+R.osm.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/osm/P+R.osm.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/osm/accessno-at-end.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/osm/accessno-at-end.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/osm/accessno-at-end.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/osm/accessno-at-end.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/osm/brenner-invalid-relation-reference.osm.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/osm/brenner-invalid-relation-reference.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/osm/brenner-invalid-relation-reference.osm.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/osm/brenner-invalid-relation-reference.osm.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/osm/bridge_construction.osm.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/osm/bridge_construction.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/osm/bridge_construction.osm.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/osm/bridge_construction.osm.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/osm/coincident_pr.osm.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/osm/coincident_pr.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/osm/coincident_pr.osm.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/osm/coincident_pr.osm.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/osm/coincident_pr_dupl.osm.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/osm/coincident_pr_dupl.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/osm/coincident_pr_dupl.osm.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/osm/coincident_pr_dupl.osm.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/osm/coincident_pr_overlap.osm.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/osm/coincident_pr_overlap.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/osm/coincident_pr_overlap.osm.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/osm/coincident_pr_overlap.osm.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/osm/coincident_pr_reverse.osm.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/osm/coincident_pr_reverse.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/osm/coincident_pr_reverse.osm.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/osm/coincident_pr_reverse.osm.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/osm/ehningen-minimal.osm.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/osm/ehningen-minimal.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/osm/ehningen-minimal.osm.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/osm/ehningen-minimal.osm.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/osm/hackett_pr.osm.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/osm/hackett_pr.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/osm/hackett_pr.osm.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/osm/hackett_pr.osm.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/osm/lund-station-sweden.osm.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/osm/lund-station-sweden.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/osm/lund-station-sweden.osm.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/osm/lund-station-sweden.osm.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/osm/map.osm.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/osm/map.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/osm/map.osm.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/osm/map.osm.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/osm/skoyen.osm.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/osm/skoyen.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/osm/skoyen.osm.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/osm/skoyen.osm.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/osm/stopareas.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/osm/stopareas.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/osm/stopareas.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/osm/stopareas.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/osm/usf_area.osm.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/osm/usf_area.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/osm/usf_area.osm.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/osm/usf_area.osm.pbf diff --git a/src/test/resources/org/opentripplanner/graph_builder/module/osm/wendlingen-bahnhof.osm.pbf b/application/src/test/resources/org/opentripplanner/graph_builder/module/osm/wendlingen-bahnhof.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/graph_builder/module/osm/wendlingen-bahnhof.osm.pbf rename to application/src/test/resources/org/opentripplanner/graph_builder/module/osm/wendlingen-bahnhof.osm.pbf diff --git a/src/test/resources/org/opentripplanner/oslo-east-filtered.osm.pbf b/application/src/test/resources/org/opentripplanner/oslo-east-filtered.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/oslo-east-filtered.osm.pbf rename to application/src/test/resources/org/opentripplanner/oslo-east-filtered.osm.pbf diff --git a/src/test/resources/org/opentripplanner/street/integration/boeblingen-minimal.osm.pbf b/application/src/test/resources/org/opentripplanner/street/integration/boeblingen-minimal.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/street/integration/boeblingen-minimal.osm.pbf rename to application/src/test/resources/org/opentripplanner/street/integration/boeblingen-minimal.osm.pbf diff --git a/src/test/resources/org/opentripplanner/street/integration/deufringen-minimal.osm.pbf b/application/src/test/resources/org/opentripplanner/street/integration/deufringen-minimal.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/street/integration/deufringen-minimal.osm.pbf rename to application/src/test/resources/org/opentripplanner/street/integration/deufringen-minimal.osm.pbf diff --git a/src/test/resources/org/opentripplanner/street/integration/herrenberg-barrier-gates.osm.pbf b/application/src/test/resources/org/opentripplanner/street/integration/herrenberg-barrier-gates.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/street/integration/herrenberg-barrier-gates.osm.pbf rename to application/src/test/resources/org/opentripplanner/street/integration/herrenberg-barrier-gates.osm.pbf diff --git a/src/test/resources/org/opentripplanner/street/integration/herrenberg-hindenburgstr-under-construction.osm.pbf b/application/src/test/resources/org/opentripplanner/street/integration/herrenberg-hindenburgstr-under-construction.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/street/integration/herrenberg-hindenburgstr-under-construction.osm.pbf rename to application/src/test/resources/org/opentripplanner/street/integration/herrenberg-hindenburgstr-under-construction.osm.pbf diff --git a/src/test/resources/org/opentripplanner/street/integration/herrenberg-minimal.osm.pbf b/application/src/test/resources/org/opentripplanner/street/integration/herrenberg-minimal.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/street/integration/herrenberg-minimal.osm.pbf rename to application/src/test/resources/org/opentripplanner/street/integration/herrenberg-minimal.osm.pbf diff --git a/src/test/resources/org/opentripplanner/street/integration/roundabout.osm.pbf b/application/src/test/resources/org/opentripplanner/street/integration/roundabout.osm.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/street/integration/roundabout.osm.pbf rename to application/src/test/resources/org/opentripplanner/street/integration/roundabout.osm.pbf diff --git a/src/test/resources/org/opentripplanner/street/integration/vvs-bus-751-only.gtfs.zip b/application/src/test/resources/org/opentripplanner/street/integration/vvs-bus-751-only.gtfs.zip similarity index 100% rename from src/test/resources/org/opentripplanner/street/integration/vvs-bus-751-only.gtfs.zip rename to application/src/test/resources/org/opentripplanner/street/integration/vvs-bus-751-only.gtfs.zip diff --git a/src/test/resources/org/opentripplanner/street/integration/vvs-bus-764-only.gtfs.zip b/application/src/test/resources/org/opentripplanner/street/integration/vvs-bus-764-only.gtfs.zip similarity index 100% rename from src/test/resources/org/opentripplanner/street/integration/vvs-bus-764-only.gtfs.zip rename to application/src/test/resources/org/opentripplanner/street/integration/vvs-bus-764-only.gtfs.zip diff --git a/src/test/resources/org/opentripplanner/transit/service/kcm_gtfs.zip b/application/src/test/resources/org/opentripplanner/transit/service/kcm_gtfs.zip similarity index 100% rename from src/test/resources/org/opentripplanner/transit/service/kcm_gtfs.zip rename to application/src/test/resources/org/opentripplanner/transit/service/kcm_gtfs.zip diff --git a/src/test/resources/org/opentripplanner/updater/trip/septa.pbf b/application/src/test/resources/org/opentripplanner/updater/trip/septa.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/updater/trip/septa.pbf rename to application/src/test/resources/org/opentripplanner/updater/trip/septa.pbf diff --git a/src/test/resources/org/opentripplanner/updater/vehicle_position/king-county-metro-1.pbf b/application/src/test/resources/org/opentripplanner/updater/vehicle_position/king-county-metro-1.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/updater/vehicle_position/king-county-metro-1.pbf rename to application/src/test/resources/org/opentripplanner/updater/vehicle_position/king-county-metro-1.pbf diff --git a/src/test/resources/org/opentripplanner/updater/vehicle_position/king-county-metro-2.pbf b/application/src/test/resources/org/opentripplanner/updater/vehicle_position/king-county-metro-2.pbf similarity index 100% rename from src/test/resources/org/opentripplanner/updater/vehicle_position/king-county-metro-2.pbf rename to application/src/test/resources/org/opentripplanner/updater/vehicle_position/king-county-metro-2.pbf diff --git a/src/test/resources/portland/build-config.json b/application/src/test/resources/portland/build-config.json similarity index 100% rename from src/test/resources/portland/build-config.json rename to application/src/test/resources/portland/build-config.json diff --git a/src/test/resources/portland/portland-central-filtered.osm.pbf b/application/src/test/resources/portland/portland-central-filtered.osm.pbf similarity index 100% rename from src/test/resources/portland/portland-central-filtered.osm.pbf rename to application/src/test/resources/portland/portland-central-filtered.osm.pbf diff --git a/src/test/resources/portland/portland-ned-nodata.tif b/application/src/test/resources/portland/portland-ned-nodata.tif similarity index 100% rename from src/test/resources/portland/portland-ned-nodata.tif rename to application/src/test/resources/portland/portland-ned-nodata.tif diff --git a/src/test/resources/portland/portland-ned.tif b/application/src/test/resources/portland/portland-ned.tif similarity index 100% rename from src/test/resources/portland/portland-ned.tif rename to application/src/test/resources/portland/portland-ned.tif diff --git a/src/test/resources/portland/portland-vehicle-rental.csv b/application/src/test/resources/portland/portland-vehicle-rental.csv similarity index 100% rename from src/test/resources/portland/portland-vehicle-rental.csv rename to application/src/test/resources/portland/portland-vehicle-rental.csv diff --git a/src/test/resources/portland/portland.gtfs.zip b/application/src/test/resources/portland/portland.gtfs.zip similarity index 100% rename from src/test/resources/portland/portland.gtfs.zip rename to application/src/test/resources/portland/portland.gtfs.zip diff --git a/src/test/resources/portland/router-config.json b/application/src/test/resources/portland/router-config.json similarity index 100% rename from src/test/resources/portland/router-config.json rename to application/src/test/resources/portland/router-config.json diff --git a/src/test/resources/speedtest/speed-test-config.json b/application/src/test/resources/speedtest/speed-test-config.json similarity index 100% rename from src/test/resources/speedtest/speed-test-config.json rename to application/src/test/resources/speedtest/speed-test-config.json diff --git a/src/test/resources/speedtest/travelSearch-expected-results-bd.csv b/application/src/test/resources/speedtest/travelSearch-expected-results-bd.csv similarity index 100% rename from src/test/resources/speedtest/travelSearch-expected-results-bd.csv rename to application/src/test/resources/speedtest/travelSearch-expected-results-bd.csv diff --git a/src/test/resources/speedtest/travelSearch-expected-results-bdr.csv b/application/src/test/resources/speedtest/travelSearch-expected-results-bdr.csv similarity index 100% rename from src/test/resources/speedtest/travelSearch-expected-results-bdr.csv rename to application/src/test/resources/speedtest/travelSearch-expected-results-bdr.csv diff --git a/src/test/resources/speedtest/travelSearch-expected-results-bt.csv b/application/src/test/resources/speedtest/travelSearch-expected-results-bt.csv similarity index 100% rename from src/test/resources/speedtest/travelSearch-expected-results-bt.csv rename to application/src/test/resources/speedtest/travelSearch-expected-results-bt.csv diff --git a/src/test/resources/speedtest/travelSearch-expected-results-btr.csv b/application/src/test/resources/speedtest/travelSearch-expected-results-btr.csv similarity index 100% rename from src/test/resources/speedtest/travelSearch-expected-results-btr.csv rename to application/src/test/resources/speedtest/travelSearch-expected-results-btr.csv diff --git a/src/test/resources/speedtest/travelSearch-expected-results-mc.csv b/application/src/test/resources/speedtest/travelSearch-expected-results-mc.csv similarity index 100% rename from src/test/resources/speedtest/travelSearch-expected-results-mc.csv rename to application/src/test/resources/speedtest/travelSearch-expected-results-mc.csv diff --git a/src/test/resources/speedtest/travelSearch-expected-results-md.csv b/application/src/test/resources/speedtest/travelSearch-expected-results-md.csv similarity index 100% rename from src/test/resources/speedtest/travelSearch-expected-results-md.csv rename to application/src/test/resources/speedtest/travelSearch-expected-results-md.csv diff --git a/src/test/resources/speedtest/travelSearch-expected-results-rr.csv b/application/src/test/resources/speedtest/travelSearch-expected-results-rr.csv similarity index 100% rename from src/test/resources/speedtest/travelSearch-expected-results-rr.csv rename to application/src/test/resources/speedtest/travelSearch-expected-results-rr.csv diff --git a/src/test/resources/speedtest/travelSearch-expected-results-sr.csv b/application/src/test/resources/speedtest/travelSearch-expected-results-sr.csv similarity index 100% rename from src/test/resources/speedtest/travelSearch-expected-results-sr.csv rename to application/src/test/resources/speedtest/travelSearch-expected-results-sr.csv diff --git a/src/test/resources/speedtest/travelSearch-expected-results-srr.csv b/application/src/test/resources/speedtest/travelSearch-expected-results-srr.csv similarity index 100% rename from src/test/resources/speedtest/travelSearch-expected-results-srr.csv rename to application/src/test/resources/speedtest/travelSearch-expected-results-srr.csv diff --git a/src/test/resources/speedtest/travelSearch-expected-results-tb.csv b/application/src/test/resources/speedtest/travelSearch-expected-results-tb.csv similarity index 100% rename from src/test/resources/speedtest/travelSearch-expected-results-tb.csv rename to application/src/test/resources/speedtest/travelSearch-expected-results-tb.csv diff --git a/src/test/resources/speedtest/travelSearch-expected-results-td.csv b/application/src/test/resources/speedtest/travelSearch-expected-results-td.csv similarity index 100% rename from src/test/resources/speedtest/travelSearch-expected-results-td.csv rename to application/src/test/resources/speedtest/travelSearch-expected-results-td.csv diff --git a/src/test/resources/speedtest/travelSearch-results.csv b/application/src/test/resources/speedtest/travelSearch-results.csv similarity index 100% rename from src/test/resources/speedtest/travelSearch-results.csv rename to application/src/test/resources/speedtest/travelSearch-results.csv diff --git a/src/test/resources/speedtest/travelSearch.csv b/application/src/test/resources/speedtest/travelSearch.csv similarity index 100% rename from src/test/resources/speedtest/travelSearch.csv rename to application/src/test/resources/speedtest/travelSearch.csv diff --git a/src/test/resources/standalone/config/build-config.json b/application/src/test/resources/standalone/config/build-config.json similarity index 100% rename from src/test/resources/standalone/config/build-config.json rename to application/src/test/resources/standalone/config/build-config.json diff --git a/src/test/resources/standalone/config/invalid-config.json b/application/src/test/resources/standalone/config/invalid-config.json similarity index 100% rename from src/test/resources/standalone/config/invalid-config.json rename to application/src/test/resources/standalone/config/invalid-config.json diff --git a/application/src/test/resources/standalone/config/netex-tutorial/build-config.json b/application/src/test/resources/standalone/config/netex-tutorial/build-config.json new file mode 100644 index 00000000000..467580a73a3 --- /dev/null +++ b/application/src/test/resources/standalone/config/netex-tutorial/build-config.json @@ -0,0 +1,20 @@ +{ + "transitFeeds": [ + { + "type": "netex", + "feedId": "NO", + "source": "https://storage.googleapis.com/marduk-production/outbound/netex/rb_norway-aggregated-netex.zip", + "sharedFilePattern": "_stops.xml", + "sharedGroupFilePattern": "_(\\w{3})(_flexible)?_shared_data.xml", + "groupFilePattern": "(\\w{3})_.*\\.xml" + } + ], + "osm": [ + { + "source": "norway.osm.pbf", + "osmTagMapping": "norway", + "timeZone": "Europe/Oslo" + } + ], + "osmCacheDataInMem": true +} \ No newline at end of file diff --git a/application/src/test/resources/standalone/config/netex-tutorial/router-config.json b/application/src/test/resources/standalone/config/netex-tutorial/router-config.json new file mode 100644 index 00000000000..c8f21dd527a --- /dev/null +++ b/application/src/test/resources/standalone/config/netex-tutorial/router-config.json @@ -0,0 +1,19 @@ +{ + "updaters": [ + { + "type": "siri-sx-updater", + "frequency": "1m", + "url": "https://api.entur.io/realtime/v1/services", + "feedId": "NO", + "blockReadinessUntilInitialized": true + }, + { + "type": "siri-et-updater", + "frequency": "1m", + "previewInterval": "1h30m", + "url": "https://api.entur.io/realtime/v1/services", + "feedId": "NO", + "blockReadinessUntilInitialized": true + } + ] +} \ No newline at end of file diff --git a/src/test/resources/standalone/config/router-config.json b/application/src/test/resources/standalone/config/router-config.json similarity index 98% rename from src/test/resources/standalone/config/router-config.json rename to application/src/test/resources/standalone/config/router-config.json index c526de423c1..f1eac1cb41e 100644 --- a/src/test/resources/standalone/config/router-config.json +++ b/application/src/test/resources/standalone/config/router-config.json @@ -334,12 +334,6 @@ "Authorization": "${BIKELY_AUTHORIZATION}" } }, - { - "type": "vehicle-parking", - "feedId": "noi", - "sourceType": "noi-open-data-hub", - "url": "https://parking.otp.opendatahub.com/parking/all.json" - }, { "type": "stop-time-updater", "frequency": "1m", diff --git a/src/test/resources/standalone/config/sandbox/build-config-data-overlay.json b/application/src/test/resources/standalone/config/sandbox/build-config-data-overlay.json similarity index 100% rename from src/test/resources/standalone/config/sandbox/build-config-data-overlay.json rename to application/src/test/resources/standalone/config/sandbox/build-config-data-overlay.json diff --git a/client/.env.development b/client/.env.development index 1cb7d9235e3..e3b3585a5eb 100644 --- a/client/.env.development +++ b/client/.env.development @@ -1,3 +1,3 @@ VITE_API_URL=http://localhost:8080/otp/transmodel/v3 VITE_DEBUG_STYLE_URL=http://localhost:8080/otp/routers/default/inspector/vectortile/style.json -VITE_GRAPHIQL_URL=http://localhost:8080/graphiql?flavor=transmodel \ No newline at end of file +VITE_GRAPHIQL_URL=http://localhost:8080/graphiql?flavor=transmodel diff --git a/client/package-lock.json b/client/package-lock.json index 4632899b38f..00490ce16d6 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -9,10 +9,11 @@ "version": "0.0.0", "dependencies": { "@googlemaps/polyline-codec": "1.0.28", + "@js-temporal/polyfill": "0.4.4", "bootstrap": "5.3.3", "graphql": "16.9.0", "graphql-request": "7.1.0", - "maplibre-gl": "4.6.0", + "maplibre-gl": "4.7.0", "react": "18.3.1", "react-bootstrap": "2.10.4", "react-dom": "18.3.1", @@ -24,24 +25,24 @@ "@graphql-codegen/introspection": "4.0.3", "@parcel/watcher": "2.4.1", "@testing-library/react": "16.0.1", - "@types/react": "18.3.5", + "@types/react": "18.3.7", "@types/react-dom": "18.3.0", "@typescript-eslint/eslint-plugin": "7.18.0", "@typescript-eslint/parser": "7.18.0", "@vitejs/plugin-react": "4.3.1", - "@vitest/coverage-v8": "2.0.5", - "eslint": "8.57.0", + "@vitest/coverage-v8": "2.1.1", + "eslint": "8.57.1", "eslint-config-prettier": "9.1.0", "eslint-plugin-import": "2.30.0", - "eslint-plugin-jsx-a11y": "6.9.0", - "eslint-plugin-react": "7.35.1", + "eslint-plugin-jsx-a11y": "6.10.0", + "eslint-plugin-react": "7.36.1", "eslint-plugin-react-hooks": "4.6.2", - "eslint-plugin-react-refresh": "0.4.11", + "eslint-plugin-react-refresh": "0.4.12", "jsdom": "25.0.0", "prettier": "3.3.3", - "typescript": "5.5.4", - "vite": "5.4.2", - "vitest": "2.0.5" + "typescript": "5.6.2", + "vite": "5.4.6", + "vitest": "2.1.1" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -1775,10 +1776,11 @@ } }, "node_modules/@eslint/js": { - "version": "8.57.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", - "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", + "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==", "dev": true, + "license": "MIT", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } @@ -2745,12 +2747,14 @@ } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.14", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", - "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", + "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", + "deprecated": "Use @eslint/config-array instead", "dev": true, + "license": "Apache-2.0", "dependencies": { - "@humanwhocodes/object-schema": "^2.0.2", + "@humanwhocodes/object-schema": "^2.0.3", "debug": "^4.3.1", "minimatch": "^3.0.5" }, @@ -2794,10 +2798,12 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", - "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", - "dev": true + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", + "deprecated": "Use @eslint/object-schema instead", + "dev": true, + "license": "BSD-3-Clause" }, "node_modules/@isaacs/cliui": { "version": "8.0.2", @@ -2937,10 +2943,11 @@ } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true, + "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.25", @@ -2952,6 +2959,18 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@js-temporal/polyfill": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/@js-temporal/polyfill/-/polyfill-0.4.4.tgz", + "integrity": "sha512-2X6bvghJ/JAoZO52lbgyAPFj8uCflhTo2g7nkFzEQdXd/D8rEeD4HtmTEpmtGCva260fcd66YNXBOYdnmHqSOg==", + "dependencies": { + "jsbi": "^4.3.0", + "tslib": "^2.4.1" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/@kamilkisiela/fast-url-parser": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/@kamilkisiela/fast-url-parser/-/fast-url-parser-1.1.4.tgz", @@ -3951,9 +3970,9 @@ "integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==" }, "node_modules/@types/react": { - "version": "18.3.5", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.5.tgz", - "integrity": "sha512-WeqMfGJLGuLCqHGYRGHxnKrXcTitc6L/nBUWfWPcTarG3t9PsquqUMuVeXZeca+mglY4Vo5GZjCi0A3Or2lnxA==", + "version": "18.3.7", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.7.tgz", + "integrity": "sha512-KUnDCJF5+AiZd8owLIeVHqmW9yM4sqmDVf2JRJiBMFkGvkoZ4/WyV2lL4zVsoinmRS/W3FeEdZLEWFRofnT2FQ==", "license": "MIT", "dependencies": { "@types/prop-types": "*", @@ -4232,20 +4251,20 @@ } }, "node_modules/@vitest/coverage-v8": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-2.0.5.tgz", - "integrity": "sha512-qeFcySCg5FLO2bHHSa0tAZAOnAUbp4L6/A5JDuj9+bt53JREl8hpLjLHEWF0e/gWc8INVpJaqA7+Ene2rclpZg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-2.1.1.tgz", + "integrity": "sha512-md/A7A3c42oTT8JUHSqjP5uKTWJejzUW4jalpvs+rZ27gsURsMU8DEb+8Jf8C6Kj2gwfSHJqobDNBuoqlm0cFw==", "dev": true, "license": "MIT", "dependencies": { "@ampproject/remapping": "^2.3.0", "@bcoe/v8-coverage": "^0.2.3", - "debug": "^4.3.5", + "debug": "^4.3.6", "istanbul-lib-coverage": "^3.2.2", "istanbul-lib-report": "^3.0.1", "istanbul-lib-source-maps": "^5.0.6", "istanbul-reports": "^3.1.7", - "magic-string": "^0.30.10", + "magic-string": "^0.30.11", "magicast": "^0.3.4", "std-env": "^3.7.0", "test-exclude": "^7.0.1", @@ -4255,18 +4274,24 @@ "url": "https://opencollective.com/vitest" }, "peerDependencies": { - "vitest": "2.0.5" + "@vitest/browser": "2.1.1", + "vitest": "2.1.1" + }, + "peerDependenciesMeta": { + "@vitest/browser": { + "optional": true + } } }, "node_modules/@vitest/expect": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.0.5.tgz", - "integrity": "sha512-yHZtwuP7JZivj65Gxoi8upUN2OzHTi3zVfjwdpu2WrvCZPLwsJ2Ey5ILIPccoW23dd/zQBlJ4/dhi7DWNyXCpA==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.1.tgz", + "integrity": "sha512-YeueunS0HiHiQxk+KEOnq/QMzlUuOzbU1Go+PgAsHvvv3tUkJPm9xWt+6ITNTlzsMXUjmgm5T+U7KBPK2qQV6w==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/spy": "2.0.5", - "@vitest/utils": "2.0.5", + "@vitest/spy": "2.1.1", + "@vitest/utils": "2.1.1", "chai": "^5.1.1", "tinyrainbow": "^1.2.0" }, @@ -4274,10 +4299,38 @@ "url": "https://opencollective.com/vitest" } }, + "node_modules/@vitest/mocker": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-2.1.1.tgz", + "integrity": "sha512-LNN5VwOEdJqCmJ/2XJBywB11DLlkbY0ooDJW3uRX5cZyYCrc4PI/ePX0iQhE3BiEGiQmK4GE7Q/PqCkkaiPnrA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "^2.1.0-beta.1", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.11" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@vitest/spy": "2.1.1", + "msw": "^2.3.5", + "vite": "^5.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, "node_modules/@vitest/pretty-format": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-2.0.5.tgz", - "integrity": "sha512-h8k+1oWHfwTkyTkb9egzwNMfJAEx4veaPSnMeKbVSjp4euqGSbQlm5+6VHwTr7u4FJslVVsUG5nopCaAYdOmSQ==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-2.1.1.tgz", + "integrity": "sha512-SjxPFOtuINDUW8/UkElJYQSFtnWX7tMksSGW0vfjxMneFqxVr8YJ979QpMbDW7g+BIiq88RAGDjf7en6rvLPPQ==", "dev": true, "license": "MIT", "dependencies": { @@ -4288,13 +4341,13 @@ } }, "node_modules/@vitest/runner": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-2.0.5.tgz", - "integrity": "sha512-TfRfZa6Bkk9ky4tW0z20WKXFEwwvWhRY+84CnSEtq4+3ZvDlJyY32oNTJtM7AW9ihW90tX/1Q78cb6FjoAs+ig==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-2.1.1.tgz", + "integrity": "sha512-uTPuY6PWOYitIkLPidaY5L3t0JJITdGTSwBtwMjKzo5O6RCOEncz9PUN+0pDidX8kTHYjO0EwUIvhlGpnGpxmA==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/utils": "2.0.5", + "@vitest/utils": "2.1.1", "pathe": "^1.1.2" }, "funding": { @@ -4302,14 +4355,14 @@ } }, "node_modules/@vitest/snapshot": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-2.0.5.tgz", - "integrity": "sha512-SgCPUeDFLaM0mIUHfaArq8fD2WbaXG/zVXjRupthYfYGzc8ztbFbu6dUNOblBG7XLMR1kEhS/DNnfCZ2IhdDew==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-2.1.1.tgz", + "integrity": "sha512-BnSku1WFy7r4mm96ha2FzN99AZJgpZOWrAhtQfoxjUU5YMRpq1zmHRq7a5K9/NjqonebO7iVDla+VvZS8BOWMw==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "2.0.5", - "magic-string": "^0.30.10", + "@vitest/pretty-format": "2.1.1", + "magic-string": "^0.30.11", "pathe": "^1.1.2" }, "funding": { @@ -4317,9 +4370,9 @@ } }, "node_modules/@vitest/spy": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-2.0.5.tgz", - "integrity": "sha512-c/jdthAhvJdpfVuaexSrnawxZz6pywlTPe84LUB2m/4t3rl2fTo9NFGBG4oWgaD+FTgDDV8hJ/nibT7IfH3JfA==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-2.1.1.tgz", + "integrity": "sha512-ZM39BnZ9t/xZ/nF4UwRH5il0Sw93QnZXd9NAZGRpIgj0yvVwPpLd702s/Cx955rGaMlyBQkZJ2Ir7qyY48VZ+g==", "dev": true, "license": "MIT", "dependencies": { @@ -4330,14 +4383,13 @@ } }, "node_modules/@vitest/utils": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-2.0.5.tgz", - "integrity": "sha512-d8HKbqIcya+GR67mkZbrzhS5kKhtp8dQLcmRZLGTscGVg7yImT82cIrhtn2L8+VujWcy6KZweApgNmPsTAO/UQ==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-2.1.1.tgz", + "integrity": "sha512-Y6Q9TsI+qJ2CC0ZKj6VBb+T8UPz593N113nnUykqwANqhgf3QkZeHFlusgKLTqrnVHbj/XDKZcDHol+dxVT+rQ==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "2.0.5", - "estree-walker": "^3.0.3", + "@vitest/pretty-format": "2.1.1", "loupe": "^3.1.1", "tinyrainbow": "^1.2.0" }, @@ -4761,15 +4813,25 @@ } }, "node_modules/axe-core": { - "version": "4.9.1", - "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.9.1.tgz", - "integrity": "sha512-QbUdXJVTpvUTHU7871ppZkdOLBeGUKBQWHkHrvN2V9IQWGMt61zf3B45BtzjxEJzYuj0JBjBZP/hmYS/R9pmAw==", + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.10.0.tgz", + "integrity": "sha512-Mr2ZakwQ7XUAjp7pAwQWRhhK8mQQ6JAaNWSjmjxil0R8BPioMtQsTLOolGYkji1rcL++3dCqZA3zWqpT+9Ew6g==", "dev": true, "license": "MPL-2.0", "engines": { "node": ">=4" } }, + "node_modules/axobject-query": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", + "integrity": "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/babel-plugin-syntax-trailing-function-commas": { "version": "7.0.0-beta.0", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-7.0.0-beta.0.tgz", @@ -5491,13 +5553,13 @@ "dev": true }, "node_modules/debug": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", - "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dev": true, "license": "MIT", "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -6045,16 +6107,17 @@ } }, "node_modules/eslint": { - "version": "8.57.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", - "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", + "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", "dev": true, + "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.57.0", - "@humanwhocodes/config-array": "^0.11.14", + "@eslint/js": "8.57.1", + "@humanwhocodes/config-array": "^0.13.0", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "@ungap/structured-clone": "^1.2.0", @@ -6239,9 +6302,9 @@ } }, "node_modules/eslint-plugin-jsx-a11y": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.9.0.tgz", - "integrity": "sha512-nOFOCaJG2pYqORjK19lqPqxMO/JpvdCZdPtNdxY3kvom3jTvkAbOvQvD8wuD0G8BYR0IGAGYDlzqWJOh/ybn2g==", + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.10.0.tgz", + "integrity": "sha512-ySOHvXX8eSN6zz8Bywacm7CvGNhUtdjvqfQDVe6020TUK34Cywkw7m0KsCCk1Qtm9G1FayfTN1/7mMYnYO2Bhg==", "dev": true, "license": "MIT", "dependencies": { @@ -6249,8 +6312,8 @@ "array-includes": "^3.1.8", "array.prototype.flatmap": "^1.3.2", "ast-types-flow": "^0.0.8", - "axe-core": "^4.9.1", - "axobject-query": "~3.1.1", + "axe-core": "^4.10.0", + "axobject-query": "^4.1.0", "damerau-levenshtein": "^1.0.8", "emoji-regex": "^9.2.2", "es-iterator-helpers": "^1.0.19", @@ -6266,7 +6329,7 @@ "node": ">=4.0" }, "peerDependencies": { - "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8" + "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9" } }, "node_modules/eslint-plugin-jsx-a11y/node_modules/aria-query": { @@ -6279,16 +6342,6 @@ "deep-equal": "^2.0.5" } }, - "node_modules/eslint-plugin-jsx-a11y/node_modules/axobject-query": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.1.1.tgz", - "integrity": "sha512-goKlv8DZrK9hUh975fnHzhNIO4jUnFCfv/dszV5VwUGDFjI6vQ2VwoyjYjYNEbBE8AH87TduWP5uyDR1D+Iteg==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "deep-equal": "^2.0.5" - } - }, "node_modules/eslint-plugin-jsx-a11y/node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -6314,9 +6367,9 @@ } }, "node_modules/eslint-plugin-react": { - "version": "7.35.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.35.1.tgz", - "integrity": "sha512-B5ok2JgbaaWn/zXbKCGgKDNL2tsID3Pd/c/yvjcpsd9HQDwyYc/TQv3AZMmOvrJgCs3AnYNUHRCQEMMQAYJ7Yg==", + "version": "7.36.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.36.1.tgz", + "integrity": "sha512-/qwbqNXZoq+VP30s1d4Nc1C5GTxjJQjk4Jzs4Wq2qzxFM7dSmuG2UkIjg2USMLh3A/aVcUNrK7v0J5U1XEGGwA==", "dev": true, "license": "MIT", "dependencies": { @@ -6359,9 +6412,9 @@ } }, "node_modules/eslint-plugin-react-refresh": { - "version": "0.4.11", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.11.tgz", - "integrity": "sha512-wrAKxMbVr8qhXTtIKfXqAn5SAtRZt0aXxe5P23Fh4pUAdC6XEsybGLB8P0PI4j1yYqOgUEUlzKAGDfo7rJOjcw==", + "version": "0.4.12", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.12.tgz", + "integrity": "sha512-9neVjoGv20FwYtCP6CB1dzR1vr57ZDNOXst21wd2xJ/cTlM2xLq0GWVlSNTdMn/4BtP6cHYBMCSp1wFBJ9jBsg==", "dev": true, "license": "MIT", "peerDependencies": { @@ -6456,6 +6509,7 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6466,6 +6520,7 @@ "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dev": true, + "license": "MIT", "dependencies": { "type-fest": "^0.20.2" }, @@ -6481,6 +6536,7 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, + "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" }, @@ -6493,6 +6549,7 @@ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, + "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=10" }, @@ -6569,80 +6626,6 @@ "node": ">=0.10.0" } }, - "node_modules/execa": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", - "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^8.0.1", - "human-signals": "^5.0.0", - "is-stream": "^3.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^5.1.0", - "onetime": "^6.0.0", - "signal-exit": "^4.1.0", - "strip-final-newline": "^3.0.0" - }, - "engines": { - "node": ">=16.17" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/execa/node_modules/get-stream": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", - "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", - "dev": true, - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/execa/node_modules/mimic-fn": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", - "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/execa/node_modules/onetime": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", - "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", - "dev": true, - "dependencies": { - "mimic-fn": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/execa/node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/extend-shallow": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", @@ -7486,15 +7469,6 @@ "node": ">= 14" } }, - "node_modules/human-signals": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", - "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", - "dev": true, - "engines": { - "node": ">=16.17.0" - } - }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -8037,18 +8011,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-string": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", @@ -8320,6 +8282,11 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/jsbi": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/jsbi/-/jsbi-4.3.0.tgz", + "integrity": "sha512-SnZNcinB4RIcnEyZqFPdGPVgrg2AcnykiBy0sHVJQKHYeaLUvi3Exj+iaPpLnFVkDPZIV4U0yvgC9/R4uEAZ9g==" + }, "node_modules/jsdom": { "version": "25.0.0", "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-25.0.0.tgz", @@ -8740,13 +8707,13 @@ } }, "node_modules/magic-string": { - "version": "0.30.10", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.10.tgz", - "integrity": "sha512-iIRwTIf0QKV3UAnYK4PU8uiEc4SRh5jX0mwpIwETPpHdhVM4f53RSwS/vXvN1JhGX+Cs7B8qIq3d6AH49O5fAQ==", + "version": "0.30.11", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.11.tgz", + "integrity": "sha512-+Wri9p0QHMy+545hKww7YAu5NyzF8iomPL/RQazugQ9+Ez4Ic3mERMd8ZTX5rfK944j+560ZJi8iAwgak1Ac7A==", "dev": true, "license": "MIT", "dependencies": { - "@jridgewell/sourcemap-codec": "^1.4.15" + "@jridgewell/sourcemap-codec": "^1.5.0" } }, "node_modules/magicast": { @@ -8819,9 +8786,9 @@ } }, "node_modules/maplibre-gl": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-4.6.0.tgz", - "integrity": "sha512-zobZK+fE+XM+7K81fk5pSBYWZlTGjGT0P96y2fR4DV2ry35ZBfAd0uWNatll69EgYeE+uOhN1MvEk+z1PCuyOQ==", + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-4.7.0.tgz", + "integrity": "sha512-hkt7je7NxiMQE8EpCxLWP8t6tkK6SkrMe0hIBjYd4Ar/Q7BOCILxthGmGnU993Mwmkvs2mGiXnVUSOK12DeCzg==", "license": "BSD-3-Clause", "dependencies": { "@mapbox/geojson-rewind": "^0.5.2", @@ -8865,12 +8832,6 @@ "integrity": "sha512-XdjUArbK4Bm5fLLvlm5KpTFOiOThgfWWI4axAZDWg4E/0mKdZyI9tNEfds27qCi1ze/vwTR16kvmmGhRra3c2g==", "license": "ISC" }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true - }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -8975,10 +8936,11 @@ } }, "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" }, "node_modules/murmurhash-js": { "version": "1.0.0", @@ -9100,33 +9062,6 @@ "node": ">=0.10.0" } }, - "node_modules/npm-run-path": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", - "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", - "dev": true, - "dependencies": { - "path-key": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/npm-run-path/node_modules/path-key": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", - "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/nullthrows": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/nullthrows/-/nullthrows-1.1.1.tgz", @@ -9601,9 +9536,9 @@ } }, "node_modules/picocolors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", - "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", + "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==", "dev": true, "license": "ISC" }, @@ -9629,9 +9564,9 @@ } }, "node_modules/postcss": { - "version": "8.4.41", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.41.tgz", - "integrity": "sha512-TesUflQ0WKZqAvg52PWL6kHgLKP6xB6heTOdoYM0Wt2UHyxNa4K25EZZMgKns3BH1RLVbZCREPpLY0rhnNoHVQ==", + "version": "8.4.47", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz", + "integrity": "sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==", "dev": true, "funding": [ { @@ -9650,8 +9585,8 @@ "license": "MIT", "dependencies": { "nanoid": "^3.3.7", - "picocolors": "^1.0.1", - "source-map-js": "^1.2.0" + "picocolors": "^1.1.0", + "source-map-js": "^1.2.1" }, "engines": { "node": "^10 || ^12 || >=14" @@ -10547,10 +10482,11 @@ } }, "node_modules/source-map-js": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", - "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" } @@ -10864,18 +10800,6 @@ "node": ">=4" } }, - "node_modules/strip-final-newline": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", - "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -10984,9 +10908,16 @@ "dev": true }, "node_modules/tinybench": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.8.0.tgz", - "integrity": "sha512-1/eK7zUnIklz4JUUlL+658n58XO2hHLQfSk1Zf2LKieUjxidN16eKFEoDEfjHc3ohofSSqK3X5yO6VGb6iW8Lw==", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.0.tgz", + "integrity": "sha512-tVGE0mVJPGb0chKhqmsoosjsS+qUnJVGJpZgsHYQcGoPlG3B51R3PouqTgEGH2Dc9jjFyOqOpix6ZHNMXp1FZg==", "dev": true, "license": "MIT" }, @@ -11017,9 +10948,9 @@ } }, "node_modules/tinyspy": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-3.0.0.tgz", - "integrity": "sha512-q5nmENpTHgiPVd1cJDDc9cVoYN5x4vCvwT3FMilvKPKneCBZAxn2YWQjDF0UMcE9k0Cay1gBiDfTMU0g+mPMQA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-3.0.2.tgz", + "integrity": "sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==", "dev": true, "license": "MIT", "engines": { @@ -11265,9 +11196,9 @@ } }, "node_modules/typescript": { - "version": "5.5.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", - "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", + "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", "dev": true, "license": "Apache-2.0", "bin": { @@ -11491,14 +11422,14 @@ } }, "node_modules/vite": { - "version": "5.4.2", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.2.tgz", - "integrity": "sha512-dDrQTRHp5C1fTFzcSaMxjk6vdpKvT+2/mIdE07Gw2ykehT49O0z/VHS3zZ8iV/Gh8BJJKHWOe5RjaNrW5xf/GA==", + "version": "5.4.6", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.6.tgz", + "integrity": "sha512-IeL5f8OO5nylsgzd9tq4qD2QqI0k2CQLGrWD0rCN0EQJZpBK5vJAx0I+GDkMOXxQX/OfFHMuLIx6ddAxGX/k+Q==", "dev": true, "license": "MIT", "dependencies": { "esbuild": "^0.21.3", - "postcss": "^8.4.41", + "postcss": "^8.4.43", "rollup": "^4.20.0" }, "bin": { @@ -11551,16 +11482,15 @@ } }, "node_modules/vite-node": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.0.5.tgz", - "integrity": "sha512-LdsW4pxj0Ot69FAoXZ1yTnA9bjGohr2yNBU7QKRxpz8ITSkhuDl6h3zS/tvgz4qrNjeRnvrWeXQ8ZF7Um4W00Q==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.1.1.tgz", + "integrity": "sha512-N/mGckI1suG/5wQI35XeR9rsMsPqKXzq1CdUndzVstBj/HvyxxGctwnK6WX43NGt5L3Z5tcRf83g4TITKJhPrA==", "dev": true, "license": "MIT", "dependencies": { "cac": "^6.7.14", - "debug": "^4.3.5", + "debug": "^4.3.6", "pathe": "^1.1.2", - "tinyrainbow": "^1.2.0", "vite": "^5.0.0" }, "bin": { @@ -11574,30 +11504,30 @@ } }, "node_modules/vitest": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-2.0.5.tgz", - "integrity": "sha512-8GUxONfauuIdeSl5f9GTgVEpg5BTOlplET4WEDaeY2QBiN8wSm68vxN/tb5z405OwppfoCavnwXafiaYBC/xOA==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-2.1.1.tgz", + "integrity": "sha512-97We7/VC0e9X5zBVkvt7SGQMGrRtn3KtySFQG5fpaMlS+l62eeXRQO633AYhSTC3z7IMebnPPNjGXVGNRFlxBA==", "dev": true, "license": "MIT", "dependencies": { - "@ampproject/remapping": "^2.3.0", - "@vitest/expect": "2.0.5", - "@vitest/pretty-format": "^2.0.5", - "@vitest/runner": "2.0.5", - "@vitest/snapshot": "2.0.5", - "@vitest/spy": "2.0.5", - "@vitest/utils": "2.0.5", + "@vitest/expect": "2.1.1", + "@vitest/mocker": "2.1.1", + "@vitest/pretty-format": "^2.1.1", + "@vitest/runner": "2.1.1", + "@vitest/snapshot": "2.1.1", + "@vitest/spy": "2.1.1", + "@vitest/utils": "2.1.1", "chai": "^5.1.1", - "debug": "^4.3.5", - "execa": "^8.0.1", - "magic-string": "^0.30.10", + "debug": "^4.3.6", + "magic-string": "^0.30.11", "pathe": "^1.1.2", "std-env": "^3.7.0", - "tinybench": "^2.8.0", + "tinybench": "^2.9.0", + "tinyexec": "^0.3.0", "tinypool": "^1.0.0", "tinyrainbow": "^1.2.0", "vite": "^5.0.0", - "vite-node": "2.0.5", + "vite-node": "2.1.1", "why-is-node-running": "^2.3.0" }, "bin": { @@ -11612,8 +11542,8 @@ "peerDependencies": { "@edge-runtime/vm": "*", "@types/node": "^18.0.0 || >=20.0.0", - "@vitest/browser": "2.0.5", - "@vitest/ui": "2.0.5", + "@vitest/browser": "2.1.1", + "@vitest/ui": "2.1.1", "happy-dom": "*", "jsdom": "*" }, diff --git a/client/package.json b/client/package.json index 5b26215fe5f..0e822b4a641 100644 --- a/client/package.json +++ b/client/package.json @@ -18,10 +18,11 @@ }, "dependencies": { "@googlemaps/polyline-codec": "1.0.28", + "@js-temporal/polyfill": "0.4.4", "bootstrap": "5.3.3", "graphql": "16.9.0", "graphql-request": "7.1.0", - "maplibre-gl": "4.6.0", + "maplibre-gl": "4.7.0", "react": "18.3.1", "react-bootstrap": "2.10.4", "react-dom": "18.3.1", @@ -33,23 +34,23 @@ "@graphql-codegen/introspection": "4.0.3", "@parcel/watcher": "2.4.1", "@testing-library/react": "16.0.1", - "@types/react": "18.3.5", + "@types/react": "18.3.7", "@types/react-dom": "18.3.0", "@typescript-eslint/eslint-plugin": "7.18.0", "@typescript-eslint/parser": "7.18.0", "@vitejs/plugin-react": "4.3.1", - "@vitest/coverage-v8": "2.0.5", - "eslint": "8.57.0", + "@vitest/coverage-v8": "2.1.1", + "eslint": "8.57.1", "eslint-config-prettier": "9.1.0", "eslint-plugin-import": "2.30.0", - "eslint-plugin-jsx-a11y": "6.9.0", - "eslint-plugin-react": "7.35.1", + "eslint-plugin-jsx-a11y": "6.10.0", + "eslint-plugin-react": "7.36.1", "eslint-plugin-react-hooks": "4.6.2", - "eslint-plugin-react-refresh": "0.4.11", + "eslint-plugin-react-refresh": "0.4.12", "jsdom": "25.0.0", "prettier": "3.3.3", - "typescript": "5.5.4", - "vite": "5.4.2", - "vitest": "2.0.5" + "typescript": "5.6.2", + "vite": "5.4.6", + "vitest": "2.1.1" } } diff --git a/client/src/components/ItineraryList/ItineraryHeaderContent.tsx b/client/src/components/ItineraryList/ItineraryHeaderContent.tsx index 419b7a2ebb9..fdfea81e7e4 100644 --- a/client/src/components/ItineraryList/ItineraryHeaderContent.tsx +++ b/client/src/components/ItineraryList/ItineraryHeaderContent.tsx @@ -1,8 +1,9 @@ import { TripPattern } from '../../gql/graphql.ts'; import { TIME_BOX_WIDTH, useHeaderContentStyleCalculations } from './useHeaderContentStyleCalculations.ts'; import { ItineraryHeaderLegContent } from './ItineraryHeaderLegContent.tsx'; -import { useMemo } from 'react'; +import { useContext, useMemo } from 'react'; import { formatTime } from '../../util/formatTime.ts'; +import { TimeZoneContext } from '../../hooks/TimeZoneContext.ts'; export function ItineraryHeaderContent({ tripPattern, @@ -24,14 +25,16 @@ export function ItineraryHeaderContent({ latestEndTime, ); + const timeZone = useContext(TimeZoneContext); + const formattedStartTime = useMemo( - () => formatTime(tripPattern.expectedStartTime, 'short'), - [tripPattern.expectedStartTime], + () => formatTime(tripPattern.expectedStartTime, timeZone, 'short'), + [tripPattern.expectedStartTime, timeZone], ); const formattedEndTime = useMemo( - () => formatTime(tripPattern.expectedEndTime, 'short'), - [tripPattern.expectedEndTime], + () => formatTime(tripPattern.expectedEndTime, timeZone, 'short'), + [tripPattern.expectedEndTime, timeZone], ); return ( @@ -45,6 +48,7 @@ export function ItineraryHeaderContent({ }} />

    @@ -56,6 +59,9 @@ export function ItineraryListContainer({ ))} +
    + All times in {timeZone} +
    ); } diff --git a/client/src/components/ItineraryList/ItineraryPaginationControl.tsx b/client/src/components/ItineraryList/ItineraryPaginationControl.tsx index ecc1ffd45db..bf74c83fbca 100644 --- a/client/src/components/ItineraryList/ItineraryPaginationControl.tsx +++ b/client/src/components/ItineraryList/ItineraryPaginationControl.tsx @@ -14,6 +14,8 @@ export function ItineraryPaginationControl({ return (
    {' '} -
    + ); } + export default GraphiQLRouteButton; diff --git a/client/src/components/SearchBar/ItineraryFilterDebugSelect.tsx b/client/src/components/SearchBar/ItineraryFilterDebugSelect.tsx index 636ba551541..6f479290947 100644 --- a/client/src/components/SearchBar/ItineraryFilterDebugSelect.tsx +++ b/client/src/components/SearchBar/ItineraryFilterDebugSelect.tsx @@ -11,11 +11,12 @@ export function ItineraryFilterDebugSelect({ return ( - Itinerary filter debug + Filter debug { setTripQueryVariables({ ...tripQueryVariables, diff --git a/client/src/components/SearchBar/LocationInputField.tsx b/client/src/components/SearchBar/LocationInputField.tsx index ffa66702e81..bfa707776f1 100644 --- a/client/src/components/SearchBar/LocationInputField.tsx +++ b/client/src/components/SearchBar/LocationInputField.tsx @@ -13,6 +13,7 @@ export function LocationInputField({ location, id, label }: { location: Location id={id} size="sm" placeholder="[Click in map]" + className="input-medium" // Intentionally empty for now, but needed because of // https://react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable onChange={() => {}} diff --git a/client/src/components/SearchBar/NumTripPatternsInput.tsx b/client/src/components/SearchBar/NumTripPatternsInput.tsx index b77e70adb81..360ce1c2c73 100644 --- a/client/src/components/SearchBar/NumTripPatternsInput.tsx +++ b/client/src/components/SearchBar/NumTripPatternsInput.tsx @@ -11,7 +11,7 @@ export function NumTripPatternsInput({ return ( - Number of trip patterns + Num. results setTripQueryVariables({ diff --git a/client/src/components/SearchBar/SearchBar.tsx b/client/src/components/SearchBar/SearchBar.tsx index dfcbc6ac36e..7b1ee58b902 100644 --- a/client/src/components/SearchBar/SearchBar.tsx +++ b/client/src/components/SearchBar/SearchBar.tsx @@ -1,9 +1,8 @@ -import { Button, Spinner } from 'react-bootstrap'; +import { Button, ButtonGroup, Spinner } from 'react-bootstrap'; import { ServerInfo, TripQueryVariables } from '../../gql/graphql.ts'; import { LocationInputField } from './LocationInputField.tsx'; import { DepartureArrivalSelect } from './DepartureArrivalSelect.tsx'; -import { TimeInputField } from './TimeInputField.tsx'; -import { DateInputField } from './DateInputField.tsx'; +import { DateTimeInputField } from './DateTimeInputField.tsx'; import { SearchWindowInput } from './SearchWindowInput.tsx'; import { AccessSelect } from './AccessSelect.tsx'; import { EgressSelect } from './EgressSelect.tsx'; @@ -16,6 +15,7 @@ import { ServerInfoTooltip } from './ServerInfoTooltip.tsx'; import { useRef, useState } from 'react'; import logo from '../../static/img/otp-logo.svg'; import GraphiQLRouteButton from './GraphiQLRouteButton.tsx'; +import WheelchairAccessibleCheckBox from './WheelchairAccessibleCheckBox.tsx'; type SearchBarProps = { onRoute: () => void; @@ -40,8 +40,7 @@ export function SearchBar({ onRoute, tripQueryVariables, setTripQueryVariables, - - + @@ -52,17 +51,24 @@ export function SearchBar({ onRoute, tripQueryVariables, setTripQueryVariables, tripQueryVariables={tripQueryVariables} setTripQueryVariables={setTripQueryVariables} /> + +
    - + + + +
    -
    ); } diff --git a/client/src/components/SearchBar/SearchWindowInput.tsx b/client/src/components/SearchBar/SearchWindowInput.tsx index 5442784de8e..a04a08bed04 100644 --- a/client/src/components/SearchBar/SearchWindowInput.tsx +++ b/client/src/components/SearchBar/SearchWindowInput.tsx @@ -19,6 +19,7 @@ export function SearchWindowInput({ size="sm" placeholder="(in minutes)" min={1} + className="input-small" value={tripQueryVariables.searchWindow || ''} onChange={(event) => setTripQueryVariables({ diff --git a/client/src/components/SearchBar/TimeInputField.tsx b/client/src/components/SearchBar/TimeInputField.tsx deleted file mode 100644 index 71bb7325340..00000000000 --- a/client/src/components/SearchBar/TimeInputField.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { Form } from 'react-bootstrap'; -import { TripQueryVariables } from '../../gql/graphql.ts'; -import { ChangeEvent, useCallback, useMemo } from 'react'; - -export function TimeInputField({ - tripQueryVariables, - setTripQueryVariables, -}: { - tripQueryVariables: TripQueryVariables; - setTripQueryVariables: (tripQueryVariables: TripQueryVariables) => void; -}) { - const current = useMemo( - () => new Date(tripQueryVariables.dateTime).toTimeString().split(' ')[0], - [tripQueryVariables.dateTime], - ); - - const onChange = useCallback( - (event: ChangeEvent) => { - const timeComponents = event.target.value.split(':'); - const newDate = new Date(tripQueryVariables.dateTime); - newDate.setHours(Number(timeComponents[0]), Number(timeComponents[1]), Number(timeComponents[2])); - - setTripQueryVariables({ - ...tripQueryVariables, - dateTime: newDate.toISOString(), - }); - }, - [tripQueryVariables, setTripQueryVariables], - ); - - return ( - - - Time - - - - ); -} diff --git a/client/src/components/SearchBar/WheelchairAccessibleCheckBox.tsx b/client/src/components/SearchBar/WheelchairAccessibleCheckBox.tsx new file mode 100644 index 00000000000..b677e19049f --- /dev/null +++ b/client/src/components/SearchBar/WheelchairAccessibleCheckBox.tsx @@ -0,0 +1,35 @@ +import { Form } from 'react-bootstrap'; +import wheelchairIcon from '../../static/img/wheelchair.svg'; +import { TripQueryVariables } from '../../gql/graphql.ts'; + +export default function WheelchairAccessibleCheckBox({ + tripQueryVariables, + setTripQueryVariables, +}: { + tripQueryVariables: TripQueryVariables; + setTripQueryVariables: (tripQueryVariables: TripQueryVariables) => void; +}) { + return ( + + + Wheelchair Accessible Trip + + { + setTripQueryVariables({ + ...tripQueryVariables, + wheelchairAccessible: e.target.checked, + }); + }} + > + + ); +} diff --git a/client/src/hooks/TimeZoneContext.ts b/client/src/hooks/TimeZoneContext.ts new file mode 100644 index 00000000000..6a40921ebae --- /dev/null +++ b/client/src/hooks/TimeZoneContext.ts @@ -0,0 +1,3 @@ +import { createContext } from 'react'; + +export const TimeZoneContext = createContext('UTC'); diff --git a/client/src/hooks/useServerInfo.ts b/client/src/hooks/useServerInfo.ts index 23ee23fc283..117c1357360 100644 --- a/client/src/hooks/useServerInfo.ts +++ b/client/src/hooks/useServerInfo.ts @@ -13,6 +13,7 @@ const query = graphql(` routerConfigVersion gitCommit gitBranch + internalTransitModelTimeZone } } `); diff --git a/client/src/screens/App.tsx b/client/src/screens/App.tsx index 3e5744e5ad6..1b6b86b7a81 100644 --- a/client/src/screens/App.tsx +++ b/client/src/screens/App.tsx @@ -6,39 +6,43 @@ import { useState } from 'react'; import { useTripQuery } from '../hooks/useTripQuery.ts'; import { useServerInfo } from '../hooks/useServerInfo.ts'; import { useTripQueryVariables } from '../hooks/useTripQueryVariables.ts'; +import { TimeZoneContext } from '../hooks/TimeZoneContext.ts'; export function App() { + const serverInfo = useServerInfo(); const { tripQueryVariables, setTripQueryVariables } = useTripQueryVariables(); const [tripQueryResult, loading, callback] = useTripQuery(tripQueryVariables); - const serverInfo = useServerInfo(); const [selectedTripPatternIndex, setSelectedTripPatternIndex] = useState(0); + const timeZone = serverInfo?.internalTransitModelTimeZone || Intl.DateTimeFormat().resolvedOptions().timeZone; return (
    - - - - - + - + + + + + +
    ); } diff --git a/client/src/static/img/graphql-solid.svg b/client/src/static/img/graphql-solid.svg new file mode 100644 index 00000000000..32d6e5e0f00 --- /dev/null +++ b/client/src/static/img/graphql-solid.svg @@ -0,0 +1,4 @@ + + + + diff --git a/client/src/static/img/graphql.svg b/client/src/static/img/graphql.svg new file mode 100644 index 00000000000..ef85915ffaa --- /dev/null +++ b/client/src/static/img/graphql.svg @@ -0,0 +1,4 @@ + + + + diff --git a/client/src/static/img/wheelchair.svg b/client/src/static/img/wheelchair.svg new file mode 100644 index 00000000000..d8cf96ca995 --- /dev/null +++ b/client/src/static/img/wheelchair.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/client/src/static/query/tripQuery.tsx b/client/src/static/query/tripQuery.tsx index ccb19dc745e..57cca5d4056 100644 --- a/client/src/static/query/tripQuery.tsx +++ b/client/src/static/query/tripQuery.tsx @@ -11,6 +11,7 @@ export const query = graphql(` $searchWindow: Int $modes: Modes $itineraryFiltersDebug: ItineraryFilterDebugProfile + $wheelchairAccessible: Boolean $pageCursor: String ) { trip( @@ -22,6 +23,7 @@ export const query = graphql(` searchWindow: $searchWindow modes: $modes itineraryFilters: { debug: $itineraryFiltersDebug } + wheelchairAccessible: $wheelchairAccessible pageCursor: $pageCursor ) { previousPageCursor @@ -64,6 +66,9 @@ export const query = graphql(` publicCode name id + presentation { + colour + } } authority { name diff --git a/client/src/style.css b/client/src/style.css index 1a24ac2c072..86310fd857d 100644 --- a/client/src/style.css +++ b/client/src/style.css @@ -7,7 +7,7 @@ margin-right: 14px; } -@media (min-width: 2160px) { +@media (min-width: 1895px) { .top-content { height: 75px; } @@ -17,7 +17,7 @@ } } -@media (max-width: 2159px) { +@media (max-width: 1896px) { .top-content { height: 150px; } @@ -50,16 +50,34 @@ margin-right: 1rem; } +.search-bar input.input-small { + max-width: 100px; +} + +.search-bar input.input-medium { + max-width: 130px; +} + .search-bar-route-button-wrapper { height: 5rem; padding-top: 25px; } +.search-bar-route-button-wrapper a.btn img { + margin-top: -2px; +} + .itinerary-list-container { width: 36rem; overflow-y: auto; } +.itinerary-list-container .time-zone-info { + margin: 10px 20px; + font-size: 12px; + text-align: right; +} + .itinerary-header-wrapper { position: relative; background: #0a53be; diff --git a/client/src/util/formatTime.ts b/client/src/util/formatTime.ts index 1849640fe3f..1818ced5cd1 100644 --- a/client/src/util/formatTime.ts +++ b/client/src/util/formatTime.ts @@ -4,10 +4,11 @@ * If style argument is provided formatted with ('medium') or without ('short') seconds, * otherwise seconds are shown if not 0. */ -export function formatTime(dateTime: string, style?: 'short' | 'medium') { +export function formatTime(dateTime: string, timeZone: string, style?: 'short' | 'medium') { const parsed = new Date(dateTime); return parsed.toLocaleTimeString('en-US', { timeStyle: style ? style : parsed.getSeconds() === 0 ? 'short' : 'medium', hourCycle: 'h24', + timeZone: timeZone, }); } diff --git a/client/src/util/getColorForMode.ts b/client/src/util/getColorForLeg.ts similarity index 64% rename from client/src/util/getColorForMode.ts rename to client/src/util/getColorForLeg.ts index cb1ad8b6981..ecb8cbc1676 100644 --- a/client/src/util/getColorForMode.ts +++ b/client/src/util/getColorForLeg.ts @@ -1,6 +1,6 @@ -import { Mode } from '../gql/graphql.ts'; +import { Leg, Mode } from '../gql/graphql.ts'; -export const getColorForMode = function (mode: Mode) { +const getColorForMode = function (mode: Mode) { if (mode === Mode.Foot) return '#191616'; if (mode === Mode.Bicycle) return '#5076D9'; if (mode === Mode.Scooter) return '#253664'; @@ -19,3 +19,14 @@ export const getColorForMode = function (mode: Mode) { if (mode === Mode.Taxi) return '#81304C'; return '#aaa'; }; + +/** + * Extract a line color from a leg. If there isn't one given by its line, this method returns a fallback color. + */ +export const getColorForLeg = function (leg: Leg) { + if (leg.line?.presentation?.colour) { + return `#${leg.line.presentation.colour}`; + } else { + return getColorForMode(leg.mode); + } +}; diff --git a/doc/dev/decisionrecords/Codestyle.md b/doc/dev/decisionrecords/Codestyle.md index f9ffc1a9056..146063bbeef 100644 --- a/doc/dev/decisionrecords/Codestyle.md +++ b/doc/dev/decisionrecords/Codestyle.md @@ -115,30 +115,29 @@ The provided formatter will group class members in this order: 2. Overridden methods are kept together 3. Dependent methods are sorted in a breadth-first order. 4. Members are sorted like this: - 1. `static` `final` fields - 2. `static` fields - 3. `static` initializer - 4. `final` fields - 5. fields - 6. class initializer (avoid using it) - 7. Constructor - 8. `static` methods - 9. `static` getter and setters - 10. methods - 11. getter and setters - 12. enums - 13. interfaces - 14. `static` classes - 15. classes -5. Each section of members are sorted by visibility: - 1. ´public´ - 2. package private - 3. ´protected´ - 4. ´private´ + 1. `static` `final` fields (constants) + 2. `static` fields (avoid) + 3. instance fields + 4. static initializer + 5. class initializer + 6. constructor + 7. `static` factory methods + 8. `public` methods + 9. getter and setters + 8. `private`/package methods + 10. `private` enums (avoid `public`) + 11. interfaces + 12. `private static` classes (avoid `public`) + 13. instance classes (avoid) ### JavaDoc Guidlines -What to put in Javadoc: +As a matter of [policy](http://github.com/opentripplanner/OpenTripPlanner/issues/93), all new +methods, classes, and fields should include comments explaining what they are for and any other +pertinent information. For Java code, the comments should follow industry standards. It is best to +provide comments that not only explain *what* you did but also *why you did it* while providing some +context. Please avoid including trivial Javadoc or the empty Javadoc stubs added by IDEs, such as +`@param` annotations with no description. - On methods: - Side effects on instance state (is it a pure function) diff --git a/doc/templates/BuildConfiguration.md b/doc/templates/BuildConfiguration.md index 7e768e30eb1..77b03dae500 100644 --- a/doc/templates/BuildConfiguration.md +++ b/doc/templates/BuildConfiguration.md @@ -2,7 +2,7 @@ NOTE! Part of this document is generated. Make sure you edit the template, not the generated doc. - Template directory is: /doc/templates - - Generated directory is: /docs + - Generated directory is: /doc/user --> # Graph Build Configuration diff --git a/doc/templates/Configuration.md b/doc/templates/Configuration.md index 6f6f4fc9960..45b2c36c67b 100644 --- a/doc/templates/Configuration.md +++ b/doc/templates/Configuration.md @@ -2,7 +2,7 @@ NOTE! Part of this document is generated. Make sure you edit the template, not the generated doc. - Template directory is: /doc/templates - - Generated directory is: /docs + - Generated directory is: /doc/user --> # Configuring OpenTripPlanner diff --git a/doc/templates/GraphQL-Tutorial.md b/doc/templates/GraphQL-Tutorial.md index 11a2e304119..2a78be65cc2 100644 --- a/doc/templates/GraphQL-Tutorial.md +++ b/doc/templates/GraphQL-Tutorial.md @@ -2,7 +2,7 @@ NOTE! Part of this document is generated. Make sure you edit the template, not the generated doc. - Template directory is: /doc/templates - - Generated directory is: /docs + - Generated directory is: /doc/user --> # GraphQL tutorial diff --git a/doc/templates/Netex-Tutorial.md b/doc/templates/Netex-Tutorial.md new file mode 100644 index 00000000000..2afa997ee73 --- /dev/null +++ b/doc/templates/Netex-Tutorial.md @@ -0,0 +1,80 @@ +# NeTEx & SIRI tutorial + +One important new feature of OTP2 is the ability to +load [NeTEx](https://en.wikipedia.org/wiki/NeTEx) and [SIRI](https://en.wikipedia.org/wiki/Service_Interface_for_Real_Time_Information) +data. NeTEx is a European [specification for transit data exchange](http://netex-cen.eu), comparable in purpose to +GTFS but broader in scope. + +First of all, you need to download a [bundled jar of OTP](Getting-OTP.md). + +Secondly, you will use the [Norwegian NeTEx file](https://developer.entur.org/pages-intro-files) as +well as the [Norwegian OSM data](http://download.geofabrik.de/europe/norway.html), but OTP can download the NeTEx one for you. + +## Configuring the build + +Create a working directory and place the OTP jar file in it and call it `otp.jar.` + +Since we download the OSM data from a free source, we don't want to put undue stress on the server. +Therefore we download it before building the graph, not during. + +``` +curl https://download.geofabrik.de/europe/norway-latest.osm.pbf -o norway.osm.pbf +``` + +Now create a file called `build-config.json` in the same folder and fill it with the following +content: + + + +Note the special section specifying how to find NeTEx XML files within the single ZIP archive that +OTP downloads. + +Now you can instruct OTP to build a graph from this configuration file: + +`java -Xmx16G -jar otp.jar --build --save .` + +This should produce a file `graph.obj` in the same directory as your `build-config.json`. + +Building the Norway graph requires downloading about 250MB of input data so stay patient at the beginning +particularly on a slow internet connection. +The actual build takes approximately 10 minutes (without elevation data, as is configured above), +and can be done within 16GB of heap memory (JVM switch `-Xmx16G`). The Graph file it produces is +about 1.1 GB. The server will take about 30 seconds to load this graph and start up, and will +consume about 6GB of heap memory under light use. + +You can then start up an OTP server with a command like this: + +`java -Xmx6G -jar otp.jar --load .` + +Once the server is started up, go to `http://localhost:8080` in a browser to try out your server +using OTP's built in testing web client. Try some long trips like Oslo to Bergen and see if you can +get long distance trains and flights as alternatives. You might need to increase the walking limit +above its very low default value. + +## Adding SIRI real time Data + +Another important feature in OTP version 2 is the ability to +use [SIRI real-time data](https://en.wikipedia.org/wiki/Service_Interface_for_Real_Time_Information). +Within the EU data standards, SIRI is analogous to GTFS-RT: a way to apply real-time updates on top +of schedule data. While technically a distinct specification from NeTEx, both NeTEx and SIRI use the +Transmodel vocabulary, allowing SIRI messages to reference entities in NeTEx schedule data. Like +GTFS-RT, SIRI is consumed by OTP2 using "graph updaters" which are configured in +the `router-config.json` file, which is placed in the same directory as the `graph.obj` file and +loaded at server startup. + + + +After saving the file in the working directory, restart OTP. + +The updaters fetch two different kinds of SIRI data: + +- Situation Exchange (SX, text notices analogous to GTFS-RT Alerts) +- Estimated Timetable (ET, predicted arrival times analogous to GTFS-RT TripUpdates) + +These updaters can handle differential updates, but they use a polling approach rather than the +message-oriented streaming approach of the GTFS-RT Websocket updater. The server keeps track of +clients, sending only the things that have changed since the last polling operation. + +Note that between these SIRI updaters and the GTFS-RT Websocket updater, we now have both polling +and streaming examples of GTFS-RT "incrementality" semantics, so should be able to finalize that +part of the specification. \ No newline at end of file diff --git a/doc/templates/RouteRequest.md b/doc/templates/RouteRequest.md index a452e1d1480..9b7cd6fd58f 100644 --- a/doc/templates/RouteRequest.md +++ b/doc/templates/RouteRequest.md @@ -2,7 +2,7 @@ NOTE! Part of this document is generated. Make sure you edit the template, not the generated doc. - Template directory is: /doc/templates - - Generated directory is: /docs + - Generated directory is: /doc/user --> # Route Request diff --git a/doc/templates/RouterConfiguration.md b/doc/templates/RouterConfiguration.md index b6c6ccf9c4b..87e4c1693cc 100644 --- a/doc/templates/RouterConfiguration.md +++ b/doc/templates/RouterConfiguration.md @@ -2,7 +2,7 @@ NOTE! Part of this document is generated. Make sure you edit the template, not the generated doc. - Template directory is: /doc/templates - - Generated directory is: /docs + - Generated directory is: /doc/user --> # Router configuration diff --git a/doc/templates/StopConsolidation.md b/doc/templates/StopConsolidation.md index 6817ee47d4c..70866882bd1 100644 --- a/doc/templates/StopConsolidation.md +++ b/doc/templates/StopConsolidation.md @@ -2,7 +2,7 @@ NOTE! Part of this document is generated. Make sure you edit the template, not the generated doc. - Template directory is: /doc/templates - - Generated directory is: /docs + - Generated directory is: /doc/user --> # Stop consolidation diff --git a/doc/templates/UpdaterConfig.md b/doc/templates/UpdaterConfig.md index 440cd96f733..aab5631e6e2 100644 --- a/doc/templates/UpdaterConfig.md +++ b/doc/templates/UpdaterConfig.md @@ -2,7 +2,7 @@ NOTE! Part of this document is generated. Make sure you edit the template, not the generated doc. - Template directory is: /doc/templates - - Generated directory is: /docs + - Generated directory is: /doc/user --> diff --git a/doc/templates/VehicleParking.md b/doc/templates/VehicleParking.md index 721cbc2657a..0eb561248a1 100644 --- a/doc/templates/VehicleParking.md +++ b/doc/templates/VehicleParking.md @@ -3,7 +3,7 @@ ## Contact Info - For HSL Park and Ride updater: Digitransit team, HSL, Helsinki, Finland -- For Bikely, NOI and Bikeep updater: Leonard Ehrenfried, [mail@leonard.io](mailto:mail@leonard.io) +- For Bikely, Bikeep and SIRI-FM updater: Leonard Ehrenfried, [mail@leonard.io](mailto:mail@leonard.io) ## Documentation @@ -16,7 +16,7 @@ Currently contains the following updaters: - [HSL Park and Ride](https://p.hsl.fi/docs/index.html) - [ParkAPI](https://github.com/offenesdresden/ParkAPI) - [Bikely](https://www.safebikely.com/) -- [NOI Open Data Hub](https://opendatahub.com/) +- SIRI-FM ### Configuration @@ -40,10 +40,6 @@ All updaters have the following parameters in common: -## NOI Open Data Hub - - - ## Bikeep diff --git a/doc/user/BuildConfiguration.md b/doc/user/BuildConfiguration.md index b311991120e..f5281db0f4e 100644 --- a/doc/user/BuildConfiguration.md +++ b/doc/user/BuildConfiguration.md @@ -2,7 +2,7 @@ NOTE! Part of this document is generated. Make sure you edit the template, not the generated doc. - Template directory is: /doc/templates - - Generated directory is: /docs + - Generated directory is: /doc/user --> # Graph Build Configuration @@ -17,102 +17,103 @@ Sections follow that describe particular settings in more depth. -| Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | -|--------------------------------------------------------------------------|:-----------:|----------------------------------------------------------------------------------------------------------------------------------------------------------------|:----------:|-----------------------------------|:-----:| -| [areaVisibility](#areaVisibility) | `boolean` | Perform visibility calculations. | *Optional* | `false` | 1.5 | -| [buildReportDir](#buildReportDir) | `uri` | URI to the directory where the graph build report should be written to. | *Optional* | | 2.0 | -| [configVersion](#configVersion) | `string` | Deployment version of the *build-config.json*. | *Optional* | | 2.1 | -| [dataImportReport](#dataImportReport) | `boolean` | Generate nice HTML report of Graph errors/warnings | *Optional* | `false` | 2.0 | -| [distanceBetweenElevationSamples](#distanceBetweenElevationSamples) | `double` | The distance between elevation samples in meters. | *Optional* | `10.0` | 2.0 | -| embedRouterConfig | `boolean` | Embed the Router config in the graph, which allows it to be sent to a server fully configured over the wire. | *Optional* | `true` | 2.0 | -| [graph](#graph) | `uri` | URI to the graph object file for reading and writing. | *Optional* | | 2.0 | -| [gsCredentials](#gsCredentials) | `string` | Local file system path to Google Cloud Platform service accounts credentials file. | *Optional* | | 2.0 | -| [includeEllipsoidToGeoidDifference](#includeEllipsoidToGeoidDifference) | `boolean` | Include the Ellipsoid to Geoid difference in the calculations of every point along every StreetWithElevationEdge. | *Optional* | `false` | 2.0 | -| maxAreaNodes | `integer` | Visibility calculations for an area will not be done if there are more nodes than this limit. | *Optional* | `150` | 2.1 | -| [maxDataImportIssuesPerFile](#maxDataImportIssuesPerFile) | `integer` | When to split the import report. | *Optional* | `1000` | 2.0 | -| maxElevationPropagationMeters | `integer` | The maximum distance to propagate elevation to vertices which have no elevation. | *Optional* | `2000` | 1.5 | -| [maxStopToShapeSnapDistance](#maxStopToShapeSnapDistance) | `double` | Maximum distance between route shapes and their stops. | *Optional* | `150.0` | 2.1 | -| maxTransferDuration | `duration` | Transfers up to this duration with the default walk speed value will be pre-calculated and included in the Graph. | *Optional* | `"PT30M"` | 2.1 | -| [multiThreadElevationCalculations](#multiThreadElevationCalculations) | `boolean` | Configuring multi-threading during elevation calculations. | *Optional* | `false` | 2.0 | -| [osmCacheDataInMem](#osmCacheDataInMem) | `boolean` | If OSM data should be cached in memory during processing. | *Optional* | `false` | 2.0 | -| [osmNaming](#osmNaming) | `enum` | A custom OSM namer to use. | *Optional* | `"default"` | 1.5 | -| platformEntriesLinking | `boolean` | Link unconnected entries to public transport platforms. | *Optional* | `false` | 2.0 | -| [readCachedElevations](#readCachedElevations) | `boolean` | Whether to read cached elevation data. | *Optional* | `true` | 2.0 | -| staticBikeParkAndRide | `boolean` | Whether we should create bike P+R stations from OSM data. | *Optional* | `false` | 1.5 | -| staticParkAndRide | `boolean` | Whether we should create car P+R stations from OSM data. | *Optional* | `true` | 1.5 | -| stopConsolidationFile | `uri` | Name of the CSV-formatted file in the build directory which contains the configuration for stop consolidation. | *Optional* | | 2.5 | -| [streetGraph](#streetGraph) | `uri` | URI to the street graph object file for reading and writing. | *Optional* | | 2.0 | -| [subwayAccessTime](#subwayAccessTime) | `double` | Minutes necessary to reach stops served by trips on routes of route_type=1 (subway) from the street. | *Optional* | `2.0` | 1.5 | -| [transitModelTimeZone](#transitModelTimeZone) | `time-zone` | Time zone for the graph. | *Optional* | | 2.2 | -| [transitServiceEnd](#transitServiceEnd) | `duration` | Limit the import of transit services to the given end date. | *Optional* | `"P3Y"` | 2.0 | -| [transitServiceStart](#transitServiceStart) | `duration` | Limit the import of transit services to the given START date. | *Optional* | `"-P1Y"` | 2.0 | -| [writeCachedElevations](#writeCachedElevations) | `boolean` | Reusing elevation data from previous builds | *Optional* | `false` | 2.0 | -| [boardingLocationTags](#boardingLocationTags) | `string[]` | What OSM tags should be looked on for the source of matching stops to platforms and stops. | *Optional* | | 2.2 | -| [dataOverlay](sandbox/DataOverlay.md) | `object` | Config for the DataOverlay Sandbox module | *Optional* | | 2.2 | -| [dem](#dem) | `object[]` | Specify parameters for DEM extracts. | *Optional* | | 2.2 | -|       [elevationUnitMultiplier](#dem_0_elevationUnitMultiplier) | `double` | Specify a multiplier to convert elevation units from source to meters. Overrides the value specified in `demDefaults`. | *Optional* | `1.0` | 2.3 | -|       source | `uri` | The unique URI pointing to the data file. | *Required* | | 2.2 | -| demDefaults | `object` | Default properties for DEM extracts. | *Optional* | | 2.3 | -|    [elevationUnitMultiplier](#demDefaults_elevationUnitMultiplier) | `double` | Specify a multiplier to convert elevation units from source to meters. | *Optional* | `1.0` | 2.3 | -| [elevationBucket](#elevationBucket) | `object` | Used to download NED elevation tiles from the given AWS S3 bucket. | *Optional* | | na | -| [emissions](sandbox/Emissions.md) | `object` | Emissions configuration. | *Optional* | | 2.5 | -| [fares](sandbox/Fares.md) | `object` | Fare configuration. | *Optional* | | 2.0 | -| gtfsDefaults | `object` | The gtfsDefaults section allows you to specify default properties for GTFS files. | *Optional* | | 2.3 | -|    blockBasedInterlining | `boolean` | Whether to create stay-seated transfers in between two trips with the same block id. | *Optional* | `true` | 2.3 | -|    [discardMinTransferTimes](#gd_discardMinTransferTimes) | `boolean` | Should minimum transfer times in GTFS files be discarded. | *Optional* | `false` | 2.3 | -|    maxInterlineDistance | `integer` | Maximal distance between stops in meters that will connect consecutive trips that are made with same vehicle. | *Optional* | `200` | 2.3 | -|    removeRepeatedStops | `boolean` | Should consecutive identical stops be merged into one stop time entry. | *Optional* | `true` | 2.3 | -|    [stationTransferPreference](#gd_stationTransferPreference) | `enum` | Should there be some preference or aversion for transfers at stops that are part of a station. | *Optional* | `"allowed"` | 2.3 | -| islandPruning | `object` | Settings for fixing street graph connectivity errors | *Optional* | | 2.3 | -|    [adaptivePruningDistance](#islandPruning_adaptivePruningDistance) | `integer` | Search distance for analyzing islands in pruning. | *Optional* | `250` | 2.3 | -|    [adaptivePruningFactor](#islandPruning_adaptivePruningFactor) | `double` | Defines how much pruning thresholds grow maximally by distance. | *Optional* | `50.0` | 2.3 | -|    [islandWithStopsMaxSize](#islandPruning_islandWithStopsMaxSize) | `integer` | When a graph island with stops in it should be pruned. | *Optional* | `2` | 2.3 | -|    [islandWithoutStopsMaxSize](#islandPruning_islandWithoutStopsMaxSize) | `integer` | When a graph island without stops should be pruned. | *Optional* | `10` | 2.3 | -| [localFileNamePatterns](#localFileNamePatterns) | `object` | Patterns for matching OTP file types in the base directory | *Optional* | | 2.0 | -|    [dem](#lfp_dem) | `regexp` | Pattern for matching elevation DEM files. | *Optional* | `"(?i)\.tiff?$"` | 2.0 | -|    [gtfs](#lfp_gtfs) | `regexp` | Patterns for matching GTFS zip-files or directories. | *Optional* | `"(?i)gtfs"` | 2.0 | -|    [netex](#lfp_netex) | `regexp` | Patterns for matching NeTEx zip files or directories. | *Optional* | `"(?i)netex"` | 2.0 | -|    [osm](#lfp_osm) | `regexp` | Pattern for matching Open Street Map input files. | *Optional* | `"(?i)(\.pbf¦\.osm¦\.osm\.xml)$"` | 2.0 | -| netexDefaults | `object` | The netexDefaults section allows you to specify default properties for NeTEx files. | *Optional* | | 2.2 | -|    feedId | `string` | This field is used to identify the specific NeTEx feed. It is used instead of the feed_id field in GTFS file feed_info.txt. | *Optional* | `"NETEX"` | 2.2 | -|    [groupFilePattern](#nd_groupFilePattern) | `regexp` | Pattern for matching group NeTEx files. | *Optional* | `"(\w{3})-.*\.xml"` | 2.0 | -|    ignoreFareFrame | `boolean` | Ignore contents of the FareFrame | *Optional* | `false` | 2.3 | -|    [ignoreFilePattern](#nd_ignoreFilePattern) | `regexp` | Pattern for matching ignored files in a NeTEx bundle. | *Optional* | `"$^"` | 2.0 | -|    ignoreParking | `boolean` | Ignore Parking elements. | *Optional* | `true` | 2.6 | -|    noTransfersOnIsolatedStops | `boolean` | Whether we should allow transfers to and from StopPlaces marked with LimitedUse.ISOLATED | *Optional* | `false` | 2.2 | -|    [sharedFilePattern](#nd_sharedFilePattern) | `regexp` | Pattern for matching shared NeTEx files in a NeTEx bundle. | *Optional* | `"shared-data\.xml"` | 2.0 | -|    [sharedGroupFilePattern](#nd_sharedGroupFilePattern) | `regexp` | Pattern for matching shared group NeTEx files in a NeTEx bundle. | *Optional* | `"(\w{3})-.*-shared\.xml"` | 2.0 | -|    [ferryIdsNotAllowedForBicycle](#nd_ferryIdsNotAllowedForBicycle) | `string[]` | List ferries which do not allow bikes. | *Optional* | | 2.0 | -| [osm](#osm) | `object[]` | Configure properties for a given OpenStreetMap feed. | *Optional* | | 2.2 | -|       [osmTagMapping](#osm_0_osmTagMapping) | `enum` | The named set of mapping rules applied when parsing OSM tags. Overrides the value specified in `osmDefaults`. | *Optional* | `"default"` | 2.2 | -|       source | `uri` | The unique URI pointing to the data file. | *Required* | | 2.2 | -|       timeZone | `time-zone` | The timezone used to resolve opening hours in OSM data. Overrides the value specified in `osmDefaults`. | *Optional* | | 2.2 | -| osmDefaults | `object` | Default properties for OpenStreetMap feeds. | *Optional* | | 2.2 | -|    [osmTagMapping](#od_osmTagMapping) | `enum` | The named set of mapping rules applied when parsing OSM tags. | *Optional* | `"default"` | 2.2 | -|    timeZone | `time-zone` | The timezone used to resolve opening hours in OSM data. | *Optional* | | 2.2 | -| [transferRequests](RouteRequest.md) | `object[]` | Routing requests to use for pre-calculating stop-to-stop transfers. | *Optional* | | 2.1 | -| [transitFeeds](#transitFeeds) | `object[]` | Scan for transit data files | *Optional* | | 2.2 | -|    { object } | `object` | Nested object in array. The object type is determined by the parameters. | *Optional* | | 2.2 | -|       type = "gtfs" | `enum` | The feed input format. | *Required* | | 2.2 | -|       blockBasedInterlining | `boolean` | Whether to create stay-seated transfers in between two trips with the same block id. Overrides the value specified in `gtfsDefaults`. | *Optional* | `true` | 2.3 | -|       [discardMinTransferTimes](#tf_0_discardMinTransferTimes) | `boolean` | Should minimum transfer times in GTFS files be discarded. Overrides the value specified in `gtfsDefaults`. | *Optional* | `false` | 2.3 | -|       feedId | `string` | The unique ID for this feed. This overrides any feed ID defined within the feed itself. | *Optional* | | 2.2 | -|       maxInterlineDistance | `integer` | Maximal distance between stops in meters that will connect consecutive trips that are made with same vehicle. Overrides the value specified in `gtfsDefaults`. | *Optional* | `200` | 2.3 | -|       removeRepeatedStops | `boolean` | Should consecutive identical stops be merged into one stop time entry. Overrides the value specified in `gtfsDefaults`. | *Optional* | `true` | 2.3 | -|       source | `uri` | The unique URI pointing to the data file. | *Required* | | 2.2 | -|       [stationTransferPreference](#tf_0_stationTransferPreference) | `enum` | Should there be some preference or aversion for transfers at stops that are part of a station. Overrides the value specified in `gtfsDefaults`. | *Optional* | `"allowed"` | 2.3 | -|    { object } | `object` | Nested object in array. The object type is determined by the parameters. | *Optional* | | 2.2 | -|       type = "netex" | `enum` | The feed input format. | *Required* | | 2.2 | -|       feedId | `string` | This field is used to identify the specific NeTEx feed. It is used instead of the feed_id field in GTFS file feed_info.txt. | *Required* | | 2.2 | -|       [groupFilePattern](#tf_1_groupFilePattern) | `regexp` | Pattern for matching group NeTEx files. | *Optional* | `"(\w{3})-.*\.xml"` | 2.0 | -|       ignoreFareFrame | `boolean` | Ignore contents of the FareFrame | *Optional* | `false` | 2.3 | -|       [ignoreFilePattern](#tf_1_ignoreFilePattern) | `regexp` | Pattern for matching ignored files in a NeTEx bundle. | *Optional* | `"$^"` | 2.0 | -|       ignoreParking | `boolean` | Ignore Parking elements. | *Optional* | `true` | 2.6 | -|       noTransfersOnIsolatedStops | `boolean` | Whether we should allow transfers to and from StopPlaces marked with LimitedUse.ISOLATED | *Optional* | `false` | 2.2 | -|       [sharedFilePattern](#tf_1_sharedFilePattern) | `regexp` | Pattern for matching shared NeTEx files in a NeTEx bundle. | *Optional* | `"shared-data\.xml"` | 2.0 | -|       [sharedGroupFilePattern](#tf_1_sharedGroupFilePattern) | `regexp` | Pattern for matching shared group NeTEx files in a NeTEx bundle. | *Optional* | `"(\w{3})-.*-shared\.xml"` | 2.0 | -|       source | `uri` | The unique URI pointing to the data file. | *Required* | | 2.2 | -|       [ferryIdsNotAllowedForBicycle](#tf_1_ferryIdsNotAllowedForBicycle) | `string[]` | List ferries which do not allow bikes. | *Optional* | | 2.0 | +| Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | +|--------------------------------------------------------------------------|:------------------:|----------------------------------------------------------------------------------------------------------------------------------------------------------------|:----------:|-----------------------------------|:-----:| +| [areaVisibility](#areaVisibility) | `boolean` | Perform visibility calculations. | *Optional* | `false` | 1.5 | +| [buildReportDir](#buildReportDir) | `uri` | URI to the directory where the graph build report should be written to. | *Optional* | | 2.0 | +| [configVersion](#configVersion) | `string` | Deployment version of the *build-config.json*. | *Optional* | | 2.1 | +| [dataImportReport](#dataImportReport) | `boolean` | Generate nice HTML report of Graph errors/warnings | *Optional* | `false` | 2.0 | +| [distanceBetweenElevationSamples](#distanceBetweenElevationSamples) | `double` | The distance between elevation samples in meters. | *Optional* | `10.0` | 2.0 | +| embedRouterConfig | `boolean` | Embed the Router config in the graph, which allows it to be sent to a server fully configured over the wire. | *Optional* | `true` | 2.0 | +| [graph](#graph) | `uri` | URI to the graph object file for reading and writing. | *Optional* | | 2.0 | +| [gsCredentials](#gsCredentials) | `string` | Local file system path to Google Cloud Platform service accounts credentials file. | *Optional* | | 2.0 | +| [includeEllipsoidToGeoidDifference](#includeEllipsoidToGeoidDifference) | `boolean` | Include the Ellipsoid to Geoid difference in the calculations of every point along every StreetWithElevationEdge. | *Optional* | `false` | 2.0 | +| maxAreaNodes | `integer` | Visibility calculations for an area will not be done if there are more nodes than this limit. | *Optional* | `150` | 2.1 | +| [maxDataImportIssuesPerFile](#maxDataImportIssuesPerFile) | `integer` | When to split the import report. | *Optional* | `1000` | 2.0 | +| maxElevationPropagationMeters | `integer` | The maximum distance to propagate elevation to vertices which have no elevation. | *Optional* | `2000` | 1.5 | +| [maxStopToShapeSnapDistance](#maxStopToShapeSnapDistance) | `double` | Maximum distance between route shapes and their stops. | *Optional* | `150.0` | 2.1 | +| maxTransferDuration | `duration` | Transfers up to this duration with the default walk speed value will be pre-calculated and included in the Graph. | *Optional* | `"PT30M"` | 2.1 | +| [multiThreadElevationCalculations](#multiThreadElevationCalculations) | `boolean` | Configuring multi-threading during elevation calculations. | *Optional* | `false` | 2.0 | +| [osmCacheDataInMem](#osmCacheDataInMem) | `boolean` | If OSM data should be cached in memory during processing. | *Optional* | `false` | 2.0 | +| [osmNaming](#osmNaming) | `enum` | A custom OSM namer to use. | *Optional* | `"default"` | 1.5 | +| platformEntriesLinking | `boolean` | Link unconnected entries to public transport platforms. | *Optional* | `false` | 2.0 | +| [readCachedElevations](#readCachedElevations) | `boolean` | Whether to read cached elevation data. | *Optional* | `true` | 2.0 | +| staticBikeParkAndRide | `boolean` | Whether we should create bike P+R stations from OSM data. | *Optional* | `false` | 1.5 | +| staticParkAndRide | `boolean` | Whether we should create car P+R stations from OSM data. | *Optional* | `true` | 1.5 | +| stopConsolidationFile | `uri` | Name of the CSV-formatted file in the build directory which contains the configuration for stop consolidation. | *Optional* | | 2.5 | +| [streetGraph](#streetGraph) | `uri` | URI to the street graph object file for reading and writing. | *Optional* | | 2.0 | +| [subwayAccessTime](#subwayAccessTime) | `double` | Minutes necessary to reach stops served by trips on routes of route_type=1 (subway) from the street. | *Optional* | `2.0` | 1.5 | +| [transitModelTimeZone](#transitModelTimeZone) | `time-zone` | Time zone for the graph. | *Optional* | | 2.2 | +| [transitServiceEnd](#transitServiceEnd) | `duration` | Limit the import of transit services to the given end date. | *Optional* | `"P3Y"` | 2.0 | +| [transitServiceStart](#transitServiceStart) | `duration` | Limit the import of transit services to the given START date. | *Optional* | `"-P1Y"` | 2.0 | +| [writeCachedElevations](#writeCachedElevations) | `boolean` | Reusing elevation data from previous builds | *Optional* | `false` | 2.0 | +| [boardingLocationTags](#boardingLocationTags) | `string[]` | What OSM tags should be looked on for the source of matching stops to platforms and stops. | *Optional* | | 2.2 | +| [dataOverlay](sandbox/DataOverlay.md) | `object` | Config for the DataOverlay Sandbox module | *Optional* | | 2.2 | +| [dem](#dem) | `object[]` | Specify parameters for DEM extracts. | *Optional* | | 2.2 | +|       [elevationUnitMultiplier](#dem_0_elevationUnitMultiplier) | `double` | Specify a multiplier to convert elevation units from source to meters. Overrides the value specified in `demDefaults`. | *Optional* | `1.0` | 2.3 | +|       source | `uri` | The unique URI pointing to the data file. | *Required* | | 2.2 | +| demDefaults | `object` | Default properties for DEM extracts. | *Optional* | | 2.3 | +|    [elevationUnitMultiplier](#demDefaults_elevationUnitMultiplier) | `double` | Specify a multiplier to convert elevation units from source to meters. | *Optional* | `1.0` | 2.3 | +| [elevationBucket](#elevationBucket) | `object` | Used to download NED elevation tiles from the given AWS S3 bucket. | *Optional* | | na | +| [emissions](sandbox/Emissions.md) | `object` | Emissions configuration. | *Optional* | | 2.5 | +| [fares](sandbox/Fares.md) | `object` | Fare configuration. | *Optional* | | 2.0 | +| gtfsDefaults | `object` | The gtfsDefaults section allows you to specify default properties for GTFS files. | *Optional* | | 2.3 | +|    blockBasedInterlining | `boolean` | Whether to create stay-seated transfers in between two trips with the same block id. | *Optional* | `true` | 2.3 | +|    [discardMinTransferTimes](#gd_discardMinTransferTimes) | `boolean` | Should minimum transfer times in GTFS files be discarded. | *Optional* | `false` | 2.3 | +|    maxInterlineDistance | `integer` | Maximal distance between stops in meters that will connect consecutive trips that are made with same vehicle. | *Optional* | `200` | 2.3 | +|    removeRepeatedStops | `boolean` | Should consecutive identical stops be merged into one stop time entry. | *Optional* | `true` | 2.3 | +|    [stationTransferPreference](#gd_stationTransferPreference) | `enum` | Should there be some preference or aversion for transfers at stops that are part of a station. | *Optional* | `"allowed"` | 2.3 | +| islandPruning | `object` | Settings for fixing street graph connectivity errors | *Optional* | | 2.3 | +|    [adaptivePruningDistance](#islandPruning_adaptivePruningDistance) | `integer` | Search distance for analyzing islands in pruning. | *Optional* | `250` | 2.3 | +|    [adaptivePruningFactor](#islandPruning_adaptivePruningFactor) | `double` | Defines how much pruning thresholds grow maximally by distance. | *Optional* | `50.0` | 2.3 | +|    [islandWithStopsMaxSize](#islandPruning_islandWithStopsMaxSize) | `integer` | When a graph island with stops in it should be pruned. | *Optional* | `2` | 2.3 | +|    [islandWithoutStopsMaxSize](#islandPruning_islandWithoutStopsMaxSize) | `integer` | When a graph island without stops should be pruned. | *Optional* | `10` | 2.3 | +| [localFileNamePatterns](#localFileNamePatterns) | `object` | Patterns for matching OTP file types in the base directory | *Optional* | | 2.0 | +|    [dem](#lfp_dem) | `regexp` | Pattern for matching elevation DEM files. | *Optional* | `"(?i)\.tiff?$"` | 2.0 | +|    [gtfs](#lfp_gtfs) | `regexp` | Patterns for matching GTFS zip-files or directories. | *Optional* | `"(?i)gtfs"` | 2.0 | +|    [netex](#lfp_netex) | `regexp` | Patterns for matching NeTEx zip files or directories. | *Optional* | `"(?i)netex"` | 2.0 | +|    [osm](#lfp_osm) | `regexp` | Pattern for matching Open Street Map input files. | *Optional* | `"(?i)(\.pbf¦\.osm¦\.osm\.xml)$"` | 2.0 | +| netexDefaults | `object` | The netexDefaults section allows you to specify default properties for NeTEx files. | *Optional* | | 2.2 | +|    feedId | `string` | This field is used to identify the specific NeTEx feed. It is used instead of the feed_id field in GTFS file feed_info.txt. | *Optional* | `"NETEX"` | 2.2 | +|    [groupFilePattern](#nd_groupFilePattern) | `regexp` | Pattern for matching group NeTEx files. | *Optional* | `"(\w{3})-.*\.xml"` | 2.0 | +|    ignoreFareFrame | `boolean` | Ignore contents of the FareFrame | *Optional* | `false` | 2.3 | +|    [ignoreFilePattern](#nd_ignoreFilePattern) | `regexp` | Pattern for matching ignored files in a NeTEx bundle. | *Optional* | `"$^"` | 2.0 | +|    ignoreParking | `boolean` | Ignore Parking elements. | *Optional* | `true` | 2.6 | +|    noTransfersOnIsolatedStops | `boolean` | Whether we should allow transfers to and from StopPlaces marked with LimitedUse.ISOLATED | *Optional* | `false` | 2.2 | +|    [sharedFilePattern](#nd_sharedFilePattern) | `regexp` | Pattern for matching shared NeTEx files in a NeTEx bundle. | *Optional* | `"shared-data\.xml"` | 2.0 | +|    [sharedGroupFilePattern](#nd_sharedGroupFilePattern) | `regexp` | Pattern for matching shared group NeTEx files in a NeTEx bundle. | *Optional* | `"(\w{3})-.*-shared\.xml"` | 2.0 | +|    [ferryIdsNotAllowedForBicycle](#nd_ferryIdsNotAllowedForBicycle) | `string[]` | List ferries which do not allow bikes. | *Optional* | | 2.0 | +| [osm](#osm) | `object[]` | Configure properties for a given OpenStreetMap feed. | *Optional* | | 2.2 | +|       [osmTagMapping](#osm_0_osmTagMapping) | `enum` | The named set of mapping rules applied when parsing OSM tags. Overrides the value specified in `osmDefaults`. | *Optional* | `"default"` | 2.2 | +|       source | `uri` | The unique URI pointing to the data file. | *Required* | | 2.2 | +|       timeZone | `time-zone` | The timezone used to resolve opening hours in OSM data. Overrides the value specified in `osmDefaults`. | *Optional* | | 2.2 | +| osmDefaults | `object` | Default properties for OpenStreetMap feeds. | *Optional* | | 2.2 | +|    [osmTagMapping](#od_osmTagMapping) | `enum` | The named set of mapping rules applied when parsing OSM tags. | *Optional* | `"default"` | 2.2 | +|    timeZone | `time-zone` | The timezone used to resolve opening hours in OSM data. | *Optional* | | 2.2 | +| [transferRequests](RouteRequest.md) | `object[]` | Routing requests to use for pre-calculating stop-to-stop transfers. | *Optional* | | 2.1 | +| [transitFeeds](#transitFeeds) | `object[]` | Scan for transit data files | *Optional* | | 2.2 | +|    { object } | `object` | Nested object in array. The object type is determined by the parameters. | *Optional* | | 2.2 | +|       type = "gtfs" | `enum` | The feed input format. | *Required* | | 2.2 | +|       blockBasedInterlining | `boolean` | Whether to create stay-seated transfers in between two trips with the same block id. Overrides the value specified in `gtfsDefaults`. | *Optional* | `true` | 2.3 | +|       [discardMinTransferTimes](#tf_0_discardMinTransferTimes) | `boolean` | Should minimum transfer times in GTFS files be discarded. Overrides the value specified in `gtfsDefaults`. | *Optional* | `false` | 2.3 | +|       feedId | `string` | The unique ID for this feed. This overrides any feed ID defined within the feed itself. | *Optional* | | 2.2 | +|       maxInterlineDistance | `integer` | Maximal distance between stops in meters that will connect consecutive trips that are made with same vehicle. Overrides the value specified in `gtfsDefaults`. | *Optional* | `200` | 2.3 | +|       removeRepeatedStops | `boolean` | Should consecutive identical stops be merged into one stop time entry. Overrides the value specified in `gtfsDefaults`. | *Optional* | `true` | 2.3 | +|       source | `uri` | The unique URI pointing to the data file. | *Required* | | 2.2 | +|       [stationTransferPreference](#tf_0_stationTransferPreference) | `enum` | Should there be some preference or aversion for transfers at stops that are part of a station. Overrides the value specified in `gtfsDefaults`. | *Optional* | `"allowed"` | 2.3 | +|    { object } | `object` | Nested object in array. The object type is determined by the parameters. | *Optional* | | 2.2 | +|       type = "netex" | `enum` | The feed input format. | *Required* | | 2.2 | +|       feedId | `string` | This field is used to identify the specific NeTEx feed. It is used instead of the feed_id field in GTFS file feed_info.txt. | *Required* | | 2.2 | +|       [groupFilePattern](#tf_1_groupFilePattern) | `regexp` | Pattern for matching group NeTEx files. | *Optional* | `"(\w{3})-.*\.xml"` | 2.0 | +|       ignoreFareFrame | `boolean` | Ignore contents of the FareFrame | *Optional* | `false` | 2.3 | +|       [ignoreFilePattern](#tf_1_ignoreFilePattern) | `regexp` | Pattern for matching ignored files in a NeTEx bundle. | *Optional* | `"$^"` | 2.0 | +|       ignoreParking | `boolean` | Ignore Parking elements. | *Optional* | `true` | 2.6 | +|       noTransfersOnIsolatedStops | `boolean` | Whether we should allow transfers to and from StopPlaces marked with LimitedUse.ISOLATED | *Optional* | `false` | 2.2 | +|       [sharedFilePattern](#tf_1_sharedFilePattern) | `regexp` | Pattern for matching shared NeTEx files in a NeTEx bundle. | *Optional* | `"shared-data\.xml"` | 2.0 | +|       [sharedGroupFilePattern](#tf_1_sharedGroupFilePattern) | `regexp` | Pattern for matching shared group NeTEx files in a NeTEx bundle. | *Optional* | `"(\w{3})-.*-shared\.xml"` | 2.0 | +|       source | `uri` | The unique URI pointing to the data file. | *Required* | | 2.2 | +|       [ferryIdsNotAllowedForBicycle](#tf_1_ferryIdsNotAllowedForBicycle) | `string[]` | List ferries which do not allow bikes. | *Optional* | | 2.0 | +| [transitRouteToStationCentroid](#transitRouteToStationCentroid) | `feed-scoped-id[]` | List stations that should route to centroid. | *Optional* | | 2.7 | @@ -1067,6 +1068,26 @@ For this reason we allow bicycles on ferries by default and allow to override th case where this is not the case. +

    transitRouteToStationCentroid

    + +**Since version:** `2.7` ∙ **Type:** `feed-scoped-id[]` ∙ **Cardinality:** `Optional` +**Path:** / + +List stations that should route to centroid. + +This field contains a list of station ids for which street legs will start/end at the station +centroid instead of the child stops. + +When searching from/to a station the default behaviour is to route from/to any of the stations child +stops. This can cause strange results for stations that have stops spread over a large area. + +For some stations you might instead wish to use the centroid of the station as the +origin/destination. In this case the centroid will be used both for direct street search and for +access/egress street search where the station is used as the start/end of the access/egress. But +transit that starts/ends at the station will work as usual without any additional street leg from/to +the centroid. + + diff --git a/doc/user/Changelog.md b/doc/user/Changelog.md index 2bdee72c6e0..b654916e8fd 100644 --- a/doc/user/Changelog.md +++ b/doc/user/Changelog.md @@ -3,6 +3,21 @@ The changelog lists most feature changes between each release. The list is automatically created based on merged pull requests. Search GitHub issues and pull requests for smaller issues. +## 2.7.0-SNAPSHOT (under development) + +- Extra leg when transferring at the same stop [#5984](https://github.com/opentripplanner/OpenTripPlanner/pull/5984) +- Filter vector tiles stops by current service week [#6003](https://github.com/opentripplanner/OpenTripPlanner/pull/6003) +- Add a matcher API for filters in the transit service used for datedServiceJourneyQuery [#5713](https://github.com/opentripplanner/OpenTripPlanner/pull/5713) +- Refetch transit leg with a leg query of GTFS GraphQL API [#6045](https://github.com/opentripplanner/OpenTripPlanner/pull/6045) +- Remove deprecated support for GTFS flex stop areas [#6074](https://github.com/opentripplanner/OpenTripPlanner/pull/6074) +- Don't use elevation data directly for ways with cutting=*, location=underground or indoor=yes tags in the default mapper [#6093](https://github.com/opentripplanner/OpenTripPlanner/pull/6093) +- Un-deprecate GTFS API's `planConnection`, deprecate `plan` [#6110](https://github.com/opentripplanner/OpenTripPlanner/pull/6110) +- Support for routing to Station centroid instead of child stops [#6047](https://github.com/opentripplanner/OpenTripPlanner/pull/6047) +- Add via to the Transmodel trip query and make a proper Raptor implementation for it [#6084](https://github.com/opentripplanner/OpenTripPlanner/pull/6084) +- Fix GTFS-Flex duration offset and factor parsing when only one of them is set [#6138](https://github.com/opentripplanner/OpenTripPlanner/pull/6138) +- Fix arrive by filtering for on-street/flex itineraries [#6050](https://github.com/opentripplanner/OpenTripPlanner/pull/6050) +[](AUTOMATIC_CHANGELOG_PLACEHOLDER_DO_NOT_REMOVE) + ## 2.6.0 (2024-09-18) ### Notable Changes diff --git a/doc/user/Configuration.md b/doc/user/Configuration.md index 832784d977b..bca974f8617 100644 --- a/doc/user/Configuration.md +++ b/doc/user/Configuration.md @@ -2,7 +2,7 @@ NOTE! Part of this document is generated. Make sure you edit the template, not the generated doc. - Template directory is: /doc/templates - - Generated directory is: /docs + - Generated directory is: /doc/user --> # Configuring OpenTripPlanner @@ -226,6 +226,7 @@ Here is a list of all features which can be toggled on/off and their default val | `APIUpdaterStatus` | Enable endpoint for graph updaters status. | ✓️ | | | `ConsiderPatternsForDirectTransfers` | Enable limiting transfers so that there is only a single transfer to each pattern. | ✓️ | | | `DebugUi` | Enable the debug GraphQL client and web UI and located at the root of the web server as well as the debug map tiles it uses. Be aware that the map tiles are not a stable API and can change without notice. Use the [vector tiles feature if](sandbox/MapboxVectorTilesApi.md) you want a stable map tiles API. | ✓️ | | +| `ExtraTransferLegOnSameStop` | Should there be a transfer leg when transferring on the very same stop. Note that for in-seat/interlined transfers no transfer leg will be generated. | | | | `FloatingBike` | Enable floating bike routing. | ✓️ | | | `GtfsGraphQlApi` | Enable the [GTFS GraphQL API](apis/GTFS-GraphQL-API.md). | ✓️ | | | `GtfsGraphQlApiRentalStationFuzzyMatching` | Does vehicleRentalStation query also allow ids that are not feed scoped. | | | diff --git a/doc/user/Container-Image.md b/doc/user/Container-Image.md index ed2441f5ac1..0c2a03b2b0f 100644 --- a/doc/user/Container-Image.md +++ b/doc/user/Container-Image.md @@ -20,9 +20,15 @@ curl -L https://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf -o be # download GTFS curl -L https://vbb.de/vbbgtfs -o berlin/vbb-gtfs.zip # build graph and save it onto the host system via the volume -docker run --rm -v "$(pwd)/berlin:/var/opentripplanner" docker.io/opentripplanner/opentripplanner:latest --build --save +docker run --rm \ + -e JAVA_TOOL_OPTIONS='-Xmx8g' \ + -v "$(pwd)/berlin:/var/opentripplanner" \ + docker.io/opentripplanner/opentripplanner:latest --build --save # load and serve graph -docker run -it --rm -p 8080:8080 -v "$(pwd)/berlin:/var/opentripplanner" docker.io/opentripplanner/opentripplanner:latest --load --serve +docker run -it --rm -p 8080:8080 \ + -e JAVA_TOOL_OPTIONS='-Xmx8g' \ + -v "$(pwd)/berlin:/var/opentripplanner" \ + docker.io/opentripplanner/opentripplanner:latest --load --serve ``` Now open [http://localhost:8080](http://localhost:8080) to see your running OTP instance. diff --git a/doc/user/Developers-Guide.md b/doc/user/Developers-Guide.md index 368a12edb62..f5633ff17b1 100644 --- a/doc/user/Developers-Guide.md +++ b/doc/user/Developers-Guide.md @@ -56,7 +56,7 @@ There are several ways to get involved: * Join the [Gitter chat room](https://gitter.im/opentripplanner/OpenTripPlanner) and the [user mailing list](http://groups.google.com/group/opentripplanner-users). -* Fix typos and improve the documentation within the `/docs` directory of the project (details +* Fix typos and improve the documentation within the `/doc/user` directory of the project (details below). * [File a bug or new feature request](http://github.com/openplans/OpenTripPlanner/issues/new). @@ -106,16 +106,6 @@ standards: 2. Strip out any unneeded information by using the `osmium filter-tags` as describe in [Preparing OSM](Preparing-OSM.md) -### Code Comments - -As a matter of [policy](http://github.com/opentripplanner/OpenTripPlanner/issues/93), all new -methods, classes, and fields should include comments explaining what they are for and any other -pertinent information. For Java code, the comments should use the -[JavaDoc conventions](http://java.sun.com/j2se/javadoc/writingdoccomments). It is best to provide -comments that not only explain *what* you did but also *why you did it* while providing some -context. Please avoid including trivial Javadoc or the empty Javadoc stubs added by IDEs, such as -`@param` annotations with no description. - ### Itinerary and API Snapshot Tests To test the itinerary generation, and the API there are snapshot test which save the result of the @@ -133,7 +123,7 @@ control to be applied to documentation as well as program source code. All pull how OTP is used or configured should include changes to the documentation alongside code modifications. -The documentation files are in Markdown format and are in the `/docs` directory under the root of +The documentation files are in Markdown format and are in the `/doc/user` directory under the root of the project. On every push to the `dev-2.x` branch the documentation will be rebuilt and deployed as static pages to our subdomain of [Github Pages](https://github.com/opentripplanner/docs). MkDocs is a Python program and should run on any major platform. @@ -143,7 +133,7 @@ how to generate a live local preview of the documentation while you're writing i In short: ``` -$ pip install -r docs/requirements.txt +$ pip install -r doc/user/requirements.txt $ mkdocs serve ``` @@ -205,7 +195,8 @@ so they are a bit easier to maintain that way. The primary audience is also acti that have the code checked out locally. - [Architecture](https://github.com/opentripplanner/OpenTripPlanner/blob/dev-2.x/ARCHITECTURE.md) - - [Code Conventions](https://github.com/opentripplanner/OpenTripPlanner/blob/dev-2.x/CODE_CONVENTIONS.md) + - [Code Style](https://github.com/opentripplanner/OpenTripPlanner/blob/dev-2.x/doc/dev/decisionrecords/Codestyle.md) + - [Naming Conventions](https://github.com/opentripplanner/OpenTripPlanner/blob/dev-2.x/doc/dev/decisionrecords/NamingConventions.md) - [Development Decision Records](https://github.com/opentripplanner/OpenTripPlanner/blob/dev-2.x/DEVELOPMENT_DECISION_RECORDS.md) diff --git a/doc/user/Frontends.md b/doc/user/Frontends.md index b2f0b9d0b2e..8bb32273149 100644 --- a/doc/user/Frontends.md +++ b/doc/user/Frontends.md @@ -56,14 +56,16 @@ specified in terms of latitude and longitude coordinates. The debug frontend and Many different production OTP frontends exist. Any number of agencies and consultancies may have built new frontends, whether in Javascript or as native mobile apps, without the OpenTripPlanner development team even being aware of them. That said, there are two main Javascript-based web user interfaces that are generally recommended by members of the OTP development team who also work on professional, public-facing OpenTripPlanner deployments: + - The [Digitransit UI](https://github.com/HSLdevcom/digitransit-ui), part of the Finnish Digitransit project. - The [OpenTripPlanner React UI](https://github.com/opentripplanner/otp-react-redux), developed and maintained by [Arcadis IBI](https://www.ibigroup.com)'s [transit routing team](https://www.ibigroup.com/ibi-products/transit-routing/). **Digitransit** is an open-source public transportation project, originally created in Finland to replace existing nationwide and regional journey planning solutions in 2014. Digitransit has since been used around the world in other projects, for example in Germany. It is a joint project of Helsinki Regional Transport Authority (HSL), Fintraffic, and Waltti Solutions. **Arcadis IBI** has for several years actively developed, deployed, and maintained instances of the React-based OTP UI, systematically contributing their improvements back to the original repositories under the OpenTripPlanner organization: -- https://github.com/opentripplanner/otp-ui -- https://github.com/opentripplanner/otp-react-redux + +- [https://github.com/opentripplanner/otp-ui](https://github.com/opentripplanner/otp-ui) +- [https://github.com/opentripplanner/otp-react-redux](https://github.com/opentripplanner/otp-react-redux) Both major frontend projects mentioned above support internationalization and have several translations already available. diff --git a/doc/user/Netex-Norway.md b/doc/user/Netex-Norway.md deleted file mode 100644 index 0a447237592..00000000000 --- a/doc/user/Netex-Norway.md +++ /dev/null @@ -1,148 +0,0 @@ -# Using European Data Standards - -## Building with Netex Data - -One important new feature of OTP2 is the ability to -load [Netex](https://en.wikipedia.org/wiki/NeTEx) data. Netex is a -European [specification for transit data exchange](http://netex-cen.eu), comparable in purpose to -GTFS but broader in scope. An EU directive aims to have all EU countries sharing Netex data by the -end of 2019. - -Different countries are currently using different incompatible "profiles" of Netex, but an effort is -underway to converge on a single European standard profile. This is based in large part on the -Norwegian profile, and Norway's national passenger information and ticketing agency Entur has -contributed the OTP2 Netex loading code. Therefore if you'd like to try loading Netex data, Norway -is a good place to start. - -The Norwegian Netex data can be downloaded from -the [Entur developer pages](https://developer.entur.org/pages-intro-files). There is a column of -Netex download links partway down the page, and the first row is for all of Norway. - -Full OSM data for Norway can be downloaded from -the [Geofabrik Norway downloads page](http://download.geofabrik.de/europe/norway.html). Get -the `norway-latest.osm.pbf` file, which can then be filtered to remove buildings and other unused -data before loading into OTP using a command like the one below. This filtering step can be skipped -if you don't have the necessary Osmium tools installed. - -`osmium tags-filter norway-latest.osm.pbf w/highway w/public_transport=platform w/railway=platform w/park_ride=yes r/type=restriction -o norway-filtered.osm.pbf -f pbf,add_metadata=false,pbf_dense_nodes=true` - -Be sure to move the original unfiltered file out of your graph inputs directory (or rename it with a -suffix like `norway-latest.osm.pbf.ignore`) otherwise OTP2 will try to include both the filtered and -unfiltered OSM data in your graph. - -The `build-config.json` for a Norwegian graph using Netex data looks like this: - -```json -{ - "areaVisibility": true, - "platformEntriesLinking": true, - "islandWithoutStopsMaxSize": 5, - "islandWithStopsMaxSize": 5, - "dataImportReport": true, - "netexDefaults" : { - "moduleFilePattern" : ".*-netex\\.zip", - "sharedFilePattern": "_stops.xml", - "sharedGroupFilePattern": "_(\\w{3})(_flexible)?_shared_data.xml", - "groupFilePattern": "(\\w{3})_.*\\.xml", - "feedId": "EN", - "ferryIdsNotAllowedForBicycle": [ - "NYC:Line:1", - "NYC:Line:012fc5c4-131b-4dfc-8160-4e49136e531a", - "NYC:Line:8bfef12a-ac98-4376-8a2a-eb5a336d107b" - ] - }, - "osm": [ - { - "source": "norway-latest.osm.pbf", - "osmTagMapping": "norway", - "timeZone": "Europe/Oslo" - } - ] -} -``` - -Note the special section specifying how to find Netex XML files within the single ZIP archive you -downloaded. - -Once you have the graph inputs (the OSM PBF file, the Netex ZIP file, and the `build-config.json`) -saved together in a directory, you can instruct OTP2 to build a graph from these inputs: - -`java -Xmx10G otp2.jar --build --save /path/to/graph/inputs` - -This should produce a file `graph.obj` in the same directory as your inputs. Building this Norway -graph takes approximately 16 minutes (without elevation data, as configured above), and can be done -within 10GB of heap memory (JVM switch `-Xmx10G`). Increasing that to 12 or 14GB might speed it up a -bit if you have the space. The Graph file it produces is just under 600MB. The server will take -about 30 seconds to load this Graph and start up, and will consume about 4GB of heap memory under -light use. - -You can then start up an OTP server with a command like this: - -`java -Xmx6G otp2.jar --load /path/to/graph` - -Once the server is started up, go to `http://localhost:8080` in a browser to try out your server -using OTP's built in testing web client. Try some long trips like Oslo to Bergen and see if you can -get long distance trains and flights as alternatives. You might need to increase the walking limit -above its very low default value. - -## Adding SIRI Real-time Data - -Another important feature in OTP2 is the ability to -use [SIRI real-time data](https://en.wikipedia.org/wiki/Service_Interface_for_Real_Time_Information). -Within the EU data standards, SIRI is analogous to GTFS-RT: a way to apply real-time updates on top -of schedule data. While technically a distinct specification from Netex, both Netex and SIRI use the -Transmodel vocabulary, allowing SIRI messages to reference entities in Netex schedule data. Like -GTFS-RT, SIRI is consumed by OTP2 using "graph updaters" which are configured in -the `router-config.json` file, which is placed in the same directory as the `graph.obj` file and -loaded at server startup. - -```json -{ - "updaters": [ - { - "type": "siri-sx-updater", - "frequency": "1m", - "url": "https://api.example.com/siri", - "feedId": "siri-sx", - "blockReadinessUntilInitialized": true - }, - { - "type": "siri-et-updater", - "frequency": "20s", - "previewIntervalMinutes": 180, - "url": "https://api.example.com/siri", - "feedId": "siri-et", - "blockReadinessUntilInitialized": true - }, - { - "type": "siri-vm-updater", - "frequency": "1m", - "url": "https://api.example.com/siri", - "feedId": "siri-vm", - "blockReadinessUntilInitialized": true - }, - { - "type": "raptor-transit-layer", - "updateIntervalSeconds": 20 - } - ] -} -``` - -The first three updaters fetch three different kinds of SIRI data: - -- Situation Exchange (SX, text notices analogous to GTFS-RT Alerts) -- Estimated Timetable (ET, predicted arrival times analogous to GTFS-RT TripUpdates) -- Vehicle Monitoring (VM, location and status of vehicles analogous to GTFS-RT VehiclePositions) - -These updaters can handle differential updates, but they use a polling approach rather than the -message-oriented streaming approach of the GTFS-RT Websocket updater. The server keeps track of -clients, sending only the things that have changed since the last polling operation. - -Note that between these SIRI updaters and the GTFS-RT Websocket updater, we now have both polling -and streaming examples of GTFS-RT "incrementality" semantics, so should be able to finalize that -part of the specification. - -The final updater regularly performs a copy of the real-time data into a format suitable for use by -OTP2's new Raptor router. Without this updater the real-time data will be received and cataloged, but -not visible to the router. diff --git a/doc/user/Netex-Tutorial.md b/doc/user/Netex-Tutorial.md new file mode 100644 index 00000000000..3021f9c9674 --- /dev/null +++ b/doc/user/Netex-Tutorial.md @@ -0,0 +1,133 @@ +# NeTEx & SIRI tutorial + +One important new feature of OTP2 is the ability to +load [NeTEx](https://en.wikipedia.org/wiki/NeTEx) and [SIRI](https://en.wikipedia.org/wiki/Service_Interface_for_Real_Time_Information) +data. NeTEx is a European [specification for transit data exchange](http://netex-cen.eu), comparable in purpose to +GTFS but broader in scope. + +First of all, you need to download a [bundled jar of OTP](Getting-OTP.md). + +Secondly, you will use the [Norwegian NeTEx file](https://developer.entur.org/pages-intro-files) as +well as the [Norwegian OSM data](http://download.geofabrik.de/europe/norway.html), but OTP can download the NeTEx one for you. + +## Configuring the build + +Create a working directory and place the OTP jar file in it and call it `otp.jar.` + +Since we download the OSM data from a free source, we don't want to put undue stress on the server. +Therefore we download it before building the graph, not during. + +``` +curl https://download.geofabrik.de/europe/norway-latest.osm.pbf -o norway.osm.pbf +``` + +Now create a file called `build-config.json` in the same folder and fill it with the following +content: + + + + +```JSON +// build-config.json +{ + "transitFeeds" : [ + { + "type" : "netex", + "feedId" : "NO", + "source" : "https://storage.googleapis.com/marduk-production/outbound/netex/rb_norway-aggregated-netex.zip", + "sharedFilePattern" : "_stops.xml", + "sharedGroupFilePattern" : "_(\\w{3})(_flexible)?_shared_data.xml", + "groupFilePattern" : "(\\w{3})_.*\\.xml" + } + ], + "osm" : [ + { + "source" : "norway.osm.pbf", + "osmTagMapping" : "norway", + "timeZone" : "Europe/Oslo" + } + ], + "osmCacheDataInMem" : true +} +``` + + + +Note the special section specifying how to find NeTEx XML files within the single ZIP archive that +OTP downloads. + +Now you can instruct OTP to build a graph from this configuration file: + +`java -Xmx16G -jar otp.jar --build --save .` + +This should produce a file `graph.obj` in the same directory as your `build-config.json`. + +Building the Norway graph requires downloading about 250MB of input data so stay patient at the beginning +particularly on a slow internet connection. +The actual build takes approximately 10 minutes (without elevation data, as is configured above), +and can be done within 16GB of heap memory (JVM switch `-Xmx16G`). The Graph file it produces is +about 1.1 GB. The server will take about 30 seconds to load this graph and start up, and will +consume about 6GB of heap memory under light use. + +You can then start up an OTP server with a command like this: + +`java -Xmx6G -jar otp.jar --load .` + +Once the server is started up, go to `http://localhost:8080` in a browser to try out your server +using OTP's built in testing web client. Try some long trips like Oslo to Bergen and see if you can +get long distance trains and flights as alternatives. You might need to increase the walking limit +above its very low default value. + +## Adding SIRI real time Data + +Another important feature in OTP version 2 is the ability to +use [SIRI real-time data](https://en.wikipedia.org/wiki/Service_Interface_for_Real_Time_Information). +Within the EU data standards, SIRI is analogous to GTFS-RT: a way to apply real-time updates on top +of schedule data. While technically a distinct specification from NeTEx, both NeTEx and SIRI use the +Transmodel vocabulary, allowing SIRI messages to reference entities in NeTEx schedule data. Like +GTFS-RT, SIRI is consumed by OTP2 using "graph updaters" which are configured in +the `router-config.json` file, which is placed in the same directory as the `graph.obj` file and +loaded at server startup. + + + + +```JSON +// router-config.json +{ + "updaters" : [ + { + "type" : "siri-sx-updater", + "frequency" : "1m", + "url" : "https://api.entur.io/realtime/v1/services", + "feedId" : "NO", + "blockReadinessUntilInitialized" : true + }, + { + "type" : "siri-et-updater", + "frequency" : "1m", + "previewInterval" : "1h30m", + "url" : "https://api.entur.io/realtime/v1/services", + "feedId" : "NO", + "blockReadinessUntilInitialized" : true + } + ] +} +``` + + + +After saving the file in the working directory, restart OTP. + +The updaters fetch two different kinds of SIRI data: + +- Situation Exchange (SX, text notices analogous to GTFS-RT Alerts) +- Estimated Timetable (ET, predicted arrival times analogous to GTFS-RT TripUpdates) + +These updaters can handle differential updates, but they use a polling approach rather than the +message-oriented streaming approach of the GTFS-RT Websocket updater. The server keeps track of +clients, sending only the things that have changed since the last polling operation. + +Note that between these SIRI updaters and the GTFS-RT Websocket updater, we now have both polling +and streaming examples of GTFS-RT "incrementality" semantics, so should be able to finalize that +part of the specification. \ No newline at end of file diff --git a/doc/user/RouteRequest.md b/doc/user/RouteRequest.md index 674ab238888..ea3d0d12c74 100644 --- a/doc/user/RouteRequest.md +++ b/doc/user/RouteRequest.md @@ -2,7 +2,7 @@ NOTE! Part of this document is generated. Make sure you edit the template, not the generated doc. - Template directory is: /doc/templates - - Generated directory is: /docs + - Generated directory is: /doc/user --> # Route Request @@ -13,171 +13,172 @@ and in the [transferRequests in build-config.json](BuildConfiguration.md#transfe -| Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | -|--------------------------------------------------------------------------------------------------------------|:----------------------:|------------------------------------------------------------------------------------------------------------------------------------------------|:----------:|------------------|:-----:| -| [alightSlack](#rd_alightSlack) | `duration` | The time safety margin when alighting from a vehicle. | *Optional* | `"PT0S"` | 2.0 | -| arriveBy | `boolean` | Whether the trip should depart or arrive at the specified date and time. | *Optional* | `false` | 2.0 | -| [boardSlack](#rd_boardSlack) | `duration` | The time safety margin when boarding a vehicle. | *Optional* | `"PT0S"` | 2.0 | -| [drivingDirection](#rd_drivingDirection) | `enum` | The driving direction to use in the intersection traversal calculation | *Optional* | `"right"` | 2.2 | -| elevatorBoardCost | `integer` | What is the cost of boarding a elevator? | *Optional* | `90` | 2.0 | -| elevatorBoardTime | `integer` | How long does it take to get on an elevator, on average. | *Optional* | `90` | 2.0 | -| elevatorHopCost | `integer` | What is the cost of travelling one floor on an elevator? | *Optional* | `20` | 2.0 | -| elevatorHopTime | `integer` | How long does it take to advance one floor on an elevator? | *Optional* | `20` | 2.0 | -| geoidElevation | `boolean` | If true, the Graph's ellipsoidToGeoidDifference is applied to all elevations returned by this query. | *Optional* | `false` | 2.0 | -| ignoreRealtimeUpdates | `boolean` | When true, real-time updates are ignored during this search. | *Optional* | `false` | 2.0 | -| [intersectionTraversalModel](#rd_intersectionTraversalModel) | `enum` | The model that computes the costs of turns. | *Optional* | `"simple"` | 2.2 | -| locale | `locale` | TODO | *Optional* | `"en_US"` | 2.0 | -| [maxDirectStreetDuration](#rd_maxDirectStreetDuration) | `duration` | This is the maximum duration for a direct street search for each mode. | *Optional* | `"PT4H"` | 2.1 | -| [maxJourneyDuration](#rd_maxJourneyDuration) | `duration` | The expected maximum time a journey can last across all possible journeys for the current deployment. | *Optional* | `"PT24H"` | 2.1 | -| modes | `string` | The set of access/egress/direct/transit modes to be used for the route search. | *Optional* | `"TRANSIT,WALK"` | 2.0 | -| nonpreferredTransferPenalty | `integer` | Penalty (in seconds) for using a non-preferred transfer. | *Optional* | `180` | 2.0 | -| numItineraries | `integer` | The maximum number of itineraries to return. | *Optional* | `50` | 2.0 | -| [otherThanPreferredRoutesPenalty](#rd_otherThanPreferredRoutesPenalty) | `integer` | Penalty added for using every route that is not preferred if user set any route as preferred. | *Optional* | `300` | 2.0 | -| [relaxTransitGroupPriority](#rd_relaxTransitGroupPriority) | `string` | The relax function for transit-group-priority | *Optional* | `"0s + 1.00 t"` | 2.5 | -| [relaxTransitSearchGeneralizedCostAtDestination](#rd_relaxTransitSearchGeneralizedCostAtDestination) | `double` | Whether non-optimal transit paths at the destination should be returned | *Optional* | | 2.3 | -| [searchWindow](#rd_searchWindow) | `duration` | The duration of the search-window. | *Optional* | | 2.0 | -| [streetRoutingTimeout](#rd_streetRoutingTimeout) | `duration` | The maximum time a street routing request is allowed to take before returning the results. | *Optional* | `"PT5S"` | 2.2 | -| [transferPenalty](#rd_transferPenalty) | `integer` | An additional penalty added to boardings after the first. | *Optional* | `0` | 2.0 | -| [transferSlack](#rd_transferSlack) | `duration` | The extra time needed to make a safe transfer. | *Optional* | `"PT2M"` | 2.0 | -| turnReluctance | `double` | Multiplicative factor on expected turning time. | *Optional* | `1.0` | 2.0 | -| [unpreferredCost](#rd_unpreferredCost) | `cost-linear-function` | A cost function used to calculate penalty for an unpreferred route. | *Optional* | `"0s + 1.00 t"` | 2.2 | -| waitReluctance | `double` | How much worse is waiting for a transit vehicle than being on a transit vehicle, as a multiplier. | *Optional* | `1.0` | 2.0 | -| accessEgress | `object` | Parameters for access and egress routing. | *Optional* | | 2.4 | -|    [maxDuration](#rd_accessEgress_maxDuration) | `duration` | This is the maximum duration for access/egress for street searches. | *Optional* | `"PT45M"` | 2.1 | -|    [maxStopCount](#rd_accessEgress_maxStopCount) | `integer` | Maximal number of stops collected in access/egress routing | *Optional* | `500` | 2.4 | -|    [maxDurationForMode](#rd_accessEgress_maxDurationForMode) | `enum map of duration` | Limit access/egress per street mode. | *Optional* | | 2.1 | -|    [penalty](#rd_accessEgress_penalty) | `enum map of object` | Penalty for access/egress by street mode. | *Optional* | | 2.4 | -|       FLEXIBLE | `object` | NA | *Optional* | | 2.4 | -|          costFactor | `double` | A factor multiplied with the time-penalty to get the cost-penalty. | *Optional* | `0.0` | 2.4 | -|          timePenalty | `time-penalty` | Penalty added to the time of a path/leg. | *Optional* | `"0s + 0.00 t"` | 2.4 | -| [alightSlackForMode](#rd_alightSlackForMode) | `enum map of duration` | How much extra time should be given when alighting a vehicle for each given mode. | *Optional* | | 2.0 | -| bicycle | `object` | Bicycle preferences. | *Optional* | | 2.5 | -|    [boardCost](#rd_bicycle_boardCost) | `integer` | Prevents unnecessary transfers by adding a cost for boarding a transit vehicle. | *Optional* | `600` | 2.0 | -|    [optimization](#rd_bicycle_optimization) | `enum` | The set of characteristics that the user wants to optimize for. | *Optional* | `"safe-streets"` | 2.0 | -|    reluctance | `double` | A multiplier for how bad cycling is, compared to being in transit for equal lengths of time. | *Optional* | `2.0` | 2.0 | -|    speed | `double` | Max bicycle speed along streets, in meters per second | *Optional* | `5.0` | 2.0 | -|    parking | `object` | Preferences for parking a vehicle. | *Optional* | | 2.5 | -|       cost | `integer` | Cost to park a vehicle. | *Optional* | `120` | 2.0 | -|       time | `duration` | Time to park a vehicle. | *Optional* | `"PT1M"` | 2.0 | -|       [unpreferredVehicleParkingTagCost](#rd_bicycle_parking_unpreferredVehicleParkingTagCost) | `integer` | What cost to add if a parking facility doesn't contain a preferred tag. | *Optional* | `300` | 2.3 | -|       [bannedVehicleParkingTags](#rd_bicycle_parking_bannedVehicleParkingTags) | `string[]` | Tags with which a vehicle parking will not be used. If empty, no tags are banned. | *Optional* | | 2.1 | -|       [preferredVehicleParkingTags](#rd_bicycle_parking_preferredVehicleParkingTags) | `string[]` | Vehicle parking facilities that don't have one of these tags will receive an extra cost and will therefore be penalised. | *Optional* | | 2.3 | -|       [requiredVehicleParkingTags](#rd_bicycle_parking_requiredVehicleParkingTags) | `string[]` | Tags without which a vehicle parking will not be used. If empty, no tags are required. | *Optional* | | 2.1 | -|    rental | `object` | Vehicle rental options | *Optional* | | 2.3 | -|       allowKeepingAtDestination | `boolean` | If a vehicle should be allowed to be kept at the end of a station-based rental. | *Optional* | `false` | 2.2 | -|       dropOffCost | `integer` | Cost to drop-off a rented vehicle. | *Optional* | `30` | 2.0 | -|       dropOffTime | `duration` | Time to drop-off a rented vehicle. | *Optional* | `"PT30S"` | 2.0 | -|       keepingAtDestinationCost | `integer` | The cost of arriving at the destination with the rented vehicle, to discourage doing so. | *Optional* | `0` | 2.2 | -|       pickupCost | `integer` | Cost to rent a vehicle. | *Optional* | `120` | 2.0 | -|       pickupTime | `duration` | Time to rent a vehicle. | *Optional* | `"PT1M"` | 2.0 | -|       useAvailabilityInformation | `boolean` | Whether or not vehicle rental availability information will be used to plan vehicle rental trips. | *Optional* | `false` | 2.0 | -|       [allowedNetworks](#rd_bicycle_rental_allowedNetworks) | `string[]` | The vehicle rental networks which may be used. If empty all networks may be used. | *Optional* | | 2.1 | -|       [bannedNetworks](#rd_bicycle_rental_bannedNetworks) | `string[]` | The vehicle rental networks which may not be used. If empty, no networks are banned. | *Optional* | | 2.1 | -|    [triangle](#rd_bicycle_triangle) | `object` | Triangle optimization criteria. | *Optional* | | 2.5 | -|       flatness | `double` | Relative importance of flat terrain (range 0-1). | *Optional* | `0.0` | 2.0 | -|       [safety](#rd_bicycle_triangle_safety) | `double` | Relative importance of safety (range 0-1). | *Optional* | `0.0` | 2.0 | -|       time | `double` | Relative importance of duration of travel (range 0-1). | *Optional* | `0.0` | 2.0 | -|    walk | `object` | Preferences for walking a vehicle. | *Optional* | | 2.5 | -|       [mountDismountCost](#rd_bicycle_walk_mountDismountCost) | `integer` | The cost of hopping on or off a vehicle. | *Optional* | `0` | 2.0 | -|       [mountDismountTime](#rd_bicycle_walk_mountDismountTime) | `duration` | The time it takes the user to hop on or off a vehicle. | *Optional* | `"PT0S"` | 2.0 | -|       reluctance | `double` | A multiplier for how bad walking with a vehicle is, compared to being in transit for equal lengths of time. | *Optional* | `5.0` | 2.1 | -|       speed | `double` | The user's vehicle walking speed in meters/second. Defaults to approximately 3 MPH. | *Optional* | `1.33` | 2.1 | -|       stairsReluctance | `double` | How bad is it to walk the vehicle up/down a flight of stairs compared to taking a detour. | *Optional* | `10.0` | 2.3 | -| [boardSlackForMode](#rd_boardSlackForMode) | `enum map of duration` | How much extra time should be given when boarding a vehicle for each given mode. | *Optional* | | 2.0 | -| car | `object` | Car preferences. | *Optional* | | 2.5 | -|    accelerationSpeed | `double` | The acceleration speed of an automobile, in meters per second per second. | *Optional* | `2.9` | 2.0 | -|    decelerationSpeed | `double` | The deceleration speed of an automobile, in meters per second per second. | *Optional* | `2.9` | 2.0 | -|    pickupCost | `integer` | Add a cost for car pickup changes when a pickup or drop off takes place | *Optional* | `120` | 2.1 | -|    pickupTime | `duration` | Add a time for car pickup changes when a pickup or drop off takes place | *Optional* | `"PT1M"` | 2.1 | -|    reluctance | `double` | A multiplier for how bad driving is, compared to being in transit for equal lengths of time. | *Optional* | `2.0` | 2.0 | -|    parking | `object` | Preferences for parking a vehicle. | *Optional* | | 2.5 | -|       cost | `integer` | Cost to park a vehicle. | *Optional* | `120` | 2.0 | -|       time | `duration` | Time to park a vehicle. | *Optional* | `"PT1M"` | 2.0 | -|       [unpreferredVehicleParkingTagCost](#rd_car_parking_unpreferredVehicleParkingTagCost) | `integer` | What cost to add if a parking facility doesn't contain a preferred tag. | *Optional* | `300` | 2.3 | -|       [bannedVehicleParkingTags](#rd_car_parking_bannedVehicleParkingTags) | `string[]` | Tags with which a vehicle parking will not be used. If empty, no tags are banned. | *Optional* | | 2.1 | -|       [preferredVehicleParkingTags](#rd_car_parking_preferredVehicleParkingTags) | `string[]` | Vehicle parking facilities that don't have one of these tags will receive an extra cost and will therefore be penalised. | *Optional* | | 2.3 | -|       [requiredVehicleParkingTags](#rd_car_parking_requiredVehicleParkingTags) | `string[]` | Tags without which a vehicle parking will not be used. If empty, no tags are required. | *Optional* | | 2.1 | -|    rental | `object` | Vehicle rental options | *Optional* | | 2.3 | -|       allowKeepingAtDestination | `boolean` | If a vehicle should be allowed to be kept at the end of a station-based rental. | *Optional* | `false` | 2.2 | -|       dropOffCost | `integer` | Cost to drop-off a rented vehicle. | *Optional* | `30` | 2.0 | -|       dropOffTime | `duration` | Time to drop-off a rented vehicle. | *Optional* | `"PT30S"` | 2.0 | -|       keepingAtDestinationCost | `integer` | The cost of arriving at the destination with the rented vehicle, to discourage doing so. | *Optional* | `0` | 2.2 | -|       pickupCost | `integer` | Cost to rent a vehicle. | *Optional* | `120` | 2.0 | -|       pickupTime | `duration` | Time to rent a vehicle. | *Optional* | `"PT1M"` | 2.0 | -|       useAvailabilityInformation | `boolean` | Whether or not vehicle rental availability information will be used to plan vehicle rental trips. | *Optional* | `false` | 2.0 | -|       [allowedNetworks](#rd_car_rental_allowedNetworks) | `string[]` | The vehicle rental networks which may be used. If empty all networks may be used. | *Optional* | | 2.1 | -|       [bannedNetworks](#rd_car_rental_bannedNetworks) | `string[]` | The vehicle rental networks which may not be used. If empty, no networks are banned. | *Optional* | | 2.1 | -| [itineraryFilters](#rd_itineraryFilters) | `object` | Configure itinerary filters that may modify itineraries, sort them, and filter away less preferable results. | *Optional* | | 2.0 | -|    [accessibilityScore](#rd_if_accessibilityScore) | `boolean` | An experimental feature contributed by IBI which adds a sandbox accessibility *score* between 0 and 1 for each leg and itinerary. | *Optional* | `false` | 2.2 | -|    [bikeRentalDistanceRatio](#rd_if_bikeRentalDistanceRatio) | `double` | Filter routes that consist of bike-rental and walking by the minimum fraction of the bike-rental leg using _distance_. | *Optional* | `0.0` | 2.1 | -|    [debug](#rd_if_debug) | `enum` | Enable this to attach a system notice to itineraries instead of removing them. This is very convenient when tuning the itinerary-filter-chain. | *Optional* | `"off"` | 2.0 | -|    [filterItinerariesWithSameFirstOrLastTrip](#rd_if_filterItinerariesWithSameFirstOrLastTrip) | `boolean` | If more than one itinerary begins or ends with same trip, filter out one of those itineraries so that only one remains. | *Optional* | `false` | 2.2 | -|    groupSimilarityKeepOne | `double` | Pick ONE itinerary from each group after putting itineraries that are 85% similar together. | *Optional* | `0.85` | 2.1 | -|    groupSimilarityKeepThree | `double` | Reduce the number of itineraries to three itineraries by reducing each group of itineraries grouped by 68% similarity. | *Optional* | `0.68` | 2.1 | -|    [groupedOtherThanSameLegsMaxCostMultiplier](#rd_if_groupedOtherThanSameLegsMaxCostMultiplier) | `double` | Filter grouped itineraries, where the non-grouped legs are more expensive than in the lowest cost one. | *Optional* | `2.0` | 2.1 | -|    [minBikeParkingDistance](#rd_if_minBikeParkingDistance) | `double` | Filter out bike park+ride results that have fewer meters of cycling than this value. | *Optional* | `0.0` | 2.3 | -|    [nonTransitGeneralizedCostLimit](#rd_if_nonTransitGeneralizedCostLimit) | `cost-linear-function` | The function define a max-limit for generalized-cost for non-transit itineraries. | *Optional* | `"1h + 2.0 t"` | 2.1 | -|    [parkAndRideDurationRatio](#rd_if_parkAndRideDurationRatio) | `double` | Filter P+R routes that consist of driving and walking by the minimum fraction of the driving using of _time_. | *Optional* | `0.0` | 2.1 | -|    [removeItinerariesWithSameRoutesAndStops](#rd_if_removeItinerariesWithSameRoutesAndStops) | `boolean` | Set to true if you want to list only the first itinerary which goes through the same stops and routes. | *Optional* | `false` | 2.2 | -|    [removeTransitWithHigherCostThanBestOnStreetOnly](#rd_if_removeTransitWithHigherCostThanBestOnStreetOnly) | `cost-linear-function` | Limit function for generalized-cost computed from street-only itineries applied to transit itineraries. | *Optional* | `"1m + 1.30 t"` | 2.4 | -|    [transitGeneralizedCostLimit](#rd_if_transitGeneralizedCostLimit) | `object` | A relative limit for the generalized-cost for transit itineraries. | *Optional* | | 2.1 | -|       [costLimitFunction](#rd_if_transitGeneralizedCostLimit_costLimitFunction) | `cost-linear-function` | The base function used by the filter. | *Optional* | `"15m + 1.50 t"` | 2.2 | -|       [intervalRelaxFactor](#rd_if_transitGeneralizedCostLimit_intervalRelaxFactor) | `double` | How much the filter should be relaxed for itineraries that do not overlap in time. | *Optional* | `0.4` | 2.2 | -| [maxDirectStreetDurationForMode](#rd_maxDirectStreetDurationForMode) | `enum map of duration` | Limit direct route duration per street mode. | *Optional* | | 2.2 | -| scooter | `object` | Scooter preferences. | *Optional* | | 2.5 | -|    [optimization](#rd_scooter_optimization) | `enum` | The set of characteristics that the user wants to optimize for. | *Optional* | `"safe-streets"` | 2.0 | -|    reluctance | `double` | A multiplier for how bad scooter travel is, compared to being in transit for equal lengths of time. | *Optional* | `2.0` | 2.0 | -|    speed | `double` | Max scooter speed along streets, in meters per second | *Optional* | `5.0` | 2.0 | -|    rental | `object` | Vehicle rental options | *Optional* | | 2.3 | -|       allowKeepingAtDestination | `boolean` | If a vehicle should be allowed to be kept at the end of a station-based rental. | *Optional* | `false` | 2.2 | -|       dropOffCost | `integer` | Cost to drop-off a rented vehicle. | *Optional* | `30` | 2.0 | -|       dropOffTime | `duration` | Time to drop-off a rented vehicle. | *Optional* | `"PT30S"` | 2.0 | -|       keepingAtDestinationCost | `integer` | The cost of arriving at the destination with the rented vehicle, to discourage doing so. | *Optional* | `0` | 2.2 | -|       pickupCost | `integer` | Cost to rent a vehicle. | *Optional* | `120` | 2.0 | -|       pickupTime | `duration` | Time to rent a vehicle. | *Optional* | `"PT1M"` | 2.0 | -|       useAvailabilityInformation | `boolean` | Whether or not vehicle rental availability information will be used to plan vehicle rental trips. | *Optional* | `false` | 2.0 | -|       [allowedNetworks](#rd_scooter_rental_allowedNetworks) | `string[]` | The vehicle rental networks which may be used. If empty all networks may be used. | *Optional* | | 2.1 | -|       [bannedNetworks](#rd_scooter_rental_bannedNetworks) | `string[]` | The vehicle rental networks which may not be used. If empty, no networks are banned. | *Optional* | | 2.1 | -|    [triangle](#rd_scooter_triangle) | `object` | Triangle optimization criteria. | *Optional* | | 2.5 | -|       flatness | `double` | Relative importance of flat terrain (range 0-1). | *Optional* | `0.0` | 2.0 | -|       [safety](#rd_scooter_triangle_safety) | `double` | Relative importance of safety (range 0-1). | *Optional* | `0.0` | 2.0 | -|       time | `double` | Relative importance of duration of travel (range 0-1). | *Optional* | `0.0` | 2.0 | -| [transferOptimization](#rd_transferOptimization) | `object` | Optimize where a transfer between to trip happens. | *Optional* | | 2.1 | -|    [backTravelWaitTimeFactor](#rd_to_backTravelWaitTimeFactor) | `double` | To reduce back-travel we favor waiting, this reduces the cost of waiting. | *Optional* | `1.0` | 2.1 | -|    [extraStopBoardAlightCostsFactor](#rd_to_extraStopBoardAlightCostsFactor) | `double` | Add an extra board- and alight-cost for prioritized stops. | *Optional* | `0.0` | 2.1 | -|    [minSafeWaitTimeFactor](#rd_to_minSafeWaitTimeFactor) | `double` | Used to set a maximum wait-time cost, base on min-safe-transfer-time. | *Optional* | `5.0` | 2.1 | -|    [optimizeTransferWaitTime](#rd_to_optimizeTransferWaitTime) | `boolean` | This enables the transfer wait time optimization. | *Optional* | `true` | 2.1 | -| [transitGroupPriority](#rd_transitGroupPriority) | `object` | Group transit patterns and give each group a mutual advantage in the Raptor search. | *Optional* | | 2.5 | -| [transitReluctanceForMode](#rd_transitReluctanceForMode) | `enum map of double` | Transit reluctance for a given transport mode | *Optional* | | 2.1 | -| [unpreferred](#rd_unpreferred) | `object` | Parameters listing authorities or lines that preferably should not be used in trip patters. | *Optional* | | 2.2 | -|    [agencies](#rd_unpreferred_agencies) | `feed-scoped-id[]` | The ids of the agencies that incur an extra cost when being used. Format: `FeedId:AgencyId` | *Optional* | | 2.2 | -|    [routes](#rd_unpreferred_routes) | `feed-scoped-id[]` | The ids of the routes that incur an extra cost when being used. Format: `FeedId:RouteId` | *Optional* | | 2.2 | -| walk | `object` | Walking preferences. | *Optional* | | 2.5 | -|    boardCost | `integer` | Prevents unnecessary transfers by adding a cost for boarding a vehicle. This is the cost that is used when boarding while walking. | *Optional* | `600` | 2.0 | -|    escalatorReluctance | `double` | A multiplier for how bad being in an escalator is compared to being in transit for equal lengths of time | *Optional* | `1.5` | 2.4 | -|    [reluctance](#rd_walk_reluctance) | `double` | A multiplier for how bad walking is, compared to being in transit for equal lengths of time. | *Optional* | `2.0` | 2.0 | -|    [safetyFactor](#rd_walk_safetyFactor) | `double` | Factor for how much the walk safety is considered in routing. | *Optional* | `1.0` | 2.2 | -|    speed | `double` | The user's walking speed in meters/second. | *Optional* | `1.33` | 2.0 | -|    stairsReluctance | `double` | Used instead of walkReluctance for stairs. | *Optional* | `2.0` | 2.0 | -|    [stairsTimeFactor](#rd_walk_stairsTimeFactor) | `double` | How much more time does it take to walk a flight of stairs compared to walking a similar horizontal length. | *Optional* | `3.0` | 2.1 | -| wheelchairAccessibility | `object` | See [Wheelchair Accessibility](Accessibility.md) | *Optional* | | 2.2 | -|    enabled | `boolean` | Enable wheelchair accessibility. | *Optional* | `false` | 2.0 | -|    inaccessibleStreetReluctance | `double` | The factor to multiply the cost of traversing a street edge that is not wheelchair-accessible. | *Optional* | `25.0` | 2.2 | -|    [maxSlope](#rd_wheelchairAccessibility_maxSlope) | `double` | The maximum slope as a fraction of 1. | *Optional* | `0.083` | 2.0 | -|    [slopeExceededReluctance](#rd_wheelchairAccessibility_slopeExceededReluctance) | `double` | How much streets with high slope should be avoided. | *Optional* | `1.0` | 2.2 | -|    [stairsReluctance](#rd_wheelchairAccessibility_stairsReluctance) | `double` | How much stairs should be avoided. | *Optional* | `100.0` | 2.2 | -|    elevator | `object` | Configuration for when to use inaccessible elevators. | *Optional* | | 2.2 | -|       inaccessibleCost | `integer` | The cost to add when traversing an entity which is know to be inaccessible. | *Optional* | `3600` | 2.2 | -|       onlyConsiderAccessible | `boolean` | Whether to only use this entity if it is explicitly marked as wheelchair accessible. | *Optional* | `false` | 2.2 | -|       unknownCost | `integer` | The cost to add when traversing an entity with unknown accessibility information. | *Optional* | `20` | 2.2 | -|    stop | `object` | Configuration for when to use inaccessible stops. | *Optional* | | 2.2 | -|       inaccessibleCost | `integer` | The cost to add when traversing an entity which is know to be inaccessible. | *Optional* | `3600` | 2.2 | -|       onlyConsiderAccessible | `boolean` | Whether to only use this entity if it is explicitly marked as wheelchair accessible. | *Optional* | `true` | 2.2 | -|       unknownCost | `integer` | The cost to add when traversing an entity with unknown accessibility information. | *Optional* | `600` | 2.2 | -|    trip | `object` | Configuration for when to use inaccessible trips. | *Optional* | | 2.2 | -|       inaccessibleCost | `integer` | The cost to add when traversing an entity which is know to be inaccessible. | *Optional* | `3600` | 2.2 | -|       onlyConsiderAccessible | `boolean` | Whether to only use this entity if it is explicitly marked as wheelchair accessible. | *Optional* | `true` | 2.2 | -|       unknownCost | `integer` | The cost to add when traversing an entity with unknown accessibility information. | *Optional* | `600` | 2.2 | +| Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | +|--------------------------------------------------------------------------------------------------------------|:----------------------:|----------------------------------------------------------------------------------------------------------------------------------------------------------|:----------:|------------------|:-----:| +| [alightSlack](#rd_alightSlack) | `duration` | The time safety margin when alighting from a vehicle. | *Optional* | `"PT0S"` | 2.0 | +| arriveBy | `boolean` | Whether the trip should depart or arrive at the specified date and time. | *Optional* | `false` | 2.0 | +| [boardSlack](#rd_boardSlack) | `duration` | The time safety margin when boarding a vehicle. | *Optional* | `"PT0S"` | 2.0 | +| [drivingDirection](#rd_drivingDirection) | `enum` | The driving direction to use in the intersection traversal calculation | *Optional* | `"right"` | 2.2 | +| elevatorBoardCost | `integer` | What is the cost of boarding a elevator? | *Optional* | `90` | 2.0 | +| elevatorBoardTime | `integer` | How long does it take to get on an elevator, on average. | *Optional* | `90` | 2.0 | +| elevatorHopCost | `integer` | What is the cost of travelling one floor on an elevator? | *Optional* | `20` | 2.0 | +| elevatorHopTime | `integer` | How long does it take to advance one floor on an elevator? | *Optional* | `20` | 2.0 | +| geoidElevation | `boolean` | If true, the Graph's ellipsoidToGeoidDifference is applied to all elevations returned by this query. | *Optional* | `false` | 2.0 | +| ignoreRealtimeUpdates | `boolean` | When true, real-time updates are ignored during this search. | *Optional* | `false` | 2.0 | +| [intersectionTraversalModel](#rd_intersectionTraversalModel) | `enum` | The model that computes the costs of turns. | *Optional* | `"simple"` | 2.2 | +| locale | `locale` | TODO | *Optional* | `"en_US"` | 2.0 | +| [maxDirectStreetDuration](#rd_maxDirectStreetDuration) | `duration` | This is the maximum duration for a direct street search for each mode. | *Optional* | `"PT4H"` | 2.1 | +| [maxJourneyDuration](#rd_maxJourneyDuration) | `duration` | The expected maximum time a journey can last across all possible journeys for the current deployment. | *Optional* | `"PT24H"` | 2.1 | +| modes | `string` | The set of access/egress/direct/transit modes to be used for the route search. | *Optional* | `"TRANSIT,WALK"` | 2.0 | +| nonpreferredTransferPenalty | `integer` | Penalty (in seconds) for using a non-preferred transfer. | *Optional* | `180` | 2.0 | +| numItineraries | `integer` | The maximum number of itineraries to return. | *Optional* | `50` | 2.0 | +| [otherThanPreferredRoutesPenalty](#rd_otherThanPreferredRoutesPenalty) | `integer` | Penalty added for using every route that is not preferred if user set any route as preferred. | *Optional* | `300` | 2.0 | +| [relaxTransitGroupPriority](#rd_relaxTransitGroupPriority) | `string` | The relax function for transit-group-priority | *Optional* | `"0s + 1.00 t"` | 2.5 | +| [relaxTransitSearchGeneralizedCostAtDestination](#rd_relaxTransitSearchGeneralizedCostAtDestination) | `double` | Whether non-optimal transit paths at the destination should be returned | *Optional* | | 2.3 | +| [searchWindow](#rd_searchWindow) | `duration` | The duration of the search-window. | *Optional* | | 2.0 | +| [streetRoutingTimeout](#rd_streetRoutingTimeout) | `duration` | The maximum time a street routing request is allowed to take before returning the results. | *Optional* | `"PT5S"` | 2.2 | +| [transferPenalty](#rd_transferPenalty) | `integer` | An additional penalty added to boardings after the first. | *Optional* | `0` | 2.0 | +| [transferSlack](#rd_transferSlack) | `duration` | The extra time needed to make a safe transfer. | *Optional* | `"PT2M"` | 2.0 | +| turnReluctance | `double` | Multiplicative factor on expected turning time. | *Optional* | `1.0` | 2.0 | +| [unpreferredCost](#rd_unpreferredCost) | `cost-linear-function` | A cost function used to calculate penalty for an unpreferred route. | *Optional* | `"0s + 1.00 t"` | 2.2 | +| waitReluctance | `double` | How much worse is waiting for a transit vehicle than being on a transit vehicle, as a multiplier. | *Optional* | `1.0` | 2.0 | +| accessEgress | `object` | Parameters for access and egress routing. | *Optional* | | 2.4 | +|    [maxDuration](#rd_accessEgress_maxDuration) | `duration` | This is the maximum duration for access/egress for street searches. | *Optional* | `"PT45M"` | 2.1 | +|    [maxStopCount](#rd_accessEgress_maxStopCount) | `integer` | Maximal number of stops collected in access/egress routing | *Optional* | `500` | 2.4 | +|    [maxDurationForMode](#rd_accessEgress_maxDurationForMode) | `enum map of duration` | Limit access/egress per street mode. | *Optional* | | 2.1 | +|    [penalty](#rd_accessEgress_penalty) | `enum map of object` | Penalty for access/egress by street mode. | *Optional* | | 2.4 | +|       FLEXIBLE | `object` | NA | *Optional* | | 2.4 | +|          costFactor | `double` | A factor multiplied with the time-penalty to get the cost-penalty. | *Optional* | `0.0` | 2.4 | +|          timePenalty | `time-penalty` | Penalty added to the time of a path/leg. | *Optional* | `"0s + 0.00 t"` | 2.4 | +| [alightSlackForMode](#rd_alightSlackForMode) | `enum map of duration` | How much extra time should be given when alighting a vehicle for each given mode. | *Optional* | | 2.0 | +| bicycle | `object` | Bicycle preferences. | *Optional* | | 2.5 | +|    [boardCost](#rd_bicycle_boardCost) | `integer` | Prevents unnecessary transfers by adding a cost for boarding a transit vehicle. | *Optional* | `600` | 2.0 | +|    [optimization](#rd_bicycle_optimization) | `enum` | The set of characteristics that the user wants to optimize for. | *Optional* | `"safe-streets"` | 2.0 | +|    reluctance | `double` | A multiplier for how bad cycling is, compared to being in transit for equal lengths of time. | *Optional* | `2.0` | 2.0 | +|    speed | `double` | Max bicycle speed along streets, in meters per second | *Optional* | `5.0` | 2.0 | +|    parking | `object` | Preferences for parking a vehicle. | *Optional* | | 2.5 | +|       cost | `integer` | Cost to park a vehicle. | *Optional* | `120` | 2.0 | +|       time | `duration` | Time to park a vehicle. | *Optional* | `"PT1M"` | 2.0 | +|       [unpreferredVehicleParkingTagCost](#rd_bicycle_parking_unpreferredVehicleParkingTagCost) | `integer` | What cost to add if a parking facility doesn't contain a preferred tag. | *Optional* | `300` | 2.3 | +|       [bannedVehicleParkingTags](#rd_bicycle_parking_bannedVehicleParkingTags) | `string[]` | Tags with which a vehicle parking will not be used. If empty, no tags are banned. | *Optional* | | 2.1 | +|       [preferredVehicleParkingTags](#rd_bicycle_parking_preferredVehicleParkingTags) | `string[]` | Vehicle parking facilities that don't have one of these tags will receive an extra cost and will therefore be penalised. | *Optional* | | 2.3 | +|       [requiredVehicleParkingTags](#rd_bicycle_parking_requiredVehicleParkingTags) | `string[]` | Tags without which a vehicle parking will not be used. If empty, no tags are required. | *Optional* | | 2.1 | +|    rental | `object` | Vehicle rental options | *Optional* | | 2.3 | +|       allowKeepingAtDestination | `boolean` | If a vehicle should be allowed to be kept at the end of a station-based rental. | *Optional* | `false` | 2.2 | +|       dropOffCost | `integer` | Cost to drop-off a rented vehicle. | *Optional* | `30` | 2.0 | +|       dropOffTime | `duration` | Time to drop-off a rented vehicle. | *Optional* | `"PT30S"` | 2.0 | +|       keepingAtDestinationCost | `integer` | The cost of arriving at the destination with the rented vehicle, to discourage doing so. | *Optional* | `0` | 2.2 | +|       pickupCost | `integer` | Cost to rent a vehicle. | *Optional* | `120` | 2.0 | +|       pickupTime | `duration` | Time to rent a vehicle. | *Optional* | `"PT1M"` | 2.0 | +|       useAvailabilityInformation | `boolean` | Whether or not vehicle rental availability information will be used to plan vehicle rental trips. | *Optional* | `false` | 2.0 | +|       [allowedNetworks](#rd_bicycle_rental_allowedNetworks) | `string[]` | The vehicle rental networks which may be used. If empty all networks may be used. | *Optional* | | 2.1 | +|       [bannedNetworks](#rd_bicycle_rental_bannedNetworks) | `string[]` | The vehicle rental networks which may not be used. If empty, no networks are banned. | *Optional* | | 2.1 | +|    [triangle](#rd_bicycle_triangle) | `object` | Triangle optimization criteria. | *Optional* | | 2.5 | +|       flatness | `double` | Relative importance of flat terrain (range 0-1). | *Optional* | `0.0` | 2.0 | +|       [safety](#rd_bicycle_triangle_safety) | `double` | Relative importance of safety (range 0-1). | *Optional* | `0.0` | 2.0 | +|       time | `double` | Relative importance of duration of travel (range 0-1). | *Optional* | `0.0` | 2.0 | +|    walk | `object` | Preferences for walking a vehicle. | *Optional* | | 2.5 | +|       [mountDismountCost](#rd_bicycle_walk_mountDismountCost) | `integer` | The cost of hopping on or off a vehicle. | *Optional* | `0` | 2.0 | +|       [mountDismountTime](#rd_bicycle_walk_mountDismountTime) | `duration` | The time it takes the user to hop on or off a vehicle. | *Optional* | `"PT0S"` | 2.0 | +|       reluctance | `double` | A multiplier for how bad walking with a vehicle is, compared to being in transit for equal lengths of time. | *Optional* | `5.0` | 2.1 | +|       speed | `double` | The user's vehicle walking speed in meters/second. Defaults to approximately 3 MPH. | *Optional* | `1.33` | 2.1 | +|       stairsReluctance | `double` | How bad is it to walk the vehicle up/down a flight of stairs compared to taking a detour. | *Optional* | `10.0` | 2.3 | +| [boardSlackForMode](#rd_boardSlackForMode) | `enum map of duration` | How much extra time should be given when boarding a vehicle for each given mode. | *Optional* | | 2.0 | +| car | `object` | Car preferences. | *Optional* | | 2.5 | +|    accelerationSpeed | `double` | The acceleration speed of an automobile, in meters per second per second. | *Optional* | `2.9` | 2.0 | +|    decelerationSpeed | `double` | The deceleration speed of an automobile, in meters per second per second. | *Optional* | `2.9` | 2.0 | +|    pickupCost | `integer` | Add a cost for car pickup changes when a pickup or drop off takes place | *Optional* | `120` | 2.1 | +|    pickupTime | `duration` | Add a time for car pickup changes when a pickup or drop off takes place | *Optional* | `"PT1M"` | 2.1 | +|    reluctance | `double` | A multiplier for how bad driving is, compared to being in transit for equal lengths of time. | *Optional* | `2.0` | 2.0 | +|    parking | `object` | Preferences for parking a vehicle. | *Optional* | | 2.5 | +|       cost | `integer` | Cost to park a vehicle. | *Optional* | `120` | 2.0 | +|       time | `duration` | Time to park a vehicle. | *Optional* | `"PT1M"` | 2.0 | +|       [unpreferredVehicleParkingTagCost](#rd_car_parking_unpreferredVehicleParkingTagCost) | `integer` | What cost to add if a parking facility doesn't contain a preferred tag. | *Optional* | `300` | 2.3 | +|       [bannedVehicleParkingTags](#rd_car_parking_bannedVehicleParkingTags) | `string[]` | Tags with which a vehicle parking will not be used. If empty, no tags are banned. | *Optional* | | 2.1 | +|       [preferredVehicleParkingTags](#rd_car_parking_preferredVehicleParkingTags) | `string[]` | Vehicle parking facilities that don't have one of these tags will receive an extra cost and will therefore be penalised. | *Optional* | | 2.3 | +|       [requiredVehicleParkingTags](#rd_car_parking_requiredVehicleParkingTags) | `string[]` | Tags without which a vehicle parking will not be used. If empty, no tags are required. | *Optional* | | 2.1 | +|    rental | `object` | Vehicle rental options | *Optional* | | 2.3 | +|       allowKeepingAtDestination | `boolean` | If a vehicle should be allowed to be kept at the end of a station-based rental. | *Optional* | `false` | 2.2 | +|       dropOffCost | `integer` | Cost to drop-off a rented vehicle. | *Optional* | `30` | 2.0 | +|       dropOffTime | `duration` | Time to drop-off a rented vehicle. | *Optional* | `"PT30S"` | 2.0 | +|       keepingAtDestinationCost | `integer` | The cost of arriving at the destination with the rented vehicle, to discourage doing so. | *Optional* | `0` | 2.2 | +|       pickupCost | `integer` | Cost to rent a vehicle. | *Optional* | `120` | 2.0 | +|       pickupTime | `duration` | Time to rent a vehicle. | *Optional* | `"PT1M"` | 2.0 | +|       useAvailabilityInformation | `boolean` | Whether or not vehicle rental availability information will be used to plan vehicle rental trips. | *Optional* | `false` | 2.0 | +|       [allowedNetworks](#rd_car_rental_allowedNetworks) | `string[]` | The vehicle rental networks which may be used. If empty all networks may be used. | *Optional* | | 2.1 | +|       [bannedNetworks](#rd_car_rental_bannedNetworks) | `string[]` | The vehicle rental networks which may not be used. If empty, no networks are banned. | *Optional* | | 2.1 | +| [itineraryFilters](#rd_itineraryFilters) | `object` | Configure itinerary filters that may modify itineraries, sort them, and filter away less preferable results. | *Optional* | | 2.0 | +|    [accessibilityScore](#rd_if_accessibilityScore) | `boolean` | An experimental feature contributed by IBI which adds a sandbox accessibility *score* between 0 and 1 for each leg and itinerary. | *Optional* | `false` | 2.2 | +|    [bikeRentalDistanceRatio](#rd_if_bikeRentalDistanceRatio) | `double` | Filter routes that consist of bike-rental and walking by the minimum fraction of the bike-rental leg using _distance_. | *Optional* | `0.0` | 2.1 | +|    [debug](#rd_if_debug) | `enum` | Enable this to attach a system notice to itineraries instead of removing them. This is very convenient when tuning the itinerary-filter-chain. | *Optional* | `"off"` | 2.0 | +|    [filterDirectFlexBySearchWindow](#rd_if_filterDirectFlexBySearchWindow) | `boolean` | Filter direct flex results by the search window. The search-window is not used during flex routing, but we use one end to align it with transit results. | *Optional* | `true` | 2.7 | +|    [filterItinerariesWithSameFirstOrLastTrip](#rd_if_filterItinerariesWithSameFirstOrLastTrip) | `boolean` | If more than one itinerary begins or ends with same trip, filter out one of those itineraries so that only one remains. | *Optional* | `false` | 2.2 | +|    groupSimilarityKeepOne | `double` | Pick ONE itinerary from each group after putting itineraries that are 85% similar together. | *Optional* | `0.85` | 2.1 | +|    groupSimilarityKeepThree | `double` | Reduce the number of itineraries to three itineraries by reducing each group of itineraries grouped by 68% similarity. | *Optional* | `0.68` | 2.1 | +|    [groupedOtherThanSameLegsMaxCostMultiplier](#rd_if_groupedOtherThanSameLegsMaxCostMultiplier) | `double` | Filter grouped itineraries, where the non-grouped legs are more expensive than in the lowest cost one. | *Optional* | `2.0` | 2.1 | +|    [minBikeParkingDistance](#rd_if_minBikeParkingDistance) | `double` | Filter out bike park+ride results that have fewer meters of cycling than this value. | *Optional* | `0.0` | 2.3 | +|    [nonTransitGeneralizedCostLimit](#rd_if_nonTransitGeneralizedCostLimit) | `cost-linear-function` | The function define a max-limit for generalized-cost for non-transit itineraries. | *Optional* | `"1h + 2.0 t"` | 2.1 | +|    [parkAndRideDurationRatio](#rd_if_parkAndRideDurationRatio) | `double` | Filter P+R routes that consist of driving and walking by the minimum fraction of the driving using of _time_. | *Optional* | `0.0` | 2.1 | +|    [removeItinerariesWithSameRoutesAndStops](#rd_if_removeItinerariesWithSameRoutesAndStops) | `boolean` | Set to true if you want to list only the first itinerary which goes through the same stops and routes. | *Optional* | `false` | 2.2 | +|    [removeTransitWithHigherCostThanBestOnStreetOnly](#rd_if_removeTransitWithHigherCostThanBestOnStreetOnly) | `cost-linear-function` | Limit function for generalized-cost computed from street-only itineries applied to transit itineraries. | *Optional* | `"1m + 1.30 t"` | 2.4 | +|    [transitGeneralizedCostLimit](#rd_if_transitGeneralizedCostLimit) | `object` | A relative limit for the generalized-cost for transit itineraries. | *Optional* | | 2.1 | +|       [costLimitFunction](#rd_if_transitGeneralizedCostLimit_costLimitFunction) | `cost-linear-function` | The base function used by the filter. | *Optional* | `"15m + 1.50 t"` | 2.2 | +|       [intervalRelaxFactor](#rd_if_transitGeneralizedCostLimit_intervalRelaxFactor) | `double` | How much the filter should be relaxed for itineraries that do not overlap in time. | *Optional* | `0.4` | 2.2 | +| [maxDirectStreetDurationForMode](#rd_maxDirectStreetDurationForMode) | `enum map of duration` | Limit direct route duration per street mode. | *Optional* | | 2.2 | +| scooter | `object` | Scooter preferences. | *Optional* | | 2.5 | +|    [optimization](#rd_scooter_optimization) | `enum` | The set of characteristics that the user wants to optimize for. | *Optional* | `"safe-streets"` | 2.0 | +|    reluctance | `double` | A multiplier for how bad scooter travel is, compared to being in transit for equal lengths of time. | *Optional* | `2.0` | 2.0 | +|    speed | `double` | Max scooter speed along streets, in meters per second | *Optional* | `5.0` | 2.0 | +|    rental | `object` | Vehicle rental options | *Optional* | | 2.3 | +|       allowKeepingAtDestination | `boolean` | If a vehicle should be allowed to be kept at the end of a station-based rental. | *Optional* | `false` | 2.2 | +|       dropOffCost | `integer` | Cost to drop-off a rented vehicle. | *Optional* | `30` | 2.0 | +|       dropOffTime | `duration` | Time to drop-off a rented vehicle. | *Optional* | `"PT30S"` | 2.0 | +|       keepingAtDestinationCost | `integer` | The cost of arriving at the destination with the rented vehicle, to discourage doing so. | *Optional* | `0` | 2.2 | +|       pickupCost | `integer` | Cost to rent a vehicle. | *Optional* | `120` | 2.0 | +|       pickupTime | `duration` | Time to rent a vehicle. | *Optional* | `"PT1M"` | 2.0 | +|       useAvailabilityInformation | `boolean` | Whether or not vehicle rental availability information will be used to plan vehicle rental trips. | *Optional* | `false` | 2.0 | +|       [allowedNetworks](#rd_scooter_rental_allowedNetworks) | `string[]` | The vehicle rental networks which may be used. If empty all networks may be used. | *Optional* | | 2.1 | +|       [bannedNetworks](#rd_scooter_rental_bannedNetworks) | `string[]` | The vehicle rental networks which may not be used. If empty, no networks are banned. | *Optional* | | 2.1 | +|    [triangle](#rd_scooter_triangle) | `object` | Triangle optimization criteria. | *Optional* | | 2.5 | +|       flatness | `double` | Relative importance of flat terrain (range 0-1). | *Optional* | `0.0` | 2.0 | +|       [safety](#rd_scooter_triangle_safety) | `double` | Relative importance of safety (range 0-1). | *Optional* | `0.0` | 2.0 | +|       time | `double` | Relative importance of duration of travel (range 0-1). | *Optional* | `0.0` | 2.0 | +| [transferOptimization](#rd_transferOptimization) | `object` | Optimize where a transfer between to trip happens. | *Optional* | | 2.1 | +|    [backTravelWaitTimeFactor](#rd_to_backTravelWaitTimeFactor) | `double` | To reduce back-travel we favor waiting, this reduces the cost of waiting. | *Optional* | `1.0` | 2.1 | +|    [extraStopBoardAlightCostsFactor](#rd_to_extraStopBoardAlightCostsFactor) | `double` | Add an extra board- and alight-cost for prioritized stops. | *Optional* | `0.0` | 2.1 | +|    [minSafeWaitTimeFactor](#rd_to_minSafeWaitTimeFactor) | `double` | Used to set a maximum wait-time cost, base on min-safe-transfer-time. | *Optional* | `5.0` | 2.1 | +|    [optimizeTransferWaitTime](#rd_to_optimizeTransferWaitTime) | `boolean` | This enables the transfer wait time optimization. | *Optional* | `true` | 2.1 | +| [transitGroupPriority](#rd_transitGroupPriority) | `object` | Group transit patterns and give each group a mutual advantage in the Raptor search. | *Optional* | | 2.5 | +| [transitReluctanceForMode](#rd_transitReluctanceForMode) | `enum map of double` | Transit reluctance for a given transport mode | *Optional* | | 2.1 | +| [unpreferred](#rd_unpreferred) | `object` | Parameters listing authorities or lines that preferably should not be used in trip patters. | *Optional* | | 2.2 | +|    [agencies](#rd_unpreferred_agencies) | `feed-scoped-id[]` | The ids of the agencies that incur an extra cost when being used. Format: `FeedId:AgencyId` | *Optional* | | 2.2 | +|    [routes](#rd_unpreferred_routes) | `feed-scoped-id[]` | The ids of the routes that incur an extra cost when being used. Format: `FeedId:RouteId` | *Optional* | | 2.2 | +| walk | `object` | Walking preferences. | *Optional* | | 2.5 | +|    boardCost | `integer` | Prevents unnecessary transfers by adding a cost for boarding a vehicle. This is the cost that is used when boarding while walking. | *Optional* | `600` | 2.0 | +|    escalatorReluctance | `double` | A multiplier for how bad being in an escalator is compared to being in transit for equal lengths of time | *Optional* | `1.5` | 2.4 | +|    [reluctance](#rd_walk_reluctance) | `double` | A multiplier for how bad walking is, compared to being in transit for equal lengths of time. | *Optional* | `2.0` | 2.0 | +|    [safetyFactor](#rd_walk_safetyFactor) | `double` | Factor for how much the walk safety is considered in routing. | *Optional* | `1.0` | 2.2 | +|    speed | `double` | The user's walking speed in meters/second. | *Optional* | `1.33` | 2.0 | +|    stairsReluctance | `double` | Used instead of walkReluctance for stairs. | *Optional* | `2.0` | 2.0 | +|    [stairsTimeFactor](#rd_walk_stairsTimeFactor) | `double` | How much more time does it take to walk a flight of stairs compared to walking a similar horizontal length. | *Optional* | `3.0` | 2.1 | +| wheelchairAccessibility | `object` | See [Wheelchair Accessibility](Accessibility.md) | *Optional* | | 2.2 | +|    enabled | `boolean` | Enable wheelchair accessibility. | *Optional* | `false` | 2.0 | +|    inaccessibleStreetReluctance | `double` | The factor to multiply the cost of traversing a street edge that is not wheelchair-accessible. | *Optional* | `25.0` | 2.2 | +|    [maxSlope](#rd_wheelchairAccessibility_maxSlope) | `double` | The maximum slope as a fraction of 1. | *Optional* | `0.083` | 2.0 | +|    [slopeExceededReluctance](#rd_wheelchairAccessibility_slopeExceededReluctance) | `double` | How much streets with high slope should be avoided. | *Optional* | `1.0` | 2.2 | +|    [stairsReluctance](#rd_wheelchairAccessibility_stairsReluctance) | `double` | How much stairs should be avoided. | *Optional* | `100.0` | 2.2 | +|    elevator | `object` | Configuration for when to use inaccessible elevators. | *Optional* | | 2.2 | +|       inaccessibleCost | `integer` | The cost to add when traversing an entity which is know to be inaccessible. | *Optional* | `3600` | 2.2 | +|       onlyConsiderAccessible | `boolean` | Whether to only use this entity if it is explicitly marked as wheelchair accessible. | *Optional* | `false` | 2.2 | +|       unknownCost | `integer` | The cost to add when traversing an entity with unknown accessibility information. | *Optional* | `20` | 2.2 | +|    stop | `object` | Configuration for when to use inaccessible stops. | *Optional* | | 2.2 | +|       inaccessibleCost | `integer` | The cost to add when traversing an entity which is know to be inaccessible. | *Optional* | `3600` | 2.2 | +|       onlyConsiderAccessible | `boolean` | Whether to only use this entity if it is explicitly marked as wheelchair accessible. | *Optional* | `true` | 2.2 | +|       unknownCost | `integer` | The cost to add when traversing an entity with unknown accessibility information. | *Optional* | `600` | 2.2 | +|    trip | `object` | Configuration for when to use inaccessible trips. | *Optional* | | 2.2 | +|       inaccessibleCost | `integer` | The cost to add when traversing an entity which is know to be inaccessible. | *Optional* | `3600` | 2.2 | +|       onlyConsiderAccessible | `boolean` | Whether to only use this entity if it is explicitly marked as wheelchair accessible. | *Optional* | `true` | 2.2 | +|       unknownCost | `integer` | The cost to add when traversing an entity with unknown accessibility information. | *Optional* | `600` | 2.2 | @@ -731,6 +732,23 @@ convenient when tuning the itinerary-filter-chain. moving to the next page. +

    filterDirectFlexBySearchWindow

    + +**Since version:** `2.7` ∙ **Type:** `boolean` ∙ **Cardinality:** `Optional` ∙ **Default value:** `true` +**Path:** /routingDefaults/itineraryFilters + +Filter direct flex results by the search window. The search-window is not used +during flex routing, but we use one end to align it with transit results. + +When direct flex is mixed with a transit search in the same request, then the direct +flex results are filtered by the search window of the transit results. + +Depart-at searches are filtered by latest-arrival-time and arrive-by searches are +filtered by earliest-departure-time. + +Use this configuration to turn this feature off. + +

    filterItinerariesWithSameFirstOrLastTrip

    **Since version:** `2.2` ∙ **Type:** `boolean` ∙ **Cardinality:** `Optional` ∙ **Default value:** `false` diff --git a/doc/user/RouterConfiguration.md b/doc/user/RouterConfiguration.md index 4e565cfe17d..711eca3fb87 100644 --- a/doc/user/RouterConfiguration.md +++ b/doc/user/RouterConfiguration.md @@ -2,7 +2,7 @@ NOTE! Part of this document is generated. Make sure you edit the template, not the generated doc. - Template directory is: /doc/templates - - Generated directory is: /docs + - Generated directory is: /doc/user --> # Router configuration @@ -778,12 +778,6 @@ Used to group requests when monitoring OTP. "Authorization" : "${BIKELY_AUTHORIZATION}" } }, - { - "type" : "vehicle-parking", - "feedId" : "noi", - "sourceType" : "noi-open-data-hub", - "url" : "https://parking.otp.opendatahub.com/parking/all.json" - }, { "type" : "stop-time-updater", "frequency" : "1m", diff --git a/doc/user/UpdaterConfig.md b/doc/user/UpdaterConfig.md index f3a0d982e68..cc5e1d75901 100644 --- a/doc/user/UpdaterConfig.md +++ b/doc/user/UpdaterConfig.md @@ -2,7 +2,7 @@ NOTE! Part of this document is generated. Make sure you edit the template, not the generated doc. - Template directory is: /doc/templates - - Generated directory is: /docs + - Generated directory is: /doc/user --> @@ -92,20 +92,20 @@ The information is downloaded in a single HTTP request and polled regularly. | Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | |-----------------------------------------------------------------------|:---------------:|----------------------------------------------------------------------------|:----------:|----------------------|:-----:| | type = "stop-time-updater" | `enum` | The type of the updater. | *Required* | | 1.5 | -| [backwardsDelayPropagationType](#u__6__backwardsDelayPropagationType) | `enum` | How backwards propagation should be handled. | *Optional* | `"required-no-data"` | 2.2 | +| [backwardsDelayPropagationType](#u__5__backwardsDelayPropagationType) | `enum` | How backwards propagation should be handled. | *Optional* | `"required-no-data"` | 2.2 | | feedId | `string` | Which feed the updates apply to. | *Required* | | 1.5 | | frequency | `duration` | How often the data should be downloaded. | *Optional* | `"PT1M"` | 1.5 | | fuzzyTripMatching | `boolean` | If the trips should be matched fuzzily. | *Optional* | `false` | 1.5 | -| [url](#u__6__url) | `string` | The URL of the GTFS-RT resource. | *Required* | | 1.5 | -| [headers](#u__6__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.3 | +| [url](#u__5__url) | `string` | The URL of the GTFS-RT resource. | *Required* | | 1.5 | +| [headers](#u__5__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.3 | ##### Parameter details -

    backwardsDelayPropagationType

    +

    backwardsDelayPropagationType

    **Since version:** `2.2` ∙ **Type:** `enum` ∙ **Cardinality:** `Optional` ∙ **Default value:** `"required-no-data"` -**Path:** /updaters/[6] +**Path:** /updaters/[5] **Enum values:** `required-no-data` | `required` | `always` How backwards propagation should be handled. @@ -124,19 +124,19 @@ How backwards propagation should be handled. The updated times are exposed through APIs. -

    url

    +

    url

    **Since version:** `1.5` ∙ **Type:** `string` ∙ **Cardinality:** `Required` -**Path:** /updaters/[6] +**Path:** /updaters/[5] The URL of the GTFS-RT resource. `file:` URLs are also supported if you want to read a file from the local disk. -

    headers

    +

    headers

    **Since version:** `2.3` ∙ **Type:** `map of string` ∙ **Cardinality:** `Optional` -**Path:** /updaters/[6] +**Path:** /updaters/[5] HTTP headers to add to the request. Any header key, value can be inserted. @@ -178,7 +178,7 @@ This system powers the realtime updates in Helsinki and more information can be | Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | |-----------------------------------------------------------------------|:---------:|----------------------------------------------|:----------:|----------------------|:-----:| | type = "mqtt-gtfs-rt-updater" | `enum` | The type of the updater. | *Required* | | 1.5 | -| [backwardsDelayPropagationType](#u__7__backwardsDelayPropagationType) | `enum` | How backwards propagation should be handled. | *Optional* | `"required-no-data"` | 2.2 | +| [backwardsDelayPropagationType](#u__6__backwardsDelayPropagationType) | `enum` | How backwards propagation should be handled. | *Optional* | `"required-no-data"` | 2.2 | | feedId | `string` | The feed id to apply the updates to. | *Required* | | 2.0 | | fuzzyTripMatching | `boolean` | Whether to match trips fuzzily. | *Optional* | `false` | 2.0 | | qos | `integer` | QOS level. | *Optional* | `0` | 2.0 | @@ -188,10 +188,10 @@ This system powers the realtime updates in Helsinki and more information can be ##### Parameter details -

    backwardsDelayPropagationType

    +

    backwardsDelayPropagationType

    **Since version:** `2.2` ∙ **Type:** `enum` ∙ **Cardinality:** `Optional` ∙ **Default value:** `"required-no-data"` -**Path:** /updaters/[7] +**Path:** /updaters/[6] **Enum values:** `required-no-data` | `required` | `always` How backwards propagation should be handled. @@ -247,24 +247,24 @@ The information is downloaded in a single HTTP request and polled regularly. | frequency | `duration` | How often the positions should be updated. | *Optional* | `"PT1M"` | 2.2 | | fuzzyTripMatching | `boolean` | Whether to match trips fuzzily. | *Optional* | `false` | 2.5 | | url | `uri` | The URL of GTFS-RT protobuf HTTP resource to download the positions from. | *Required* | | 2.2 | -| [features](#u__8__features) | `enum set` | Which features of GTFS RT vehicle positions should be loaded into OTP. | *Optional* | | 2.5 | -| [headers](#u__8__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.3 | +| [features](#u__7__features) | `enum set` | Which features of GTFS RT vehicle positions should be loaded into OTP. | *Optional* | | 2.5 | +| [headers](#u__7__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.3 | ##### Parameter details -

    features

    +

    features

    **Since version:** `2.5` ∙ **Type:** `enum set` ∙ **Cardinality:** `Optional` -**Path:** /updaters/[8] +**Path:** /updaters/[7] **Enum values:** `position` | `stop-position` | `occupancy` Which features of GTFS RT vehicle positions should be loaded into OTP. -

    headers

    +

    headers

    **Since version:** `2.3` ∙ **Type:** `map of string` ∙ **Cardinality:** `Optional` -**Path:** /updaters/[8] +**Path:** /updaters/[7] HTTP headers to add to the request. Any header key, value can be inserted. diff --git a/doc/user/apis/GraphQL-Tutorial.md b/doc/user/apis/GraphQL-Tutorial.md index d65fbc144ba..5c4b59e864e 100644 --- a/doc/user/apis/GraphQL-Tutorial.md +++ b/doc/user/apis/GraphQL-Tutorial.md @@ -2,7 +2,7 @@ NOTE! Part of this document is generated. Make sure you edit the template, not the generated doc. - Template directory is: /doc/templates - - Generated directory is: /docs + - Generated directory is: /doc/user --> # GraphQL tutorial @@ -70,53 +70,61 @@ Most people want to get routing results out of OTP, so lets see the query for th ```graphql { - plan( - # these coordinates are in Portland, change this to YOUR origin - from: { lat: 45.5552, lon: -122.6534 } - # these coordinates are in Portland, change this to YOUR destination - to: { lat: 45.4908, lon: -122.5519 } + planConnection( + origin: { + # these coordinates are in Portland, change this to YOUR origin + location: { coordinate: { latitude: 45.5552, longitude: -122.6534 } } + } + destination: { + # these coordinates are in Portland, change this to YOUR destination + location: { coordinate: { latitude: 45.4908, longitude: -122.5519 } } + } # use the correct date and time of your request - date: "2023-02-15" - time: "11:37" + dateTime: { earliestDeparture: "2023-06-13T14:30-07:00" } # choose the transport modes you need - transportModes: [{ mode: WALK }, { mode: TRANSIT }] + modes: { + direct: [WALK] + transit: { transit: [{ mode: BUS }, { mode: RAIL }] } + } ) { - itineraries { - start - end - legs { - mode - from { - name - lat - lon - departure { - scheduledTime - estimated { - time - delay + edges { + node { + start + end + legs { + mode + from { + name + lat + lon + departure { + scheduledTime + estimated { + time + delay + } } } - } - to { - name - lat - lon - arrival { - scheduledTime - estimated { - time - delay + to { + name + lat + lon + arrival { + scheduledTime + estimated { + time + delay + } } } - } - route { - gtfsId - longName - shortName - } - legGeometry { - points + route { + gtfsId + longName + shortName + } + legGeometry { + points + } } } } diff --git a/doc/user/css/magidoc-overrides.css b/doc/user/css/magidoc-overrides.css new file mode 100644 index 00000000000..dbf0cb2523d --- /dev/null +++ b/doc/user/css/magidoc-overrides.css @@ -0,0 +1,11 @@ +/* + * This file contains custom CSS overrides for the GraphQL documentation available at + * https://docs.opentripplanner.org/api/dev-2.x/graphql-gtfs/ + */ + +/* + * Hide the deprecated queries from the left hand navigation panel. + */ +nav ul li .deprecated { + display: none; +} diff --git a/doc/user/examples/ibi/portland/router-config.json b/doc/user/examples/ibi/portland/router-config.json index 0bf3547dbfd..acbcbc2e0a0 100644 --- a/doc/user/examples/ibi/portland/router-config.json +++ b/doc/user/examples/ibi/portland/router-config.json @@ -59,6 +59,62 @@ "url": "https://gbfs.spin.pm/api/gbfs/v2/portland" } ], + "vectorTiles": { + "basePath": "/rtp/routers/default/vectorTiles", + "attribution": "Regional Partners", + "layers": [ + { + "name": "stops", + "type": "Stop", + "mapper": "Digitransit", + "maxZoom": 20, + "minZoom": 14, + "cacheMaxSeconds": 600, + "filter": "sunday-to-sunday-service-week" + }, + { + "name": "areaStops", + "type": "AreaStop", + "mapper": "OTPRR", + "maxZoom": 30, + "minZoom": 8, + "cacheMaxSeconds": 600 + }, + { + "name": "stations", + "type": "Station", + "mapper": "Digitransit", + "maxZoom": 20, + "minZoom": 2, + "cacheMaxSeconds": 600 + }, + { + "name": "rentalVehicles", + "type": "VehicleRentalVehicle", + "mapper": "Digitransit", + "maxZoom": 20, + "minZoom": 2, + "cacheMaxSeconds": 60 + }, + { + "name": "rentalStations", + "type": "VehicleRentalStation", + "mapper": "Digitransit", + "maxZoom": 20, + "minZoom": 2, + "cacheMaxSeconds": 600 + }, + { + "name": "vehicleParking", + "type": "VehicleParking", + "mapper": "Digitransit", + "maxZoom": 20, + "minZoom": 10, + "cacheMaxSeconds": 60, + "expansionFactor": 0.25 + } + ] + }, "rideHailingServices": [ { "type": "uber-car-hailing", diff --git a/doc/user/features-explained/Netex-Siri-Compatibility.md b/doc/user/features-explained/Netex-Siri-Compatibility.md new file mode 100644 index 00000000000..731011be8e0 --- /dev/null +++ b/doc/user/features-explained/Netex-Siri-Compatibility.md @@ -0,0 +1,36 @@ +# NeTEx and SIRI compatibility + +NeTEx and SIRI are two European public transport data specifications that are comparable to GTFS and +GTFS-RT but have a broader scope. Support for both was added by Entur in OTP version 2 and you can +find examples of those in their [examples repo](https://github.com/entur/profile-examples). + +## Profiles + +### Nordic profile + +Different countries are currently using different incompatible "profiles" of NeTEx, but an effort is +underway to converge on a single European standard profile. This is based in large part on the +Nordic profile used by Entur. + +The Nordic profile is the only profile that has been thoroughly tested in production in OTP and is +used in Norway, Finland and Sweden. + +### EPIP + +The [European Passenger Information Profile](http://netex.uk/netex/doc/2019.05.07-v1.1_FinalDraft/prCEN_TS_16614-PI_Profile_FV_%28E%29-2019-Final-Draft-v3.pdf) +is an attempt to unify other country profiles and support in OTP is adequate, but it is difficult +to tell how much of EPIP is supported since it is a very large profile. The current status +of the support is tracked on [Github](https://github.com/opentripplanner/OpenTripPlanner/issues/3640). + +Sometimes it is difficult to tell if a file conforms to EPIP so to find out, you can run the following +commands: + +``` +git clone git@github.com:NeTEx-CEN/NeTEx-Profile-EPIP.git +xmllint --noout --schema NeTEx-Profile-EPIP/NeTEx_publication_EPIP.xsd your-filename.xml +``` + +### Other profiles + +It is the goal of the community to support both the Nordic profile and EPIP. If you have another +profile, we encourage to get in touch with the community to find a way forward. \ No newline at end of file diff --git a/doc/user/requirements.txt b/doc/user/requirements.txt index 4681f78c93f..ee0eb31d65c 100644 --- a/doc/user/requirements.txt +++ b/doc/user/requirements.txt @@ -1,4 +1,4 @@ -mkdocs==1.6.0 -mkdocs-material==9.5.27 +mkdocs==1.6.1 +mkdocs-material==9.5.39 mike@git+https://github.com/jimporter/mike.git@f0522f245e64687dd18384fbd86b721175711474 mkdocs-no-sitemap-plugin==0.0.1 diff --git a/doc/user/sandbox/MapboxVectorTilesApi.md b/doc/user/sandbox/MapboxVectorTilesApi.md index 62f3bd36c38..4430a398a5d 100644 --- a/doc/user/sandbox/MapboxVectorTilesApi.md +++ b/doc/user/sandbox/MapboxVectorTilesApi.md @@ -173,6 +173,7 @@ For each layer, the configuration includes: |       type = "stop" | `enum` | Type of the layer. | *Required* | | 2.0 | |       [cacheMaxSeconds](#vectorTiles_layers_0_cacheMaxSeconds) | `integer` | Sets the cache header in the response. | *Optional* | `-1` | 2.0 | |       [expansionFactor](#vectorTiles_layers_0_expansionFactor) | `double` | How far outside its boundaries should the tile contain information. | *Optional* | `0.25` | 2.0 | +|       [filter](#vectorTiles_layers_0_filter) | `enum` | Reduce the result set of a layer further by a specific filter. | *Optional* | `"none"` | 2.6 | |       [mapper](#vectorTiles_layers_0_mapper) | `string` | Describes the mapper converting from the OTP model entities to the vector tile properties. | *Required* | | 2.0 | |       maxZoom | `integer` | Maximum zoom levels the layer is active for. | *Optional* | `20` | 2.0 | |       minZoom | `integer` | Minimum zoom levels the layer is active for. | *Optional* | `9` | 2.0 | @@ -245,6 +246,18 @@ How far outside its boundaries should the tile contain information. The value is a fraction of the tile size. If you are having problem with icons and shapes being clipped at tile edges, then increase this number. +

    filter

    + +**Since version:** `2.6` ∙ **Type:** `enum` ∙ **Cardinality:** `Optional` ∙ **Default value:** `"none"` +**Path:** /vectorTiles/layers/[0] +**Enum values:** `none` | `sunday-to-sunday-service-week` + +Reduce the result set of a layer further by a specific filter. + +This is useful for when the schema of a layer, say stops, should remain unchanged but some +elements should not be included in the result. + +

    mapper

    **Since version:** `2.0` ∙ **Type:** `string` ∙ **Cardinality:** `Required` diff --git a/doc/user/sandbox/StopConsolidation.md b/doc/user/sandbox/StopConsolidation.md index b36429b1f60..d0e18a9ce30 100644 --- a/doc/user/sandbox/StopConsolidation.md +++ b/doc/user/sandbox/StopConsolidation.md @@ -2,7 +2,7 @@ NOTE! Part of this document is generated. Make sure you edit the template, not the generated doc. - Template directory is: /doc/templates - - Generated directory is: /docs + - Generated directory is: /doc/user --> # Stop consolidation diff --git a/doc/user/sandbox/VehicleParking.md b/doc/user/sandbox/VehicleParking.md index db057bd9dbd..ccd56fc238c 100644 --- a/doc/user/sandbox/VehicleParking.md +++ b/doc/user/sandbox/VehicleParking.md @@ -3,7 +3,7 @@ ## Contact Info - For HSL Park and Ride updater: Digitransit team, HSL, Helsinki, Finland -- For Bikely, NOI and Bikeep updater: Leonard Ehrenfried, [mail@leonard.io](mailto:mail@leonard.io) +- For Bikely, Bikeep and SIRI-FM updater: Leonard Ehrenfried, [mail@leonard.io](mailto:mail@leonard.io) ## Documentation @@ -16,7 +16,7 @@ Currently contains the following updaters: - [HSL Park and Ride](https://p.hsl.fi/docs/index.html) - [ParkAPI](https://github.com/offenesdresden/ParkAPI) - [Bikely](https://www.safebikely.com/) -- [NOI Open Data Hub](https://opendatahub.com/) +- SIRI-FM ### Configuration @@ -61,7 +61,7 @@ This will end up in the API responses as the feed id of the parking lot. **Since version:** `2.2` ∙ **Type:** `enum` ∙ **Cardinality:** `Required` **Path:** /updaters/[2] -**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `noi-open-data-hub` | `bikeep` | `siri-fm` +**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `bikeep` | `siri-fm` The source of the vehicle updates. @@ -131,7 +131,7 @@ This will end up in the API responses as the feed id of the parking lot. **Since version:** `2.2` ∙ **Type:** `enum` ∙ **Cardinality:** `Required` **Path:** /updaters/[3] -**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `noi-open-data-hub` | `bikeep` | `siri-fm` +**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `bikeep` | `siri-fm` The source of the vehicle updates. @@ -216,7 +216,7 @@ This will end up in the API responses as the feed id of the parking lot. **Since version:** `2.2` ∙ **Type:** `enum` ∙ **Cardinality:** `Required` **Path:** /updaters/[4] -**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `noi-open-data-hub` | `bikeep` | `siri-fm` +**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `bikeep` | `siri-fm` The source of the vehicle updates. @@ -251,67 +251,6 @@ HTTP headers to add to the request. Any header key, value can be inserted. -## NOI Open Data Hub - - - - -| Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | -|---------------------------------|:---------------:|------------------------------------------------------------------------------|:----------:|---------------|:-----:| -| type = "vehicle-parking" | `enum` | The type of the updater. | *Required* | | 1.5 | -| [feedId](#u__5__feedId) | `string` | The id of the data source, which will be the prefix of the parking lot's id. | *Required* | | 2.2 | -| frequency | `duration` | How often to update the source. | *Optional* | `"PT1M"` | 2.6 | -| [sourceType](#u__5__sourceType) | `enum` | The source of the vehicle updates. | *Required* | | 2.2 | -| url | `uri` | URL of the locations endpoint. | *Required* | | 2.6 | -| [headers](#u__5__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.6 | - - -#### Details - -

    feedId

    - -**Since version:** `2.2` ∙ **Type:** `string` ∙ **Cardinality:** `Required` -**Path:** /updaters/[5] - -The id of the data source, which will be the prefix of the parking lot's id. - -This will end up in the API responses as the feed id of the parking lot. - -

    sourceType

    - -**Since version:** `2.2` ∙ **Type:** `enum` ∙ **Cardinality:** `Required` -**Path:** /updaters/[5] -**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `noi-open-data-hub` | `bikeep` | `siri-fm` - -The source of the vehicle updates. - -

    headers

    - -**Since version:** `2.6` ∙ **Type:** `map of string` ∙ **Cardinality:** `Optional` -**Path:** /updaters/[5] - -HTTP headers to add to the request. Any header key, value can be inserted. - - - -##### Example configuration - -```JSON -// router-config.json -{ - "updaters" : [ - { - "type" : "vehicle-parking", - "feedId" : "noi", - "sourceType" : "noi-open-data-hub", - "url" : "https://parking.otp.opendatahub.com/parking/all.json" - } - ] -} -``` - - - ## Bikeep @@ -320,36 +259,36 @@ HTTP headers to add to the request. Any header key, value can be inserted. | Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | |----------------------------------|:---------------:|------------------------------------------------------------------------------|:----------:|---------------|:-----:| | type = "vehicle-parking" | `enum` | The type of the updater. | *Required* | | 1.5 | -| [feedId](#u__14__feedId) | `string` | The id of the data source, which will be the prefix of the parking lot's id. | *Required* | | 2.2 | +| [feedId](#u__13__feedId) | `string` | The id of the data source, which will be the prefix of the parking lot's id. | *Required* | | 2.2 | | frequency | `duration` | How often to update the source. | *Optional* | `"PT1M"` | 2.6 | -| [sourceType](#u__14__sourceType) | `enum` | The source of the vehicle updates. | *Required* | | 2.2 | +| [sourceType](#u__13__sourceType) | `enum` | The source of the vehicle updates. | *Required* | | 2.2 | | url | `uri` | URL of the locations endpoint. | *Required* | | 2.6 | -| [headers](#u__14__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.6 | +| [headers](#u__13__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.6 | #### Details -

    feedId

    +

    feedId

    **Since version:** `2.2` ∙ **Type:** `string` ∙ **Cardinality:** `Required` -**Path:** /updaters/[14] +**Path:** /updaters/[13] The id of the data source, which will be the prefix of the parking lot's id. This will end up in the API responses as the feed id of the parking lot. -

    sourceType

    +

    sourceType

    **Since version:** `2.2` ∙ **Type:** `enum` ∙ **Cardinality:** `Required` -**Path:** /updaters/[14] -**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `noi-open-data-hub` | `bikeep` | `siri-fm` +**Path:** /updaters/[13] +**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `bikeep` | `siri-fm` The source of the vehicle updates. -

    headers

    +

    headers

    **Since version:** `2.6` ∙ **Type:** `map of string` ∙ **Cardinality:** `Optional` -**Path:** /updaters/[14] +**Path:** /updaters/[13] HTTP headers to add to the request. Any header key, value can be inserted. @@ -387,36 +326,36 @@ which requires SIRI 2.1. | Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | |----------------------------------|:---------------:|------------------------------------------------------------------------------|:----------:|---------------|:-----:| | type = "vehicle-parking" | `enum` | The type of the updater. | *Required* | | 1.5 | -| [feedId](#u__15__feedId) | `string` | The id of the data source, which will be the prefix of the parking lot's id. | *Required* | | 2.2 | +| [feedId](#u__14__feedId) | `string` | The id of the data source, which will be the prefix of the parking lot's id. | *Required* | | 2.2 | | frequency | `duration` | How often to update the source. | *Optional* | `"PT1M"` | 2.6 | -| [sourceType](#u__15__sourceType) | `enum` | The source of the vehicle updates. | *Required* | | 2.2 | -| [url](#u__15__url) | `uri` | URL of the SIRI-FM Light endpoint. | *Required* | | 2.6 | -| [headers](#u__15__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.6 | +| [sourceType](#u__14__sourceType) | `enum` | The source of the vehicle updates. | *Required* | | 2.2 | +| [url](#u__14__url) | `uri` | URL of the SIRI-FM Light endpoint. | *Required* | | 2.6 | +| [headers](#u__14__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.6 | #### Details -

    feedId

    +

    feedId

    **Since version:** `2.2` ∙ **Type:** `string` ∙ **Cardinality:** `Required` -**Path:** /updaters/[15] +**Path:** /updaters/[14] The id of the data source, which will be the prefix of the parking lot's id. This will end up in the API responses as the feed id of the parking lot. -

    sourceType

    +

    sourceType

    **Since version:** `2.2` ∙ **Type:** `enum` ∙ **Cardinality:** `Required` -**Path:** /updaters/[15] -**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `noi-open-data-hub` | `bikeep` | `siri-fm` +**Path:** /updaters/[14] +**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `bikeep` | `siri-fm` The source of the vehicle updates. -

    url

    +

    url

    **Since version:** `2.6` ∙ **Type:** `uri` ∙ **Cardinality:** `Required` -**Path:** /updaters/[15] +**Path:** /updaters/[14] URL of the SIRI-FM Light endpoint. @@ -427,10 +366,10 @@ The contents must also conform to the [Italian SIRI profile](https://github.com/ which requires SIRI 2.1. -

    headers

    +

    headers

    **Since version:** `2.6` ∙ **Type:** `map of string` ∙ **Cardinality:** `Optional` -**Path:** /updaters/[15] +**Path:** /updaters/[14] HTTP headers to add to the request. Any header key, value can be inserted. diff --git a/doc/user/sandbox/siri/SiriAzureUpdater.md b/doc/user/sandbox/siri/SiriAzureUpdater.md index 7b29e802f21..c8e7f4d9255 100644 --- a/doc/user/sandbox/siri/SiriAzureUpdater.md +++ b/doc/user/sandbox/siri/SiriAzureUpdater.md @@ -25,14 +25,14 @@ To enable the SIRI updater you need to add it to the updaters section of the `ro | Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | |------------------------------------------------------------|:----------:|------------------------------------------------------------------|:----------:|---------------------|:-----:| | type = "siri-azure-et-updater" | `enum` | The type of the updater. | *Required* | | 1.5 | -| [authenticationType](#u__12__authenticationType) | `enum` | Which authentication type to use | *Optional* | `"sharedaccesskey"` | 2.5 | +| [authenticationType](#u__11__authenticationType) | `enum` | Which authentication type to use | *Optional* | `"sharedaccesskey"` | 2.5 | | autoDeleteOnIdle | `duration` | The time after which an inactive subscription is removed. | *Optional* | `"PT1H"` | 2.5 | -| [customMidnight](#u__12__customMidnight) | `integer` | Time on which time breaks into new day. | *Optional* | `0` | 2.2 | +| [customMidnight](#u__11__customMidnight) | `integer` | Time on which time breaks into new day. | *Optional* | `0` | 2.2 | | feedId | `string` | The ID of the feed to apply the updates to. | *Optional* | | 2.2 | -| [fullyQualifiedNamespace](#u__12__fullyQualifiedNamespace) | `string` | Service Bus fully qualified namespace used for authentication. | *Optional* | | 2.5 | +| [fullyQualifiedNamespace](#u__11__fullyQualifiedNamespace) | `string` | Service Bus fully qualified namespace used for authentication. | *Optional* | | 2.5 | | fuzzyTripMatching | `boolean` | Whether to apply fuzzyTripMatching on the updates | *Optional* | `false` | 2.2 | | prefetchCount | `integer` | The number of messages to fetch from the subscription at a time. | *Optional* | `10` | 2.5 | -| [servicebus-url](#u__12__servicebus_url) | `string` | Service Bus connection used for authentication. | *Optional* | | 2.2 | +| [servicebus-url](#u__11__servicebus_url) | `string` | Service Bus connection used for authentication. | *Optional* | | 2.2 | | topic | `string` | Service Bus topic to connect to. | *Optional* | | 2.2 | | history | `object` | Configuration for fetching historical data on startup | *Optional* | | 2.2 | |    fromDateTime | `string` | Datetime boundary for historical data | *Optional* | `"-P1D"` | 2.2 | @@ -42,36 +42,36 @@ To enable the SIRI updater you need to add it to the updaters section of the `ro ##### Parameter details -

    authenticationType

    +

    authenticationType

    **Since version:** `2.5` ∙ **Type:** `enum` ∙ **Cardinality:** `Optional` ∙ **Default value:** `"sharedaccesskey"` -**Path:** /updaters/[12] +**Path:** /updaters/[11] **Enum values:** `sharedaccesskey` | `federatedidentity` Which authentication type to use -

    customMidnight

    +

    customMidnight

    **Since version:** `2.2` ∙ **Type:** `integer` ∙ **Cardinality:** `Optional` ∙ **Default value:** `0` -**Path:** /updaters/[12] +**Path:** /updaters/[11] Time on which time breaks into new day. It is common that operating day date breaks a little bit later than midnight so that the switch happens when traffic is at the lowest point. Parameter uses 24-hour format. If the switch happens on 4 am then set this field to 4. -

    fullyQualifiedNamespace

    +

    fullyQualifiedNamespace

    **Since version:** `2.5` ∙ **Type:** `string` ∙ **Cardinality:** `Optional` -**Path:** /updaters/[12] +**Path:** /updaters/[11] Service Bus fully qualified namespace used for authentication. Has to be present for authenticationMethod FederatedIdentity. -

    servicebus-url

    +

    servicebus-url

    **Since version:** `2.2` ∙ **Type:** `string` ∙ **Cardinality:** `Optional` -**Path:** /updaters/[12] +**Path:** /updaters/[11] Service Bus connection used for authentication. @@ -113,14 +113,14 @@ Has to be present for authenticationMethod SharedAccessKey. This should be Prima | Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | |------------------------------------------------------------|:----------:|------------------------------------------------------------------|:----------:|---------------------|:-----:| | type = "siri-azure-sx-updater" | `enum` | The type of the updater. | *Required* | | 1.5 | -| [authenticationType](#u__11__authenticationType) | `enum` | Which authentication type to use | *Optional* | `"sharedaccesskey"` | 2.5 | +| [authenticationType](#u__10__authenticationType) | `enum` | Which authentication type to use | *Optional* | `"sharedaccesskey"` | 2.5 | | autoDeleteOnIdle | `duration` | The time after which an inactive subscription is removed. | *Optional* | `"PT1H"` | 2.5 | -| [customMidnight](#u__11__customMidnight) | `integer` | Time on which time breaks into new day. | *Optional* | `0` | 2.2 | +| [customMidnight](#u__10__customMidnight) | `integer` | Time on which time breaks into new day. | *Optional* | `0` | 2.2 | | feedId | `string` | The ID of the feed to apply the updates to. | *Optional* | | 2.2 | -| [fullyQualifiedNamespace](#u__11__fullyQualifiedNamespace) | `string` | Service Bus fully qualified namespace used for authentication. | *Optional* | | 2.5 | +| [fullyQualifiedNamespace](#u__10__fullyQualifiedNamespace) | `string` | Service Bus fully qualified namespace used for authentication. | *Optional* | | 2.5 | | fuzzyTripMatching | `boolean` | Whether to apply fuzzyTripMatching on the updates | *Optional* | `false` | 2.2 | | prefetchCount | `integer` | The number of messages to fetch from the subscription at a time. | *Optional* | `10` | 2.5 | -| [servicebus-url](#u__11__servicebus_url) | `string` | Service Bus connection used for authentication. | *Optional* | | 2.2 | +| [servicebus-url](#u__10__servicebus_url) | `string` | Service Bus connection used for authentication. | *Optional* | | 2.2 | | topic | `string` | Service Bus topic to connect to. | *Optional* | | 2.2 | | history | `object` | Configuration for fetching historical data on startup | *Optional* | | 2.2 | |    fromDateTime | `string` | Datetime boundary for historical data. | *Optional* | `"-P1D"` | 2.2 | @@ -131,36 +131,36 @@ Has to be present for authenticationMethod SharedAccessKey. This should be Prima ##### Parameter details -

    authenticationType

    +

    authenticationType

    **Since version:** `2.5` ∙ **Type:** `enum` ∙ **Cardinality:** `Optional` ∙ **Default value:** `"sharedaccesskey"` -**Path:** /updaters/[11] +**Path:** /updaters/[10] **Enum values:** `sharedaccesskey` | `federatedidentity` Which authentication type to use -

    customMidnight

    +

    customMidnight

    **Since version:** `2.2` ∙ **Type:** `integer` ∙ **Cardinality:** `Optional` ∙ **Default value:** `0` -**Path:** /updaters/[11] +**Path:** /updaters/[10] Time on which time breaks into new day. It is common that operating day date breaks a little bit later than midnight so that the switch happens when traffic is at the lowest point. Parameter uses 24-hour format. If the switch happens on 4 am then set this field to 4. -

    fullyQualifiedNamespace

    +

    fullyQualifiedNamespace

    **Since version:** `2.5` ∙ **Type:** `string` ∙ **Cardinality:** `Optional` -**Path:** /updaters/[11] +**Path:** /updaters/[10] Service Bus fully qualified namespace used for authentication. Has to be present for authenticationMethod FederatedIdentity. -

    servicebus-url

    +

    servicebus-url

    **Since version:** `2.2` ∙ **Type:** `string` ∙ **Cardinality:** `Optional` -**Path:** /updaters/[11] +**Path:** /updaters/[10] Service Bus connection used for authentication. diff --git a/doc/user/sandbox/siri/SiriGooglePubSubUpdater.md b/doc/user/sandbox/siri/SiriGooglePubSubUpdater.md index 74dfc4a4238..58d05d5490e 100644 --- a/doc/user/sandbox/siri/SiriGooglePubSubUpdater.md +++ b/doc/user/sandbox/siri/SiriGooglePubSubUpdater.md @@ -31,22 +31,22 @@ of the `router-config.json`. | Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | |------------------------------------------------------------|:----------:|----------------------------------------------------------------------------------|:----------:|---------------|:-----:| | type = "siri-et-google-pubsub-updater" | `enum` | The type of the updater. | *Required* | | 1.5 | -| [dataInitializationUrl](#u__13__dataInitializationUrl) | `string` | URL used to download over HTTP the recent history of SIRI-ET messages. | *Optional* | | 2.1 | +| [dataInitializationUrl](#u__12__dataInitializationUrl) | `string` | URL used to download over HTTP the recent history of SIRI-ET messages. | *Optional* | | 2.1 | | feedId | `string` | The ID of the feed to apply the updates to. | *Optional* | | 2.1 | | fuzzyTripMatching | `boolean` | If the trips should be matched fuzzily. | *Optional* | `false` | 2.1 | -| [initialGetDataTimeout](#u__13__initialGetDataTimeout) | `duration` | Timeout for retrieving the recent history of SIRI-ET messages. | *Optional* | `"PT30S"` | 2.1 | -| [reconnectPeriod](#u__13__reconnectPeriod) | `duration` | Wait this amount of time before trying to reconnect to the PubSub subscription. | *Optional* | `"PT30S"` | 2.1 | -| [subscriptionProjectName](#u__13__subscriptionProjectName) | `string` | The Google Cloud project that hosts the PubSub subscription. | *Required* | | 2.1 | +| [initialGetDataTimeout](#u__12__initialGetDataTimeout) | `duration` | Timeout for retrieving the recent history of SIRI-ET messages. | *Optional* | `"PT30S"` | 2.1 | +| [reconnectPeriod](#u__12__reconnectPeriod) | `duration` | Wait this amount of time before trying to reconnect to the PubSub subscription. | *Optional* | `"PT30S"` | 2.1 | +| [subscriptionProjectName](#u__12__subscriptionProjectName) | `string` | The Google Cloud project that hosts the PubSub subscription. | *Required* | | 2.1 | | topicName | `string` | The name of the PubSub topic that publishes the updates. | *Required* | | 2.1 | | topicProjectName | `string` | The Google Cloud project that hosts the PubSub topic that publishes the updates. | *Required* | | 2.1 | ##### Parameter details -

    dataInitializationUrl

    +

    dataInitializationUrl

    **Since version:** `2.1` ∙ **Type:** `string` ∙ **Cardinality:** `Optional` -**Path:** /updaters/[13] +**Path:** /updaters/[12] URL used to download over HTTP the recent history of SIRI-ET messages. @@ -55,10 +55,10 @@ If this parameter is set, the updater will be marked as initialized (primed) onl the message history is fully downloaded and applied. -

    initialGetDataTimeout

    +

    initialGetDataTimeout

    **Since version:** `2.1` ∙ **Type:** `duration` ∙ **Cardinality:** `Optional` ∙ **Default value:** `"PT30S"` -**Path:** /updaters/[13] +**Path:** /updaters/[12] Timeout for retrieving the recent history of SIRI-ET messages. @@ -67,10 +67,10 @@ of time for the connection to be established. If the connection times out, the updater will retry indefinitely with exponential backoff. -

    reconnectPeriod

    +

    reconnectPeriod

    **Since version:** `2.1` ∙ **Type:** `duration` ∙ **Cardinality:** `Optional` ∙ **Default value:** `"PT30S"` -**Path:** /updaters/[13] +**Path:** /updaters/[12] Wait this amount of time before trying to reconnect to the PubSub subscription. @@ -78,10 +78,10 @@ In case of a network error, the updater will try periodically to reconnect to th Google PubSub subscription. -

    subscriptionProjectName

    +

    subscriptionProjectName

    **Since version:** `2.1` ∙ **Type:** `string` ∙ **Cardinality:** `Required` -**Path:** /updaters/[13] +**Path:** /updaters/[12] The Google Cloud project that hosts the PubSub subscription. diff --git a/doc/user/sandbox/siri/SiriUpdater.md b/doc/user/sandbox/siri/SiriUpdater.md index 72ab45d0f39..f6c4c3f999f 100644 --- a/doc/user/sandbox/siri/SiriUpdater.md +++ b/doc/user/sandbox/siri/SiriUpdater.md @@ -37,16 +37,16 @@ To enable the SIRI updater you need to add it to the updaters section of the `ro | previewInterval | `duration` | TODO | *Optional* | | 2.0 | | requestorRef | `string` | The requester reference. | *Optional* | | 2.0 | | timeout | `duration` | The HTTP timeout to download the updates. | *Optional* | `"PT15S"` | 2.0 | -| [url](#u__9__url) | `string` | The URL to send the HTTP requests to. | *Required* | | 2.0 | -| [headers](#u__9__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.3 | +| [url](#u__8__url) | `string` | The URL to send the HTTP requests to. | *Required* | | 2.0 | +| [headers](#u__8__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.3 | ##### Parameter details -

    url

    +

    url

    **Since version:** `2.0` ∙ **Type:** `string` ∙ **Cardinality:** `Required` -**Path:** /updaters/[9] +**Path:** /updaters/[8] The URL to send the HTTP requests to. @@ -58,10 +58,10 @@ renamed by the loader when processed: -

    headers

    +

    headers

    **Since version:** `2.3` ∙ **Type:** `map of string` ∙ **Cardinality:** `Optional` -**Path:** /updaters/[9] +**Path:** /updaters/[8] HTTP headers to add to the request. Any header key, value can be inserted. @@ -93,25 +93,25 @@ HTTP headers to add to the request. Any header key, value can be inserted. -| Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | -|----------------------------------|:---------------:|--------------------------------------------------------------------------------------------------------|:----------:|---------------|:-----:| -| type = "siri-sx-updater" | `enum` | The type of the updater. | *Required* | | 1.5 | -| blockReadinessUntilInitialized | `boolean` | Whether catching up with the updates should block the readiness check from returning a 'ready' result. | *Optional* | `false` | 2.0 | -| [earlyStart](#u__10__earlyStart) | `duration` | This value is subtracted from the actual validity defined in the message. | *Optional* | `"PT0S"` | 2.0 | -| feedId | `string` | The ID of the feed to apply the updates to. | *Required* | | 2.0 | -| frequency | `duration` | How often the updates should be retrieved. | *Optional* | `"PT1M"` | 2.0 | -| requestorRef | `string` | The requester reference. | *Optional* | | 2.0 | -| timeout | `duration` | The HTTP timeout to download the updates. | *Optional* | `"PT15S"` | 2.0 | -| [url](#u__10__url) | `string` | The URL to send the HTTP requests to. Supports http/https and file protocol. | *Required* | | 2.0 | -| [headers](#u__10__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.3 | +| Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | +|---------------------------------|:---------------:|--------------------------------------------------------------------------------------------------------|:----------:|---------------|:-----:| +| type = "siri-sx-updater" | `enum` | The type of the updater. | *Required* | | 1.5 | +| blockReadinessUntilInitialized | `boolean` | Whether catching up with the updates should block the readiness check from returning a 'ready' result. | *Optional* | `false` | 2.0 | +| [earlyStart](#u__9__earlyStart) | `duration` | This value is subtracted from the actual validity defined in the message. | *Optional* | `"PT0S"` | 2.0 | +| feedId | `string` | The ID of the feed to apply the updates to. | *Required* | | 2.0 | +| frequency | `duration` | How often the updates should be retrieved. | *Optional* | `"PT1M"` | 2.0 | +| requestorRef | `string` | The requester reference. | *Optional* | | 2.0 | +| timeout | `duration` | The HTTP timeout to download the updates. | *Optional* | `"PT15S"` | 2.0 | +| [url](#u__9__url) | `string` | The URL to send the HTTP requests to. Supports http/https and file protocol. | *Required* | | 2.0 | +| [headers](#u__9__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.3 | ##### Parameter details -

    earlyStart

    +

    earlyStart

    **Since version:** `2.0` ∙ **Type:** `duration` ∙ **Cardinality:** `Optional` ∙ **Default value:** `"PT0S"` -**Path:** /updaters/[10] +**Path:** /updaters/[9] This value is subtracted from the actual validity defined in the message. @@ -119,10 +119,10 @@ Normally the planned departure time is used, so setting this to 10s will cause t SX-message to be included in trip-results 10 seconds before the the planned departure time. -

    url

    +

    url

    **Since version:** `2.0` ∙ **Type:** `string` ∙ **Cardinality:** `Required` -**Path:** /updaters/[10] +**Path:** /updaters/[9] The URL to send the HTTP requests to. Supports http/https and file protocol. @@ -135,10 +135,10 @@ renamed by the loader when processed: -

    headers

    +

    headers

    **Since version:** `2.3` ∙ **Type:** `map of string` ∙ **Cardinality:** `Optional` -**Path:** /updaters/[10] +**Path:** /updaters/[9] HTTP headers to add to the request. Any header key, value can be inserted. diff --git a/magidoc.mjs b/magidoc.mjs index 595ba25c0c0..d43945f976c 100644 --- a/magidoc.mjs +++ b/magidoc.mjs @@ -1,7 +1,7 @@ export default { introspection: { type: 'sdl', - paths: ['src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls'], + paths: ['application/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls'], }, website: { template: 'carbon-multi-page', @@ -9,6 +9,7 @@ export default { options: { siteRoot: '/api/dev-2.x/graphql-gtfs', appLogo: 'https://docs.opentripplanner.org/en/dev-2.x/images/otp-logo.svg', + customStyles: ['https://docs.opentripplanner.org/en/dev-2.x/css/magidoc-overrides.css'], pages: [{ title: 'Introduction', content: ` diff --git a/mkdocs.yml b/mkdocs.yml index 8b3748be2b0..1364be7be1f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -56,12 +56,12 @@ nav: - Visual Identity: 'Visual-Identity.md' - 'Usage': - Basic Tutorial: 'Basic-Tutorial.md' - - Data Sources: 'Data-Sources.md' + - Netex and SIRI Tutorial: 'Netex-Tutorial.md' - Getting OTP: 'Getting-OTP.md' + - Data Sources: 'Data-Sources.md' - Container Image: 'Container-Image.md' - System Requirements and Suggestions: 'System-Requirements.md' - Preparing OSM Data: 'Preparing-OSM.md' - - Netex and SIRI: 'Netex-Norway.md' - Troubleshooting: 'Troubleshooting-Routing.md' - Comparing OTP2 to OTP1: 'Version-Comparison.md' - Frontends: 'Frontends.md' @@ -90,6 +90,7 @@ nav: - "Stop Area Relations": 'StopAreas.md' - "Street Graph Pruning": 'IslandPruning.md' - Accessibility: 'Accessibility.md' + - NeTex and Siri compatibility: 'features-explained/Netex-Siri-Compatibility.md' - "Travel Time Analysis": 'Analysis.md' - "Logging": "Logging.md" - Development: diff --git a/pom.xml b/pom.xml index 710270dad16..34a76961872 100644 --- a/pom.xml +++ b/pom.xml @@ -1,14 +1,16 @@ - + 4.0.0 + org.opentripplanner + otp-root + 2.7.0-SNAPSHOT + pom - OpenTripPlanner + OpenTripPlanner - Root The OpenTripPlanner multimodal journey planning system https://opentripplanner.org - org.opentripplanner - otp - 2.6.0 - jar @@ -56,17 +58,17 @@ - 157 + 164 - 31.3 + 32.0 2.52 - 2.17.2 + 2.18.0 3.1.8 5.11.0 - 1.13.4 + 1.13.5 5.6.0 - 1.5.7 - 9.11.1 + 1.5.8 + 9.12.0 2.0.16 2.0.15 1.27 @@ -80,7 +82,7 @@ 0.22 write - + false @@ -91,43 +93,11 @@ + + application + + - - - - src/main/resources - true - - - src/ext/resources - true - - - src/client - client - false - - - - - src/test/resources - - - src/ext-test/resources - - - - - - src/scripts - true - - ../.. - - package-javadoc package - jar + + jar + ${basedir}/doc/javadoc javadoc @@ -206,39 +178,6 @@ UTF-8 - - org.codehaus.mojo - build-helper-maven-plugin - 3.6.0 - - - build-helper-generate-sources - generate-sources - - add-source - - - - src/main/java - src/ext/java - - - - - build-helper-generate-test-sources - generate-test-sources - - add-test-source - - - - src/test/java - src/ext-test/java - - - - - org.apache.maven.plugins maven-surefire-plugin @@ -344,91 +283,16 @@ - - - - org.apache.maven.plugins - maven-shade-plugin - 3.6.0 - - - package - - shade - - - - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - true - shaded - false - - - - - - - org.opentripplanner.standalone.OTPMain - - Java Advanced Imaging Image I/O - Tools - - 1.1 - Sun Microsystems, Inc. - com.sun.media.imageio - 1.1 - Sun Microsystems, Inc. - com.sun.media.imageio - - - - - - - com.hubspot.maven.plugins prettier-maven-plugin ${plugin.prettier.version} + ${plugin.prettier.skip} 2.0.0 src/main/java/**/*.java src/test/java/**/*.java - src/ext/java/**/*.java - src/ext-test/java/**/*.java src/test/resources/org/opentripplanner/apis/**/*.graphql @@ -440,7 +304,6 @@ - com.google.cloud.tools @@ -524,9 +387,9 @@ Maven tries to download from every other repository and fails before checking central. Do not change the id from central2 to central, otherwise the entry will be ignored. --> - central2 - Check central first to avoid a lot of not found warnings - https://repo.maven.apache.org/maven2 + central2 + Check central first to avoid a lot of not found warnings + https://repo.maven.apache.org/maven2 osgeo @@ -541,381 +404,102 @@ com.google.cloud libraries-bom - 26.45.0 + 26.48.0 pom import - - - - - - - org.slf4j - slf4j-api - ${slf4j.version} - - - - org.slf4j - jul-to-slf4j - ${slf4j.version} - - - - ch.qos.logback - logback-classic - ${logback.version} - - - - net.logstash.logback - logstash-logback-encoder - 8.0 - - - - - com.google.dagger - dagger - ${google.dagger.version} - - - - - - - org.geotools - gt-coverage - ${geotools.version} - - - org.geotools - gt-geotiff - ${geotools.version} - - - org.geotools - gt-api - ${geotools.version} - - - org.geotools - gt-geojson-core - ${geotools.version} - - - - - org.apache.lucene - lucene-core - ${lucene.version} - - - org.apache.lucene - lucene-queryparser - ${lucene.version} - - - org.apache.lucene - lucene-suggest - ${lucene.version} - - - - io.micrometer - micrometer-registry-prometheus - ${micrometer.version} - - - io.micrometer - micrometer-registry-influx - ${micrometer.version} - test - - - - - - edu.ucar - netcdf4 - ${netcdf4.version} - - - - org.entur - netex-java-model - ${netex-java-model.version} - - - - - org.entur - siri-java-model - ${siri-java-model.version} - - - - - org.entur - siri-protobuf-mapper - 1.0.3 - - - - org.mobilitydata - gbfs-java-model - 1.0.7 - - - - - org.junit.jupiter - junit-jupiter-api - ${junit.version} - test - - - org.junit.jupiter - junit-jupiter-params - ${junit.version} - test - - - com.google.truth - truth - 1.4.4 - test - - - com.tngtech.archunit - archunit - 1.3.0 - test - - - org.mockito - mockito-core - 5.13.0 - test - - - io.github.origin-energy - java-snapshot-testing-junit5 - 2.3.0 - test - - - - - com.conveyal - kryo-tools - 1.6.0 - - - - de.javakaffee - kryo-serializers - 0.45 - - - - com.google.guava - guava - 33.2.1-jre - - - - org.glassfish.jersey.core - jersey-server - ${jersey.version} - - - - org.glassfish.jersey.containers - jersey-container-grizzly2-http - ${jersey.version} - - - - org.glassfish.jersey.media - jersey-media-json-jackson - ${jersey.version} - - - - org.glassfish.jersey.inject - jersey-hk2 - ${jersey.version} - - - - - org.glassfish.jaxb - jaxb-runtime - ${jaxb-runtime.version} - - - - - com.fasterxml.jackson.core - jackson-core - ${jackson.version} - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - - - com.fasterxml.jackson.datatype - jackson-datatype-jdk8 - ${jackson.version} - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - ${jackson.version} - - - - com.fasterxml.jackson.core - jackson-annotations - ${jackson.version} - - - + + + org.slf4j + slf4j-api + ${slf4j.version} + - - - com.google.cloud - google-cloud-storage - + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + net.sf.trove4j + trove4j + 3.0.3 + + + com.google.guava + guava + 33.2.1-jre + - - - com.google.cloud - google-cloud-pubsub - + + + + org.geotools + gt-coverage + ${geotools.version} + + + org.geotools + gt-geotiff + ${geotools.version} + + + org.geotools + gt-api + ${geotools.version} + + + org.geotools + gt-geojson-core + ${geotools.version} + + + de.grundid.opendatalab + geojson-jackson + 1.14 + - - - com.google.protobuf - protobuf-java - + - - - org.onebusaway - onebusaway-gtfs - 3.2.3 - - - - org.processing - core - 2.2.1 - - - - net.java.dev.jets3t - jets3t - 0.9.4 - - - - org.openstreetmap.osmosis - osmosis-osm-binary - 0.48.3 - - - - com.beust - jcommander - 1.82 - - - com.graphql-java - graphql-java - 22.3 - - - com.graphql-java - graphql-java-extended-scalars - 22.0 - - - org.apache.httpcomponents.client5 - httpclient5 - 5.3.1 - - - commons-cli - commons-cli - 1.5.0 - test - - - net.sourceforge.javacsv - javacsv - 2.0 - - - org.eclipse.paho - org.eclipse.paho.client.mqttv3 - 1.2.5 - - - io.github.ci-cmg - mapbox-vector-tile - 4.0.6 - - - net.objecthunter - exp4j - 0.4.8 - - - com.azure - azure-core - 1.46.0 - - - com.azure - azure-messaging-servicebus - 7.15.0 - - - com.azure - azure-identity - 1.11.2 - compile - - - ch.poole - OpeningHoursParser - 0.28.2 - + + org.junit.jupiter + junit-jupiter-api + ${junit.version} + + + org.junit.jupiter + junit-jupiter-params + ${junit.version} + + + com.google.truth + truth + 1.4.4 + + + com.tngtech.archunit + archunit + 1.3.0 + + + org.mockito + mockito-core + 5.13.0 + + + io.github.origin-energy + java-snapshot-testing-junit5 + 2.3.0 + - - - org.apache.commons - commons-compress - 1.27.1 - test - - + + @@ -938,18 +522,9 @@ - - - - com.hubspot.maven.plugins - prettier-maven-plugin - ${plugin.prettier.version} - - true - - - - + + true + clean-test-snapshots @@ -989,7 +564,7 @@ org.apache.maven.plugins maven-gpg-plugin - 3.2.5 + 3.2.6 sign-artifacts diff --git a/renovate.json5 b/renovate.json5 index b672797d48f..900147e0f07 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -147,9 +147,18 @@ { "description": "give some projects time to publish a changelog before opening the PR", "matchPackagePrefixes": [ - "com.google.dagger:" + "com.google.dagger:", + "com.fasterxml.jackson" ], "minimumReleaseAge": "1 week" + }, + { + "description": "Geotools takes a while to publish a changelog and since it pulls in JTS it can change the serialization of the graph", + "matchPackagePrefixes": [ + "org.geotools:" + ], + "minimumReleaseAge": "1 week", + "labels": ["skip changelog", "bump serialization id"] } ], "timezone": "Europe/Berlin" diff --git a/src/scripts/otp b/script/otp similarity index 100% rename from src/scripts/otp rename to script/otp diff --git a/src/scripts/otp-ui b/script/otp-ui similarity index 100% rename from src/scripts/otp-ui rename to script/otp-ui diff --git a/src/ext-test/java/org/opentripplanner/ext/vehicleparking/noi/NoiUpdaterTest.java b/src/ext-test/java/org/opentripplanner/ext/vehicleparking/noi/NoiUpdaterTest.java deleted file mode 100644 index f931e3d964e..00000000000 --- a/src/ext-test/java/org/opentripplanner/ext/vehicleparking/noi/NoiUpdaterTest.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.opentripplanner.ext.vehicleparking.noi; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -import java.time.Duration; -import org.junit.jupiter.api.Test; -import org.opentripplanner.test.support.ResourceLoader; -import org.opentripplanner.updater.spi.HttpHeaders; - -class NoiUpdaterTest { - - @Test - void parse() { - var uri = ResourceLoader.of(this).uri("stations.json"); - var parameters = new NoiUpdaterParameters( - "noi", - uri, - "noi", - Duration.ofSeconds(30), - HttpHeaders.empty() - ); - var updater = new NoiUpdater(parameters); - updater.update(); - var lots = updater.getUpdates(); - - assertEquals(14, lots.size()); - - lots.forEach(l -> assertNotNull(l.getName())); - - var first = lots.getFirst(); - assertEquals("noi:105", first.getId().toString()); - assertEquals("(46.49817, 11.35726)", first.getCoordinate().toString()); - assertEquals("P05 - Laurin", first.getName().toString()); - assertEquals(57, first.getAvailability().getCarSpaces()); - assertEquals(90, first.getCapacity().getCarSpaces()); - - var last = lots.getLast(); - assertEquals( - "noi:935af00d-aa5f-eb11-9889-501ac5928d31-0.8458736393052522", - last.getId().toString() - ); - assertEquals("(46.5057, 11.3395)", last.getCoordinate().toString()); - assertEquals( - "Parksensoren Bozen - PNI Parksensor Nr.10 Commissariato - Viale Eugenio di savoia", - last.getName().toString() - ); - assertEquals(0, last.getAvailability().getCarSpaces()); - assertEquals(1, last.getCapacity().getCarSpaces()); - } -} diff --git a/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/noi/stations.json b/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/noi/stations.json deleted file mode 100644 index 2bbb07ac98b..00000000000 --- a/src/ext-test/resources/org/opentripplanner/ext/vehicleparking/noi/stations.json +++ /dev/null @@ -1,159 +0,0 @@ -{ - "last_updated": 1711368767, - "ttl": 0, - "version": "3.0.0", - "data": { - "stations": [ - { - "type": "station", - "station_id": "105", - "name": "P05 - Laurin", - "lat": 46.498174, - "lon": 11.357255, - "city": "Bolzano - Bozen", - "capacity": 90, - "free": 57 - }, - { - "type": "station", - "station_id": "TRENTO:areaexsitviacanestrinip1", - "name": "Area ex SIT via Canestrini - P1", - "lat": 46.0691, - "lon": 11.1162, - "address": "Lung'Adige Monte Grappa", - "city": "Trento", - "capacity": 300, - "free": 0 - }, - { - "type": "station", - "station_id": "ROVERETO:asm", - "name": "A.S.M.", - "lat": 45.893593, - "lon": 11.036507, - "address": "Piazzale ex-A.S.M - Via Manzoni - Rovereto", - "city": "Rovereto", - "capacity": 145, - "free": 42 - }, - { - "type": "station", - "station_id": "ROVERETO:centrostorico", - "name": "Centro Storico", - "lat": 45.890306, - "lon": 11.045004, - "address": "Viale dei Colli - Rovereto", - "city": "Rovereto", - "capacity": 143, - "free": 20 - }, - { - "type": "station", - "station_id": "ROVERETO:mart", - "name": "Mart", - "lat": 45.894705, - "lon": 11.044661, - "address": "Mart - Via Sticcotta - Rovereto", - "city": "Rovereto", - "capacity": 224, - "free": 224 - }, - { - "type": "sensor", - "station_id": "001bc50670100557-0.30188412882192206", - "group_name": "area viale Druso", - "group_id": "area_viale_druso", - "name": "piazzetta Mazzoni 3", - "lat": 46.495025, - "lon": 11.347069, - "address": "area viale Druso", - "city": "Bolzano - Bozen", - "free": false - }, - { - "type": "sensor", - "station_id": "001bc50670100541-0.9632040952321754", - "group_name": "Via A. Rosmini 22-26", - "group_id": "via_a_rosmini_22_26", - "name": "Via A. Rosmini 22-26", - "lat": 46.498292, - "lon": 11.348031, - "address": "Via A. Rosmini 22-26", - "city": "Bolzano - Bozen", - "free": false - }, - { - "type": "sensor", - "station_id": "001bc50670112a6b-0.6239539554369709", - "group_name": "Via Amalfi", - "group_id": "via_amalfi", - "name": "Via Amalfi angolo Via Druso", - "lat": 46.495283, - "lon": 11.332472, - "address": "Via Amalfi", - "city": "Bolzano - Bozen", - "free": false - }, - { - "type": "sensor", - "station_id": "001bc5067010064d-0.18879954213280836", - "group_name": "area viale Druso", - "group_id": "area_viale_druso", - "name": "piazzetta Mazzoni 4", - "lat": 46.495056, - "lon": 11.347056, - "address": "area viale Druso", - "city": "Bolzano - Bozen", - "free": false - }, - { - "type": "sensor", - "station_id": "001bc50670112976-0.4989211141789258", - "group_name": "Viale Druso 237", - "group_id": "viale_druso_237", - "name": "Viale Druso 237", - "lat": 46.495, - "lon": 11.328703, - "address": "Viale Druso 237", - "city": "Bolzano - Bozen", - "free": true - }, - { - "type": "sensor", - "station_id": "9398a35b-ef3d-eb11-b9ed-0050f244b601-0.12775006754129703", - "group_id": "", - "name": "Parksensoren Bozen - PNI Parksensor Nr.3 Siegesplatz Parkplatz", - "lat": 46.501, - "lon": 11.3431, - "free": true - }, - { - "type": "sensor", - "station_id": "7776d25f-f03d-eb11-b9ed-0050f244b601-0.4355636862513992", - "group_id": "", - "name": "Parksensoren Bozen - PNI Parksensor Nr.5 DucaDaostastrasse", - "lat": 46.4953, - "lon": 11.3396, - "free": false - }, - { - "type": "sensor", - "station_id": "e3e26add-ee3d-eb11-b9ed-0050f244b601-0.8423578257530036", - "group_id": "", - "name": "Parksensoren Bozen - PNI Parksensor Nr.4 Bahnhof BZ Richtung Rittnerseilbahn", - "lat": 46.497, - "lon": 11.3583, - "free": false - }, - { - "type": "sensor", - "station_id": "935af00d-aa5f-eb11-9889-501ac5928d31-0.8458736393052522", - "group_id": "", - "name": "Parksensoren Bozen - PNI Parksensor Nr.10 Commissariato - Viale Eugenio di savoia", - "lat": 46.5057, - "lon": 11.3395, - "free": false - } - ] - } -} \ No newline at end of file diff --git a/src/ext/java/org/opentripplanner/ext/vehicleparking/noi/NoiUpdater.java b/src/ext/java/org/opentripplanner/ext/vehicleparking/noi/NoiUpdater.java deleted file mode 100644 index d5ef7e63d13..00000000000 --- a/src/ext/java/org/opentripplanner/ext/vehicleparking/noi/NoiUpdater.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.opentripplanner.ext.vehicleparking.noi; - -import com.fasterxml.jackson.databind.JsonNode; -import org.opentripplanner.framework.geometry.WgsCoordinate; -import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.framework.tostring.ToStringBuilder; -import org.opentripplanner.routing.vehicle_parking.VehicleParking; -import org.opentripplanner.routing.vehicle_parking.VehicleParkingSpaces; -import org.opentripplanner.routing.vehicle_parking.VehicleParkingState; -import org.opentripplanner.transit.model.framework.FeedScopedId; -import org.opentripplanner.updater.spi.GenericJsonDataSource; - -/** - * Vehicle parking updater class for NOI's open data hub format APIs. - */ -public class NoiUpdater extends GenericJsonDataSource { - - private static final String JSON_PARSE_PATH = "data/stations"; - private final NoiUpdaterParameters params; - - public NoiUpdater(NoiUpdaterParameters parameters) { - super(parameters.url().toString(), JSON_PARSE_PATH, parameters.httpHeaders()); - this.params = parameters; - } - - @Override - protected VehicleParking parseElement(JsonNode jsonNode) { - var type = jsonNode.path("type").textValue(); - VehicleParkingSpaces capacity, availability; - if (type.equals("station")) { - capacity = extractSpaces(jsonNode, "capacity"); - availability = extractSpaces(jsonNode, "free"); - } else if (type.equals("sensor")) { - capacity = VehicleParkingSpaces.builder().carSpaces(1).build(); - var isFree = jsonNode.path("free").asBoolean(); - availability = VehicleParkingSpaces.builder().carSpaces(isFree ? 1 : 0).build(); - } else { - throw new IllegalArgumentException("Unknown type '%s'".formatted(type)); - } - - var vehicleParkId = new FeedScopedId(params.feedId(), jsonNode.path("station_id").asText()); - var name = new NonLocalizedString(jsonNode.path("name").asText()); - double lat = jsonNode.path("lat").asDouble(); - double lon = jsonNode.path("lon").asDouble(); - var coordinate = new WgsCoordinate(lat, lon); - VehicleParking.VehicleParkingEntranceCreator entrance = builder -> - builder - .entranceId(new FeedScopedId(params.feedId(), vehicleParkId.getId() + "/entrance")) - .coordinate(coordinate) - .walkAccessible(true) - .carAccessible(true); - - return VehicleParking - .builder() - .id(vehicleParkId) - .name(name) - .state(VehicleParkingState.OPERATIONAL) - .coordinate(coordinate) - .capacity(capacity) - .availability(availability) - .carPlaces(true) - .entrance(entrance) - .build(); - } - - private static VehicleParkingSpaces extractSpaces(JsonNode jsonNode, String free) { - return VehicleParkingSpaces.builder().carSpaces(jsonNode.get(free).asInt()).build(); - } - - @Override - public String toString() { - return ToStringBuilder - .of(this.getClass()) - .addStr("url", this.params.url().toString()) - .toString(); - } -} diff --git a/src/ext/java/org/opentripplanner/ext/vehicleparking/noi/NoiUpdaterParameters.java b/src/ext/java/org/opentripplanner/ext/vehicleparking/noi/NoiUpdaterParameters.java deleted file mode 100644 index b34769c9dd2..00000000000 --- a/src/ext/java/org/opentripplanner/ext/vehicleparking/noi/NoiUpdaterParameters.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.opentripplanner.ext.vehicleparking.noi; - -import static org.opentripplanner.updater.vehicle_parking.VehicleParkingUpdaterParameters.UpdateType.FULL; - -import java.net.URI; -import java.time.Duration; -import org.opentripplanner.updater.spi.HttpHeaders; -import org.opentripplanner.updater.vehicle_parking.VehicleParkingSourceType; -import org.opentripplanner.updater.vehicle_parking.VehicleParkingUpdaterParameters; - -/** - * Class that extends {@link VehicleParkingUpdaterParameters} with parameters required by {@link - * NoiUpdater}. - */ -public record NoiUpdaterParameters( - String configRef, - URI url, - String feedId, - Duration frequency, - HttpHeaders httpHeaders -) - implements VehicleParkingUpdaterParameters { - @Override - public VehicleParkingSourceType sourceType() { - return VehicleParkingSourceType.NOI_OPEN_DATA_HUB; - } - - @Override - public UpdateType updateType() { - return FULL; - } -} diff --git a/src/main/java/org/opentripplanner/apis/transmodel/mapping/PassThroughLocationMapper.java b/src/main/java/org/opentripplanner/apis/transmodel/mapping/PassThroughLocationMapper.java deleted file mode 100644 index 951467e8727..00000000000 --- a/src/main/java/org/opentripplanner/apis/transmodel/mapping/PassThroughLocationMapper.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.opentripplanner.apis.transmodel.mapping; - -import static java.util.stream.Collectors.collectingAndThen; -import static java.util.stream.Collectors.toList; - -import java.util.List; -import java.util.Map; -import java.util.Objects; -import org.opentripplanner.routing.api.request.PassThroughPoint; -import org.opentripplanner.transit.service.TransitService; - -class PassThroughLocationMapper { - - static List toLocations( - final TransitService transitService, - final List> passThroughPoints - ) { - return passThroughPoints - .stream() - .map(p -> handlePoint(transitService, p)) - .filter(Objects::nonNull) - .collect(toList()); - // TODO Propagate an error if a stopplace is unknown and fails lookup. - } - - private static PassThroughPoint handlePoint( - final TransitService transitService, - Map map - ) { - final List stops = (List) map.get("placeIds"); - final String name = (String) map.get("name"); - if (stops == null) { - return null; - } - - return stops - .stream() - .map(TransitIdMapper::mapIDToDomain) - .flatMap(id -> { - var stopLocations = transitService.getStopOrChildStops(id); - if (stopLocations.isEmpty()) { - throw new RuntimeException("No match for %s.".formatted(id)); - } - return stopLocations.stream(); - }) - .collect(collectingAndThen(toList(), sls -> new PassThroughPoint(sls, name))); - } -} diff --git a/src/main/java/org/opentripplanner/gtfs/mapping/StopAreaMapper.java b/src/main/java/org/opentripplanner/gtfs/mapping/StopAreaMapper.java deleted file mode 100644 index 55c836aa458..00000000000 --- a/src/main/java/org/opentripplanner/gtfs/mapping/StopAreaMapper.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.opentripplanner.gtfs.mapping; - -import static org.opentripplanner.gtfs.mapping.AgencyAndIdMapper.mapAgencyAndId; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import org.onebusaway.gtfs.model.Location; -import org.onebusaway.gtfs.model.Stop; -import org.opentripplanner.framework.collection.MapUtils; -import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model.site.GroupStop; -import org.opentripplanner.transit.model.site.GroupStopBuilder; -import org.opentripplanner.transit.service.StopModelBuilder; - -/** - * For a while GTFS Flex location groups were replaced by GTFS Fares v2 stop areas. After a few - * months, this decision was reverted and a new style of location groups were re-added to the Flex - * spec. - * @deprecated Arcadis tooling still produces stop areas and for a while we will support both. Please don't rely - * on this as the class will be removed in the future! - */ -@Deprecated -public class StopAreaMapper { - - private final StopMapper stopMapper; - - private final LocationMapper locationMapper; - - private final Map mappedStopAreas = new HashMap<>(); - private final StopModelBuilder stopModel; - - public StopAreaMapper( - StopMapper stopMapper, - LocationMapper locationMapper, - StopModelBuilder stopModel - ) { - this.stopMapper = stopMapper; - this.locationMapper = locationMapper; - this.stopModel = stopModel; - } - - Collection map(Collection allAreas) { - return MapUtils.mapToList(allAreas, this::map); - } - - /** Map from GTFS to OTP model, {@code null} safe. */ - GroupStop map(org.onebusaway.gtfs.model.StopArea original) { - return original == null ? null : mappedStopAreas.computeIfAbsent(original, this::doMap); - } - - private GroupStop doMap(org.onebusaway.gtfs.model.StopArea element) { - GroupStopBuilder groupStopBuilder = stopModel - .groupStop(mapAgencyAndId(element.getId())) - .withName(new NonLocalizedString(element.getName())); - - for (org.onebusaway.gtfs.model.StopLocation location : element.getLocations()) { - switch (location) { - case Stop stop -> groupStopBuilder.addLocation(stopMapper.map(stop)); - case Location loc -> groupStopBuilder.addLocation(locationMapper.map(loc)); - case org.onebusaway.gtfs.model.StopArea ignored -> throw new RuntimeException( - "Nested GroupStops are not allowed" - ); - case null, default -> throw new RuntimeException( - "Unknown location type: " + location.getClass().getSimpleName() - ); - } - } - - return groupStopBuilder.build(); - } -} diff --git a/src/main/java/org/opentripplanner/openstreetmap/model/OSMMemberType.java b/src/main/java/org/opentripplanner/openstreetmap/model/OSMMemberType.java deleted file mode 100644 index 6cb9974b9d8..00000000000 --- a/src/main/java/org/opentripplanner/openstreetmap/model/OSMMemberType.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.opentripplanner.openstreetmap.model; - -public enum OSMMemberType { - NODE, - WAY, - RELATION, -} diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorWorker.java b/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorWorker.java deleted file mode 100644 index fc5786b2407..00000000000 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorWorker.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.opentripplanner.raptor.rangeraptor.internalapi; - -import org.opentripplanner.raptor.api.model.RaptorTripSchedule; - -/** - * The worker performs the travel search. There are multiple implementations, even some that do not - * return paths. - * - * @param The TripSchedule type defined by the user of the raptor API. - */ -public interface RaptorWorker { - /** - * Perform the routing request. - */ - RaptorWorkerResult route(); -} diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RoundProvider.java b/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RoundProvider.java deleted file mode 100644 index 21bd86f8133..00000000000 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RoundProvider.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.opentripplanner.raptor.rangeraptor.internalapi; - -import org.opentripplanner.raptor.rangeraptor.transit.RoundTracker; - -/** - * Keep track of current Raptor round. The provider is injected where needed instead of passing the - * current round down the call stack. This is faster than passing the round on the stack because the - * round is access so frequently thet in most cases it is cached in the CPU registry - at least - * tests indicate this. - *

    - * - * @see RoundTracker - */ -public interface RoundProvider { - /** - * The current Raptor round. - */ - int round(); - - /** - * Return true if this round is the first round, calculating the first transit path. Access is - * calculated in round zero (0). - */ - boolean isFirstRound(); -} diff --git a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/StopArrivalParetoSet.java b/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/StopArrivalParetoSet.java deleted file mode 100644 index ca653be6fc9..00000000000 --- a/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/StopArrivalParetoSet.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.opentripplanner.raptor.rangeraptor.multicriteria; - -import java.util.List; -import javax.annotation.Nullable; -import org.opentripplanner.raptor.api.model.RaptorAccessEgress; -import org.opentripplanner.raptor.api.model.RaptorTripSchedule; -import org.opentripplanner.raptor.api.view.ArrivalView; -import org.opentripplanner.raptor.rangeraptor.multicriteria.arrivals.McStopArrival; -import org.opentripplanner.raptor.rangeraptor.path.DestinationArrivalPaths; -import org.opentripplanner.raptor.util.paretoset.ParetoComparator; -import org.opentripplanner.raptor.util.paretoset.ParetoSetEventListener; -import org.opentripplanner.raptor.util.paretoset.ParetoSetEventListenerComposite; -import org.opentripplanner.raptor.util.paretoset.ParetoSetWithMarker; - -/** - * A pareto optimal set of stop arrivals for a given stop. - * - * @param The TripSchedule type defined by the user of the raptor API. - */ -class StopArrivalParetoSet - extends ParetoSetWithMarker> { - - /** - * Use the factory methods in this class to create a new instance. - */ - private StopArrivalParetoSet( - ParetoComparator> comparator, - ParetoSetEventListener> listener - ) { - super(comparator, listener); - } - - /** - * Create a stop arrivals pareto set and attach an optional {@code paretoSetEventListener} - * (debug handler). - */ - static StopArrivalParetoSet createStopArrivalSet( - ParetoComparator> comparator, - @Nullable ParetoSetEventListener> paretoSetEventListener - ) { - return new StopArrivalParetoSet<>(comparator, paretoSetEventListener); - } - - /** - * Create a new StopArrivalParetoSet and attach a debugger if it exist. Also attach a {@link - * CalculateTransferToDestination} listener which will create new destination arrivals for each - * accepted egress stop arrival. - */ - static StopArrivalParetoSet createEgressStopArrivalSet( - ParetoComparator> comparator, - List egressPaths, - DestinationArrivalPaths destinationArrivals, - @Nullable ParetoSetEventListener> paretoSetEventListener - ) { - ParetoSetEventListener> listener; - - listener = new CalculateTransferToDestination<>(egressPaths, destinationArrivals); - - if (paretoSetEventListener != null) { - listener = new ParetoSetEventListenerComposite<>(paretoSetEventListener, listener); - } - - return new StopArrivalParetoSet<>(comparator, listener); - } -} diff --git a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressRouter.java b/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressRouter.java deleted file mode 100644 index f6a0526fa66..00000000000 --- a/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/AccessEgressRouter.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.opentripplanner.routing.algorithm.raptoradapter.router.street; - -import java.time.Duration; -import java.util.Collection; -import org.opentripplanner.ext.dataoverlay.routing.DataOverlayContext; -import org.opentripplanner.framework.application.OTPRequestTimeoutException; -import org.opentripplanner.graph_builder.module.nearbystops.StreetNearbyStopFinder; -import org.opentripplanner.routing.api.request.RouteRequest; -import org.opentripplanner.routing.api.request.request.StreetRequest; -import org.opentripplanner.routing.graphfinder.NearbyStop; -import org.opentripplanner.street.search.TemporaryVerticesContainer; -import org.opentripplanner.transit.service.TransitService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * This uses a street search to find paths to all the access/egress stop within range - */ -public class AccessEgressRouter { - - private static final Logger LOG = LoggerFactory.getLogger(AccessEgressRouter.class); - - private AccessEgressRouter() {} - - /** - * @param fromTarget whether to route from or towards the point provided in the routing request - * (access or egress) - * @return Transfer objects by access/egress stop - */ - public static Collection streetSearch( - RouteRequest request, - TemporaryVerticesContainer verticesContainer, - StreetRequest streetRequest, - DataOverlayContext dataOverlayContext, - boolean fromTarget, - Duration durationLimit, - int maxStopCount - ) { - OTPRequestTimeoutException.checkForTimeout(); - var nearbyStopFinder = new StreetNearbyStopFinder( - durationLimit, - maxStopCount, - dataOverlayContext - ); - Collection nearbyStopList = nearbyStopFinder.findNearbyStops( - fromTarget ? verticesContainer.getToVertices() : verticesContainer.getFromVertices(), - fromTarget, - request, - streetRequest - ); - - LOG.debug("Found {} {} stops", nearbyStopList.size(), fromTarget ? "egress" : "access"); - - return nearbyStopList; - } -} diff --git a/src/main/java/org/opentripplanner/routing/api/request/PassThroughPoint.java b/src/main/java/org/opentripplanner/routing/api/request/PassThroughPoint.java deleted file mode 100644 index fa63c2e5668..00000000000 --- a/src/main/java/org/opentripplanner/routing/api/request/PassThroughPoint.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.opentripplanner.routing.api.request; - -import java.util.List; -import javax.annotation.Nullable; -import org.opentripplanner.transit.model.site.StopLocation; - -/** - * Defines one pass-through point which the journey must pass through. - */ -public record PassThroughPoint(List stopLocations, @Nullable String name) { - /** - * Get the one or multiple stops of the pass-through point, of which only one is required to be - * passed through. - */ - @Override - public List stopLocations() { - return stopLocations; - } - - /** - * Get an optional name of the pass-through point for debugging and logging. - */ - @Override - @Nullable - public String name() { - return name; - } -} diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/StopAreaMapperTest.java b/src/test/java/org/opentripplanner/gtfs/mapping/StopAreaMapperTest.java deleted file mode 100644 index d58bcfcdd31..00000000000 --- a/src/test/java/org/opentripplanner/gtfs/mapping/StopAreaMapperTest.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.opentripplanner.gtfs.mapping; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.graph_builder.issue.api.DataImportIssueStore.NOOP; - -import java.util.Set; -import java.util.stream.Collectors; -import javax.annotation.Nonnull; -import org.junit.jupiter.api.Test; -import org.onebusaway.gtfs.model.AgencyAndId; -import org.onebusaway.gtfs.model.Area; -import org.onebusaway.gtfs.model.Location; -import org.onebusaway.gtfs.model.Stop; -import org.onebusaway.gtfs.model.StopArea; -import org.opentripplanner._support.geometry.Polygons; -import org.opentripplanner.transit.service.StopModel; - -class StopAreaMapperTest { - - private static final String NAME = "Floxjam"; - private static final AgencyAndId AREA_ID = agencyAndId("flox"); - - @Test - void map() { - var stopModel = StopModel.of(); - var stopMapper = new StopMapper(new TranslationHelper(), ignored -> null, stopModel); - var locationMapper = new LocationMapper(stopModel, NOOP); - var mapper = new StopAreaMapper(stopMapper, locationMapper, stopModel); - - var area = new Area(); - area.setId(AREA_ID); - area.setName(NAME); - - var stop1 = stop("stop1"); - var stop2 = stop("stop2"); - var location = location("location"); - - var stopArea = new StopArea(); - stopArea.setArea(area); - stopArea.addLocation(stop1); - stopArea.addLocation(stop2); - stopArea.addLocation(location); - var areaStop = mapper.map(stopArea); - - assertEquals(NAME, areaStop.getName().toString()); - var stopIds = areaStop - .getChildLocations() - .stream() - .map(l -> l.getId().toString()) - .collect(Collectors.toSet()); - assertEquals(Set.of("1:location", "1:stop1", "1:stop2"), stopIds); - } - - private static Stop stop(String id) { - var stop = new Stop(); - stop.setId(agencyAndId(id)); - stop.setLat(1); - stop.setLon(2); - stop.setName("A stop"); - return stop; - } - - private static Location location(String id) { - var stop = new Location(); - stop.setId(agencyAndId(id)); - stop.setName("A stop"); - stop.setGeometry(Polygons.toGeoJson(Polygons.BERLIN)); - return stop; - } - - @Nonnull - private static AgencyAndId agencyAndId(String id) { - return new AgencyAndId("1", id); - } -} diff --git a/src/test/java/org/opentripplanner/openstreetmap/tagmapping/PortlandMapperTest.java b/src/test/java/org/opentripplanner/openstreetmap/tagmapping/PortlandMapperTest.java deleted file mode 100644 index 26f45fd8c32..00000000000 --- a/src/test/java/org/opentripplanner/openstreetmap/tagmapping/PortlandMapperTest.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.opentripplanner.openstreetmap.tagmapping; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.carTunnel; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.cobblestones; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.fiveLanes; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.footwaySidewalk; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.highwayTertiary; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.highwayTertiaryWithSidewalk; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.highwayTrunk; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.noSidewalk; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.noSidewalkHighSpeed; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.pedestrianTunnel; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.sidewalkBoth; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.southeastLaBonitaWay; -import static org.opentripplanner.openstreetmap.wayproperty.specifier.WayTestData.southwestMayoStreet; - -import java.util.stream.Stream; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; -import org.opentripplanner.openstreetmap.model.OSMWithTags; -import org.opentripplanner.openstreetmap.wayproperty.WayPropertySet; - -public class PortlandMapperTest { - - static double delta = 0.1; - - static WayPropertySet wps = new WayPropertySet(); - - static Stream cases() { - return Stream.of( - Arguments.of(southeastLaBonitaWay(), 0.8), - Arguments.of(southwestMayoStreet(), 0.9), - Arguments.of(sidewalkBoth(), 0.96), - Arguments.of(pedestrianTunnel(), 1.0), - Arguments.of(highwayTertiaryWithSidewalk(), 1.056), - Arguments.of(cobblestones(), 1.2), - Arguments.of(noSidewalk(), 1.2), - Arguments.of(carTunnel(), 1.2), - Arguments.of(footwaySidewalk(), 1.32), - Arguments.of(highwayTertiary(), 1.32), - Arguments.of(highwayTrunk(), 1.44), - Arguments.of(fiveLanes(), 1.584), - Arguments.of(noSidewalkHighSpeed(), 7.19) - ); - } - - static { - var source = new PortlandMapper(); - source.populateProperties(wps); - } - - @ParameterizedTest(name = "way {0} should have walk safety factor {1}") - @MethodSource("cases") - void walkSafety(OSMWithTags way, double expected) { - var score = wps.getDataForWay(way); - - var ws = score.walkSafety(); - assertEquals(expected, ws.forward(), delta); - assertEquals(expected, ws.back(), delta); - } -} diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/plan-extended.json b/src/test/resources/org/opentripplanner/apis/gtfs/expectations/plan-extended.json deleted file mode 100644 index ea58480be8e..00000000000 --- a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/plan-extended.json +++ /dev/null @@ -1,344 +0,0 @@ -{ - "data" : { - "plan" : { - "itineraries" : [ - { - "start" : "2020-02-02T11:00:00Z", - "end" : "2020-02-02T12:00:00Z", - "startTime" : 1580641200000, - "endTime" : 1580644800000, - "generalizedCost" : 4072, - "accessibilityScore" : 0.5, - "emissionsPerPerson" : { - "co2" : 123.0 - }, - "numberOfTransfers" : 1, - "walkDistance" : 28.0, - "walkTime" : 20, - "legs" : [ - { - "mode" : "WALK", - "start" : { - "scheduledTime" : "2020-02-02T11:00:00Z", - "estimated" : null - }, - "end" : { - "scheduledTime" : "2020-02-02T11:00:20Z", - "estimated" : null - }, - "from" : { - "name" : "A", - "lat" : 5.0, - "lon" : 8.0, - "arrival" : { - "scheduledTime" : "2020-02-02T11:00:00Z", - "estimated" : null - }, - "departure" : { - "scheduledTime" : "2020-02-02T11:00:00Z", - "estimated" : null - }, - "departureTime" : 1580641200000, - "arrivalTime" : 1580641200000 - }, - "to" : { - "name" : "B", - "lat" : 6.0, - "lon" : 8.5, - "arrival" : { - "scheduledTime" : "2020-02-02T11:00:20Z", - "estimated" : null - }, - "departure" : { - "scheduledTime" : "2020-02-02T11:00:20Z", - "estimated" : null - }, - "departureTime" : 1580641220000, - "arrivalTime" : 1580641220000 - }, - "startTime" : 1580641200000, - "endTime" : 1580641220000, - "generalizedCost" : 40, - "headsign" : null, - "trip" : null, - "intermediatePlaces" : null, - "alerts" : [ ], - "rideHailingEstimate" : null, - "accessibilityScore" : null - }, - { - "mode" : "BUS", - "start" : { - "scheduledTime" : "2020-02-02T10:51:00Z", - "estimated" : { - "time" : "2020-02-02T11:01:00Z", - "delay" : "PT10M" - } - }, - "end" : { - "scheduledTime" : "2020-02-02T11:05:00Z", - "estimated" : { - "time" : "2020-02-02T11:15:00Z", - "delay" : "PT10M" - } - }, - "from" : { - "name" : "B", - "lat" : 6.0, - "lon" : 8.5, - "arrival" : { - "scheduledTime" : "2020-02-02T10:51:00Z", - "estimated" : { - "delay" : "PT10M", - "time" : "2020-02-02T11:01:00Z" - } - }, - "departure" : { - "scheduledTime" : "2020-02-02T10:51:00Z", - "estimated" : { - "delay" : "PT10M", - "time" : "2020-02-02T11:01:00Z" - } - }, - "departureTime" : 1580641260000, - "arrivalTime" : 1580641260000 - }, - "to" : { - "name" : "C", - "lat" : 7.0, - "lon" : 9.0, - "arrival" : { - "scheduledTime" : "2020-02-02T11:05:00Z", - "estimated" : { - "delay" : "PT10M", - "time" : "2020-02-02T11:15:00Z" - } - }, - "departure" : { - "scheduledTime" : "2020-02-02T11:05:00Z", - "estimated" : { - "delay" : "PT10M", - "time" : "2020-02-02T11:15:00Z" - } - }, - "departureTime" : 1580642100000, - "arrivalTime" : 1580642100000 - }, - "startTime" : 1580641260000, - "endTime" : 1580642100000, - "generalizedCost" : 992, - "headsign" : "Headsign at boarding (stop index 5)", - "trip" : { - "tripHeadsign" : "Trip headsign 122" - }, - "intermediatePlaces" : [ - { - "arrival" : { - "scheduledTime" : "2020-02-02T11:01:00Z", - "estimated" : { - "time" : "2020-02-02T11:11:00Z", - "delay" : "PT10M" - } - }, - "departure" : { - "scheduledTime" : "2020-02-02T11:01:00Z", - "estimated" : { - "time" : "2020-02-02T11:11:00Z", - "delay" : "PT10M" - } - }, - "stop" : { - "name" : "B" - } - } - ], - "alerts" : [ ], - "rideHailingEstimate" : null, - "accessibilityScore" : null - }, - { - "mode" : "RAIL", - "start" : { - "scheduledTime" : "2020-02-02T11:20:00Z", - "estimated" : { - "time" : "2020-02-02T11:30:00Z", - "delay" : "PT10M" - } - }, - "end" : { - "scheduledTime" : "2020-02-02T11:40:00Z", - "estimated" : { - "time" : "2020-02-02T11:50:00Z", - "delay" : "PT10M" - } - }, - "from" : { - "name" : "C", - "lat" : 7.0, - "lon" : 9.0, - "arrival" : { - "scheduledTime" : "2020-02-02T11:20:00Z", - "estimated" : { - "delay" : "PT10M", - "time" : "2020-02-02T11:30:00Z" - } - }, - "departure" : { - "scheduledTime" : "2020-02-02T11:20:00Z", - "estimated" : { - "delay" : "PT10M", - "time" : "2020-02-02T11:30:00Z" - } - }, - "departureTime" : 1580643000000, - "arrivalTime" : 1580643000000 - }, - "to" : { - "name" : "D", - "lat" : 8.0, - "lon" : 9.5, - "arrival" : { - "scheduledTime" : "2020-02-02T11:40:00Z", - "estimated" : { - "delay" : "PT10M", - "time" : "2020-02-02T11:50:00Z" - } - }, - "departure" : { - "scheduledTime" : "2020-02-02T11:40:00Z", - "estimated" : { - "delay" : "PT10M", - "time" : "2020-02-02T11:50:00Z" - } - }, - "departureTime" : 1580644200000, - "arrivalTime" : 1580644200000 - }, - "startTime" : 1580643000000, - "endTime" : 1580644200000, - "generalizedCost" : 2040, - "headsign" : "Headsign at boarding (stop index 5)", - "trip" : { - "tripHeadsign" : "Trip headsign 439" - }, - "intermediatePlaces" : [ - { - "arrival" : { - "scheduledTime" : "2020-02-02T11:30:00Z", - "estimated" : { - "time" : "2020-02-02T11:40:00Z", - "delay" : "PT10M" - } - }, - "departure" : { - "scheduledTime" : "2020-02-02T11:30:00Z", - "estimated" : { - "time" : "2020-02-02T11:40:00Z", - "delay" : "PT10M" - } - }, - "stop" : { - "name" : "C" - } - } - ], - "alerts" : [ - { - "id" : "QWxlcnQ6Rjphbi1hbGVydA", - "alertHeaderText" : "A header", - "alertDescriptionText" : "A description", - "alertEffect" : "REDUCED_SERVICE", - "alertCause" : "MAINTENANCE", - "alertSeverityLevel" : "SEVERE", - "alertUrl" : "https://example.com", - "effectiveStartDate" : 1676459008, - "effectiveEndDate" : 1676545408, - "entities" : [ - { - "name" : "A", - "gtfsId" : "F:A", - "lat" : 5.0, - "lon" : 8.0 - } - ] - } - ], - "rideHailingEstimate" : null, - "accessibilityScore" : null - }, - { - "mode" : "CAR", - "start" : { - "scheduledTime" : "2020-02-02T11:50:00Z", - "estimated" : null - }, - "end" : { - "scheduledTime" : "2020-02-02T12:00:00Z", - "estimated" : null - }, - "from" : { - "name" : "D", - "lat" : 8.0, - "lon" : 9.5, - "arrival" : { - "scheduledTime" : "2020-02-02T11:50:00Z", - "estimated" : null - }, - "departure" : { - "scheduledTime" : "2020-02-02T11:50:00Z", - "estimated" : null - }, - "departureTime" : 1580644200000, - "arrivalTime" : 1580644200000 - }, - "to" : { - "name" : "E", - "lat" : 9.0, - "lon" : 10.0, - "arrival" : { - "scheduledTime" : "2020-02-02T12:00:00Z", - "estimated" : null - }, - "departure" : { - "scheduledTime" : "2020-02-02T12:00:00Z", - "estimated" : null - }, - "departureTime" : 1580644800000, - "arrivalTime" : 1580644800000 - }, - "startTime" : 1580644200000, - "endTime" : 1580644800000, - "generalizedCost" : 1000, - "headsign" : null, - "trip" : null, - "intermediatePlaces" : null, - "alerts" : [ ], - "rideHailingEstimate" : { - "provider" : { - "id" : "uber" - }, - "productName" : "UberX", - "minPrice" : { - "currency" : { - "code" : "EUR", - "digits" : 2 - }, - "amount" : 10.0 - }, - "maxPrice" : { - "currency" : { - "code" : "EUR", - "digits" : 2 - }, - "amount" : 20.0 - }, - "arrival" : "PT10M" - }, - "accessibilityScore" : null - } - ] - } - ] - } - } -} \ No newline at end of file diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/plan-fares.json b/src/test/resources/org/opentripplanner/apis/gtfs/expectations/plan-fares.json deleted file mode 100644 index 1defc81ded1..00000000000 --- a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/plan-fares.json +++ /dev/null @@ -1,191 +0,0 @@ -{ - "data" : { - "plan" : { - "itineraries" : [ - { - "legs" : [ - { - "mode" : "WALK", - "from" : { - "name" : "A", - "lat" : 5.0, - "lon" : 8.0, - "departureTime" : 1580641200000, - "arrivalTime" : 1580641200000 - }, - "to" : { - "name" : "B", - "lat" : 6.0, - "lon" : 8.5, - "departureTime" : 1580641220000, - "arrivalTime" : 1580641220000 - }, - "startTime" : 1580641200000, - "endTime" : 1580641220000, - "generalizedCost" : 40, - "fareProducts" : [ ] - }, - { - "mode" : "BUS", - "from" : { - "name" : "B", - "lat" : 6.0, - "lon" : 8.5, - "departureTime" : 1580641260000, - "arrivalTime" : 1580641260000 - }, - "to" : { - "name" : "C", - "lat" : 7.0, - "lon" : 9.0, - "departureTime" : 1580642100000, - "arrivalTime" : 1580642100000 - }, - "startTime" : 1580641260000, - "endTime" : 1580642100000, - "generalizedCost" : 992, - "fareProducts" : [ - { - "id" : "5d8f889c-42cb-3bcc-89d5-480b995c78c8", - "product" : { - "id" : "F:day-pass", - "name" : "day-pass", - "__typename" : "DefaultFareProduct", - "price" : { - "currency" : { - "digits" : 2, - "code" : "EUR" - }, - "amount" : 10.0 - }, - "riderCategory" : { - "id" : "F:senior-citizens", - "name" : "Senior citizens" - }, - "medium" : { - "id" : "F:oyster", - "name" : "TfL Oyster Card" - } - } - }, - { - "id" : "09bb5f2b-6af9-3355-8b5d-5e93a27ce280", - "product" : { - "id" : "F:single-ticket", - "name" : "single-ticket", - "__typename" : "DefaultFareProduct", - "price" : { - "currency" : { - "digits" : 2, - "code" : "EUR" - }, - "amount" : 10.0 - }, - "riderCategory" : { - "id" : "F:senior-citizens", - "name" : "Senior citizens" - }, - "medium" : { - "id" : "F:oyster", - "name" : "TfL Oyster Card" - } - } - } - ] - }, - { - "mode" : "RAIL", - "from" : { - "name" : "C", - "lat" : 7.0, - "lon" : 9.0, - "departureTime" : 1580643000000, - "arrivalTime" : 1580643000000 - }, - "to" : { - "name" : "D", - "lat" : 8.0, - "lon" : 9.5, - "departureTime" : 1580644200000, - "arrivalTime" : 1580644200000 - }, - "startTime" : 1580643000000, - "endTime" : 1580644200000, - "generalizedCost" : 2040, - "fareProducts" : [ - { - "id" : "5d8f889c-42cb-3bcc-89d5-480b995c78c8", - "product" : { - "id" : "F:day-pass", - "name" : "day-pass", - "__typename" : "DefaultFareProduct", - "price" : { - "currency" : { - "digits" : 2, - "code" : "EUR" - }, - "amount" : 10.0 - }, - "riderCategory" : { - "id" : "F:senior-citizens", - "name" : "Senior citizens" - }, - "medium" : { - "id" : "F:oyster", - "name" : "TfL Oyster Card" - } - } - }, - { - "id" : "46190ddd-93b0-3136-adb7-a18394f8b0ef", - "product" : { - "id" : "F:single-ticket", - "name" : "single-ticket", - "__typename" : "DefaultFareProduct", - "price" : { - "currency" : { - "digits" : 2, - "code" : "EUR" - }, - "amount" : 10.0 - }, - "riderCategory" : { - "id" : "F:senior-citizens", - "name" : "Senior citizens" - }, - "medium" : { - "id" : "F:oyster", - "name" : "TfL Oyster Card" - } - } - } - ] - }, - { - "mode" : "CAR", - "from" : { - "name" : "D", - "lat" : 8.0, - "lon" : 9.5, - "departureTime" : 1580644200000, - "arrivalTime" : 1580644200000 - }, - "to" : { - "name" : "E", - "lat" : 9.0, - "lon" : 10.0, - "departureTime" : 1580644800000, - "arrivalTime" : 1580644800000 - }, - "startTime" : 1580644200000, - "endTime" : 1580644800000, - "generalizedCost" : 1000, - "fareProducts" : [ ] - } - ], - "fares" : [ ] - } - ] - } - } -} \ No newline at end of file diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/plan-stop-positions.json b/src/test/resources/org/opentripplanner/apis/gtfs/expectations/plan-stop-positions.json deleted file mode 100644 index 8b7e9771958..00000000000 --- a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/plan-stop-positions.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "data" : { - "plan" : { - "itineraries" : [ - { - "startTime" : 1580641200000, - "endTime" : 1580644800000, - "generalizedCost" : 4072, - "accessibilityScore" : 0.5, - "legs" : [ - { - "mode" : "WALK", - "from" : { - "name" : "A", - "lat" : 5.0, - "lon" : 8.0, - "departureTime" : 1580641200000, - "arrivalTime" : 1580641200000, - "stopPosition" : null - }, - "to" : { - "name" : "B", - "lat" : 6.0, - "lon" : 8.5, - "departureTime" : 1580641220000, - "arrivalTime" : 1580641220000, - "stopPosition" : null - }, - "startTime" : 1580641200000, - "endTime" : 1580641220000, - "generalizedCost" : 40 - }, - { - "mode" : "BUS", - "from" : { - "name" : "B", - "lat" : 6.0, - "lon" : 8.5, - "departureTime" : 1580641260000, - "arrivalTime" : 1580641260000, - "stopPosition" : { - "__typename" : "PositionAtStop", - "position" : 0 - } - }, - "to" : { - "name" : "C", - "lat" : 7.0, - "lon" : 9.0, - "departureTime" : 1580642100000, - "arrivalTime" : 1580642100000, - "stopPosition" : { - "__typename" : "PositionAtStop", - "position" : 0 - } - }, - "startTime" : 1580641260000, - "endTime" : 1580642100000, - "generalizedCost" : 992 - }, - { - "mode" : "RAIL", - "from" : { - "name" : "C", - "lat" : 7.0, - "lon" : 9.0, - "departureTime" : 1580643000000, - "arrivalTime" : 1580643000000, - "stopPosition" : { - "__typename" : "PositionAtStop", - "position" : 0 - } - }, - "to" : { - "name" : "D", - "lat" : 8.0, - "lon" : 9.5, - "departureTime" : 1580644200000, - "arrivalTime" : 1580644200000, - "stopPosition" : { - "__typename" : "PositionAtStop", - "position" : 0 - } - }, - "startTime" : 1580643000000, - "endTime" : 1580644200000, - "generalizedCost" : 2040 - }, - { - "mode" : "CAR", - "from" : { - "name" : "D", - "lat" : 8.0, - "lon" : 9.5, - "departureTime" : 1580644200000, - "arrivalTime" : 1580644200000, - "stopPosition" : null - }, - "to" : { - "name" : "E", - "lat" : 9.0, - "lon" : 10.0, - "departureTime" : 1580644800000, - "arrivalTime" : 1580644800000, - "stopPosition" : null - }, - "startTime" : 1580644200000, - "endTime" : 1580644800000, - "generalizedCost" : 1000 - } - ] - } - ] - } - } -} \ No newline at end of file diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/plan-tutorial.json b/src/test/resources/org/opentripplanner/apis/gtfs/expectations/plan-tutorial.json deleted file mode 100644 index d213443f7cd..00000000000 --- a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/plan-tutorial.json +++ /dev/null @@ -1,130 +0,0 @@ -{ - "data" : { - "plan" : { - "itineraries" : [ - { - "start" : "2020-02-02T11:00:00Z", - "end" : "2020-02-02T12:00:00Z", - "legs" : [ - { - "mode" : "WALK", - "from" : { - "name" : "A", - "lat" : 5.0, - "lon" : 8.0, - "departure" : { - "scheduledTime" : "2020-02-02T11:00:00Z", - "estimated" : null - } - }, - "to" : { - "name" : "B", - "lat" : 6.0, - "lon" : 8.5, - "arrival" : { - "scheduledTime" : "2020-02-02T11:00:20Z", - "estimated" : null - } - }, - "route" : null, - "legGeometry" : null - }, - { - "mode" : "BUS", - "from" : { - "name" : "B", - "lat" : 6.0, - "lon" : 8.5, - "departure" : { - "scheduledTime" : "2020-02-02T10:51:00Z", - "estimated" : { - "time" : "2020-02-02T11:01:00Z", - "delay" : "PT10M" - } - } - }, - "to" : { - "name" : "C", - "lat" : 7.0, - "lon" : 9.0, - "arrival" : { - "scheduledTime" : "2020-02-02T11:05:00Z", - "estimated" : { - "time" : "2020-02-02T11:15:00Z", - "delay" : "PT10M" - } - } - }, - "route" : { - "gtfsId" : "F:BUS", - "longName" : "Long name for BUS", - "shortName" : "RBUS" - }, - "legGeometry" : { - "points" : "_{rc@_d{r@????_ibE_t`B" - } - }, - { - "mode" : "RAIL", - "from" : { - "name" : "C", - "lat" : 7.0, - "lon" : 9.0, - "departure" : { - "scheduledTime" : "2020-02-02T11:20:00Z", - "estimated" : { - "time" : "2020-02-02T11:30:00Z", - "delay" : "PT10M" - } - } - }, - "to" : { - "name" : "D", - "lat" : 8.0, - "lon" : 9.5, - "arrival" : { - "scheduledTime" : "2020-02-02T11:40:00Z", - "estimated" : { - "time" : "2020-02-02T11:50:00Z", - "delay" : "PT10M" - } - } - }, - "route" : { - "gtfsId" : "F:2", - "longName" : null, - "shortName" : "R2" - }, - "legGeometry" : { - "points" : "_evi@_y|u@????_ibE_t`B" - } - }, - { - "mode" : "CAR", - "from" : { - "name" : "D", - "lat" : 8.0, - "lon" : 9.5, - "departure" : { - "scheduledTime" : "2020-02-02T11:50:00Z", - "estimated" : null - } - }, - "to" : { - "name" : "E", - "lat" : 9.0, - "lon" : 10.0, - "arrival" : { - "scheduledTime" : "2020-02-02T12:00:00Z", - "estimated" : null - } - }, - "route" : null, - "legGeometry" : null - } - ] - } - ] - } - } -} \ No newline at end of file diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/planConnection.json b/src/test/resources/org/opentripplanner/apis/gtfs/expectations/planConnection.json deleted file mode 100644 index 53ab016cc93..00000000000 --- a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/planConnection.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "data" : { - "planConnection" : { - "searchDateTime" : "2023-01-27T21:08:35+01:00", - "routingErrors" : [ ], - "pageInfo" : { - "hasNextPage" : false, - "hasPreviousPage" : false, - "startCursor" : null, - "endCursor" : null, - "searchWindowUsed" : null - }, - "edges" : [ - { - "cursor" : "NoCursor", - "node" : { - "start" : "2020-02-02T11:00:00Z", - "end" : "2020-02-02T12:00:00Z", - "legs" : [ - { - "mode" : "WALK" - }, - { - "mode" : "BUS" - }, - { - "mode" : "RAIL" - }, - { - "mode" : "CAR" - } - ] - } - } - ] - } - } -} diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/stops.json b/src/test/resources/org/opentripplanner/apis/gtfs/expectations/stops.json deleted file mode 100644 index 307b07b58aa..00000000000 --- a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/stops.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "data" : { - "stops" : [ - { - "gtfsId" : "F:A", - "lat" : 5.0, - "lon" : 8.0, - "name" : "A", - "vehicleMode" : "BUS" - }, - { - "gtfsId" : "F:B", - "lat" : 6.0, - "lon" : 8.5, - "name" : "B", - "vehicleMode" : "BUS" - }, - { - "gtfsId" : "F:C", - "lat" : 7.0, - "lon" : 9.0, - "name" : "C", - "vehicleMode" : "BUS" - }, - { - "gtfsId" : "F:D", - "lat" : 8.0, - "lon" : 9.5, - "name" : "D", - "vehicleMode" : "BUS" - }, - { - "gtfsId" : "F:E", - "lat" : 9.0, - "lon" : 10.0, - "name" : "E", - "vehicleMode" : "BUS" - }, - { - "gtfsId" : "F:F", - "lat" : 9.0, - "lon" : 10.5, - "name" : "F", - "vehicleMode" : "BUS" - }, - { - "gtfsId" : "F:G", - "lat" : 9.5, - "lon" : 11.0, - "name" : "G", - "vehicleMode" : "BUS" - }, - { - "gtfsId" : "F:H", - "lat" : 10.0, - "lon" : 11.5, - "name" : "H", - "vehicleMode" : "BUS" - } - ] - } -} \ No newline at end of file diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/walk-steps.json b/src/test/resources/org/opentripplanner/apis/gtfs/expectations/walk-steps.json deleted file mode 100644 index 703663dc7ec..00000000000 --- a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/walk-steps.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "data" : { - "plan" : { - "itineraries" : [ - { - "legs" : [ - { - "steps" : [ - { - "streetName" : "street", - "area" : false, - "relativeDirection" : "DEPART", - "absoluteDirection" : "NORTHEAST" - }, - { - "streetName" : "elevator", - "area" : false, - "relativeDirection" : "ELEVATOR", - "absoluteDirection" : null - } - ] - }, - { - "steps" : [ ] - }, - { - "steps" : [ ] - }, - { - "steps" : [ ] - } - ] - } - ] - } - } -} \ No newline at end of file diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/queries/plan-extended.graphql b/src/test/resources/org/opentripplanner/apis/gtfs/queries/plan-extended.graphql deleted file mode 100644 index 76bf8aa84e0..00000000000 --- a/src/test/resources/org/opentripplanner/apis/gtfs/queries/plan-extended.graphql +++ /dev/null @@ -1,157 +0,0 @@ -{ - plan( - from: { lat: 52.3092, lon: 13.0291 } - to: { lat: 52.5147, lon: 13.3927 } - date: "2023-02-15" - time: "11:37" - parking: { - unpreferredCost: 555 - preferred: [{ not: [{ tags: ["a", "b", "c"] }] }] - filters: [{ select: [{ tags: ["e"] }] }] - } - transportModes: [{ mode: CAR, qualifier: HAIL }] - ) { - itineraries { - start - end - # next two are deprecated - startTime - endTime - generalizedCost - accessibilityScore - emissionsPerPerson { - co2 - } - numberOfTransfers - walkDistance - walkTime - legs { - mode - start { - scheduledTime - estimated { - time - delay - } - } - end { - scheduledTime - estimated { - time - delay - } - } - from { - name - lat - lon - arrival { - scheduledTime - estimated { - delay - time - } - } - departure { - scheduledTime - estimated { - delay - time - } - } - departureTime - arrivalTime - } - to { - name - lat - lon - arrival { - scheduledTime - estimated { - delay - time - } - } - departure { - scheduledTime - estimated { - delay - time - } - } - departureTime - arrivalTime - } - startTime - endTime - mode - generalizedCost - headsign - trip { - tripHeadsign - } - intermediatePlaces { - arrival { - scheduledTime - estimated { - time - delay - } - } - departure { - scheduledTime - estimated { - time - delay - } - } - stop { - name - } - } - alerts { - id - alertHeaderText - alertDescriptionText - alertEffect - alertCause - alertSeverityLevel - alertUrl - effectiveStartDate - effectiveEndDate - entities { - ... on Stop { - name - gtfsId - lat - lon - } - } - } - rideHailingEstimate { - provider { - id - } - productName - minPrice { - currency { - code - digits - } - amount - } - maxPrice { - currency { - code - digits - } - amount - } - arrival - } - accessibilityScore - } - } - } -} diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/queries/plan-fares.graphql b/src/test/resources/org/opentripplanner/apis/gtfs/queries/plan-fares.graphql deleted file mode 100644 index c5081b1c8ed..00000000000 --- a/src/test/resources/org/opentripplanner/apis/gtfs/queries/plan-fares.graphql +++ /dev/null @@ -1,71 +0,0 @@ -{ - plan( - from: { lat: 52.3092, lon: 13.0291 } - to: { lat: 52.5147, lon: 13.3927 } - date: "2023-02-15" - time: "11:37" - transportModes: [{ mode: TRANSIT }] - ) { - itineraries { - legs { - mode - from { - name - lat - lon - departureTime - arrivalTime - } - to { - name - lat - lon - departureTime - arrivalTime - } - startTime - endTime - mode - generalizedCost - fareProducts { - id - product { - id - name - __typename - ... on DefaultFareProduct { - price { - currency { - digits - code - } - amount - } - } - riderCategory { - id - name - } - medium { - id - name - } - } - } - } - fares { - type - cents - currency - components { - currency - cents - fareId - routes { - gtfsId - } - } - } - } - } -} diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/queries/plan-stop-positions.graphql b/src/test/resources/org/opentripplanner/apis/gtfs/queries/plan-stop-positions.graphql deleted file mode 100644 index dd2217e4288..00000000000 --- a/src/test/resources/org/opentripplanner/apis/gtfs/queries/plan-stop-positions.graphql +++ /dev/null @@ -1,43 +0,0 @@ -{ - plan(fromPlace: "from", toPlace: "to", date: "2023-02-15", time: "11:37") { - itineraries { - startTime - endTime - generalizedCost - accessibilityScore - legs { - mode - from { - name - lat - lon - departureTime - arrivalTime - stopPosition { - __typename - ... on PositionAtStop { - position - } - } - } - to { - name - lat - lon - departureTime - arrivalTime - stopPosition { - __typename - ... on PositionAtStop { - position - } - } - } - startTime - endTime - mode - generalizedCost - } - } - } -} diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/queries/plan-tutorial.graphql b/src/test/resources/org/opentripplanner/apis/gtfs/queries/plan-tutorial.graphql deleted file mode 100644 index dd461060029..00000000000 --- a/src/test/resources/org/opentripplanner/apis/gtfs/queries/plan-tutorial.graphql +++ /dev/null @@ -1,53 +0,0 @@ -{ - plan( - # these coordinates are in Portland, change this to YOUR origin - from: { lat: 45.5552, lon: -122.6534 } - # these coordinates are in Portland, change this to YOUR destination - to: { lat: 45.4908, lon: -122.5519 } - # use the correct date and time of your request - date: "2023-02-15" - time: "11:37" - # choose the transport modes you need - transportModes: [{ mode: WALK }, { mode: TRANSIT }] - ) { - itineraries { - start - end - legs { - mode - from { - name - lat - lon - departure { - scheduledTime - estimated { - time - delay - } - } - } - to { - name - lat - lon - arrival { - scheduledTime - estimated { - time - delay - } - } - } - route { - gtfsId - longName - shortName - } - legGeometry { - points - } - } - } - } -} diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/queries/planConnection.graphql b/src/test/resources/org/opentripplanner/apis/gtfs/queries/planConnection.graphql deleted file mode 100644 index 5691f130119..00000000000 --- a/src/test/resources/org/opentripplanner/apis/gtfs/queries/planConnection.graphql +++ /dev/null @@ -1,103 +0,0 @@ -{ - planConnection( - dateTime: { earliestDeparture: "2023-06-13T14:30+03:00" } - searchWindow: "PT2H30M" - first: 5 - origin: { - location: { coordinate: { latitude: 45.5552, longitude: -122.6534 } } - label: "Home" - } - destination: { - location: { coordinate: { latitude: 45.4908, longitude: -122.5519 } } - label: "Work" - } - modes: { - directOnly: false - transitOnly: false - direct: [WALK] - transit: { - access: [BICYCLE_RENTAL, WALK] - transfer: [WALK] - egress: [BICYCLE_RENTAL, WALK] - transit: [{ mode: TRAM, cost: { reluctance: 1.3 } }, { mode: BUS }] - } - } - preferences: { - accessibility: { wheelchair: { enabled: true } } - street: { - car: { - reluctance: 6.5 - rental: { - allowedNetworks: ["foo", "bar"] - bannedNetworks: ["foobar"] - } - parking: { - unpreferredCost: 200 - preferred: [{ select: [{ tags: ["best-park"] }] }] - filters: [{ not: [{ tags: ["worst-park"] }] }] - } - } - bicycle: { - reluctance: 3.0 - speed: 7.4 - optimization: { type: SAFEST_STREETS } - boardCost: 200 - walk: { - speed: 1.3 - cost: { mountDismountCost: 100, reluctance: 3.5 } - mountDismountTime: "PT5S" - } - rental: { - destinationBicyclePolicy: { allowKeeping: true, keepingCost: 300 } - allowedNetworks: ["foo", "bar"] - bannedNetworks: ["foobar"] - } - parking: { - unpreferredCost: 200 - preferred: [{ select: [{ tags: ["best-park"] }] }] - filters: [{ not: [{ tags: ["worst-park"] }] }] - } - } - walk: { speed: 2.4, reluctance: 1.5, safetyFactor: 0.5, boardCost: 200 } - } - transit: { - board: { waitReluctance: 3.2, slack: "PT1M30S" } - alight: { slack: "PT0S" } - transfer: { - cost: 200 - slack: "PT2M" - maximumAdditionalTransfers: 2 - maximumTransfers: 5 - } - timetable: { - excludeRealTimeUpdates: false - includePlannedCancellations: false - includeRealTimeCancellations: true - } - } - } - locale: "en" - ) { - searchDateTime - routingErrors { - code - } - pageInfo { - hasNextPage - hasPreviousPage - startCursor - endCursor - searchWindowUsed - } - edges { - cursor - node { - start - end - legs { - mode - } - } - } - } -} diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/queries/stops.graphql b/src/test/resources/org/opentripplanner/apis/gtfs/queries/stops.graphql deleted file mode 100644 index 5f3df71f8e7..00000000000 --- a/src/test/resources/org/opentripplanner/apis/gtfs/queries/stops.graphql +++ /dev/null @@ -1,9 +0,0 @@ -{ - stops { - gtfsId - lat - lon - name - vehicleMode - } -} diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/queries/walk-steps.graphql b/src/test/resources/org/opentripplanner/apis/gtfs/queries/walk-steps.graphql deleted file mode 100644 index c88958840d4..00000000000 --- a/src/test/resources/org/opentripplanner/apis/gtfs/queries/walk-steps.graphql +++ /dev/null @@ -1,20 +0,0 @@ -{ - plan( - fromPlace: "from" - toPlace: "to" - date: "2023-02-15" - time: "11:37" - transportModes: [{ mode: WALK }] - ) { - itineraries { - legs { - steps { - streetName - area - relativeDirection - absoluteDirection - } - } - } - } -}