diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 875f4fb67b8..bed6a5ba84b 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -9,3 +9,6 @@ # reorder and reformat GTFS GraphQL API schema file with graphql-java 14051fab312a67cae9a460aaf0bbc77223bec624 + +# Make OTP a multi-module project +ead33ffe280dd7caf72cae5ff7a41542e8427636 diff --git a/.github/workflows/cibuild.yml b/.github/workflows/cibuild.yml index b69d998eca7..e778fe25679 100644 --- a/.github/workflows/cibuild.yml +++ b/.github/workflows/cibuild.yml @@ -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` @@ -179,9 +179,9 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: 16 + node-version: 22 - 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..49c738a251e --- /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.14.2 + 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 6a7d7f32aaa..e463c510830 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 75% 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..c26ec7c636a 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,7 +2,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.model.plan.Itinerary.createScheduledTransitItinerary; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.time.OffsetDateTime; import java.time.ZonedDateTime; @@ -20,7 +21,7 @@ import org.opentripplanner.model.plan.ScheduledTransitLegBuilder; import org.opentripplanner.model.plan.StreetLeg; import org.opentripplanner.street.search.TraverseMode; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -45,9 +46,13 @@ class EmissionsTest { .withEndTime(TIME.plusHours(1)) .build(); - private static final Route ROUTE_WITH_EMISSIONS = TransitModelForTest.route(id("1")).build(); - private static final Route ROUTE_WITH_ZERO_EMISSIONS = TransitModelForTest.route(id("2")).build(); - private static final Route ROUTE_WITHOUT_EMISSIONS_CONFIGURED = TransitModelForTest + private static final Route ROUTE_WITH_EMISSIONS = TimetableRepositoryForTest + .route(id("1")) + .build(); + private static final Route ROUTE_WITH_ZERO_EMISSIONS = TimetableRepositoryForTest + .route(id("2")) + .build(); + private static final Route ROUTE_WITHOUT_EMISSIONS_CONFIGURED = TimetableRepositoryForTest .route(id("3")) .build(); @@ -63,42 +68,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); @@ -112,12 +123,15 @@ private ScheduledTransitLeg createTransitLeg(Route route) { var stoptime = new StopTime(); var stopTimes = new ArrayList(); stopTimes.add(stoptime); - var testModel = TransitModelForTest.of(); + var testModel = TimetableRepositoryForTest.of(); var stopOne = testModel.stop("1:stop1", 60, 25).build(); var stopTwo = testModel.stop("1:stop1", 61, 25).build(); var stopThree = testModel.stop("1:stop1", 62, 25).build(); - var stopPattern = TransitModelForTest.stopPattern(stopOne, stopTwo, stopThree); - var pattern = TransitModelForTest.tripPattern("1", route).withStopPattern(stopPattern).build(); + var stopPattern = TimetableRepositoryForTest.stopPattern(stopOne, stopTwo, stopThree); + var pattern = TimetableRepositoryForTest + .tripPattern("1", route) + .withStopPattern(stopPattern) + .build(); var trip = Trip .of(FeedScopedId.parse("FOO:BAR")) .withMode(TransitMode.BUS) 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 86% 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 index ac11886c208..b897f3aa78f 100644 --- a/src/ext-test/java/org/opentripplanner/ext/fares/FaresFilterTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/fares/FaresFilterTest.java @@ -2,7 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.opentripplanner.model.plan.TestItineraryBuilder.newItinerary; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.List; import org.junit.jupiter.api.Test; @@ -13,12 +13,12 @@ import org.opentripplanner.model.plan.Place; import org.opentripplanner.model.plan.PlanTestConstants; import org.opentripplanner.routing.fares.FareService; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Money; public class FaresFilterTest implements PlanTestConstants { - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); @Test void shouldAddFare() { 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 96% 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 index 407cd0f11e9..f1dabd0948c 100644 --- 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 @@ -22,13 +22,13 @@ import org.opentripplanner.model.plan.Place; import org.opentripplanner.model.plan.PlanTestConstants; import org.opentripplanner.routing.core.FareType; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Money; import org.opentripplanner.transit.model.network.Route; class CombinedInterlinedLegsFareServiceTest implements PlanTestConstants { - static final Route route = TransitModelForTest.route("route-1").build(); + static final Route route = TimetableRepositoryForTest.route("route-1").build(); static final Itinerary interlinedWithDifferentRoute = newItinerary( Place.forStop(AIRPORT_STOP), T11_00 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 98% 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 index cae23f60800..788c1c9b6d6 100644 --- 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 @@ -24,7 +24,7 @@ import org.opentripplanner.model.plan.Place; import org.opentripplanner.model.plan.PlanTestConstants; import org.opentripplanner.routing.core.FareType; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Money; class DefaultFareServiceTest implements PlanTestConstants { @@ -116,7 +116,7 @@ void shouldNotCombineInterlinedLegs() { var itin = newItinerary(Place.forStop(AIRPORT_STOP), T11_00) .bus(1, T11_05, T11_12, Place.forStop(CITY_CENTER_A_STOP)) .staySeatedBus( - TransitModelForTest.route("123").build(), + TimetableRepositoryForTest.route("123").build(), 2, T11_12, T11_16, 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 94% 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 index e498588d00f..d9325d139a8 100644 --- 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 @@ -1,13 +1,12 @@ package org.opentripplanner.ext.fares.impl; -import static org.opentripplanner.transit.model._data.TransitModelForTest.OTHER_FEED_AGENCY; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.OTHER_FEED_AGENCY; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import org.opentripplanner.ext.fares.model.FareAttribute; import org.opentripplanner.ext.fares.model.FareRuleSet; import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.i18n.I18NString; -import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.transit.model.basic.Money; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.FeedScopedId; 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 92% 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 index 7b822b03059..f5ad2b471ab 100644 --- 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 @@ -22,7 +22,7 @@ import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.standalone.api.OtpServerRequestContext; import org.opentripplanner.transit.model.basic.Money; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class FaresIntegrationTest { @@ -30,11 +30,11 @@ public class FaresIntegrationTest { public void testBasic() { TestOtpModel model = ConstantsForTests.buildGtfsGraph(ConstantsForTests.CALTRAIN_GTFS); var graph = model.graph(); - var transitModel = model.transitModel(); + var timetableRepository = model.timetableRepository(); - var feedId = transitModel.getFeedIds().iterator().next(); + var feedId = timetableRepository.getFeedIds().iterator().next(); - var serverContext = TestServerContext.createServerContext(graph, transitModel); + var serverContext = TestServerContext.createServerContext(graph, timetableRepository); var start = LocalDateTime .of(2009, Month.AUGUST, 7, 12, 0, 0) @@ -53,10 +53,10 @@ public void testBasic() { public void testPortland() { TestOtpModel model = ConstantsForTests.getInstance().getCachedPortlandGraph(); Graph graph = model.graph(); - TransitModel transitModel = model.transitModel(); - var portlandId = transitModel.getFeedIds().iterator().next(); + TimetableRepository timetableRepository = model.timetableRepository(); + var portlandId = timetableRepository.getFeedIds().iterator().next(); - var serverContext = TestServerContext.createServerContext(graph, transitModel); + var serverContext = TestServerContext.createServerContext(graph, timetableRepository); // from zone 3 to zone 2 var from = GenericLocation.fromStopId( 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 97% 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 index c209bc22192..19b55489778 100644 --- 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 @@ -2,8 +2,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.opentripplanner.model.plan.TestItineraryBuilder.newItinerary; -import static org.opentripplanner.transit.model._data.TransitModelForTest.FEED_ID; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.FEED_ID; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import com.google.common.collect.Multimaps; import java.time.Duration; @@ -22,13 +22,13 @@ import org.opentripplanner.model.plan.Itinerary; import org.opentripplanner.model.plan.Place; import org.opentripplanner.model.plan.PlanTestConstants; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Money; import org.opentripplanner.transit.model.framework.FeedScopedId; class GtfsFaresV2ServiceTest implements PlanTestConstants { - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); FeedScopedId LEG_GROUP1 = id("leg-group1"); FeedScopedId LEG_GROUP2 = id("leg-group2"); 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 98% 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 index 17c381f1bd6..072e8a5a4fe 100644 --- 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 @@ -1,10 +1,9 @@ package org.opentripplanner.ext.fares.impl; import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.opentripplanner.model.plan.TestItineraryBuilder.newItinerary; -import static org.opentripplanner.transit.model._data.TransitModelForTest.FEED_ID; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.FEED_ID; import static org.opentripplanner.transit.model.basic.Money.euros; import java.util.LinkedList; @@ -21,7 +20,7 @@ import org.opentripplanner.model.plan.PlanTestConstants; import org.opentripplanner.routing.core.FareType; import org.opentripplanner.routing.fares.FareService; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Money; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -76,7 +75,7 @@ private static List createTestCases() { FareZone C = FareZone.of(new FeedScopedId(FEED_ID, "C")).build(); FareZone D = FareZone.of(new FeedScopedId(FEED_ID, "D")).build(); - var testModel = TransitModelForTest.of(); + var testModel = TimetableRepositoryForTest.of(); Place A1 = testModel.place("A1", sb -> sb.withCoordinate(10.0, 12.0).addFareZones(A)); Place A2 = testModel.place("A2", sb -> sb.withCoordinate(10.0, 12.0).addFareZones(A)); 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 98% 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 index e9aa17ba35f..c65db6c3a9f 100644 --- 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 @@ -3,8 +3,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.opentripplanner.model.plan.TestItineraryBuilder.newItinerary; -import static org.opentripplanner.transit.model._data.TransitModelForTest.FEED_ID; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.FEED_ID; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.time.Duration; import java.util.LinkedList; 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 88% 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 index 67eb7e3ed93..1e7ff64c5dd 100644 --- a/src/ext-test/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapperTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapperTest.java @@ -19,15 +19,15 @@ import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.street.model.StreetTraversalPermission; import org.opentripplanner.street.model._data.StreetModelForTest; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.site.AreaStop; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class AreaStopsToVerticesMapperTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final AreaStop BERLIN_AREA_STOP = TEST_MODEL .areaStop("berlin") @@ -38,7 +38,10 @@ class AreaStopsToVerticesMapperTest { .withAreaStop(AreaStopsToVerticesMapperTest.BERLIN_AREA_STOP) .build(); - public static final TransitModel TRANSIT_MODEL = new TransitModel(STOP_MODEL, new Deduplicator()); + public static final TimetableRepository TRANSIT_MODEL = new TimetableRepository( + STOP_MODEL, + new Deduplicator() + ); static List testCases() { return List.of( 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 91% 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..cac0707af92 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; @@ -34,7 +33,7 @@ import org.opentripplanner.routing.api.request.framework.TimeAndCostPenalty; import org.opentripplanner.routing.api.request.request.filter.AllowAllTransitFilter; import org.opentripplanner.routing.graph.Graph; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * This test checks the combination of transit and flex works. @@ -49,7 +48,7 @@ public class FlexIntegrationTest { static Graph graph; - static TransitModel transitModel; + static TimetableRepository timetableRepository; static RoutingService service; @@ -58,23 +57,23 @@ static void setup() { OTPFeature.enableFeatures(Map.of(OTPFeature.FlexRouting, true)); TestOtpModel model = FlexIntegrationTestData.cobbOsm(); graph = model.graph(); - transitModel = model.transitModel(); + timetableRepository = model.timetableRepository(); addGtfsToGraph( graph, - transitModel, + timetableRepository, List.of( FlexIntegrationTestData.COBB_BUS_30_GTFS, FlexIntegrationTestData.MARTA_BUS_856_GTFS, FlexIntegrationTestData.COBB_FLEX_GTFS ) ); - service = TestServerContext.createServerContext(graph, transitModel).routingService(); + service = TestServerContext.createServerContext(graph, timetableRepository).routingService(); } @Test void addFlexTripsAndPatternsToGraph() { - assertFalse(transitModel.getAllTripPatterns().isEmpty()); + assertFalse(timetableRepository.getAllTripPatterns().isEmpty()); } @Test @@ -177,22 +176,26 @@ static void teardown() { OTPFeature.enableFeatures(Map.of(OTPFeature.FlexRouting, false)); } - private static void addGtfsToGraph(Graph graph, TransitModel transitModel, List gtfsFiles) { + private static void addGtfsToGraph( + Graph graph, + TimetableRepository timetableRepository, + List gtfsFiles + ) { // GTFS var gtfsBundles = gtfsFiles.stream().map(GtfsBundle::new).toList(); GtfsModule gtfsModule = new GtfsModule( gtfsBundles, - transitModel, + timetableRepository, graph, ServiceDateInterval.unbounded() ); gtfsModule.buildGraph(); // link stations to streets - TestStreetLinkerModule.link(graph, transitModel); + TestStreetLinkerModule.link(graph, timetableRepository); // link flex locations to streets - new AreaStopsToVerticesMapper(graph, transitModel).buildGraph(); + new AreaStopsToVerticesMapper(graph, timetableRepository).buildGraph(); // generate direct transfers var req = new RouteRequest(); @@ -200,15 +203,15 @@ private static void addGtfsToGraph(Graph graph, TransitModel transitModel, List< // we don't have a complete coverage of the entire area so use straight lines for transfers new DirectTransferGenerator( graph, - transitModel, + timetableRepository, DataImportIssueStore.NOOP, Duration.ofMinutes(10), List.of(req) ) .buildGraph(); - transitModel.index(); - graph.index(transitModel.getStopModel()); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); } private Itinerary getItinerary(GenericLocation from, GenericLocation to, int index) { @@ -216,7 +219,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 84% 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 index d3f4f7a62e8..a1d41cdebb5 100644 --- a/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTestData.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTestData.java @@ -16,7 +16,7 @@ import org.opentripplanner.test.support.ResourceLoader; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public final class FlexIntegrationTestData { @@ -43,20 +43,20 @@ public static TestOtpModel cobbOsm() { private static TestOtpModel buildFlexGraph(File file) { var deduplicator = new Deduplicator(); var graph = new Graph(deduplicator); - var transitModel = new TransitModel(new StopModel(), deduplicator); + var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); GtfsBundle gtfsBundle = new GtfsBundle(file); GtfsModule module = new GtfsModule( List.of(gtfsBundle), - transitModel, + timetableRepository, graph, new ServiceDateInterval(LocalDate.of(2021, 1, 1), LocalDate.of(2022, 1, 1)) ); OTPFeature.enableFeatures(Map.of(OTPFeature.FlexRouting, true)); module.buildGraph(); - transitModel.index(); - graph.index(transitModel.getStopModel()); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); OTPFeature.enableFeatures(Map.of(OTPFeature.FlexRouting, false)); - assertTrue(transitModel.hasFlexTrips()); - return new TestOtpModel(graph, transitModel); + assertTrue(timetableRepository.hasFlexTrips()); + return new TestOtpModel(graph, timetableRepository); } } 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 91% 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 index 8437a62e6da..acf0d3b2699 100644 --- a/src/ext-test/java/org/opentripplanner/ext/flex/FlexStopTimesForTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexStopTimesForTest.java @@ -5,13 +5,13 @@ import org.opentripplanner._support.geometry.Polygons; import org.opentripplanner.framework.time.TimeUtils; import org.opentripplanner.model.StopTime; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.StopLocation; public class FlexStopTimesForTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final StopLocation AREA_STOP = TEST_MODEL .areaStop("area") .withGeometry(Polygons.BERLIN) 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 82% 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 index e116831e2d3..4bd042d332c 100644 --- a/src/ext-test/java/org/opentripplanner/ext/flex/GtfsFlexTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/GtfsFlexTest.java @@ -11,7 +11,7 @@ import org.opentripplanner.ext.flex.trip.FlexTrip; import org.opentripplanner.ext.flex.trip.UnscheduledTrip; import org.opentripplanner.transit.model.framework.FeedScopedId; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * This test makes sure that one of the example feeds in the GTFS-Flex repo works. It's the City of @@ -23,17 +23,17 @@ */ class GtfsFlexTest { - private static TransitModel transitModel; + private static TimetableRepository timetableRepository; @BeforeAll static void setup() { TestOtpModel model = FlexIntegrationTestData.aspenGtfs(); - transitModel = model.transitModel(); + timetableRepository = model.timetableRepository(); } @Test void parseAspenTaxiAsUnscheduledTrip() { - var flexTrips = transitModel.getAllFlexTrips(); + var flexTrips = timetableRepository.getAllFlexTrips(); assertFalse(flexTrips.isEmpty()); assertEquals( Set.of("t_1289262_b_29084_tn_0", "t_1289257_b_28352_tn_0"), @@ -48,6 +48,6 @@ void parseAspenTaxiAsUnscheduledTrip() { @Test void shouldGeneratePatternForFlexTripWithSingleStop() { - assertFalse(transitModel.getAllTripPatterns().isEmpty()); + assertFalse(timetableRepository.getAllTripPatterns().isEmpty()); } } 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 94% 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 index 985ca5a9898..e6fddb07cf8 100644 --- 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 @@ -5,7 +5,7 @@ import static org.opentripplanner.ext.flex.FlexStopTimesForTest.regularStopTime; import static org.opentripplanner.street.model._data.StreetModelForTest.V1; import static org.opentripplanner.street.model._data.StreetModelForTest.V2; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.time.Duration; import java.util.List; 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 98% 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 index 8c73d0901ff..cdb8bb8ff4e 100644 --- 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 @@ -30,7 +30,7 @@ import org.opentripplanner.street.model.vertex.StreetLocation; import org.opentripplanner.street.search.request.StreetSearchRequest; import org.opentripplanner.street.search.state.State; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.StopLocation; import org.opentripplanner.transit.model.timetable.Trip; @@ -38,7 +38,7 @@ class FlexTemplateFactoryTest { - private static final TransitModelForTest MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest MODEL = TimetableRepositoryForTest.of(); /** * This is pass-through information @@ -78,7 +78,7 @@ class FlexTemplateFactoryTest { private static final StopLocation GROUP_STOP_12 = MODEL.groupStop("G", STOP_G1, STOP_G2); private static final StopLocation GROUP_STOP_34 = MODEL.groupStop("G", STOP_G3, STOP_G4); - private static final Trip TRIP = TransitModelForTest.trip("Trip").build(); + private static final Trip TRIP = TimetableRepositoryForTest.trip("Trip").build(); private static final int T_10_00 = time("10:00"); private static final int T_10_10 = time("10:10"); private static final int T_10_20 = time("10:20"); 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 90% 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 index fad9e98e254..73364caccf1 100644 --- 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 @@ -11,7 +11,7 @@ import org.opentripplanner.ext.flex.flexpathcalculator.DirectFlexPathCalculator; import org.opentripplanner.model.StopTime; import org.opentripplanner.model.impl.OtpTransitServiceBuilder; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.service.StopModel; class FlexTripsMapperTest { @@ -30,7 +30,7 @@ void defaultTimePenalty() { private static StopTime stopTime(int seq) { var st = FlexStopTimesForTest.area("08:00", "18:00"); - st.setTrip(TransitModelForTest.trip("flex-1").build()); + st.setTrip(TimetableRepositoryForTest.trip("flex-1").build()); st.setStopSequence(seq); return st; } 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 92% 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 index 6466d7bf6d6..4c77ecc6134 100644 --- 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 @@ -44,7 +44,7 @@ import org.opentripplanner.transit.model.network.grouppriority.TransitGroupPriorityService; import org.opentripplanner.transit.model.site.AreaStop; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * This tests that the feed for the Cobb County Flex service is processed correctly. This service @@ -56,13 +56,13 @@ class ScheduledDeviatedTripTest { static Graph graph; - static TransitModel transitModel; + static TimetableRepository timetableRepository; float delta = 0.01f; @Test void parseCobbCountyAsScheduledDeviatedTrip() { - var flexTrips = transitModel.getAllFlexTrips(); + var flexTrips = timetableRepository.getAllFlexTrips(); assertFalse(flexTrips.isEmpty()); assertEquals(72, flexTrips.size()); @@ -101,7 +101,7 @@ void calculateDirectFare() { var router = new FlexRouter( graph, - new DefaultTransitService(transitModel), + new DefaultTransitService(timetableRepository), FlexParameters.defaultValues(), OffsetDateTime.parse("2021-11-12T10:15:24-05:00").toInstant(), null, @@ -134,9 +134,9 @@ void calculateDirectFare() { */ @Test void flexTripInTransitMode() { - var feedId = transitModel.getFeedIds().iterator().next(); + var feedId = timetableRepository.getFeedIds().iterator().next(); - var serverContext = TestServerContext.createServerContext(graph, transitModel); + var serverContext = TestServerContext.createServerContext(graph, timetableRepository); // from zone 3 to zone 2 var from = GenericLocation.fromStopId("Transfer Point for Route 30", feedId, "cujv"); @@ -177,8 +177,8 @@ void flexTripInTransitMode() { */ @Test void shouldNotInterpolateFlexTimes() { - var feedId = transitModel.getFeedIds().iterator().next(); - var pattern = transitModel.getTripPatternForId(new FeedScopedId(feedId, "090z:0:01")); + var feedId = timetableRepository.getFeedIds().iterator().next(); + var pattern = timetableRepository.getTripPatternForId(new FeedScopedId(feedId, "090z:0:01")); assertEquals(3, pattern.numberOfStops()); @@ -192,7 +192,7 @@ void shouldNotInterpolateFlexTimes() { static void setup() { TestOtpModel model = FlexIntegrationTestData.cobbFlexGtfs(); graph = model.graph(); - transitModel = model.transitModel(); + timetableRepository = model.timetableRepository(); } private static List getItineraries( @@ -248,8 +248,8 @@ private static NearbyStop getNearbyStop(FlexTrip trip, String id) { } private static FlexTrip getFlexTrip() { - var feedId = transitModel.getFeedIds().iterator().next(); + var feedId = timetableRepository.getFeedIds().iterator().next(); var tripId = new FeedScopedId(feedId, "a326c618-d42c-4bd1-9624-c314fbf8ecd8"); - return transitModel.getFlexTrip(tripId); + return timetableRepository.getFlexTrip(tripId); } } 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 95% 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 index f19478af629..f6fd43595a9 100644 --- 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 @@ -3,7 +3,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.opentripplanner.street.model._data.StreetModelForTest.V1; import static org.opentripplanner.street.model._data.StreetModelForTest.V2; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.time.Duration; import java.util.List; 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 97% 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..d235dd5a950 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 @@ -3,20 +3,16 @@ 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.ext.flex.FlexStopTimesForTest.area; -import static org.opentripplanner.ext.flex.FlexStopTimesForTest.regularArrival; -import static org.opentripplanner.ext.flex.FlexStopTimesForTest.regularDeparture; import static org.opentripplanner.ext.flex.trip.UnscheduledTrip.isUnscheduledTrip; import static org.opentripplanner.ext.flex.trip.UnscheduledTripTest.TestCase.tc; import static org.opentripplanner.model.PickDrop.NONE; import static org.opentripplanner.model.StopTime.MISSING_VALUE; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.Collections; 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; @@ -26,9 +22,7 @@ import org.opentripplanner.framework.tostring.ToStringBuilder; import org.opentripplanner.model.PickDrop; import org.opentripplanner.model.StopTime; -import org.opentripplanner.routing.graphfinder.NearbyStop; -import org.opentripplanner.transit.model._data.TransitModelForTest; -import org.opentripplanner.transit.model.site.AreaStop; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.StopLocation; @@ -42,7 +36,7 @@ class UnscheduledTripTest { private static final int T14_00 = TimeUtils.hm2time(14, 0); private static final int T15_00 = TimeUtils.hm2time(15, 0); - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final RegularStop REGULAR_STOP = TEST_MODEL.stop("stop").build(); @@ -57,7 +51,7 @@ class IsUnscheduledTrip { private static final StopTime CONTINUOUS_DROP_OFF_STOP = new StopTime(); static { - var trip = TransitModelForTest.trip("flex").build(); + var trip = TimetableRepositoryForTest.trip("flex").build(); SCHEDULED_STOP.setArrivalTime(30); SCHEDULED_STOP.setDepartureTime(60); SCHEDULED_STOP.setStop(AREA_STOP); 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 94% 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 index de6e600037c..9d90cbb5f26 100644 --- a/src/ext-test/java/org/opentripplanner/ext/geocoder/LuceneIndexTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/geocoder/LuceneIndexTest.java @@ -1,7 +1,7 @@ package org.opentripplanner.ext.geocoder; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import static org.opentripplanner.transit.model.basic.TransitMode.BUS; import static org.opentripplanner.transit.model.basic.TransitMode.FERRY; @@ -21,7 +21,7 @@ import org.opentripplanner.ext.stopconsolidation.internal.DefaultStopConsolidationRepository; import org.opentripplanner.ext.stopconsolidation.internal.DefaultStopConsolidationService; import org.opentripplanner.model.FeedInfo; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -31,11 +31,11 @@ import org.opentripplanner.transit.model.site.Station; import org.opentripplanner.transit.model.site.StopLocation; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class LuceneIndexTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); static final Agency BVG = Agency .of(id("bvg")) @@ -126,9 +126,9 @@ static void setup() { List .of(ALEXANDERPLATZ_STATION, BERLIN_HAUPTBAHNHOF_STATION, FIVE_POINTS_STATION) .forEach(stopModel::withStation); - var transitModel = new TransitModel(stopModel.build(), new Deduplicator()); - transitModel.index(); - var transitService = new DefaultTransitService(transitModel) { + var timetableRepository = new TimetableRepository(stopModel.build(), new Deduplicator()); + timetableRepository.index(); + var transitService = new DefaultTransitService(timetableRepository) { private final Multimap modes = ImmutableMultimap .builder() .putAll(WESTHAFEN, FERRY, BUS) @@ -153,7 +153,7 @@ public Agency getAgencyForId(FeedScopedId id) { @Override public Set getRoutesForStop(StopLocation stop) { - return Set.of(TransitModelForTest.route("route1").withAgency(BVG).build()); + return Set.of(TimetableRepositoryForTest.route("route1").withAgency(BVG).build()); } @Override @@ -171,7 +171,7 @@ public FeedInfo getFeedInfo(String feedId) { }; var stopConsolidationService = new DefaultStopConsolidationService( new DefaultStopConsolidationRepository(), - transitModel + timetableRepository ); index = new LuceneIndex(transitService, stopConsolidationService); mapper = new StopClusterMapper(transitService, stopConsolidationService); 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 87% 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 index 578f7d4118f..b98de173817 100644 --- a/src/ext-test/java/org/opentripplanner/ext/geocoder/StopClusterMapperTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/geocoder/StopClusterMapperTest.java @@ -7,17 +7,17 @@ import org.opentripplanner.ext.stopconsolidation.internal.DefaultStopConsolidationRepository; import org.opentripplanner.ext.stopconsolidation.internal.DefaultStopConsolidationService; import org.opentripplanner.ext.stopconsolidation.model.ConsolidatedStopGroup; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.StopLocation; import org.opentripplanner.transit.service.DefaultTransitService; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class StopClusterMapperTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final RegularStop STOP_A = TEST_MODEL.stop("A").build(); private static final RegularStop STOP_B = TEST_MODEL.stop("B").build(); private static final RegularStop STOP_C = TEST_MODEL.stop("C").build(); @@ -26,7 +26,7 @@ class StopClusterMapperTest { .stopModelBuilder() .withRegularStops(STOPS) .build(); - private static final TransitModel TRANSIT_MODEL = new TransitModel( + private static final TimetableRepository TRANSIT_MODEL = new TimetableRepository( STOP_MODEL, new Deduplicator() ); 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 92% 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 index ce841be54a7..82023904f0f 100644 --- a/src/ext-test/java/org/opentripplanner/ext/mapping/TransmodelMappingUtilTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/mapping/TransmodelMappingUtilTest.java @@ -6,7 +6,7 @@ import java.util.List; import org.junit.jupiter.api.Test; import org.opentripplanner.apis.transmodel.mapping.TransitIdMapper; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.organization.Agency; @@ -33,7 +33,7 @@ public void resolveFixedFeedIdTest() { Agency agency(String feedScope, int id) { // We use the test builder to make sure we get back an agency with all required fields - return TransitModelForTest + return TimetableRepositoryForTest .agency("Agency " + id) .copy() .withId(new FeedScopedId(feedScope, Integer.toString(id))) 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 87% 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 e5b842a474a..6150cfc6c18 100644 --- a/src/ext-test/java/org/opentripplanner/ext/realtimeresolver/RealtimeResolverTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/realtimeresolver/RealtimeResolverTest.java @@ -23,21 +23,21 @@ import org.opentripplanner.routing.alertpatch.TransitAlert; import org.opentripplanner.routing.impl.TransitAlertServiceImpl; import org.opentripplanner.routing.services.TransitAlertService; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.timetable.TripTimes; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitService; class RealtimeResolverTest { - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); - private final Route route1 = TransitModelForTest.route("route1").build(); - private final Route route2 = TransitModelForTest.route("route2").build(); + private final Route route1 = TimetableRepositoryForTest.route("route1").build(); + private final Route route2 = TimetableRepositoryForTest.route("route2").build(); private final RegularStop stop1 = testModel.stop("stop1", 1, 1).build(); private final RegularStop stop2 = testModel.stop("stop2", 2, 1).build(); @@ -90,7 +90,7 @@ void testPopulateLegsWithRealtimeNonTransit() { .bus(route1, 1, time("11:20"), time("11:40"), Place.forStop(stop3)) .build(); - var model = new TransitModel(); + var model = new TimetableRepository(); model.index(); var transitService = new DefaultTransitService(model); @@ -164,23 +164,27 @@ private static TransitService makeTransitService( List patterns, LocalDate serviceDate ) { - var transitModel = new TransitModel(); + var timetableRepository = new TimetableRepository(); CalendarServiceData calendarServiceData = new CalendarServiceData(); patterns.forEach(pattern -> { - transitModel.addTripPattern(pattern.getId(), pattern); + timetableRepository.addTripPattern(pattern.getId(), pattern); var serviceCode = pattern.getScheduledTimetable().getTripTimes(0).getServiceCode(); - transitModel.getServiceCodes().put(pattern.getId(), serviceCode); + timetableRepository.getServiceCodes().put(pattern.getId(), serviceCode); calendarServiceData.putServiceDatesForServiceId(pattern.getId(), List.of(serviceDate)); }); - transitModel.updateCalendarServiceData(true, calendarServiceData, DataImportIssueStore.NOOP); - transitModel.index(); + timetableRepository.updateCalendarServiceData( + true, + calendarServiceData, + DataImportIssueStore.NOOP + ); + timetableRepository.index(); - return new DefaultTransitService(transitModel) { - final TransitAlertService alertService = new TransitAlertServiceImpl(transitModel); + return new DefaultTransitService(timetableRepository) { + final TransitAlertService alertService = new TransitAlertServiceImpl(timetableRepository); @Override public TransitAlertService getTransitAlertService() { 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 51% 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 index 7f389bc41ec..bcbc84fc4b8 100644 --- a/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNamesTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNamesTest.java @@ -5,17 +5,21 @@ import static org.opentripplanner.ext.stopconsolidation.TestStopConsolidationModel.STOP_D; import static org.opentripplanner.model.plan.PlanTestConstants.T11_05; import static org.opentripplanner.model.plan.PlanTestConstants.T11_12; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.List; import org.junit.jupiter.api.Test; import org.opentripplanner.ext.stopconsolidation.internal.DefaultStopConsolidationRepository; import org.opentripplanner.ext.stopconsolidation.internal.DefaultStopConsolidationService; import org.opentripplanner.ext.stopconsolidation.model.ConsolidatedStopGroup; +import org.opentripplanner.ext.stopconsolidation.model.ConsolidatedStopLeg; import org.opentripplanner.model.fare.FareProduct; import org.opentripplanner.model.fare.FareProductUse; +import org.opentripplanner.model.plan.Leg; import org.opentripplanner.model.plan.Place; import org.opentripplanner.model.plan.PlanTestConstants; +import org.opentripplanner.model.plan.ScheduledTransitLeg; +import org.opentripplanner.model.plan.StreetLeg; import org.opentripplanner.model.plan.TestItineraryBuilder; import org.opentripplanner.transit.model.basic.Money; @@ -32,21 +36,18 @@ class DecorateConsolidatedStopNamesTest { private static final List fpu = List.of( new FareProductUse("c1a04702-1fb6-32d4-ba02-483bf68111ed", fp) ); + private static final List GROUPS = List.of( + new ConsolidatedStopGroup(STOP_C.getId(), List.of(STOP_D.getId())) + ); + private static final Place PLACE_C = Place.forStop(STOP_C); @Test void changeNames() { - var transitModel = TestStopConsolidationModel.buildTransitModel(); - - var groups = List.of(new ConsolidatedStopGroup(STOP_C.getId(), List.of(STOP_D.getId()))); - var repo = new DefaultStopConsolidationRepository(); - repo.addGroups(groups); - - var service = new DefaultStopConsolidationService(repo, transitModel); - var filter = new DecorateConsolidatedStopNames(service); + var filter = defaultFilter(); var itinerary = TestItineraryBuilder - .newItinerary(Place.forStop(STOP_C)) - .bus(TestStopConsolidationModel.ROUTE, 1, T11_05, T11_12, Place.forStop(STOP_C)) + .newItinerary(PLACE_C) + .bus(TestStopConsolidationModel.ROUTE, 1, T11_05, T11_12, PLACE_C) .bus(1, T11_05, T11_12, PlanTestConstants.E) .bus(1, T11_05, T11_12, PlanTestConstants.F) .build(); @@ -62,4 +63,51 @@ void changeNames() { // Check that the fares were carried over assertEquals(fpu, updatedLeg.fareProducts()); } + + @Test + void removeTransferAtConsolidatedStop() { + final var filter = defaultFilter(); + + var itinerary = TestItineraryBuilder + .newItinerary(PLACE_C) + .bus(TestStopConsolidationModel.ROUTE, 1, T11_05, T11_12, PLACE_C) + .walk(1, PLACE_C) + .bus(1, T11_05, T11_12, PlanTestConstants.F) + .build(); + + filter.decorate(itinerary); + + var legs = itinerary.getLegs().stream().map(Leg::getClass).toList(); + assertEquals(List.of(ConsolidatedStopLeg.class, ScheduledTransitLeg.class), legs); + } + + @Test + void keepRegularTransfer() { + final var filter = defaultFilter(); + + var itinerary = TestItineraryBuilder + .newItinerary(PLACE_C) + .bus(TestStopConsolidationModel.ROUTE, 1, T11_05, T11_12, PLACE_C) + .walk(1, PlanTestConstants.E) + .bus(1, T11_05, T11_12, PlanTestConstants.F) + .build(); + + filter.decorate(itinerary); + + var legs = itinerary.getLegs().stream().map(Leg::getClass).toList(); + assertEquals( + List.of(ConsolidatedStopLeg.class, StreetLeg.class, ScheduledTransitLeg.class), + legs + ); + } + + private static DecorateConsolidatedStopNames defaultFilter() { + var timetableRepository = TestStopConsolidationModel.buildTimetableRepository(); + + var repo = new DefaultStopConsolidationRepository(); + repo.addGroups(GROUPS); + + var service = new DefaultStopConsolidationService(repo, timetableRepository); + return new DecorateConsolidatedStopNames(service); + } } 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 80% 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 index 0df495d63d0..91f62c319f6 100644 --- a/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModuleTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModuleTest.java @@ -20,13 +20,13 @@ class StopConsolidationModuleTest { void replacePatterns() { var groups = List.of(new ConsolidatedStopGroup(STOP_D.getId(), List.of(STOP_B.getId()))); - var transitModel = TestStopConsolidationModel.buildTransitModel(); - transitModel.addTripPattern(PATTERN.getId(), PATTERN); + var timetableRepository = TestStopConsolidationModel.buildTimetableRepository(); + timetableRepository.addTripPattern(PATTERN.getId(), PATTERN); var repo = new DefaultStopConsolidationRepository(); - var module = new StopConsolidationModule(transitModel, repo, groups); + var module = new StopConsolidationModule(timetableRepository, repo, groups); module.buildGraph(); - var modifiedPattern = transitModel.getTripPatternForId(PATTERN.getId()); + var modifiedPattern = timetableRepository.getTripPatternForId(PATTERN.getId()); assertFalse(modifiedPattern.getRoutingTripPattern().getPattern().sameAs(PATTERN)); assertFalse(modifiedPattern.sameAs(PATTERN)); @@ -37,7 +37,7 @@ void replacePatterns() { .getStop(1); assertEquals(modifiedStop, STOP_D); - var patterns = List.copyOf(transitModel.getAllTripPatterns()); + var patterns = List.copyOf(timetableRepository.getAllTripPatterns()); var stops = patterns.stream().map(TripPattern::getStops).toList(); assertEquals(List.of(List.of(STOP_A, STOP_D, STOP_C)), stops); 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 70% 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 index da0c1d6f61d..193eddf9690 100644 --- a/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/TestStopConsolidationModel.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/TestStopConsolidationModel.java @@ -1,9 +1,9 @@ package org.opentripplanner.ext.stopconsolidation; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.List; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.Route; @@ -11,26 +11,26 @@ 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.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class TestStopConsolidationModel { - private static final TransitModelForTest testModel = TransitModelForTest.of(); + private static final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); public static final RegularStop STOP_A = testModel.stop("A").withCoordinate(1, 1).build(); public static final RegularStop STOP_B = testModel.stop("B").withCoordinate(1.1, 1.1).build(); public static final RegularStop STOP_C = testModel.stop("C").withCoordinate(1.2, 1.2).build(); - public static final StopPattern STOP_PATTERN = TransitModelForTest.stopPattern( + public static final StopPattern STOP_PATTERN = TimetableRepositoryForTest.stopPattern( STOP_A, STOP_B, STOP_C ); static final String SECONDARY_FEED_ID = "secondary"; - static final Agency AGENCY = TransitModelForTest + static final Agency AGENCY = TimetableRepositoryForTest .agency("agency") .copy() .withId(new FeedScopedId(SECONDARY_FEED_ID, "agency")) .build(); - static final Route ROUTE = TransitModelForTest + static final Route ROUTE = TimetableRepositoryForTest .route(new FeedScopedId(SECONDARY_FEED_ID, "route-33")) .withAgency(AGENCY) .build(); @@ -45,9 +45,9 @@ class TestStopConsolidationModel { .withStopPattern(STOP_PATTERN) .build(); - static TransitModel buildTransitModel() { + static TimetableRepository buildTimetableRepository() { var stopModelBuilder = testModel.stopModelBuilder(); List.of(STOP_A, STOP_B, STOP_C, STOP_D).forEach(stopModelBuilder::withRegularStop); - return new TransitModel(stopModelBuilder.build(), new Deduplicator()); + return new TimetableRepository(stopModelBuilder.build(), new Deduplicator()); } } 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 91% 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 index ac5eb6d66e4..7bf87b4c89c 100644 --- 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 @@ -2,7 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.List; import org.junit.jupiter.api.Test; 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 80% 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 index b2fc356d111..1dd07a075ed 100644 --- 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 @@ -3,7 +3,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class DefaultStopConsolidationServiceTest { @@ -11,7 +11,7 @@ class DefaultStopConsolidationServiceTest { void isActive() { var service = new DefaultStopConsolidationService( new DefaultStopConsolidationRepository(), - new TransitModel() + new TimetableRepository() ); assertFalse(service.isActive()); } 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 85% 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 index ff9509a8474..be379fb6fa6 100644 --- a/src/ext-test/java/org/opentripplanner/ext/vectortiles/VectorTilesResourceTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/VectorTilesResourceTest.java @@ -8,7 +8,7 @@ import org.opentripplanner.TestServerContext; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.test.support.HttpForTest; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class VectorTilesResourceTest { @@ -17,7 +17,7 @@ void tileJson() { // the Grizzly request is awful to instantiate, using Mockito var grizzlyRequest = Mockito.mock(Request.class); var resource = new VectorTilesResource( - TestServerContext.createServerContext(new Graph(), new TransitModel()), + TestServerContext.createServerContext(new Graph(), new TimetableRepository()), grizzlyRequest, "default" ); diff --git a/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/LayerFiltersTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/LayerFiltersTest.java similarity index 87% rename from src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/LayerFiltersTest.java rename to application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/LayerFiltersTest.java index f12d43b62cf..871a4b4c7da 100644 --- a/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/LayerFiltersTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/LayerFiltersTest.java @@ -7,13 +7,13 @@ 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._data.TimetableRepositoryForTest; 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 RegularStop STOP = TimetableRepositoryForTest.of().stop("1").build(); private static final LocalDate DATE = LocalDate.of(2024, 9, 5); private static final TripPattern PATTERN = PatternTestModel.pattern(); 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 59% 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 index d187b611ef3..b97cbcdc6fe 100644 --- 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 @@ -1,23 +1,23 @@ package org.opentripplanner.ext.vectortiles.layers; import java.util.Set; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.site.StopLocation; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class TestTransitService extends DefaultTransitService { - public TestTransitService(TransitModel transitModel) { - super(transitModel); + public TestTransitService(TimetableRepository timetableRepository) { + super(timetableRepository); } @Override public Set getRoutesForStop(StopLocation stop) { return Set.of( - TransitModelForTest.route("1").withMode(TransitMode.RAIL).withGtfsType(100).build() + TimetableRepositoryForTest.route("1").withMode(TransitMode.RAIL).withGtfsType(100).build() ); } } 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 72% 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 index 5387df91bca..7d14d11785c 100644 --- 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 @@ -6,20 +6,22 @@ import java.util.List; import java.util.Locale; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.site.AreaStop; import org.opentripplanner.transit.service.StopModel; class AreaStopPropertyMapperTest { - private static final TransitModelForTest MODEL = new TransitModelForTest(StopModel.of()); + private static final TimetableRepositoryForTest MODEL = new TimetableRepositoryForTest( + StopModel.of() + ); private static final AreaStop STOP = MODEL.areaStop("123").build(); - private static final Route ROUTE_WITH_COLOR = TransitModelForTest + private static final Route ROUTE_WITH_COLOR = TimetableRepositoryForTest .route("123") .withColor("ffffff") .build(); - private static final Route ROUTE_WITHOUT_COLOR = TransitModelForTest.route("456").build(); + private static final Route ROUTE_WITHOUT_COLOR = TimetableRepositoryForTest.route("456").build(); @Test void map() { 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 90% 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 index 2e6c4e16c40..7cfab197cf1 100644 --- 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 @@ -17,7 +17,7 @@ import org.opentripplanner.transit.service.DefaultTransitService; import org.opentripplanner.transit.service.StopModel; import org.opentripplanner.transit.service.StopModelBuilder; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class AreaStopsLayerBuilderTest { @@ -54,17 +54,17 @@ class AreaStopsLayerBuilderTest { .withGeometry(Polygons.BERLIN) .build(); - private final TransitModel transitModel = new TransitModel( + private final TimetableRepository timetableRepository = new TimetableRepository( stopModelBuilder.withAreaStop(AREA_STOP).build(), new Deduplicator() ); @Test void getAreaStops() { - transitModel.index(); + timetableRepository.index(); var subject = new AreaStopsLayerBuilder( - new DefaultTransitService(transitModel), + new DefaultTransitService(timetableRepository), LAYER_CONFIG, Locale.ENGLISH ); 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 71% 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 index da85285954d..2f37afc76be 100644 --- 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 @@ -1,7 +1,7 @@ package org.opentripplanner.ext.vectortiles.layers.stations; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.HashMap; import java.util.Locale; @@ -9,20 +9,20 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.ext.vectortiles.layers.TestTransitService; import org.opentripplanner.framework.i18n.I18NString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.site.Station; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class DigitransitStationPropertyMapperTest { @Test void map() { var deduplicator = new Deduplicator(); - var transitModel = new TransitModel(new StopModel(), deduplicator); - transitModel.index(); - var transitService = new TestTransitService(transitModel); + var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); + timetableRepository.index(); + var transitService = new TestTransitService(timetableRepository); var mapper = DigitransitStationPropertyMapper.create(transitService, Locale.US); @@ -32,7 +32,7 @@ void map() { .withName(I18NString.of("A station")) .build(); - TransitModelForTest.of().stop("stop-1").withParentStation(station).build(); + TimetableRepositoryForTest.of().stop("stop-1").withParentStation(station).build(); Map map = new HashMap<>(); mapper.map(station).forEach(o -> map.put(o.key(), o.value())); 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 88% 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 index 796b2a204da..867903c410a 100644 --- 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 @@ -21,14 +21,14 @@ import org.opentripplanner.routing.alertpatch.TransitAlert; import org.opentripplanner.routing.impl.TransitAlertServiceImpl; import org.opentripplanner.routing.services.TransitAlertService; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; 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.site.RegularStop; import org.opentripplanner.transit.service.DefaultTransitService; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class RealtimeStopsLayerTest { @@ -62,11 +62,11 @@ public void setUp() { @Test void realtimeStopLayer() { var deduplicator = new Deduplicator(); - var transitModel = new TransitModel(new StopModel(), deduplicator); - transitModel.initTimeZone(ZoneIds.HELSINKI); - transitModel.index(); - var transitService = new DefaultTransitService(transitModel) { - final TransitAlertService alertService = new TransitAlertServiceImpl(transitModel); + var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); + timetableRepository.initTimeZone(ZoneIds.HELSINKI); + timetableRepository.index(); + var transitService = new DefaultTransitService(timetableRepository) { + final TransitAlertService alertService = new TransitAlertServiceImpl(timetableRepository); @Override public TransitAlertService getTransitAlertService() { @@ -74,7 +74,7 @@ public TransitAlertService getTransitAlertService() { } }; - Route route = TransitModelForTest.route("route").build(); + Route route = TimetableRepositoryForTest.route("route").build(); var itinerary = newItinerary(Place.forStop(stop), time("11:00")) .bus(route, 1, time("11:05"), time("11:20"), Place.forStop(stop2)) .build(); 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 84% 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 index 7760eee13b8..046c5839db0 100644 --- 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 @@ -1,7 +1,7 @@ package org.opentripplanner.ext.vectortiles.layers.stops; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.HashMap; import java.util.Locale; @@ -17,7 +17,7 @@ import org.opentripplanner.transit.model.site.Station; import org.opentripplanner.transit.service.DefaultTransitService; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class StopsLayerTest { @@ -59,9 +59,9 @@ public class StopsLayerTest { @Test public void digitransitStopPropertyMapperTest() { var deduplicator = new Deduplicator(); - var transitModel = new TransitModel(new StopModel(), deduplicator); - transitModel.index(); - var transitService = new TestTransitService(transitModel); + var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); + timetableRepository.index(); + var transitService = new TestTransitService(timetableRepository); DigitransitStopPropertyMapper mapper = DigitransitStopPropertyMapper.create( transitService, @@ -81,9 +81,9 @@ public void digitransitStopPropertyMapperTest() { @Test public void digitransitStopPropertyMapperTranslationTest() { var deduplicator = new Deduplicator(); - var transitModel = new TransitModel(new StopModel(), deduplicator); - transitModel.index(); - var transitService = new DefaultTransitService(transitModel); + var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); + timetableRepository.index(); + var transitService = new DefaultTransitService(timetableRepository); DigitransitStopPropertyMapper mapper = DigitransitStopPropertyMapper.create( transitService, 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 97% 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 index 1beca037457..95ad7ea713e 100644 --- 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 @@ -26,12 +26,12 @@ import org.opentripplanner.routing.vehicle_parking.VehicleParkingSpaces; import org.opentripplanner.routing.vehicle_parking.VehicleParkingState; import org.opentripplanner.standalone.config.routerconfig.VectorTileConfig; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; public class VehicleParkingGroupsLayerTest { - private static final FeedScopedId ID = TransitModelForTest.id("id"); + private static final FeedScopedId ID = TimetableRepositoryForTest.id("id"); private VehicleParkingGroup vehicleParkingGroup; private VehicleParking vehicleParking; 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 97% 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 index 14e96e2aa28..b63c9c51bc6 100644 --- 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 @@ -29,13 +29,13 @@ import org.opentripplanner.routing.vehicle_parking.VehicleParkingSpaces; import org.opentripplanner.routing.vehicle_parking.VehicleParkingState; import org.opentripplanner.standalone.config.routerconfig.VectorTileConfig; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; public class VehicleParkingsLayerTest { - private static final FeedScopedId ID = TransitModelForTest.id("id"); + private static final FeedScopedId ID = TimetableRepositoryForTest.id("id"); private VehicleParking vehicleParking; 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 85% 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..be237236700 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; @@ -13,7 +12,7 @@ import org.opentripplanner.routing.graph.index.StreetIndex; import org.opentripplanner.street.model.vertex.StreetVertex; import org.opentripplanner.transit.model.site.AreaStop; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,31 +25,31 @@ public class AreaStopsToVerticesMapper implements GraphBuilderModule { private static final Logger LOG = LoggerFactory.getLogger(AreaStopsToVerticesMapper.class); private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; @Inject - public AreaStopsToVerticesMapper(Graph graph, TransitModel transitModel) { + public AreaStopsToVerticesMapper(Graph graph, TimetableRepository timetableRepository) { this.graph = graph; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; } @Override @SuppressWarnings("Convert2MethodRef") public void buildGraph() { - if (!transitModel.getStopModel().hasAreaStops()) { + if (!timetableRepository.getStopModel().hasAreaStops()) { return; } - StreetIndex streetIndex = graph.getStreetIndexSafe(transitModel.getStopModel()); + StreetIndex streetIndex = graph.getStreetIndexSafe(timetableRepository.getStopModel()); ProgressTracker progress = ProgressTracker.track( "Add flex locations to street vertices", 1, - transitModel.getStopModel().listAreaStops().size() + timetableRepository.getStopModel().listAreaStops().size() ); LOG.info(progress.startMessage()); - var results = transitModel + var results = timetableRepository .getStopModel() .listAreaStops() .parallelStream() @@ -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 88% rename from src/ext/java/org/opentripplanner/ext/flex/FlexIndex.java rename to application/src/ext/java/org/opentripplanner/ext/flex/FlexIndex.java index a875ba0f516..cd047de6d04 100644 --- a/src/ext/java/org/opentripplanner/ext/flex/FlexIndex.java +++ b/application/src/ext/java/org/opentripplanner/ext/flex/FlexIndex.java @@ -12,7 +12,7 @@ import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.site.GroupStop; import org.opentripplanner.transit.model.site.StopLocation; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class FlexIndex { @@ -24,11 +24,11 @@ public class FlexIndex { private final Map> tripById = new HashMap<>(); - public FlexIndex(TransitModel transitModel) { - for (PathTransfer transfer : transitModel.getAllPathTransfers()) { + public FlexIndex(TimetableRepository timetableRepository) { + for (PathTransfer transfer : timetableRepository.getAllPathTransfers()) { transfersToStop.put(transfer.to, transfer); } - for (FlexTrip flexTrip : transitModel.getAllFlexTrips()) { + for (FlexTrip flexTrip : timetableRepository.getAllFlexTrips()) { routeById.put(flexTrip.getTrip().getRoute().getId(), flexTrip.getTrip().getRoute()); tripById.put(flexTrip.getTrip().getId(), flexTrip); for (StopLocation stop : flexTrip.getStops()) { 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 95% 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..72ac22b027a 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; @@ -48,7 +48,7 @@ import org.opentripplanner.transit.model.site.StopLocation; import org.opentripplanner.transit.model.site.StopLocationsGroup; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitService; public class LuceneIndex implements Serializable { @@ -73,8 +73,11 @@ public class LuceneIndex implements Serializable { * However, we do need some methods in the service and that's why we instantiate it manually in this * constructor. */ - public LuceneIndex(TransitModel transitModel, StopConsolidationService stopConsolidationService) { - this(new DefaultTransitService(transitModel), stopConsolidationService); + public LuceneIndex( + TimetableRepository timetableRepository, + StopConsolidationService stopConsolidationService + ) { + this(new DefaultTransitService(timetableRepository), stopConsolidationService); } /** @@ -200,8 +203,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 79% 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 index 9eaf6ade8e5..666ff5d7eaf 100644 --- a/src/ext/java/org/opentripplanner/ext/geocoder/configure/GeocoderModule.java +++ b/application/src/ext/java/org/opentripplanner/ext/geocoder/configure/GeocoderModule.java @@ -7,7 +7,7 @@ import org.opentripplanner.ext.geocoder.LuceneIndex; import org.opentripplanner.ext.stopconsolidation.StopConsolidationService; import org.opentripplanner.framework.application.OTPFeature; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * This module builds the Lucene geocoder based on whether the feature flag is on or off. @@ -19,11 +19,11 @@ public class GeocoderModule { @Singleton @Nullable LuceneIndex luceneIndex( - TransitModel transitModel, + TimetableRepository timetableRepository, @Nullable StopConsolidationService stopConsolidationService ) { if (OTPFeature.SandboxAPIGeocoder.isOn()) { - return new LuceneIndex(transitModel, stopConsolidationService); + return new LuceneIndex(timetableRepository, stopConsolidationService); } else { return null; } 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 93% 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..0f3e2afe1ea 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.transit.service.TimetableRepository; 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; @@ -35,11 +35,14 @@ public class SiriAzureSXUpdater extends AbstractAzureSiriUpdater implements Tran private final LocalDate fromDateTime; private final LocalDate toDateTime; - public SiriAzureSXUpdater(SiriAzureSXUpdaterParameters config, TransitModel transitModel) { + public SiriAzureSXUpdater( + SiriAzureSXUpdaterParameters config, + TimetableRepository timetableRepository + ) { super(config); this.fromDateTime = config.getFromDateTime(); this.toDateTime = config.getToDateTime(); - this.transitAlertService = new TransitAlertServiceImpl(transitModel); + this.transitAlertService = new TransitAlertServiceImpl(timetableRepository); this.updateHandler = new SiriAlertsUpdateHandler(feedId, transitAlertService, Duration.ZERO); } 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 68% rename from src/ext/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNames.java rename to application/src/ext/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNames.java index 1806b3e9e32..6def5c85fa1 100644 --- a/src/ext/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNames.java +++ b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNames.java @@ -1,8 +1,10 @@ package org.opentripplanner.ext.stopconsolidation; +import java.util.ArrayList; import java.util.Objects; import org.opentripplanner.ext.stopconsolidation.model.ConsolidatedStopLeg; import org.opentripplanner.model.plan.Itinerary; +import org.opentripplanner.model.plan.Leg; import org.opentripplanner.model.plan.ScheduledTransitLeg; import org.opentripplanner.routing.algorithm.filterchain.framework.spi.ItineraryDecorator; @@ -13,6 +15,7 @@ */ public class DecorateConsolidatedStopNames implements ItineraryDecorator { + private static final int MAX_INTRA_STOP_WALK_DISTANCE_METERS = 15; private final StopConsolidationService service; public DecorateConsolidatedStopNames(StopConsolidationService service) { @@ -22,6 +25,7 @@ public DecorateConsolidatedStopNames(StopConsolidationService service) { @Override public void decorate(Itinerary itinerary) { replaceConsolidatedStops(itinerary); + removeShortWalkLegs(itinerary); } /** @@ -51,6 +55,43 @@ private void replaceConsolidatedStops(Itinerary i) { }); } + /** + * Removes walk legs from and to a consolidated stop if they are deemed "short". This means that + * they are from a different element of the consolidated stop. + */ + private void removeShortWalkLegs(Itinerary itinerary) { + var legs = new ArrayList<>(itinerary.getLegs()); + var first = legs.getFirst(); + if ( + service.isPartOfConsolidatedStop(first.getTo().stop) && + isShortWalkLeg(first) + ) { + legs.removeFirst(); + } + var last = legs.getLast(); + if ( + service.isPartOfConsolidatedStop(last.getFrom().stop) && + isShortWalkLeg(last) + ) { + legs.removeLast(); + } + + var transfersRemoved = legs.stream().filter(l -> !isTransferWithinConsolidatedStop(l)).toList(); + + itinerary.setLegs(transfersRemoved); + } + + private boolean isTransferWithinConsolidatedStop(Leg l) { + return isShortWalkLeg(l) && + service.isPartOfConsolidatedStop(l.getFrom().stop) && + service.isPartOfConsolidatedStop(l.getTo().stop); + } + + private static boolean isShortWalkLeg(Leg leg) { + return leg.isWalkingLeg() && + leg.getDistanceMeters() < MAX_INTRA_STOP_WALK_DISTANCE_METERS; + } + /** * Figures out if the from/to stops are part of a consolidated stop group and therefore * some stops need to be replaced. 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 82% 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..c4fca42d129 100644 --- a/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModule.java +++ b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModule.java @@ -4,14 +4,13 @@ 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; import org.opentripplanner.ext.stopconsolidation.model.StopReplacement; import org.opentripplanner.graph_builder.model.GraphBuilderModule; import org.opentripplanner.transit.model.network.TripPattern; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,18 +25,18 @@ */ public class StopConsolidationModule implements GraphBuilderModule { - private static final Logger LOG = LoggerFactory.getLogger(TripPattern.class); + private static final Logger LOG = LoggerFactory.getLogger(StopConsolidationModule.class); private final StopConsolidationRepository repository; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final Collection groups; public StopConsolidationModule( - TransitModel transitModel, + TimetableRepository timetableRepository, StopConsolidationRepository repository, Collection groups ) { - this.transitModel = Objects.requireNonNull(transitModel); + this.timetableRepository = Objects.requireNonNull(timetableRepository); this.repository = Objects.requireNonNull(repository); this.groups = Objects.requireNonNull(groups); } @@ -46,23 +45,22 @@ public StopConsolidationModule( public void buildGraph() { repository.addGroups(groups); - var service = new DefaultStopConsolidationService(repository, transitModel); + var service = new DefaultStopConsolidationService(repository, timetableRepository); var stopsToReplace = service.secondaryStops(); var replacements = service.replacements(); - transitModel + timetableRepository .getAllTripPatterns() .stream() .filter(pattern -> pattern.containsAnyStopId(stopsToReplace)) .forEach(pattern -> { LOG.info("Replacing stop(s) in pattern {}", pattern); var modifiedPattern = modifyStopsInPattern(pattern, replacements); - transitModel.addTripPattern(modifiedPattern.getId(), modifiedPattern); + timetableRepository.addTripPattern(modifiedPattern.getId(), modifiedPattern); }); } - @Nonnull private TripPattern modifyStopsInPattern( TripPattern pattern, List replacements @@ -73,14 +71,14 @@ private TripPattern modifyStopsInPattern( } public static StopConsolidationModule of( - TransitModel transitModel, + TimetableRepository timetableRepository, StopConsolidationRepository repo, DataSource ds ) { LOG.info("Reading stop consolidation information from '{}'", ds); try (var inputStream = ds.asInputStream()) { var groups = StopConsolidationParser.parseGroups(inputStream); - return new StopConsolidationModule(transitModel, repo, groups); + return new StopConsolidationModule(timetableRepository, repo, groups); } catch (IOException e) { throw new RuntimeException(e); } 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 93% rename from src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationService.java rename to application/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationService.java index 68efe8744cc..0457212e66a 100644 --- a/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationService.java +++ b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationService.java @@ -2,6 +2,7 @@ import java.util.List; import java.util.Optional; +import javax.annotation.Nullable; import org.opentripplanner.ext.stopconsolidation.model.StopReplacement; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.organization.Agency; @@ -44,5 +45,5 @@ public interface StopConsolidationService { */ Optional primaryStop(FeedScopedId id); - boolean isPartOfConsolidatedStop(StopLocation sl); + boolean isPartOfConsolidatedStop(@Nullable StopLocation sl); } 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 77% 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 index 3851435641c..5c829b20b67 100644 --- a/src/ext/java/org/opentripplanner/ext/stopconsolidation/configure/StopConsolidationServiceModule.java +++ b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/configure/StopConsolidationServiceModule.java @@ -7,7 +7,7 @@ import org.opentripplanner.ext.stopconsolidation.StopConsolidationRepository; import org.opentripplanner.ext.stopconsolidation.StopConsolidationService; import org.opentripplanner.ext.stopconsolidation.internal.DefaultStopConsolidationService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; @Module public class StopConsolidationServiceModule { @@ -15,7 +15,10 @@ public class StopConsolidationServiceModule { @Provides @Singleton @Nullable - StopConsolidationService service(@Nullable StopConsolidationRepository repo, TransitModel tm) { + StopConsolidationService service( + @Nullable StopConsolidationRepository repo, + TimetableRepository tm + ) { if (repo == null) { return null; } else { 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 80% 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..d4f148d9ec6 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,15 +4,15 @@ import java.util.Objects; import java.util.Optional; import java.util.stream.Stream; -import javax.annotation.Nonnull; import org.opentripplanner.ext.stopconsolidation.StopConsolidationRepository; +import javax.annotation.Nullable; import org.opentripplanner.ext.stopconsolidation.StopConsolidationService; import org.opentripplanner.ext.stopconsolidation.model.ConsolidatedStopGroup; import org.opentripplanner.ext.stopconsolidation.model.StopReplacement; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.organization.Agency; import org.opentripplanner.transit.model.site.StopLocation; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,14 +21,14 @@ public class DefaultStopConsolidationService implements StopConsolidationService private static final Logger LOG = LoggerFactory.getLogger(DefaultStopConsolidationService.class); private final StopConsolidationRepository repo; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; public DefaultStopConsolidationService( StopConsolidationRepository repo, - TransitModel transitModel + TimetableRepository timetableRepository ) { this.repo = Objects.requireNonNull(repo); - this.transitModel = Objects.requireNonNull(transitModel); + this.timetableRepository = Objects.requireNonNull(timetableRepository); } @Override @@ -37,7 +37,7 @@ public List replacements() { .groups() .stream() .flatMap(group -> { - var primaryStop = transitModel.getStopModel().getRegularStop(group.primary()); + var primaryStop = timetableRepository.getStopModel().getRegularStop(group.primary()); if (primaryStop == null) { LOG.error( "Could not find primary stop with id {}. Ignoring stop group {}.", @@ -68,8 +68,12 @@ public boolean isSecondaryStop(StopLocation stop) { } @Override - public boolean isPartOfConsolidatedStop(StopLocation sl) { - return isSecondaryStop(sl) || isPrimaryStop(sl); + public boolean isPartOfConsolidatedStop(@Nullable StopLocation sl) { + if (sl == null) { + return false; + } else { + return isSecondaryStop(sl) || isPrimaryStop(sl); + } } @Override @@ -86,7 +90,6 @@ public StopLocation agencySpecificStop(StopLocation stop, Agency agency) { } } - @Nonnull private Optional findAgencySpecificStop(StopLocation stop, Agency agency) { return repo .groups() @@ -95,7 +98,7 @@ private Optional findAgencySpecificStop(StopLocation stop, Agency .flatMap(g -> g.secondaries().stream()) .filter(secondary -> secondary.getFeedId().equals(agency.getId().getFeedId())) .findAny() - .map(id -> transitModel.getStopModel().getRegularStop(id)); + .map(id -> timetableRepository.getStopModel().getRegularStop(id)); } @Override @@ -107,6 +110,6 @@ public Optional primaryStop(FeedScopedId id) { .map(ConsolidatedStopGroup::primary) .findAny() .orElse(id); - return Optional.ofNullable(transitModel.getStopModel().getRegularStop(primaryId)); + return Optional.ofNullable(timetableRepository.getStopModel().getRegularStop(primaryId)); } } 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 95% rename from src/ext/java/org/opentripplanner/ext/transferanalyzer/DirectTransferAnalyzer.java rename to application/src/ext/java/org/opentripplanner/ext/transferanalyzer/DirectTransferAnalyzer.java index 979912c5f37..701ff702a32 100644 --- a/src/ext/java/org/opentripplanner/ext/transferanalyzer/DirectTransferAnalyzer.java +++ b/application/src/ext/java/org/opentripplanner/ext/transferanalyzer/DirectTransferAnalyzer.java @@ -18,7 +18,7 @@ import org.opentripplanner.routing.graphfinder.StreetGraphFinder; import org.opentripplanner.street.model.vertex.TransitStopVertex; import org.opentripplanner.transit.model.site.RegularStop; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,18 +41,18 @@ public class DirectTransferAnalyzer implements GraphBuilderModule { private static final Logger LOG = LoggerFactory.getLogger(DirectTransferAnalyzer.class); private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final DataImportIssueStore issueStore; private final double radiusMeters; public DirectTransferAnalyzer( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore, double radiusMeters ) { this.graph = graph; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.issueStore = issueStore; this.radiusMeters = radiusMeters; } @@ -60,7 +60,7 @@ public DirectTransferAnalyzer( @Override public void buildGraph() { /* Initialize transit index which is needed by the nearby stop finder. */ - transitModel.index(); + timetableRepository.index(); LOG.info("Analyzing transfers (this can be time consuming)..."); @@ -68,7 +68,7 @@ public void buildGraph() { List directTransfersNotFound = new ArrayList<>(); DirectGraphFinder nearbyStopFinderEuclidian = new DirectGraphFinder( - transitModel.getStopModel()::findRegularStops + timetableRepository.getStopModel()::findRegularStops ); StreetGraphFinder nearbyStopFinderStreets = new StreetGraphFinder(graph); 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/src/ext/java/org/opentripplanner/ext/vectortiles/layers/LayerFilters.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/LayerFilters.java similarity index 100% rename from src/ext/java/org/opentripplanner/ext/vectortiles/layers/LayerFilters.java rename to application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/LayerFilters.java 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 94% 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 index 449a1489d89..25959d5ec7a 100644 --- 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 @@ -23,7 +23,7 @@ public class StationsLayerBuilder extends LayerBuilder { MapperType.Digitransit, DigitransitStationPropertyMapper::create ); - private final TransitService transitModel; + private final TransitService transitService; public StationsLayerBuilder( TransitService transitService, @@ -35,11 +35,11 @@ public StationsLayerBuilder( layerParameters.name(), layerParameters.expansionFactor() ); - this.transitModel = transitService; + this.transitService = transitService; } protected List getGeometries(Envelope query) { - return transitModel + return transitService .getStations() .stream() .map(station -> { 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 100% 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 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 98% 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 950e3d9bba5..8d84c7f0b03 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; @@ -191,10 +192,10 @@ public DataFetcher realTime() { } @Override - public DataFetcher realtimeState() { + public DataFetcher realtimeState() { return environment -> { var state = getSource(environment).getRealTimeState(); - return (state != null) ? state.name() : null; + return RealtimeStateMapper.map(state); }; } 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 100% 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 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 100% 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 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 99% 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 503899ba21a..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 @@ -278,7 +278,7 @@ public DataFetcher> stopTimesForPattern() { return null; } - if (transitService.hasRealtimeAddedTripPatterns()) { + if (transitService.hasNewTripPatternsForModifiedTrips()) { return getTripTimeOnDatesForPatternAtStopIncludingTripsWithSkippedStops( pattern, stop, @@ -562,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 2dbcf7d1998..7532faf28bd 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; @@ -504,7 +505,7 @@ public interface GraphQLLeg { public DataFetcher realTime(); - public DataFetcher realtimeState(); + public DataFetcher realtimeState(); public DataFetcher rentedBike(); @@ -1082,7 +1083,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 100% 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 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 84% 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 index 7fe496f3a24..837c064e219 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/generated/README.md +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/generated/README.md @@ -2,7 +2,7 @@ ## Requirements -- NodeJS (version 16 or newer) +- NodeJS (version 18 or newer) ## Running 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 92% 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 index d6cbf02d5e7..cd5cbf005f0 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/generated/package.json +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/generated/package.json @@ -11,7 +11,7 @@ "license": "LGPL-3.0", "dependencies": { "@graphql-codegen/add": "5.0.3", - "@graphql-codegen/cli": "5.0.2", + "@graphql-codegen/cli": "5.0.3", "@graphql-codegen/java": "4.0.1", "@graphql-codegen/java-resolvers": "3.0.0", "graphql": "16.9.0" 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 95% 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 index 25686abd94a..8ec320cb0e6 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/generated/yarn.lock +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/generated/yarn.lock @@ -699,7 +699,7 @@ "@babel/helper-validator-identifier" "^7.19.1" to-fast-properties "^2.0.0" -"@graphql-codegen/add@5.0.3": +"@graphql-codegen/add@5.0.3", "@graphql-codegen/add@^5.0.3": version "5.0.3" resolved "https://registry.yarnpkg.com/@graphql-codegen/add/-/add-5.0.3.tgz#1ede6bac9a93661ed7fa5808b203d079e1b1d215" integrity sha512-SxXPmramkth8XtBlAHu4H4jYcYXM/o3p01+psU+0NADQowA8jtYkK6MW5rV6T+CxkEaNZItfSmZRPgIuypcqnA== @@ -707,23 +707,15 @@ "@graphql-codegen/plugin-helpers" "^5.0.3" tslib "~2.6.0" -"@graphql-codegen/add@^5.0.2": - version "5.0.2" - resolved "https://registry.yarnpkg.com/@graphql-codegen/add/-/add-5.0.2.tgz#71b3ae0465a4537172dddb84531b6967ca5545f2" - integrity sha512-ouBkSvMFUhda5VoKumo/ZvsZM9P5ZTyDsI8LW18VxSNWOjrTeLXBWHG8Gfaai0HwhflPtCYVABbriEcOmrRShQ== - dependencies: - "@graphql-codegen/plugin-helpers" "^5.0.3" - tslib "~2.6.0" - -"@graphql-codegen/cli@5.0.2": - version "5.0.2" - resolved "https://registry.yarnpkg.com/@graphql-codegen/cli/-/cli-5.0.2.tgz#07ff691c16da4c3dcc0e1995d3231530379ab317" - integrity sha512-MBIaFqDiLKuO4ojN6xxG9/xL9wmfD3ZjZ7RsPjwQnSHBCUXnEkdKvX+JVpx87Pq29Ycn8wTJUguXnTZ7Di0Mlw== +"@graphql-codegen/cli@5.0.3": + version "5.0.3" + resolved "https://registry.yarnpkg.com/@graphql-codegen/cli/-/cli-5.0.3.tgz#d518ce5c011ff82496badef1342b3ba8d42efbcb" + integrity sha512-ULpF6Sbu2d7vNEOgBtE9avQp2oMgcPY/QBYcCqk0Xru5fz+ISjcovQX29V7CS7y5wWBRzNLoXwJQGeEyWbl05g== dependencies: "@babel/generator" "^7.18.13" "@babel/template" "^7.18.10" "@babel/types" "^7.18.13" - "@graphql-codegen/client-preset" "^4.2.2" + "@graphql-codegen/client-preset" "^4.4.0" "@graphql-codegen/core" "^4.0.2" "@graphql-codegen/plugin-helpers" "^5.0.3" "@graphql-tools/apollo-engine-loader" "^8.0.0" @@ -736,12 +728,12 @@ "@graphql-tools/prisma-loader" "^8.0.0" "@graphql-tools/url-loader" "^8.0.0" "@graphql-tools/utils" "^10.0.0" - "@whatwg-node/fetch" "^0.8.0" + "@whatwg-node/fetch" "^0.9.20" chalk "^4.1.0" cosmiconfig "^8.1.3" debounce "^1.2.0" detect-indent "^6.0.0" - graphql-config "^5.0.2" + graphql-config "^5.1.1" inquirer "^8.0.0" is-glob "^4.0.1" jiti "^1.17.1" @@ -756,20 +748,20 @@ yaml "^2.3.1" yargs "^17.0.0" -"@graphql-codegen/client-preset@^4.2.2": - version "4.2.2" - resolved "https://registry.yarnpkg.com/@graphql-codegen/client-preset/-/client-preset-4.2.2.tgz#545c62789a5687bee5df8b4738b4911e72ea8051" - integrity sha512-DF9pNWj3TEdA90E9FH5SsUIqiZfr872vqaQOspLVuVXGsaDx8F/JLLzaN+7ucmoo0ff/bLW8munVXYXTmgwwEA== +"@graphql-codegen/client-preset@^4.4.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@graphql-codegen/client-preset/-/client-preset-4.4.0.tgz#f79d50ee2acb2d129072c1a080af90c30388fff7" + integrity sha512-Q0NHFK7KXLhEaRC/k82ge0dHDfeHJEvvDeV0vV3+oSurHNa/lpxQtbK2BqknZe+JDfZ1YOOvYT93XsAkYD+SQg== dependencies: "@babel/helper-plugin-utils" "^7.20.2" "@babel/template" "^7.20.7" - "@graphql-codegen/add" "^5.0.2" - "@graphql-codegen/gql-tag-operations" "4.0.4" - "@graphql-codegen/plugin-helpers" "^5.0.3" - "@graphql-codegen/typed-document-node" "^5.0.4" - "@graphql-codegen/typescript" "^4.0.4" - "@graphql-codegen/typescript-operations" "^4.1.2" - "@graphql-codegen/visitor-plugin-common" "^4.1.2" + "@graphql-codegen/add" "^5.0.3" + "@graphql-codegen/gql-tag-operations" "4.0.10" + "@graphql-codegen/plugin-helpers" "^5.0.4" + "@graphql-codegen/typed-document-node" "^5.0.10" + "@graphql-codegen/typescript" "^4.1.0" + "@graphql-codegen/typescript-operations" "^4.3.0" + "@graphql-codegen/visitor-plugin-common" "^5.4.0" "@graphql-tools/documents" "^1.0.0" "@graphql-tools/utils" "^10.0.0" "@graphql-typed-document-node/core" "3.2.0" @@ -785,13 +777,13 @@ "@graphql-tools/utils" "^10.0.0" tslib "~2.6.0" -"@graphql-codegen/gql-tag-operations@4.0.4": - version "4.0.4" - resolved "https://registry.yarnpkg.com/@graphql-codegen/gql-tag-operations/-/gql-tag-operations-4.0.4.tgz#572be5db804af5efdc3ca24e4bcac815448730c5" - integrity sha512-dypul0iDLjb07yv+/cRb6qPbn42cFPcwlsJertVl9G6qkS4+3V4806WwSfUht4QVMWnvGfgDkJJqG0yUVKOHwA== +"@graphql-codegen/gql-tag-operations@4.0.10": + version "4.0.10" + resolved "https://registry.yarnpkg.com/@graphql-codegen/gql-tag-operations/-/gql-tag-operations-4.0.10.tgz#c179806a7af68123c076c4324164a3112a4bad37" + integrity sha512-WsBEVL3XQdBboFJJL5WxrUjkuo3B7Sa51R9NbT7PKBe0HCNstoouGZIvQJRUubttFCqTTyoFtNsoRSKB+rsRug== dependencies: - "@graphql-codegen/plugin-helpers" "^5.0.3" - "@graphql-codegen/visitor-plugin-common" "4.1.2" + "@graphql-codegen/plugin-helpers" "^5.0.4" + "@graphql-codegen/visitor-plugin-common" "5.4.0" "@graphql-tools/utils" "^10.0.0" auto-bind "~4.0.0" tslib "~2.6.0" @@ -864,6 +856,18 @@ lodash "~4.17.0" tslib "~2.6.0" +"@graphql-codegen/plugin-helpers@^5.0.4": + version "5.0.4" + resolved "https://registry.yarnpkg.com/@graphql-codegen/plugin-helpers/-/plugin-helpers-5.0.4.tgz#5f4c987c3f308ef1c8809ee0c43af0369867e0f6" + integrity sha512-MOIuHFNWUnFnqVmiXtrI+4UziMTYrcquljaI5f/T/Bc7oO7sXcfkAvgkNWEEi9xWreYwvuer3VHCuPI/lAFWbw== + dependencies: + "@graphql-tools/utils" "^10.0.0" + change-case-all "1.0.15" + common-tags "1.8.2" + import-from "4.0.0" + lodash "~4.17.0" + tslib "~2.6.0" + "@graphql-codegen/schema-ast@^4.0.2": version "4.0.2" resolved "https://registry.yarnpkg.com/@graphql-codegen/schema-ast/-/schema-ast-4.0.2.tgz#aeaa104e4555cca73a058f0a9350b4b0e290b377" @@ -873,36 +877,36 @@ "@graphql-tools/utils" "^10.0.0" tslib "~2.6.0" -"@graphql-codegen/typed-document-node@^5.0.4": - version "5.0.4" - resolved "https://registry.yarnpkg.com/@graphql-codegen/typed-document-node/-/typed-document-node-5.0.4.tgz#06e286caacdd66c3566f98433dcb8f1a9c9a9f1d" - integrity sha512-t66Z6erQ4Dh1j6f9pRZmc8uYtHoUI3A49tLmJAlg9/3IV0kCmwrWKJut/G8SeOefDLG8cXBTVtI/YuZOe1Te+w== +"@graphql-codegen/typed-document-node@^5.0.10": + version "5.0.10" + resolved "https://registry.yarnpkg.com/@graphql-codegen/typed-document-node/-/typed-document-node-5.0.10.tgz#5454c66ceefa2280657ce4852fbb57c9bd6df04d" + integrity sha512-YPDUNs6x0muoVWlbY2yEs0lGxFHMTszlGDh6klT/5rqiTDTZg3zz8Wd1ZTihkcH8+V6T0AT9qDWwcx9fcS2tvQ== dependencies: - "@graphql-codegen/plugin-helpers" "^5.0.3" - "@graphql-codegen/visitor-plugin-common" "4.1.2" + "@graphql-codegen/plugin-helpers" "^5.0.4" + "@graphql-codegen/visitor-plugin-common" "5.4.0" auto-bind "~4.0.0" change-case-all "1.0.15" tslib "~2.6.0" -"@graphql-codegen/typescript-operations@^4.1.2": - version "4.1.2" - resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-operations/-/typescript-operations-4.1.2.tgz#a0f455ae19e16961e5870420ca7515bbe51b5568" - integrity sha512-CtCWK+gW7hS+Ely3lohr8CL1HVLswQzMcaUk3k1sxdWCWKTNq7abMsWa31rTVwRCJ+WNEkM/7S8sIBTpEG683A== +"@graphql-codegen/typescript-operations@^4.3.0": + version "4.3.0" + resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-operations/-/typescript-operations-4.3.0.tgz#c3fba2468cd35dac1fe83a57e0e3f8e02eba4040" + integrity sha512-ZORwMy8OgsiYd9EZUhTMd4/g5LvTFpx6Fh6dNN0cxFkqSc6KhjX0vhzWsyK8N9+ILaHSutT8UTrLMdJi35HzDQ== dependencies: - "@graphql-codegen/plugin-helpers" "^5.0.3" - "@graphql-codegen/typescript" "^4.0.4" - "@graphql-codegen/visitor-plugin-common" "4.1.2" + "@graphql-codegen/plugin-helpers" "^5.0.4" + "@graphql-codegen/typescript" "^4.1.0" + "@graphql-codegen/visitor-plugin-common" "5.4.0" auto-bind "~4.0.0" tslib "~2.6.0" -"@graphql-codegen/typescript@^4.0.4": - version "4.0.4" - resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript/-/typescript-4.0.4.tgz#e791c61f675ae454951ea077b0ae519ae352cc3e" - integrity sha512-x79CKLfP9UQCX+/I78qxQlMs2Mmq3pF1lKafZo7lAno0f/fvJ+qWUduzdgjRNz+YL+5blGeWcC0pWEDxniO7hw== +"@graphql-codegen/typescript@^4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript/-/typescript-4.1.0.tgz#db6157b8df8bc5c6777ba519c24fce66536f5fcd" + integrity sha512-/fS53Nh6U6c58GTOxqfyKTLQfQv36P8II/vPw/fg0cdcWbALhRPls69P8vXUWjrElmLKzCrdusBWPp/r+AKUBQ== dependencies: - "@graphql-codegen/plugin-helpers" "^5.0.3" + "@graphql-codegen/plugin-helpers" "^5.0.4" "@graphql-codegen/schema-ast" "^4.0.2" - "@graphql-codegen/visitor-plugin-common" "4.1.2" + "@graphql-codegen/visitor-plugin-common" "5.4.0" auto-bind "~4.0.0" tslib "~2.6.0" @@ -922,12 +926,12 @@ parse-filepath "^1.0.2" tslib "~2.4.0" -"@graphql-codegen/visitor-plugin-common@4.1.2", "@graphql-codegen/visitor-plugin-common@^4.1.2": - version "4.1.2" - resolved "https://registry.yarnpkg.com/@graphql-codegen/visitor-plugin-common/-/visitor-plugin-common-4.1.2.tgz#674c5d5813f6c00dd65e1ee148a62536879e65e2" - integrity sha512-yk7iEAL1kYZ2Gi/pvVjdsZhul5WsYEM4Zcgh2Ev15VicMdJmPHsMhNUsZWyVJV0CaQCYpNOFlGD/11Ea3pn4GA== +"@graphql-codegen/visitor-plugin-common@5.4.0", "@graphql-codegen/visitor-plugin-common@^5.4.0": + version "5.4.0" + resolved "https://registry.yarnpkg.com/@graphql-codegen/visitor-plugin-common/-/visitor-plugin-common-5.4.0.tgz#157846e433224b55f9a755e59d02508783977e27" + integrity sha512-tL7hOrO+4MiNfDiHewhRQCiH9GTAh0M9Y/BZxYGGEdnrfGgqK5pCxtjq7EY/L19VGIyU7hhzYTQ0r1HzEbB4Jw== dependencies: - "@graphql-codegen/plugin-helpers" "^5.0.3" + "@graphql-codegen/plugin-helpers" "^5.0.4" "@graphql-tools/optimize" "^2.0.0" "@graphql-tools/relay-operation-optimizer" "^7.0.0" "@graphql-tools/utils" "^10.0.0" @@ -1299,6 +1303,11 @@ "@jridgewell/resolve-uri" "3.1.0" "@jridgewell/sourcemap-codec" "1.4.14" +"@kamilkisiela/fast-url-parser@^1.1.4": + version "1.1.4" + resolved "https://registry.yarnpkg.com/@kamilkisiela/fast-url-parser/-/fast-url-parser-1.1.4.tgz#9d68877a489107411b953c54ea65d0658b515809" + integrity sha512-gbkePEBupNydxCelHCESvFSFM8XPh1Zs/OAVRW/rKpEqPAl5PbOM90Si8mv9bvnR53uPD2s/FiRxdvSejpRJew== + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -1320,33 +1329,6 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@peculiar/asn1-schema@^2.1.6", "@peculiar/asn1-schema@^2.3.0": - version "2.3.3" - resolved "https://registry.yarnpkg.com/@peculiar/asn1-schema/-/asn1-schema-2.3.3.tgz#21418e1f3819e0b353ceff0c2dad8ccb61acd777" - integrity sha512-6GptMYDMyWBHTUKndHaDsRZUO/XMSgIns2krxcm2L7SEExRHwawFvSwNBhqNPR9HJwv3MruAiF1bhN0we6j6GQ== - dependencies: - asn1js "^3.0.5" - pvtsutils "^1.3.2" - tslib "^2.4.0" - -"@peculiar/json-schema@^1.1.12": - version "1.1.12" - resolved "https://registry.yarnpkg.com/@peculiar/json-schema/-/json-schema-1.1.12.tgz#fe61e85259e3b5ba5ad566cb62ca75b3d3cd5339" - integrity sha512-coUfuoMeIB7B8/NMekxaDzLhaYmp0HZNPEjYRm9goRou8UZIC3z21s0sL9AWoCw4EG876QyO3kYrc61WNF9B/w== - dependencies: - tslib "^2.0.0" - -"@peculiar/webcrypto@^1.4.0": - version "1.4.1" - resolved "https://registry.yarnpkg.com/@peculiar/webcrypto/-/webcrypto-1.4.1.tgz#821493bd5ad0f05939bd5f53b28536f68158360a" - integrity sha512-eK4C6WTNYxoI7JOabMoZICiyqRRtJB220bh0Mbj5RwRycleZf9BPyZoxsTvpP0FpmVS2aS13NKOuh5/tN3sIRw== - dependencies: - "@peculiar/asn1-schema" "^2.3.0" - "@peculiar/json-schema" "^1.1.12" - pvtsutils "^1.3.2" - tslib "^2.4.1" - webcrypto-core "^1.7.4" - "@repeaterjs/repeater@^3.0.4": version "3.0.4" resolved "https://registry.yarnpkg.com/@repeaterjs/repeater/-/repeater-3.0.4.tgz#a04d63f4d1bf5540a41b01a921c9a7fddc3bd1ca" @@ -1374,27 +1356,11 @@ dependencies: "@types/node" "*" -"@whatwg-node/events@^0.0.2": - version "0.0.2" - resolved "https://registry.yarnpkg.com/@whatwg-node/events/-/events-0.0.2.tgz#7b7107268d2982fc7b7aff5ee6803c64018f84dd" - integrity sha512-WKj/lI4QjnLuPrim0cfO7i+HsDSXHxNv1y0CrJhdntuO3hxWZmnXCwNDnwOvry11OjRin6cgWNF+j/9Pn8TN4w== - "@whatwg-node/events@^0.1.0": version "0.1.1" resolved "https://registry.yarnpkg.com/@whatwg-node/events/-/events-0.1.1.tgz#0ca718508249419587e130da26d40e29d99b5356" integrity sha512-AyQEn5hIPV7Ze+xFoXVU3QTHXVbWPrzaOkxtENMPMuNL6VVHrp4hHfDt9nrQpjO7BgvuM95dMtkycX5M/DZR3w== -"@whatwg-node/fetch@^0.8.0": - version "0.8.1" - resolved "https://registry.yarnpkg.com/@whatwg-node/fetch/-/fetch-0.8.1.tgz#ee3c94746132f217e17f78f9e073bb342043d630" - integrity sha512-Fkd1qQHK2tAWxKlC85h9L86Lgbq3BzxMnHSnTsnzNZMMzn6Xi+HlN8/LJ90LxorhSqD54td+Q864LgwUaYDj1Q== - dependencies: - "@peculiar/webcrypto" "^1.4.0" - "@whatwg-node/node-fetch" "^0.3.0" - busboy "^1.6.0" - urlpattern-polyfill "^6.0.2" - web-streams-polyfill "^3.2.1" - "@whatwg-node/fetch@^0.9.0": version "0.9.7" resolved "https://registry.yarnpkg.com/@whatwg-node/fetch/-/fetch-0.9.7.tgz#86b5cda576581beea300191d5c1f626fc7abfff7" @@ -1403,16 +1369,13 @@ "@whatwg-node/node-fetch" "^0.4.6" urlpattern-polyfill "^9.0.0" -"@whatwg-node/node-fetch@^0.3.0": - version "0.3.0" - resolved "https://registry.yarnpkg.com/@whatwg-node/node-fetch/-/node-fetch-0.3.0.tgz#7c7e90d03fa09d0ddebff29add6f16d923327d58" - integrity sha512-mPM8WnuHiI/3kFxDeE0SQQXAElbz4onqmm64fEGCwYEcBes2UsvIDI8HwQIqaXCH42A9ajJUPv4WsYoN/9oG6w== +"@whatwg-node/fetch@^0.9.20": + version "0.9.21" + resolved "https://registry.yarnpkg.com/@whatwg-node/fetch/-/fetch-0.9.21.tgz#24a08c441126ae2d0f94544e718bdb4a8c2b5ad0" + integrity sha512-Wt0jPb+04JjobK0pAAN7mEHxVHcGA9HoP3OyCsZtyAecNQeADXCZ1MihFwVwjsgaRYuGVmNlsCmLxlG6mor8Gw== dependencies: - "@whatwg-node/events" "^0.0.2" - busboy "^1.6.0" - fast-querystring "^1.1.1" - fast-url-parser "^1.1.3" - tslib "^2.3.1" + "@whatwg-node/node-fetch" "^0.5.23" + urlpattern-polyfill "^10.0.0" "@whatwg-node/node-fetch@^0.4.6": version "0.4.6" @@ -1425,6 +1388,16 @@ fast-url-parser "^1.1.3" tslib "^2.3.1" +"@whatwg-node/node-fetch@^0.5.23": + version "0.5.26" + resolved "https://registry.yarnpkg.com/@whatwg-node/node-fetch/-/node-fetch-0.5.26.tgz#b660f55bf0039ef7ead75c224fe4240469c88f88" + integrity sha512-4jXDeZ4IH4bylZ6wu14VEx0aDXXhrN4TC279v9rPmn08g4EYekcYf8wdcOOnS9STjDkb6x77/6xBUTqxGgjr8g== + dependencies: + "@kamilkisiela/fast-url-parser" "^1.1.4" + busboy "^1.6.0" + fast-querystring "^1.1.1" + tslib "^2.6.3" + agent-base@^7.0.2, agent-base@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-7.1.0.tgz#536802b76bc0b34aa50195eb2442276d613e3434" @@ -1481,15 +1454,6 @@ asap@~2.0.3: resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY= -asn1js@^3.0.1, asn1js@^3.0.5: - version "3.0.5" - resolved "https://registry.yarnpkg.com/asn1js/-/asn1js-3.0.5.tgz#5ea36820443dbefb51cc7f88a2ebb5b462114f38" - integrity sha512-FVnvrKJwpt9LP2lAMl8qZswRNm3T4q9CON+bxldk2iwk3FFpuwhx2FfinyitizWHsVYyaY+y5JzDR0rCMV5yTQ== - dependencies: - pvtsutils "^1.3.2" - pvutils "^1.1.3" - tslib "^2.4.0" - astral-regex@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" @@ -1572,6 +1536,13 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" +brace-expansion@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" + integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== + dependencies: + balanced-match "^1.0.0" + braces@^3.0.1, braces@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" @@ -2144,10 +2115,10 @@ globby@^11.0.3: merge2 "^1.3.0" slash "^3.0.0" -graphql-config@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/graphql-config/-/graphql-config-5.0.2.tgz#7e962f94ccddcc2ee0aa71d75cf4491ec5092bdb" - integrity sha512-7TPxOrlbiG0JplSZYCyxn2XQtqVhXomEjXUmWJVSS5ET1nPhOJSsIb/WTwqWhcYX6G0RlHXSj9PLtGTKmxLNGg== +graphql-config@^5.1.1: + version "5.1.3" + resolved "https://registry.yarnpkg.com/graphql-config/-/graphql-config-5.1.3.tgz#343e2867dafd5b009cd97fe6b29a5e9604001819" + integrity sha512-RBhejsPjrNSuwtckRlilWzLVt2j8itl74W9Gke1KejDTz7oaA5kVd6wRn9zK9TS5mcmIYGxf7zN7a1ORMdxp1Q== dependencies: "@graphql-tools/graphql-file-loader" "^8.0.0" "@graphql-tools/json-file-loader" "^8.0.0" @@ -2156,8 +2127,8 @@ graphql-config@^5.0.2: "@graphql-tools/url-loader" "^8.0.0" "@graphql-tools/utils" "^10.0.0" cosmiconfig "^8.1.0" - jiti "^1.18.2" - minimatch "^4.2.3" + jiti "^2.0.0" + minimatch "^9.0.5" string-env-interpolation "^1.0.1" tslib "^2.4.0" @@ -2400,10 +2371,10 @@ jiti@^1.17.1: resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.17.2.tgz#9e193d171c76b1c518a46c243c410c0462fe22d1" integrity sha512-Xf0nU8+8wuiQpLcqdb2HRyHqYwGk2Pd+F7kstyp20ZuqTyCmB9dqpX2NxaxFc1kovraa2bG6c1RL3W7XfapiZg== -jiti@^1.18.2: - version "1.19.1" - resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.19.1.tgz#fa99e4b76a23053e0e7cde098efe1704a14c16f1" - integrity sha512-oVhqoRDaBXf7sjkll95LHVS6Myyyb1zaunVwk4Z0+WPSW4gjS0pl01zYKHScTuyEhQsFxV5L4DR5r+YqSyqyyg== +jiti@^2.0.0: + version "2.3.3" + resolved "https://registry.yarnpkg.com/jiti/-/jiti-2.3.3.tgz#39c66fc77476b92a694e65dfe04b294070e2e096" + integrity sha512-EX4oNDwcXSivPrw2qKH2LB5PoFxEvgtv2JgwW0bU858HoLQ+kutSvjLMUqBd0PeJYEinLWhoI9Ol0eYMqj/wNQ== jose@^4.11.4: version "4.14.4" @@ -2580,12 +2551,12 @@ minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimatch@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-4.2.3.tgz#b4dcece1d674dee104bb0fb833ebb85a78cbbca6" - integrity sha512-lIUdtK5hdofgCTu3aT0sOaHsYR37viUuIc0rwnnDXImbwFRcumyLMeZaM0t0I/fgxS6s6JMfu0rLD1Wz9pv1ng== +minimatch@^9.0.5: + version "9.0.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5" + integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow== dependencies: - brace-expansion "^1.1.7" + brace-expansion "^2.0.1" ms@2.1.2: version "2.1.2" @@ -2847,18 +2818,6 @@ punycode@^1.3.2: resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" integrity sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ== -pvtsutils@^1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/pvtsutils/-/pvtsutils-1.3.2.tgz#9f8570d132cdd3c27ab7d51a2799239bf8d8d5de" - integrity sha512-+Ipe2iNUyrZz+8K/2IOo+kKikdtfhRKzNpQbruF2URmqPtoqAs8g3xS7TJvFF2GcPXjh7DkqMnpVveRFq4PgEQ== - dependencies: - tslib "^2.4.0" - -pvutils@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/pvutils/-/pvutils-1.1.3.tgz#f35fc1d27e7cd3dfbd39c0826d173e806a03f5a3" - integrity sha512-pMpnA0qRdFp32b1sJl1wOJNxZLQ2cbQx+k6tjNtZ8CpvVhNqEPRgivZ2WOUev2YMajecdH7ctUPDvEe87nariQ== - queue-microtask@^1.2.2: version "1.2.3" resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" @@ -3163,16 +3122,16 @@ ts-log@^2.2.3: resolved "https://registry.yarnpkg.com/ts-log/-/ts-log-2.2.3.tgz#4da5640fe25a9fb52642cd32391c886721318efb" integrity sha512-XvB+OdKSJ708Dmf9ore4Uf/q62AYDTzFcAdxc8KNML1mmAWywRFVt/dn1KYJH8Agt5UJNujfM3znU5PxgAzA2w== -tslib@^2.0.0, tslib@^2.3.1, tslib@^2.4.1: - version "2.5.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" - integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg== - tslib@^2.0.3, tslib@^2.1.0: version "2.3.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01" integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw== +tslib@^2.3.1: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" + integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg== + tslib@^2.4.0, tslib@~2.4.0: version "2.4.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.1.tgz#0d0bfbaac2880b91e22df0768e55be9753a5b17e" @@ -3183,6 +3142,11 @@ tslib@^2.5.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.0.tgz#b295854684dbda164e181d259a22cd779dcd7bc3" integrity sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA== +tslib@^2.6.3: + version "2.7.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01" + integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA== + tslib@~2.6.0: version "2.6.2" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" @@ -3232,12 +3196,10 @@ upper-case@^2.0.2: dependencies: tslib "^2.0.3" -urlpattern-polyfill@^6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/urlpattern-polyfill/-/urlpattern-polyfill-6.0.2.tgz#a193fe773459865a2a5c93b246bb794b13d07256" - integrity sha512-5vZjFlH9ofROmuWmXM9yj2wljYKgWstGwe8YTyiqM7hVum/g9LyCizPZtb3UqsuppVwety9QJmfc42VggLpTgg== - dependencies: - braces "^3.0.2" +urlpattern-polyfill@^10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/urlpattern-polyfill/-/urlpattern-polyfill-10.0.0.tgz#f0a03a97bfb03cdf33553e5e79a2aadd22cac8ec" + integrity sha512-H/A06tKD7sS1O1X2SshBVeA5FLycRpjqiBeqGKmBwBDBy28EnRjORxTNe269KSSr5un5qyWi1iL61wLxpd+ZOg== urlpattern-polyfill@^9.0.0: version "9.0.0" @@ -3266,22 +3228,6 @@ wcwidth@^1.0.1: dependencies: defaults "^1.0.3" -web-streams-polyfill@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz#71c2718c52b45fd49dbeee88634b3a60ceab42a6" - integrity sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q== - -webcrypto-core@^1.7.4: - version "1.7.6" - resolved "https://registry.yarnpkg.com/webcrypto-core/-/webcrypto-core-1.7.6.tgz#e32c4a12a13de4251f8f9ef336a6cba7cdec9b55" - integrity sha512-TBPiewB4Buw+HI3EQW+Bexm19/W4cP/qZG/02QJCXN+iN+T5sl074vZ3rJcle/ZtDBQSgjkbsQO/1eFcxnSBUA== - dependencies: - "@peculiar/asn1-schema" "^2.1.6" - "@peculiar/json-schema" "^1.1.12" - asn1js "^3.0.1" - pvtsutils "^1.3.2" - tslib "^2.4.0" - webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" 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 100% 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 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/src/main/java/org/opentripplanner/apis/gtfs/support/filter/PatternByDateFilterUtil.java b/application/src/main/java/org/opentripplanner/apis/gtfs/support/filter/PatternByDateFilterUtil.java similarity index 100% rename from src/main/java/org/opentripplanner/apis/gtfs/support/filter/PatternByDateFilterUtil.java rename to application/src/main/java/org/opentripplanner/apis/gtfs/support/filter/PatternByDateFilterUtil.java 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 94% 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..7d982e77885 100644 --- a/src/main/java/org/opentripplanner/apis/transmodel/TransmodelAPI.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelAPI.java @@ -20,10 +20,9 @@ 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; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -67,16 +66,15 @@ public TransmodelAPIOldPath( */ public static void setUp( TransmodelAPIParameters config, - TransitModel transitModel, + TimetableRepository timetableRepository, RouteRequest defaultRouteRequest ) { if (config.hideFeedId()) { - TransitIdMapper.setupFixedFeedId(transitModel.getAgencies()); + TransitIdMapper.setupFixedFeedId(timetableRepository.getAgencies()); } tracingHeaderTags = config.tracingHeaderTags(); maxNumberOfResultFields = config.maxNumberOfResultFields(); - GqlUtil gqlUtil = new GqlUtil(transitModel.getTimeZone()); - schema = TransmodelGraphQLSchema.create(defaultRouteRequest, gqlUtil); + schema = TransmodelGraphQLSchema.create(defaultRouteRequest, timetableRepository.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 c3b59070903..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 @@ -1597,7 +1575,7 @@ private GraphQLSchema create() { .newFieldDefinition() .name("leg") .description("Refetch a single transit leg based on its id") - .withDirective(gqlUtil.timingData) + .withDirective(TransmodelDirectives.TIMING_DATA) .type(LegType.REF) .argument( GraphQLArgument @@ -1626,13 +1604,13 @@ private GraphQLSchema create() { .description( "Get OTP deployment information. This is only useful for developers of OTP itself not regular API users." ) - .withDirective(gqlUtil.timingData) + .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 @@ -1641,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 100% 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 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 96% 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 e4a0b350d3d..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() @@ -75,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) @@ -91,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() ) @@ -100,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() @@ -115,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() ) @@ -270,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())) @@ -280,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())) @@ -320,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) ) @@ -354,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." ) @@ -368,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 94% 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 e3fbf90a35d..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 @@ -12,6 +12,7 @@ import java.util.List; 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; @@ -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 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/application/src/main/java/org/opentripplanner/apis/vectortiles/DebugStyleSpec.java b/application/src/main/java/org/opentripplanner/apis/vectortiles/DebugStyleSpec.java new file mode 100644 index 00000000000..1fc87176af8 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/apis/vectortiles/DebugStyleSpec.java @@ -0,0 +1,265 @@ +package org.opentripplanner.apis.vectortiles; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.opentripplanner.apis.vectortiles.model.StyleBuilder; +import org.opentripplanner.apis.vectortiles.model.StyleSpec; +import org.opentripplanner.apis.vectortiles.model.TileSource; +import org.opentripplanner.apis.vectortiles.model.TileSource.RasterSource; +import org.opentripplanner.apis.vectortiles.model.VectorSourceLayer; +import org.opentripplanner.apis.vectortiles.model.ZoomDependentNumber; +import org.opentripplanner.apis.vectortiles.model.ZoomDependentNumber.ZoomStop; +import org.opentripplanner.framework.collection.ListUtils; +import org.opentripplanner.service.vehiclerental.street.StreetVehicleRentalLink; +import org.opentripplanner.street.model.StreetTraversalPermission; +import org.opentripplanner.street.model.edge.AreaEdge; +import org.opentripplanner.street.model.edge.BoardingLocationToStopLink; +import org.opentripplanner.street.model.edge.Edge; +import org.opentripplanner.street.model.edge.ElevatorHopEdge; +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; +import org.opentripplanner.street.model.edge.TemporaryFreeEdge; +import org.opentripplanner.street.model.edge.TemporaryPartialStreetEdge; +import org.opentripplanner.street.model.vertex.VehicleParkingEntranceVertex; + +/** + * A Mapbox/Mapblibre style specification for rendering debug information about transit and + * street data. + */ +public class DebugStyleSpec { + + private static final TileSource BACKGROUND_SOURCE = new RasterSource( + "background", + List.of("https://a.tile.openstreetmap.org/{z}/{x}/{y}.png"), + 19, + 256, + "© OpenStreetMap Contributors" + ); + private static final String MAGENTA = "#f21d52"; + private static final String BRIGHT_GREEN = "#22DD9E"; + private static final String DARK_GREEN = "#136b04"; + private static final String PURPLE = "#BC55F2"; + private static final String BLACK = "#140d0e"; + + private static final int MAX_ZOOM = 23; + private static final ZoomDependentNumber LINE_OFFSET = new ZoomDependentNumber( + List.of(new ZoomStop(13, 0.3f), new ZoomStop(MAX_ZOOM, 6)) + ); + private static final ZoomDependentNumber LINE_WIDTH = new ZoomDependentNumber( + List.of(new ZoomStop(13, 0.2f), new ZoomStop(MAX_ZOOM, 8)) + ); + private static final ZoomDependentNumber CIRCLE_STROKE = new ZoomDependentNumber( + List.of(new ZoomStop(15, 0.2f), new ZoomStop(MAX_ZOOM, 3)) + ); + private static final Class[] EDGES_TO_DISPLAY = new Class[] { + StreetEdge.class, + AreaEdge.class, + EscalatorEdge.class, + PathwayEdge.class, + ElevatorHopEdge.class, + TemporaryPartialStreetEdge.class, + TemporaryFreeEdge.class, + }; + private static final String EDGES_GROUP = "Edges"; + private static final String STOPS_GROUP = "Stops"; + private static final String VERTICES_GROUP = "Vertices"; + private static final String TRAVERSAL_PERMISSIONS_GROUP = "Traversal permissions"; + + static StyleSpec build( + VectorSourceLayer regularStops, + VectorSourceLayer areaStops, + VectorSourceLayer groupStops, + VectorSourceLayer edges, + VectorSourceLayer vertices + ) { + var vectorSources = Stream + .of(regularStops, edges, vertices) + .map(VectorSourceLayer::vectorSource); + var allSources = Stream + .concat(Stream.of(BACKGROUND_SOURCE), vectorSources) + .collect(Collectors.toSet()); + return new StyleSpec( + "OTP Debug Tiles", + allSources, + ListUtils.combine( + List.of(StyleBuilder.ofId("background").typeRaster().source(BACKGROUND_SOURCE).minZoom(0)), + traversalPermissions(edges), + edges(edges), + vertices(vertices), + stops(regularStops, areaStops, groupStops) + ) + ); + } + + private static List stops( + VectorSourceLayer regularStops, + VectorSourceLayer areaStops, + VectorSourceLayer groupStops + ) { + return List.of( + StyleBuilder + .ofId("area-stop") + .group(STOPS_GROUP) + .typeFill() + .vectorSourceLayer(areaStops) + .fillColor(BRIGHT_GREEN) + .fillOpacity(0.5f) + .fillOutlineColor(BLACK) + .minZoom(6) + .maxZoom(MAX_ZOOM), + StyleBuilder + .ofId("group-stop") + .group(STOPS_GROUP) + .typeFill() + .vectorSourceLayer(groupStops) + .fillColor(BRIGHT_GREEN) + .fillOpacity(0.5f) + .fillOutlineColor(BLACK) + .minZoom(6) + .maxZoom(MAX_ZOOM), + StyleBuilder + .ofId("regular-stop") + .group(STOPS_GROUP) + .typeCircle() + .vectorSourceLayer(regularStops) + .circleStroke( + BLACK, + new ZoomDependentNumber(List.of(new ZoomStop(11, 0.5f), new ZoomStop(MAX_ZOOM, 5))) + ) + .circleRadius( + new ZoomDependentNumber(List.of(new ZoomStop(11, 0.5f), new ZoomStop(MAX_ZOOM, 10))) + ) + .circleColor("#fcf9fa") + .minZoom(10) + .maxZoom(MAX_ZOOM) + ); + } + + private static List vertices(VectorSourceLayer vertices) { + return List.of( + StyleBuilder + .ofId("vertex") + .group(VERTICES_GROUP) + .typeCircle() + .vectorSourceLayer(vertices) + .circleStroke(BLACK, CIRCLE_STROKE) + .circleRadius( + new ZoomDependentNumber(List.of(new ZoomStop(15, 1), new ZoomStop(MAX_ZOOM, 7))) + ) + .circleColor(PURPLE) + .minZoom(15) + .maxZoom(MAX_ZOOM) + .intiallyHidden(), + StyleBuilder + .ofId("parking-vertex") + .group(VERTICES_GROUP) + .typeCircle() + .vectorSourceLayer(vertices) + .vertexFilter(VehicleParkingEntranceVertex.class) + .circleStroke(BLACK, CIRCLE_STROKE) + .circleRadius( + new ZoomDependentNumber(List.of(new ZoomStop(13, 1.4f), new ZoomStop(MAX_ZOOM, 10))) + ) + .circleColor(DARK_GREEN) + .minZoom(13) + .maxZoom(MAX_ZOOM) + .intiallyHidden() + ); + } + + private static List edges(VectorSourceLayer edges) { + return List.of( + StyleBuilder + .ofId("edge") + .group(EDGES_GROUP) + .typeLine() + .vectorSourceLayer(edges) + .lineColor(MAGENTA) + .edgeFilter(EDGES_TO_DISPLAY) + .lineWidth(LINE_WIDTH) + .lineOffset(LINE_OFFSET) + .minZoom(6) + .maxZoom(MAX_ZOOM) + .intiallyHidden(), + StyleBuilder + .ofId("edge-name") + .group(EDGES_GROUP) + .typeSymbol() + .lineText("name") + .vectorSourceLayer(edges) + .edgeFilter(EDGES_TO_DISPLAY) + .minZoom(17) + .maxZoom(MAX_ZOOM) + .intiallyHidden(), + StyleBuilder + .ofId("link") + .group(EDGES_GROUP) + .typeLine() + .vectorSourceLayer(edges) + .lineColor(BRIGHT_GREEN) + .edgeFilter( + StreetTransitStopLink.class, + StreetTransitEntranceLink.class, + BoardingLocationToStopLink.class, + StreetVehicleRentalLink.class, + StreetVehicleParkingLink.class, + StreetStationCentroidLink.class + ) + .lineWidth(LINE_WIDTH) + .lineOffset(LINE_OFFSET) + .minZoom(13) + .maxZoom(MAX_ZOOM) + .intiallyHidden() + ); + } + + private static List traversalPermissions(VectorSourceLayer edges) { + var permissionStyles = Arrays + .stream(StreetTraversalPermission.values()) + .map(p -> + StyleBuilder + .ofId(p.name()) + .vectorSourceLayer(edges) + .group(TRAVERSAL_PERMISSIONS_GROUP) + .typeLine() + .lineColor(permissionColor(p)) + .permissionsFilter(p) + .lineWidth(LINE_WIDTH) + .lineOffset(LINE_OFFSET) + .minZoom(6) + .maxZoom(MAX_ZOOM) + .intiallyHidden() + ) + .toList(); + var textStyle = StyleBuilder + .ofId("permission-text") + .vectorSourceLayer(edges) + .group(TRAVERSAL_PERMISSIONS_GROUP) + .typeSymbol() + .lineText("permission") + .textOffset(1) + .edgeFilter(EDGES_TO_DISPLAY) + .minZoom(17) + .maxZoom(MAX_ZOOM) + .intiallyHidden(); + return ListUtils.combine(permissionStyles, List.of(textStyle)); + } + + private static String permissionColor(StreetTraversalPermission p) { + return switch (p) { + case NONE -> "#000"; + case PEDESTRIAN -> "#2ba812"; + case BICYCLE, PEDESTRIAN_AND_BICYCLE -> "#10d3b6"; + case CAR -> "#f92e13"; + case BICYCLE_AND_CAR, PEDESTRIAN_AND_CAR -> "#e25f8f"; + case ALL -> "#adb2b0"; + }; + } +} 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 84% 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..93b7ea91e7c 100644 --- a/src/main/java/org/opentripplanner/apis/vectortiles/model/StyleBuilder.java +++ b/application/src/main/java/org/opentripplanner/apis/vectortiles/model/StyleBuilder.java @@ -11,6 +11,7 @@ import org.opentripplanner.apis.vectortiles.model.ZoomDependentNumber.ZoomStop; import org.opentripplanner.framework.collection.ListUtils; import org.opentripplanner.framework.json.ObjectMappers; +import org.opentripplanner.street.model.StreetTraversalPermission; import org.opentripplanner.street.model.edge.Edge; import org.opentripplanner.street.model.vertex.Vertex; @@ -26,6 +27,7 @@ public class StyleBuilder { private final Map props = new LinkedHashMap<>(); private final Map paint = new LinkedHashMap<>(); private final Map layout = new LinkedHashMap<>(); + private final Map metadata = new LinkedHashMap<>(); private final Map line = new LinkedHashMap<>(); private List filter = List.of(); @@ -48,6 +50,7 @@ public enum LayerType { private StyleBuilder(String id) { props.put("id", id); + metadata.put("group", "Other"); } public StyleBuilder minZoom(int i) { @@ -107,18 +110,28 @@ private StyleBuilder type(LayerType type) { return this; } + /** + * Puts the layer into an arbitrarily defined group in the layer selector. This allows you + * to switch the entire group on and off. + */ + public StyleBuilder group(String group) { + metadata.put("group", group); + return this; + } + public StyleBuilder lineText(String name) { - layout.put("symbol-placement", "line"); - layout.put("symbol-spacing", 500); + layout.put("symbol-placement", "line-center"); + layout.put("symbol-spacing", 1000); layout.put("text-field", "{%s}".formatted(name)); layout.put("text-font", List.of("KlokanTech Noto Sans Regular")); layout.put( "text-size", - new ZoomDependentNumber(14, List.of(new ZoomStop(14, 12), new ZoomStop(20, 14))).toJson() + new ZoomDependentNumber(List.of(new ZoomStop(10, 6), new ZoomStop(24, 12))).toJson() ); - layout.put("text-max-width", 5); + layout.put("text-max-width", 100); layout.put("text-keep-upright", true); layout.put("text-rotation-alignment", "map"); + layout.put("text-overlap", "never"); paint.put("text-color", "#000"); paint.put("text-halo-color", "#fff"); paint.put("text-halo-blur", 4); @@ -126,6 +139,11 @@ public StyleBuilder lineText(String name) { return this; } + public StyleBuilder textOffset(float offset) { + layout.put("text-offset", List.of(0, offset)); + return this; + } + public StyleBuilder circleColor(String color) { paint.put("circle-color", validateColor(color)); return this; @@ -165,6 +183,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; @@ -196,6 +219,14 @@ public final StyleBuilder edgeFilter(Class... classToFilter) { return filterClasses(classToFilter); } + /** + * Filter the entities by their "permission" property. + */ + public final StyleBuilder permissionsFilter(StreetTraversalPermission p) { + filter = List.of("==", "permission", p.name()); + return this; + } + /** * Only apply the style to the given vertices. */ @@ -220,6 +251,7 @@ public JsonNode toJson() { if (!line.isEmpty()) { copy.put("line", line); } + copy.put("metadata", metadata); return OBJECT_MAPPER.valueToTree(copy); } 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 62% 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 index d83c4b63495..4d1d83ee8a9 100644 --- a/src/main/java/org/opentripplanner/apis/vectortiles/model/ZoomDependentNumber.java +++ b/application/src/main/java/org/opentripplanner/apis/vectortiles/model/ZoomDependentNumber.java @@ -2,21 +2,26 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; +import java.util.stream.Stream; +import org.opentripplanner.framework.collection.ListUtils; import org.opentripplanner.framework.json.ObjectMappers; /** * A style parameter that allows you to specify a number that changes dependent on the zoom level. */ -public record ZoomDependentNumber(float base, List stops) { +public record ZoomDependentNumber(List stops) { private static final ObjectMapper OBJECT_MAPPER = ObjectMappers.ignoringExtraFields(); public JsonNode toJson() { - var props = new LinkedHashMap<>(); - props.put("base", base); - var vals = stops.stream().map(ZoomStop::toList).toList(); - props.put("stops", vals); - return OBJECT_MAPPER.valueToTree(props); + var interpolation = new ArrayList<>(); + interpolation.add("interpolate"); + interpolation.add(List.of("linear")); + interpolation.add(List.of("zoom")); + stops.forEach(s -> interpolation.addAll(s.toList())); + + return OBJECT_MAPPER.valueToTree(interpolation); } /** 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 99% rename from src/main/java/org/opentripplanner/framework/application/OTPFeature.java rename to application/src/main/java/org/opentripplanner/framework/application/OTPFeature.java index 29c2a452448..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; @@ -199,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 63f1df1aad5..27473dd1383 100644 --- a/src/main/java/org/opentripplanner/framework/collection/CollectionUtils.java +++ b/application/src/main/java/org/opentripplanner/framework/collection/CollectionUtils.java @@ -37,8 +37,9 @@ public static String toString(@Nullable Collection c, String nullText) { /** * A null-safe version of isEmpty() for a collection. *

- * The main strategy 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`. + * 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. *

@@ -50,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 100% rename from src/main/java/org/opentripplanner/framework/collection/ListUtils.java rename to application/src/main/java/org/opentripplanner/framework/collection/ListUtils.java 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 88% 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..bd629da9468 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; @@ -24,7 +23,7 @@ import org.opentripplanner.service.worldenvelope.WorldEnvelopeRepository; import org.opentripplanner.standalone.config.BuildConfig; import org.opentripplanner.street.model.StreetLimitationParameters; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -38,19 +37,19 @@ public class GraphBuilder implements Runnable { private final List graphBuilderModules = new ArrayList<>(); private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final DataImportIssueStore issueStore; private boolean hasTransitData = false; @Inject public GraphBuilder( - @Nonnull Graph baseGraph, - @Nonnull TransitModel transitModel, - @Nonnull DataImportIssueStore issueStore + Graph baseGraph, + TimetableRepository timetableRepository, + DataImportIssueStore issueStore ) { this.graph = baseGraph; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.issueStore = issueStore; } @@ -62,7 +61,7 @@ public static GraphBuilder create( BuildConfig config, GraphBuilderDataSources dataSources, Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, WorldEnvelopeRepository worldEnvelopeRepository, @Nullable EmissionsDataModel emissionsDataModel, @Nullable StopConsolidationRepository stopConsolidationRepository, @@ -75,18 +74,18 @@ public static GraphBuilder create( boolean hasNetex = dataSources.has(NETEX); boolean hasTransitData = hasGtfs || hasNetex; - transitModel.initTimeZone(config.transitModelTimeZone); + timetableRepository.initTimeZone(config.transitModelTimeZone); var builder = DaggerGraphBuilderFactory .builder() .config(config) .graph(graph) - .transitModel(transitModel) + .timetableRepository(timetableRepository) .worldEnvelopeRepository(worldEnvelopeRepository) .stopConsolidationRepository(stopConsolidationRepository) .streetLimitationParameters(streetLimitationParameters) .dataSources(dataSources) - .timeZoneId(transitModel.getTimeZone()); + .timeZoneId(timetableRepository.getTimeZone()); if (OTPFeature.Co2Emissions.isOn()) { builder.emissionsDataModel(emissionsDataModel); @@ -119,7 +118,7 @@ public static GraphBuilder create( graphBuilder.addModule(factory.tripPatternNamer()); } - if (hasTransitData && transitModel.getAgencyTimeZones().size() > 1) { + if (hasTransitData && timetableRepository.getAgencyTimeZones().size() > 1) { graphBuilder.addModule(factory.timeZoneAdjusterModule()); } @@ -167,6 +166,8 @@ public static GraphBuilder create( graphBuilder.addModule(factory.emissionsModule()); } + graphBuilder.addModuleOptional(factory.routeToCentroidStationIdValidator()); + if (config.dataImportReport) { graphBuilder.addModule(factory.dataImportIssueReporter()); } @@ -197,7 +198,7 @@ public void run() { new DataImportIssueSummary(issueStore.listIssues()).logSummary(); // Log before we validate, this way we have more information if the validation fails - logGraphBuilderCompleteStatus(startTime, graph, transitModel); + logGraphBuilderCompleteStatus(startTime, graph, timetableRepository); validate(); } @@ -226,7 +227,7 @@ public DataImportIssueSummary issueSummary() { * configuration, for example, then this function will throw a {@link OtpAppException}. */ private void validate() { - if (hasTransitData() && !transitModel.hasTransit()) { + if (hasTransitData() && !timetableRepository.hasTransit()) { throw new OtpAppException( "The provided transit data have no trips within the configured transit service period. " + "There is something wrong with your data - see the log above. Another possibility is that the " + @@ -238,14 +239,14 @@ private void validate() { private static void logGraphBuilderCompleteStatus( long startTime, Graph graph, - TransitModel transitModel + TimetableRepository timetableRepository ) { long endTime = System.currentTimeMillis(); String time = DurationUtils.durationToStr(Duration.ofMillis(endTime - startTime)); var f = new OtpNumberFormat(); - var nStops = f.formatNumber(transitModel.getStopModel().stopIndexSize()); - var nPatterns = f.formatNumber(transitModel.getAllTripPatterns().size()); - var nTransfers = f.formatNumber(transitModel.getTransferService().listAll().size()); + var nStops = f.formatNumber(timetableRepository.getStopModel().stopIndexSize()); + var nPatterns = f.formatNumber(timetableRepository.getAllTripPatterns().size()); + var nTransfers = f.formatNumber(timetableRepository.getTransferService().listAll().size()); var nVertices = f.formatNumber(graph.countVertices()); var nEdges = f.formatNumber(graph.countEdges()); 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 96% rename from src/main/java/org/opentripplanner/graph_builder/GraphStats.java rename to application/src/main/java/org/opentripplanner/graph_builder/GraphStats.java index 718622a142d..199146667ed 100644 --- a/src/main/java/org/opentripplanner/graph_builder/GraphStats.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/GraphStats.java @@ -27,7 +27,7 @@ import org.opentripplanner.street.model.vertex.TransitStopVertex; import org.opentripplanner.street.model.vertex.Vertex; import org.opentripplanner.transit.model.network.TripPattern; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -60,7 +60,7 @@ public class GraphStats { private Graph graph; - private TransitModel transitModel; + private TimetableRepository timetableRepository; private CsvWriter writer; @@ -97,7 +97,7 @@ private void run() { File graphFile = new File(graphPath); SerializedGraphObject serializedGraphObject = SerializedGraphObject.load(graphFile); graph = serializedGraphObject.graph; - transitModel = serializedGraphObject.transitModel; + timetableRepository = serializedGraphObject.timetableRepository; /* open output stream (same for all commands) */ if (outPath != null) { @@ -220,7 +220,7 @@ public void run() { "empiricalDistTrips", } ); - Collection patterns = transitModel.getAllTripPatterns(); + Collection patterns = timetableRepository.getAllTripPatterns(); Multiset counts = TreeMultiset.create(); int nPatterns = patterns.size(); LOG.info("total number of patterns is: {}", nPatterns); 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 92% 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 index e4e67a0f3c1..0a551cff1c9 100644 --- a/src/main/java/org/opentripplanner/graph_builder/model/GraphBuilderModule.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/model/GraphBuilderModule.java @@ -4,7 +4,7 @@ public interface GraphBuilderModule { /** * Process whatever inputs were supplied to this module and update the model objects(graph, - * transitModel and issueStore). + * timetableRepository and issueStore). */ void buildGraph(); diff --git a/src/main/java/org/opentripplanner/graph_builder/module/AddTransitModelEntitiesToGraph.java b/application/src/main/java/org/opentripplanner/graph_builder/module/AddTransitEntitiesToGraph.java similarity index 84% rename from src/main/java/org/opentripplanner/graph_builder/module/AddTransitModelEntitiesToGraph.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/AddTransitEntitiesToGraph.java index a53730b104c..7aa5d65bef1 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/AddTransitModelEntitiesToGraph.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/AddTransitEntitiesToGraph.java @@ -39,15 +39,16 @@ 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; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class AddTransitModelEntitiesToGraph { +public class AddTransitEntitiesToGraph { - private static final Logger LOG = LoggerFactory.getLogger(AddTransitModelEntitiesToGraph.class); + private static final Logger LOG = LoggerFactory.getLogger(AddTransitEntitiesToGraph.class); private final OtpTransitService otpTransitService; @@ -61,7 +62,7 @@ public class AddTransitModelEntitiesToGraph { * @param subwayAccessTime a positive integer for the extra time to access a subway platform, if * negative the default value of zero is used. */ - private AddTransitModelEntitiesToGraph( + private AddTransitEntitiesToGraph( OtpTransitService otpTransitService, int subwayAccessTime, Graph graph @@ -75,43 +76,44 @@ public static void addToGraph( OtpTransitService otpTransitService, int subwayAccessTime, Graph graph, - TransitModel transitModel + TimetableRepository timetableRepository ) { - new AddTransitModelEntitiesToGraph(otpTransitService, subwayAccessTime, graph) - .applyToGraph(transitModel); + new AddTransitEntitiesToGraph(otpTransitService, subwayAccessTime, graph) + .applyToGraph(timetableRepository); } - private void applyToGraph(TransitModel transitModel) { - transitModel.mergeStopModels(otpTransitService.stopModel()); + private void applyToGraph(TimetableRepository timetableRepository) { + timetableRepository.mergeStopModels(otpTransitService.stopModel()); - addStopsToGraphAndGenerateStopVertexes(transitModel); + addStopsToGraphAndGenerateStopVertexes(timetableRepository); addEntrancesToGraph(); + addStationCentroidsToGraph(); addPathwayNodesToGraph(); addBoardingAreasToGraph(); // Although pathways are loaded from GTFS they are street data, so we will put them in the // street graph. createPathwayEdgesAndAddThemToGraph(); - addFeedInfoToGraph(transitModel); - addAgenciesToGraph(transitModel); - addServicesToTransitModel(transitModel); - addTripPatternsToTransitModel(transitModel); + addFeedInfoToGraph(timetableRepository); + addAgenciesToGraph(timetableRepository); + addServicesToTimetableRepository(timetableRepository); + addTripPatternsToTimetableRepository(timetableRepository); /* Interpret the transfers explicitly defined in transfers.txt. */ - addTransfersToGraph(transitModel); + addTransfersToGraph(timetableRepository); if (OTPFeature.FlexRouting.isOn()) { - addFlexTripsToGraph(transitModel); + addFlexTripsToGraph(timetableRepository); } } - private void addStopsToGraphAndGenerateStopVertexes(TransitModel transitModel) { + private void addStopsToGraphAndGenerateStopVertexes(TimetableRepository timetableRepository) { // Compute the set of modes for each stop based on all the TripPatterns it is part of Map> stopModeMap = new HashMap<>(); for (TripPattern pattern : otpTransitService.getTripPatterns()) { TransitMode mode = pattern.getMode(); - transitModel.addTransitMode(mode); + timetableRepository.addTransitMode(mode); for (var stop : pattern.getStops()) { Set set = stopModeMap.computeIfAbsent(stop, s -> new HashSet<>()); set.add(mode); @@ -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); @@ -325,45 +335,47 @@ private StopLevel getStopLevel(StationElementVertex vertex) { : new StopLevel(fromStation.getName(), null); } - private void addFeedInfoToGraph(TransitModel transitModel) { + private void addFeedInfoToGraph(TimetableRepository timetableRepository) { for (FeedInfo info : otpTransitService.getAllFeedInfos()) { - transitModel.addFeedInfo(info); + timetableRepository.addFeedInfo(info); } } - private void addAgenciesToGraph(TransitModel transitModel) { + private void addAgenciesToGraph(TimetableRepository timetableRepository) { for (Agency agency : otpTransitService.getAllAgencies()) { - transitModel.addAgency(agency); + timetableRepository.addAgency(agency); } } - private void addTransfersToGraph(TransitModel transitModel) { - transitModel.getTransferService().addAll(otpTransitService.getAllTransfers()); + private void addTransfersToGraph(TimetableRepository timetableRepository) { + timetableRepository.getTransferService().addAll(otpTransitService.getAllTransfers()); } - private void addServicesToTransitModel(TransitModel transitModel) { + private void addServicesToTimetableRepository(TimetableRepository timetableRepository) { /* Assign 0-based numeric codes to all GTFS service IDs. */ for (FeedScopedId serviceId : otpTransitService.getAllServiceIds()) { - transitModel.getServiceCodes().put(serviceId, transitModel.getServiceCodes().size()); + timetableRepository + .getServiceCodes() + .put(serviceId, timetableRepository.getServiceCodes().size()); } } - private void addTripPatternsToTransitModel(TransitModel transitModel) { + private void addTripPatternsToTimetableRepository(TimetableRepository timetableRepository) { Collection tripPatterns = otpTransitService.getTripPatterns(); /* Loop over all new TripPatterns setting the service codes. */ for (TripPattern tripPattern : tripPatterns) { // TODO this could be more elegant - tripPattern.getScheduledTimetable().setServiceCodes(transitModel.getServiceCodes()); + tripPattern.getScheduledTimetable().setServiceCodes(timetableRepository.getServiceCodes()); // Store the tripPattern in the Graph so it will be serialized and usable in routing. - transitModel.addTripPattern(tripPattern.getId(), tripPattern); + timetableRepository.addTripPattern(tripPattern.getId(), tripPattern); } } - private void addFlexTripsToGraph(TransitModel transitModel) { + private void addFlexTripsToGraph(TimetableRepository timetableRepository) { for (FlexTrip flexTrip : otpTransitService.getAllFlexTrips()) { - transitModel.addFlexTrip(flexTrip.getId(), flexTrip); + timetableRepository.addFlexTrip(flexTrip.getId(), flexTrip); } } 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 88% 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..a1a0796c66a 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/DirectTransferGenerator.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/DirectTransferGenerator.java @@ -18,16 +18,14 @@ import org.opentripplanner.graph_builder.module.nearbystops.StreetNearbyStopFinder; import org.opentripplanner.model.PathTransfer; import org.opentripplanner.routing.api.request.RouteRequest; -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.edge.Edge; import org.opentripplanner.street.model.vertex.TransitStopVertex; -import org.opentripplanner.street.model.vertex.Vertex; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.StopLocation; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,18 +45,18 @@ public class DirectTransferGenerator implements GraphBuilderModule { private final List transferRequests; private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final DataImportIssueStore issueStore; public DirectTransferGenerator( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore, Duration radiusByDuration, List transferRequests ) { this.graph = graph; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.issueStore = issueStore; this.radiusByDuration = radiusByDuration; this.transferRequests = transferRequests; @@ -67,7 +65,7 @@ public DirectTransferGenerator( @Override public void buildGraph() { /* Initialize transit model index which is needed by the nearby stop finder. */ - transitModel.index(); + timetableRepository.index(); /* The linker will use streets if they are available, or straight-line distance otherwise. */ NearbyStopFinder nearbyStopFinder = createNearbyStopFinder(); @@ -104,8 +102,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 +123,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(), @@ -168,7 +164,7 @@ public void buildGraph() { progress.step(m -> LOG.info(m)); }); - transitModel.addAllTransfersByStops(transfersByStop); + timetableRepository.addAllTransfersByStops(transfersByStop); LOG.info(progress.completeMessage()); LOG.info( @@ -184,7 +180,7 @@ public void buildGraph() { * enabled. */ private NearbyStopFinder createNearbyStopFinder() { - var transitService = new DefaultTransitService(transitModel); + var transitService = new DefaultTransitService(timetableRepository); NearbyStopFinder finder; if (!graph.hasStreets) { LOG.info( @@ -203,15 +199,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 95% 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 index 3bb9c3745a8..ba847b96eb9 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModule.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModule.java @@ -27,7 +27,7 @@ import org.opentripplanner.street.model.vertex.VertexFactory; import org.opentripplanner.street.search.TraverseMode; import org.opentripplanner.street.search.TraverseModeSet; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,15 +55,15 @@ public class OsmBoardingLocationsModule implements GraphBuilderModule { private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final VertexFactory vertexFactory; private VertexLinker linker; @Inject - public OsmBoardingLocationsModule(Graph graph, TransitModel transitModel) { + public OsmBoardingLocationsModule(Graph graph, TimetableRepository timetableRepository) { this.graph = graph; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.vertexFactory = new VertexFactory(graph); } @@ -71,7 +71,7 @@ public OsmBoardingLocationsModule(Graph graph, TransitModel transitModel) { public void buildGraph() { LOG.info("Improving boarding locations by checking OSM entities..."); - StreetIndex streetIndex = graph.getStreetIndexSafe(transitModel.getStopModel()); + StreetIndex streetIndex = graph.getStreetIndexSafe(timetableRepository.getStopModel()); this.linker = streetIndex.getVertexLinker(); int successes = 0; 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..2b4a38da58a --- /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.TimetableRepository; + +public class RouteToCentroidStationIdsValidator implements GraphBuilderModule { + + private final DataImportIssueStore issueStore; + private final Collection transitRouteToStationCentroid; + private final TimetableRepository timetableRepository; + + public RouteToCentroidStationIdsValidator( + DataImportIssueStore issueStore, + Collection transitRouteToStationCentroid, + TimetableRepository timetableRepository + ) { + this.issueStore = issueStore; + this.transitRouteToStationCentroid = transitRouteToStationCentroid; + this.timetableRepository = timetableRepository; + } + + private void validate() { + var stationIds = timetableRepository + .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 89% 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 0930f5a4576..a0f37c392ce 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,21 +15,24 @@ 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.network.CarAccess; import org.opentripplanner.transit.model.site.GroupStop; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.StopLocation; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,31 +49,32 @@ public class StreetLinkerModule implements GraphBuilderModule { private static final TraverseModeSet CAR_ONLY = new TraverseModeSet(TraverseMode.CAR); private static final TraverseModeSet WALK_ONLY = new TraverseModeSet(TraverseMode.WALK); private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final DataImportIssueStore issueStore; private final Boolean addExtraEdgesToAreas; public StreetLinkerModule( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore, boolean addExtraEdgesToAreas ) { this.graph = graph; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.issueStore = issueStore; this.addExtraEdgesToAreas = addExtraEdgesToAreas; } @Override public void buildGraph() { - transitModel.index(); - graph.index(transitModel.getStopModel()); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); graph.getLinker().setAddExtraEdgesToAreas(this.addExtraEdgesToAreas); if (graph.hasStreets) { - linkTransitStops(graph, transitModel); + linkTransitStops(graph, timetableRepository); linkTransitEntrances(graph); + linkStationCentroids(graph); linkVehicleParks(graph, issueStore); } @@ -78,7 +82,7 @@ public void buildGraph() { graph.calculateConvexHull(); } - public void linkTransitStops(Graph graph, TransitModel transitModel) { + public void linkTransitStops(Graph graph, TimetableRepository timetableRepository) { List vertices = graph.getVerticesOfType(TransitStopVertex.class); var progress = ProgressTracker.track("Linking transit stops to graph", 5000, vertices.size()); LOG.info(progress.startMessage()); @@ -166,7 +170,6 @@ private void linkToDriveableEdge(TransitStopVertex tStop) { ); } - @Nonnull private static List createStopLinkEdges( TransitStopVertex vertex, StreetVertex streetVertex @@ -248,6 +251,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 72% 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 7168066afe3..3bd33f08a52 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/TimeZoneAdjusterModule.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/TimeZoneAdjusterModule.java @@ -8,32 +8,32 @@ import java.util.Map; import org.opentripplanner.graph_builder.model.GraphBuilderModule; import org.opentripplanner.transit.model.network.TripPattern; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * Adjust all scheduled times to match the transit model timezone. */ public class TimeZoneAdjusterModule implements GraphBuilderModule { - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; @Inject - public TimeZoneAdjusterModule(TransitModel transitModel) { - this.transitModel = transitModel; + public TimeZoneAdjusterModule(TimetableRepository timetableRepository) { + this.timetableRepository = timetableRepository; } @Override public void buildGraph() { // TODO: We assume that all time zones follow the same DST rules. In reality we need to split up // the services for each DST transition - final Instant serviceStart = transitModel.getTransitServiceStarts().toInstant(); + final Instant serviceStart = timetableRepository.getTransitServiceStarts().toInstant(); var graphOffset = Duration.ofSeconds( - transitModel.getTimeZone().getRules().getOffset(serviceStart).getTotalSeconds() + timetableRepository.getTimeZone().getRules().getOffset(serviceStart).getTotalSeconds() ); Map agencyShift = new HashMap<>(); - transitModel + timetableRepository .getAllTripPatterns() .forEach(pattern -> { var timeShift = agencyShift.computeIfAbsent( @@ -53,8 +53,8 @@ public void buildGraph() { ) .build(); // replace the original pattern with the updated pattern in the transit model - transitModel.addTripPattern(updatedPattern.getId(), updatedPattern); + timetableRepository.addTripPattern(updatedPattern.getId(), updatedPattern); }); - transitModel.index(); + timetableRepository.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 96% 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 index 744260ba784..238ddc5dc67 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/TripPatternNamer.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/TripPatternNamer.java @@ -12,24 +12,24 @@ import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.site.StopLocation; import org.opentripplanner.transit.model.timetable.TripTimes; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class TripPatternNamer implements GraphBuilderModule { private static final Logger LOG = LoggerFactory.getLogger(TripPatternNamer.class); - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; @Inject - public TripPatternNamer(TransitModel transitModel) { - this.transitModel = transitModel; + public TripPatternNamer(TimetableRepository timetableRepository) { + this.timetableRepository = timetableRepository; } @Override public void buildGraph() { /* Generate unique human-readable names for all the TableTripPatterns. */ - generateUniqueNames(transitModel.getAllTripPatterns()); + generateUniqueNames(timetableRepository.getAllTripPatterns()); } /** 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 92% 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..d0d359cea3e 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; @@ -32,7 +33,7 @@ import org.opentripplanner.service.worldenvelope.WorldEnvelopeRepository; import org.opentripplanner.standalone.config.BuildConfig; import org.opentripplanner.street.model.StreetLimitationParameters; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; @Singleton @Component(modules = { GraphBuilderModules.class }) @@ -58,6 +59,9 @@ public interface GraphBuilderFactory { CalculateWorldEnvelopeModule calculateWorldEnvelopeModule(); StreetLimitationParameters streetLimitationParameters(); + @Nullable + RouteToCentroidStationIdsValidator routeToCentroidStationIdValidator(); + @Nullable StopConsolidationModule stopConsolidationModule(); @@ -73,7 +77,7 @@ interface Builder { Builder graph(Graph graph); @BindsInstance - Builder transitModel(TransitModel transitModel); + Builder timetableRepository(TimetableRepository timetableRepository); @BindsInstance Builder worldEnvelopeRepository(WorldEnvelopeRepository worldEnvelopeRepository); 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 89% 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..080d69c571e 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,12 +40,12 @@ 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; import org.opentripplanner.street.model.StreetLimitationParameters; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * Configure all modules which is not simple enough to be injected. @@ -54,7 +55,7 @@ public class GraphBuilderModules { @Provides @Singleton - static OsmModule provideOpenStreetMapModule( + static OsmModule provideOsmModule( GraphBuilderDataSources dataSources, BuildConfig config, Graph graph, @@ -94,7 +95,7 @@ static GtfsModule provideGtfsModule( GraphBuilderDataSources dataSources, BuildConfig config, Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore ) { List gtfsBundles = new ArrayList<>(); @@ -107,7 +108,7 @@ static GtfsModule provideGtfsModule( } return new GtfsModule( gtfsBundles, - transitModel, + timetableRepository, graph, issueStore, config.getTransitServicePeriod(), @@ -137,13 +138,13 @@ static NetexModule provideNetexModule( GraphBuilderDataSources dataSources, BuildConfig config, Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore ) { return new NetexConfigure(config) .createNetexModule( dataSources.getNetexConfiguredDatasource(), - transitModel, + timetableRepository, graph, issueStore ); @@ -154,10 +155,10 @@ static NetexModule provideNetexModule( static StreetLinkerModule provideStreetLinkerModule( BuildConfig config, Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore ) { - return new StreetLinkerModule(graph, transitModel, issueStore, config.areaVisibility); + return new StreetLinkerModule(graph, timetableRepository, issueStore, config.areaVisibility); } @Provides @@ -165,14 +166,14 @@ static StreetLinkerModule provideStreetLinkerModule( static PruneIslands providePruneIslands( BuildConfig config, Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore ) { PruneIslands pruneIslands = new PruneIslands( graph, - transitModel, + timetableRepository, issueStore, - new StreetLinkerModule(graph, transitModel, issueStore, config.areaVisibility) + new StreetLinkerModule(graph, timetableRepository, issueStore, config.areaVisibility) ); pruneIslands.setPruningThresholdIslandWithoutStops( config.islandPruning.pruningThresholdIslandWithoutStops @@ -228,12 +229,12 @@ static List provideElevationModules( static DirectTransferGenerator provideDirectTransferGenerator( BuildConfig config, Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore ) { return new DirectTransferGenerator( graph, - transitModel, + timetableRepository, issueStore, config.maxTransferDuration, config.transferRequests @@ -245,12 +246,12 @@ static DirectTransferGenerator provideDirectTransferGenerator( static DirectTransferAnalyzer provideDirectTransferAnalyzer( BuildConfig config, Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore ) { return new DirectTransferAnalyzer( graph, - transitModel, + timetableRepository, issueStore, config.maxTransferDuration.toSeconds() * WalkPreferences.DEFAULT.speed() ); @@ -292,16 +293,30 @@ static DataImportIssueSummary providesDataImportIssueSummary(DataImportIssueStor @Singleton @Nullable static StopConsolidationModule providesStopConsolidationModule( - TransitModel transitModel, + TimetableRepository timetableRepository, @Nullable StopConsolidationRepository repo, GraphBuilderDataSources dataSources ) { return dataSources .stopConsolidation() - .map(ds -> StopConsolidationModule.of(transitModel, repo, ds)) + .map(ds -> StopConsolidationModule.of(timetableRepository, repo, ds)) .orElse(null); } + @Provides + @Singleton + @Nullable + static RouteToCentroidStationIdsValidator routeToCentroidStationIdValidator( + DataImportIssueStore issueStore, + BuildConfig config, + TimetableRepository timetableRepository + ) { + var ids = config.transitRouteToStationCentroid(); + return ids.isEmpty() + ? null + : new RouteToCentroidStationIdsValidator(issueStore, ids, timetableRepository); + } + /* 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 89% 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 index adcfe525414..151470e0c11 100644 --- 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 @@ -9,7 +9,7 @@ import org.opentripplanner.service.worldenvelope.model.WorldEnvelope; import org.opentripplanner.street.model.vertex.Vertex; import org.opentripplanner.transit.model.site.StopLocation; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,24 +28,24 @@ public class CalculateWorldEnvelopeModule implements GraphBuilderModule { private static final int LOG_EVERY_N_COORDINATE = 1_000_000; private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final WorldEnvelopeRepository worldEnvelopeRepository; @Inject public CalculateWorldEnvelopeModule( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, WorldEnvelopeRepository worldEnvelopeRepository ) { this.graph = graph; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.worldEnvelopeRepository = worldEnvelopeRepository; } @Override public void buildGraph() { var vertices = graph.getVertices(); - var stops = transitModel.getStopModel().listStopLocations(); + var stops = timetableRepository.getStopModel().listStopLocations(); WorldEnvelope envelope = build(vertices, stops); worldEnvelopeRepository.saveEnvelope(envelope); } 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 97% 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 index 26349c0d803..6bb2bc83719 100644 --- 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 @@ -32,7 +32,7 @@ import org.opentripplanner.street.search.TraverseMode; import org.opentripplanner.street.search.request.StreetSearchRequest; import org.opentripplanner.street.search.state.State; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -48,7 +48,7 @@ public class PruneIslands implements GraphBuilderModule { private static final Logger LOG = LoggerFactory.getLogger(PruneIslands.class); private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final DataImportIssueStore issueStore; private final StreetLinkerModule streetLinkerModule; private int pruningThresholdWithoutStops; @@ -60,12 +60,12 @@ public class PruneIslands implements GraphBuilderModule { public PruneIslands( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore, StreetLinkerModule streetLinkerModule ) { this.graph = graph; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.issueStore = issueStore; this.streetLinkerModule = streetLinkerModule; } @@ -81,8 +81,8 @@ public void buildGraph() { adaptivePruningDistance ); - this.vertexLinker = graph.getLinkerSafe(transitModel.getStopModel()); - this.streetIndex = graph.getStreetIndexSafe(transitModel.getStopModel()); + this.vertexLinker = graph.getLinkerSafe(timetableRepository.getStopModel()); + this.streetIndex = graph.getStreetIndexSafe(timetableRepository.getStopModel()); pruneIslands(TraverseMode.BICYCLE); pruneIslands(TraverseMode.WALK); @@ -91,7 +91,7 @@ public void buildGraph() { // reconnect stops that got disconnected if (streetLinkerModule != null) { LOG.info("Reconnecting stops"); - streetLinkerModule.linkTransitStops(graph, transitModel); + streetLinkerModule.linkTransitStops(graph, timetableRepository); int isolated = 0; for (TransitStopVertex tStop : graph.getVerticesOfType(TransitStopVertex.class)) { if (tStop.getDegreeOut() + tStop.getDegreeIn() == 0) { 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 100% rename from src/main/java/org/opentripplanner/gtfs/GenerateTripPatternsOperation.java rename to application/src/main/java/org/opentripplanner/gtfs/GenerateTripPatternsOperation.java 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 93% rename from src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java rename to application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java index 2f7feb5993e..59acabee819 100644 --- a/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java +++ b/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java @@ -35,7 +35,7 @@ import org.opentripplanner.framework.application.OTPFeature; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.graph_builder.model.GraphBuilderModule; -import org.opentripplanner.graph_builder.module.AddTransitModelEntitiesToGraph; +import org.opentripplanner.graph_builder.module.AddTransitEntitiesToGraph; import org.opentripplanner.graph_builder.module.GtfsFeedId; import org.opentripplanner.graph_builder.module.ValidateAndInterpolateStopTimesForEachTrip; import org.opentripplanner.graph_builder.module.geometry.GeometryProcessor; @@ -51,7 +51,7 @@ import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.standalone.config.BuildConfig; import org.opentripplanner.transit.model.framework.FeedScopedId; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -77,21 +77,21 @@ public class GtfsModule implements GraphBuilderModule { private final List gtfsBundles; private final FareServiceFactory fareServiceFactory; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final Graph graph; private final DataImportIssueStore issueStore; private int nextAgencyId = 1; // used for generating agency IDs to resolve ID conflicts public GtfsModule( List bundles, - TransitModel transitModel, + TimetableRepository timetableRepository, Graph graph, DataImportIssueStore issueStore, ServiceDateInterval transitPeriodLimit, FareServiceFactory fareServiceFactory ) { this.gtfsBundles = bundles; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.graph = graph; this.issueStore = issueStore; this.transitPeriodLimit = transitPeriodLimit; @@ -100,13 +100,13 @@ public GtfsModule( public GtfsModule( List bundles, - TransitModel transitModel, + TimetableRepository timetableRepository, Graph graph, ServiceDateInterval transitPeriodLimit ) { this( bundles, - transitModel, + timetableRepository, graph, DataImportIssueStore.NOOP, transitPeriodLimit, @@ -132,7 +132,7 @@ public void buildGraph() { feedIdsEncountered.put(feedId, gtfsBundle); GTFSToOtpTransitServiceMapper mapper = new GTFSToOtpTransitServiceMapper( - new OtpTransitServiceBuilder(transitModel.getStopModel(), issueStore), + new OtpTransitServiceBuilder(timetableRepository.getStopModel(), issueStore), feedId, issueStore, gtfsBundle.discardMinTransferTimes(), @@ -170,7 +170,7 @@ public void buildGraph() { // NB! The calls below have side effects - the builder state is updated! createTripPatterns( graph, - transitModel, + timetableRepository, builder, calendarServiceData.getServiceIds(), geometryProcessor, @@ -182,11 +182,11 @@ public void buildGraph() { // if this or previously processed gtfs bundle has transit that has not been filtered out hasTransit = hasTransit || otpTransitService.hasActiveTransit(); - addTransitModelToGraph(graph, transitModel, gtfsBundle, otpTransitService); + addTimetableRepositoryToGraph(graph, timetableRepository, gtfsBundle, otpTransitService); if (gtfsBundle.blockBasedInterlining()) { new InterlineProcessor( - transitModel.getTransferService(), + timetableRepository.getTransferService(), builder.getStaySeatedNotAllowed(), gtfsBundle.maxInterlineDistance(), issueStore, @@ -206,9 +206,9 @@ public void buildGraph() { gtfsBundles.forEach(GtfsBundle::close); } - transitModel.validateTimeZones(); + timetableRepository.validateTimeZones(); - transitModel.updateCalendarServiceData(hasTransit, calendarServiceData, issueStore); + timetableRepository.updateCalendarServiceData(hasTransit, calendarServiceData, issueStore); } /** @@ -268,7 +268,7 @@ private void validateAndInterpolateStopTimesForEachTrip( */ private void createTripPatterns( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, OtpTransitServiceBuilder builder, Set calServiceIds, GeometryProcessor geometryProcessor, @@ -282,25 +282,25 @@ private void createTripPatterns( geometryProcessor ); buildTPOp.run(); - transitModel.setHasFrequencyService( - transitModel.hasFrequencyService() || buildTPOp.hasFrequencyBasedTrips() + timetableRepository.setHasFrequencyService( + timetableRepository.hasFrequencyService() || buildTPOp.hasFrequencyBasedTrips() ); - transitModel.setHasScheduledService( - transitModel.hasScheduledService() || buildTPOp.hasScheduledTrips() + timetableRepository.setHasScheduledService( + timetableRepository.hasScheduledService() || buildTPOp.hasScheduledTrips() ); } - private void addTransitModelToGraph( + private void addTimetableRepositoryToGraph( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, GtfsBundle gtfsBundle, OtpTransitService otpTransitService ) { - AddTransitModelEntitiesToGraph.addToGraph( + AddTransitEntitiesToGraph.addToGraph( otpTransitService, gtfsBundle.subwayAccessTime, graph, - transitModel + timetableRepository ); } 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/CarAccessMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/CarAccessMapper.java similarity index 100% rename from src/main/java/org/opentripplanner/gtfs/mapping/CarAccessMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/CarAccessMapper.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 90% rename from src/main/java/org/opentripplanner/gtfs/mapping/TripMapper.java rename to application/src/main/java/org/opentripplanner/gtfs/mapping/TripMapper.java index e561de0a177..4e805d6d1df 100644 --- a/src/main/java/org/opentripplanner/gtfs/mapping/TripMapper.java +++ b/application/src/main/java/org/opentripplanner/gtfs/mapping/TripMapper.java @@ -82,8 +82,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 100% rename from src/main/java/org/opentripplanner/inspector/vector/LayerParameters.java rename to application/src/main/java/org/opentripplanner/inspector/vector/LayerParameters.java 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 100% rename from src/main/java/org/opentripplanner/model/Timetable.java rename to application/src/main/java/org/opentripplanner/model/Timetable.java diff --git a/src/main/java/org/opentripplanner/model/TimetableBuilder.java b/application/src/main/java/org/opentripplanner/model/TimetableBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/model/TimetableBuilder.java rename to application/src/main/java/org/opentripplanner/model/TimetableBuilder.java diff --git a/src/main/java/org/opentripplanner/model/TimetableSnapshot.java b/application/src/main/java/org/opentripplanner/model/TimetableSnapshot.java similarity index 85% rename from src/main/java/org/opentripplanner/model/TimetableSnapshot.java rename to application/src/main/java/org/opentripplanner/model/TimetableSnapshot.java index 8cd0707d655..f9d877a9640 100644 --- a/src/main/java/org/opentripplanner/model/TimetableSnapshot.java +++ b/application/src/main/java/org/opentripplanner/model/TimetableSnapshot.java @@ -13,11 +13,9 @@ import java.util.Comparator; import java.util.ConcurrentModificationException; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; -import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import javax.annotation.Nullable; @@ -83,10 +81,14 @@ public class TimetableSnapshot { /** * During the construction phase of the TimetableSnapshot, before it is considered immutable and - * used in routing, this Set holds all timetables that have been modified and are waiting to be - * indexed. This field will be set to null when the TimetableSnapshot becomes read-only. + * used in routing, this Map holds all timetables that have been modified and are waiting to be + * indexed. + * A real-time timetable overrides the scheduled timetable of a TripPattern for only a single + * service date. There can be only one overriding timetable per TripPattern and per service date. + * This is enforced by indexing the map with a pair (TripPattern, service date). + * This map is cleared when the TimetableSnapshot becomes read-only. */ - private final Set dirtyTimetables = new HashSet<>(); + private final Map dirtyTimetables = new HashMap<>(); /** * For each TripPattern (sequence of stops on a particular Route) for which we have received a @@ -110,9 +112,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 +129,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 TimetableRepositoryIndex. + */ private final Map realtimeAddedRoutes; private final Map realTimeAddedTrips; private final Map realTimeAddedPatternForTrip; @@ -160,7 +170,7 @@ public TimetableSnapshot() { private TimetableSnapshot( Map> timetables, - Map realtimeAddedTripPattern, + Map realTimeNewTripPatternsForModifiedTrips, Map realtimeAddedRoutes, Map realtimeAddedTrips, Map realTimeAddedPatternForTrip, @@ -171,7 +181,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 +217,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 +237,7 @@ public Route getRealtimeAddedRoute(FeedScopedId id) { return getByNullableKey(id, realtimeAddedRoutes); } - public Collection getAllRealTimeAddedRoutes() { + public Collection listRealTimeAddedRoutes() { return Collections.unmodifiableCollection(realtimeAddedRoutes.values()); } @@ -239,7 +249,7 @@ public Trip getRealTimeAddedTrip(FeedScopedId id) { return getByNullableKey(id, realTimeAddedTrips); } - public Collection getAllRealTimeAddedTrips() { + public Collection listRealTimeAddedTrips() { return Collections.unmodifiableCollection(realTimeAddedTrips.values()); } @@ -276,7 +286,7 @@ public TripOnServiceDate getRealTimeAddedTripOnServiceDateForTripAndDay( return getByNullableKey(tripIdAndServiceDate, realTimeAddedTripOnServiceDateForTripAndDay); } - public Collection getAllRealTimeAddedTripOnServiceDate() { + public Collection listRealTimeAddedTripOnServiceDate() { return Collections.unmodifiableCollection(realTimeAddedTripOnServiceDateForTripAndDay.values()); } @@ -289,14 +299,12 @@ 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); TimetableBuilder ttb = tt.copyOf().withServiceDate(serviceDate); @@ -311,7 +319,7 @@ public Result update(RealTimeTripUpdate realTimeTrip // 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. @@ -357,18 +365,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), @@ -380,7 +385,7 @@ public TimetableSnapshot commit(TransitLayerUpdater transitLayerUpdater, boolean ); if (transitLayerUpdater != null) { - transitLayerUpdater.update(dirtyTimetables, timetables); + transitLayerUpdater.update(dirtyTimetables.values(), timetables); } this.dirtyTimetables.clear(); @@ -395,15 +400,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; } } @@ -420,17 +424,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); @@ -473,9 +475,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();) { @@ -483,7 +483,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; @@ -499,13 +499,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; } @@ -534,7 +534,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() + ); } /** @@ -543,7 +547,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())); } @@ -551,14 +555,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())); } /** @@ -600,10 +602,21 @@ private void swapTimetable(TripPattern pattern, Timetable original, Timetable up } sortedTimetables.add(updated); timetables.put(pattern, ImmutableSortedSet.copyOfSorted(sortedTimetables)); - dirtyTimetables.add(updated); + + // if the timetable was already modified by a previous real-time update in the same snapshot + // and for the same service date, + // then the previously updated timetable is superseded by the new one + dirtyTimetables.put(new TripPatternAndServiceDate(pattern, updated.getServiceDate()), updated); + dirty = true; } + private void validateNotReadOnly() { + if (readOnly) { + throw new ConcurrentModificationException("This TimetableSnapshot is read-only."); + } + } + protected static class SortedTimetableComparator implements Comparator { @Override @@ -611,4 +624,9 @@ public int compare(Timetable t1, Timetable t2) { return t1.getServiceDate().compareTo(t2.getServiceDate()); } } + + /** + * A pair made of a TripPattern and one of the service dates it is running on. + */ + private record TripPatternAndServiceDate(TripPattern tripPattern, LocalDate serviceDate) {} } 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 100% rename from src/main/java/org/opentripplanner/model/impl/OtpTransitServiceBuilder.java rename to application/src/main/java/org/opentripplanner/model/impl/OtpTransitServiceBuilder.java 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 100% rename from src/main/java/org/opentripplanner/model/plan/Leg.java rename to application/src/main/java/org/opentripplanner/model/plan/Leg.java 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 99% rename from src/main/java/org/opentripplanner/model/plan/ScheduledTransitLeg.java rename to application/src/main/java/org/opentripplanner/model/plan/ScheduledTransitLeg.java index e774c9e0dbc..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; @@ -182,7 +181,6 @@ public LegTime end() { } @Override - @Nonnull public TransitMode getMode() { return getTrip().getMode(); } 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 90% rename from src/main/java/org/opentripplanner/netex/NetexBundle.java rename to application/src/main/java/org/opentripplanner/netex/NetexBundle.java index 3cd52cd246e..b061c9e9352 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 ); @@ -119,19 +125,19 @@ public void close() throws IOException { /** Load all files entries in the bundle */ private void loadFileEntries() { // Load global shared files - loadFilesThenMapToOtpTransitModel("shared file", hierarchy.sharedEntries()); + loadFilesThenMapToTimetableRepository("shared file", hierarchy.sharedEntries()); for (GroupEntries group : hierarchy.groups()) { LOG.info("reading group {}", group.name()); scopeInputData(() -> { // Load shared group files - loadFilesThenMapToOtpTransitModel("shared group file", group.sharedEntries()); + loadFilesThenMapToTimetableRepository("shared group file", group.sharedEntries()); for (DataSource entry : group.independentEntries()) { scopeInputData(() -> { // Load each independent file in group - loadFilesThenMapToOtpTransitModel("group file", List.of(entry)); + loadFilesThenMapToTimetableRepository("group file", List.of(entry)); }); } }); @@ -158,7 +164,7 @@ private void scopeInputData(Runnable task) { * when read, would lead to missing references, since the order entries are read is not enforced * in any way. */ - private void loadFilesThenMapToOtpTransitModel( + private void loadFilesThenMapToTimetableRepository( String fileDescription, Iterable entries ) { diff --git a/src/main/java/org/opentripplanner/netex/NetexModule.java b/application/src/main/java/org/opentripplanner/netex/NetexModule.java similarity index 82% rename from src/main/java/org/opentripplanner/netex/NetexModule.java rename to application/src/main/java/org/opentripplanner/netex/NetexModule.java index 2bf3403395c..4c45131389f 100644 --- a/src/main/java/org/opentripplanner/netex/NetexModule.java +++ b/application/src/main/java/org/opentripplanner/netex/NetexModule.java @@ -5,7 +5,7 @@ import org.opentripplanner.framework.application.OTPFeature; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.graph_builder.model.GraphBuilderModule; -import org.opentripplanner.graph_builder.module.AddTransitModelEntitiesToGraph; +import org.opentripplanner.graph_builder.module.AddTransitEntitiesToGraph; import org.opentripplanner.graph_builder.module.ValidateAndInterpolateStopTimesForEachTrip; import org.opentripplanner.model.OtpTransitService; import org.opentripplanner.model.TripStopTimes; @@ -15,7 +15,7 @@ import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.routing.vehicle_parking.VehicleParkingHelper; import org.opentripplanner.standalone.config.BuildConfig; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * This module is used for importing the NeTEx CEN Technical Standard for exchanging Public @@ -28,7 +28,7 @@ public class NetexModule implements GraphBuilderModule { private final int subwayAccessTime; private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final DataImportIssueStore issueStore; /** @@ -41,14 +41,14 @@ public class NetexModule implements GraphBuilderModule { public NetexModule( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore, int subwayAccessTime, ServiceDateInterval transitPeriodLimit, List netexBundles ) { this.graph = graph; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.issueStore = issueStore; this.subwayAccessTime = subwayAccessTime; this.transitPeriodLimit = transitPeriodLimit; @@ -70,7 +70,7 @@ public void buildGraph() { ); transitBuilder.limitServiceDays(transitPeriodLimit); for (var tripOnServiceDate : transitBuilder.getTripOnServiceDates().values()) { - transitModel.addTripOnServiceDate(tripOnServiceDate.getId(), tripOnServiceDate); + timetableRepository.addTripOnServiceDate(tripOnServiceDate); } calendarServiceData.add(transitBuilder.buildCalendarServiceData()); @@ -87,20 +87,20 @@ public void buildGraph() { // if this or previously processed netex bundle has transit that has not been filtered out hasActiveTransit = hasActiveTransit || otpService.hasActiveTransit(); - // TODO OTP2 - Move this into the AddTransitModelEntitiesToGraph + // TODO OTP2 - Move this into the AddTransitEntitiesToGraph // - and make sure they also work with GTFS feeds - GTFS do no // - have operators and notice assignments. - transitModel.getOperators().addAll(otpService.getAllOperators()); - transitModel.addNoticeAssignments(otpService.getNoticeAssignments()); + timetableRepository.addOperators(otpService.getAllOperators()); + timetableRepository.addNoticeAssignments(otpService.getNoticeAssignments()); - AddTransitModelEntitiesToGraph.addToGraph( + AddTransitEntitiesToGraph.addToGraph( otpService, subwayAccessTime, graph, - transitModel + timetableRepository ); - transitModel.validateTimeZones(); + timetableRepository.validateTimeZones(); var lots = transitBuilder.vehicleParkings(); graph.getVehicleParkingService().updateVehicleParking(lots, List.of()); @@ -108,7 +108,11 @@ public void buildGraph() { lots.forEach(linker::linkVehicleParkingToGraph); } - transitModel.updateCalendarServiceData(hasActiveTransit, calendarServiceData, issueStore); + timetableRepository.updateCalendarServiceData( + hasActiveTransit, + calendarServiceData, + issueStore + ); } catch (Exception e) { throw new RuntimeException(e); } 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 92% 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..5d824f833db 100644 --- a/src/main/java/org/opentripplanner/netex/configure/NetexConfigure.java +++ b/application/src/main/java/org/opentripplanner/netex/configure/NetexConfigure.java @@ -12,7 +12,7 @@ import org.opentripplanner.netex.loader.NetexDataSourceHierarchy; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.standalone.config.BuildConfig; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * Responsible for dependency injection and creating main NeTEx module objects. This decouple the @@ -35,7 +35,7 @@ public NetexConfigure(BuildConfig builderParams) { public NetexModule createNetexModule( Iterable> netexSources, - TransitModel transitModel, + TimetableRepository timetableRepository, Graph graph, DataImportIssueStore issueStore ) { @@ -43,7 +43,7 @@ public NetexModule createNetexModule( for (ConfiguredDataSource it : netexSources) { var transitServiceBuilder = new OtpTransitServiceBuilder( - transitModel.getStopModel(), + timetableRepository.getStopModel(), issueStore ); netexBundles.add(netexBundle(transitServiceBuilder, it)); @@ -51,7 +51,7 @@ public NetexModule createNetexModule( return new NetexModule( graph, - transitModel, + timetableRepository, issueStore, buildParams.getSubwayAccessTimeSeconds(), buildParams.getTransitServicePeriod(), @@ -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 98% rename from src/main/java/org/opentripplanner/netex/mapping/TripMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/TripMapper.java index 30b87d248a0..02b5de80bb3 100644 --- a/src/main/java/org/opentripplanner/netex/mapping/TripMapper.java +++ b/application/src/main/java/org/opentripplanner/netex/mapping/TripMapper.java @@ -137,7 +137,7 @@ Trip mapServiceJourney(ServiceJourney serviceJourney, Supplier headsign) ); // TODO RTM - Instead of getting the first headsign from the StopTime this could be the - // - default behaviour of the TransitModel - So, in the NeTEx mapper we would just + // - default behaviour of the TimetableRepository - So, in the NeTEx mapper we would just // - ignore setting the headsign on the Trip. builder.withHeadsign(new NonLocalizedString(headsign.get())); 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 100% rename from src/main/java/org/opentripplanner/netex/mapping/TripPatternMapper.java rename to application/src/main/java/org/opentripplanner/netex/mapping/TripPatternMapper.java 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 99% 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 155394376ae..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 @@ -140,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( @@ -390,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 96% 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..695ac5a15f5 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()) { @@ -113,7 +114,9 @@ public static ItineraryListFilterChain createFilterChain( builder.withEmissions(new DecorateWithEmission(context.emissionsService())); } - if (context.stopConsolidationService() != null) { + if ( + context.stopConsolidationService() != null && context.stopConsolidationService().isActive() + ) { builder.withConsolidatedStopNamesDecorator( new DecorateConsolidatedStopNames(context.stopConsolidationService()) ); 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 98% 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 index e5f0544f584..9e07c57ede7 100644 --- 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 @@ -17,15 +17,15 @@ import org.opentripplanner.transit.service.StopModel; /** - * This is a replica of public transportation data already present in TransitModel, but rearranged + * This is a replica of public transportation data already present in TimetableRepository, but rearranged * and indexed differently for efficient use by the Raptor router. Patterns and trips are split out * by days, retaining only the services actually running on any particular day. * * TODO RT_AB: this name may reflect usage in R5, where the TransportNetwork encompasses two * sub-aggregates (one for the streets and one for the public transit data). Here, the TransitLayer - * seems to just be an indexed and rearranged copy of the main TransitModel instance. TG has + * seems to just be an indexed and rearranged copy of the main TimetableRepository instance. TG has * indicated that "layer" should be restricted in its standard OO meaning, and this class should - * really be merged into TransitModel. + * really be merged into TimetableRepository. */ public class TransitLayer { 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 92% 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 13f8facef3d..a9da73200cc 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 @@ -25,13 +25,13 @@ import org.opentripplanner.transit.model.site.StopTransferPriority; import org.opentripplanner.transit.service.DefaultTransitService; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Maps the TransitLayer object from the TransitModel object. The ServiceDay hierarchy is reversed, + * Maps the TransitLayer object from the TimetableRepository object. The ServiceDay hierarchy is reversed, * with service days at the top level, which contains TripPatternForDate objects that contain only * TripSchedules running on that particular date. This makes it faster to filter out TripSchedules * when doing Range Raptor searches. @@ -48,16 +48,16 @@ public class TransitLayerMapper { private final TransitService transitService; private final StopModel stopModel; - private TransitLayerMapper(TransitModel transitModel) { - this.transitService = new DefaultTransitService(transitModel); - this.stopModel = transitModel.getStopModel(); + private TransitLayerMapper(TimetableRepository timetableRepository) { + this.transitService = new DefaultTransitService(timetableRepository); + this.stopModel = timetableRepository.getStopModel(); } public static TransitLayer map( TransitTuningParameters tuningParameters, - TransitModel transitModel + TimetableRepository timetableRepository ) { - return new TransitLayerMapper(transitModel).map(tuningParameters); + return new TransitLayerMapper(timetableRepository).map(tuningParameters); } private TransitLayer map(TransitTuningParameters tuningParameters) { @@ -65,7 +65,7 @@ private TransitLayer map(TransitTuningParameters tuningParameters) { List> transferByStopIndex; ConstrainedTransfersForPatterns constrainedTransfers = null; - LOG.info("Mapping transitLayer from TransitModel..."); + LOG.info("Mapping transitLayer from TimetableRepository..."); Collection allTripPatterns = transitService.getAllTripPatterns(); 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 99% 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 index 934bec39c11..8b307321ca8 100644 --- 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 @@ -30,7 +30,7 @@ * the updated copy in an atomic operation. This ensures that any TransitLayer that is referenced * from the Graph is never changed. * - * This is a way of keeping the TransitLayer up to date (in sync with the TransitModel plus its most + * This is a way of keeping the TransitLayer up to date (in sync with the TimetableRepository plus its most * recent TimetableSnapshot) without repeatedly deriving it from scratch every few seconds. The same * incremental changes are applied to both the TimetableSnapshot and the TransitLayer and they are * published together. @@ -60,7 +60,7 @@ public TransitLayerUpdater(TransitEditorService transitService) { } public void update( - Set updatedTimetables, + Collection updatedTimetables, Map> timetables ) { if (!transitService.hasRealtimeTransitLayer()) { 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 100% 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 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 98% 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..bb1944d0c4b 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; @@ -44,10 +43,10 @@ * In OTP1, the Graph contained vertices and edges representing the entire transportation network, * including edges representing both street segments and public transit lines connecting stops. In * OTP2, the Graph edges now represent only the street network. Transit routing is performed on - * other data structures suited to the Raptor algorithm (the TransitModel). Some transit-related + * other data structures suited to the Raptor algorithm (the TimetableRepository). Some transit-related * vertices are still present in the Graph, specifically those representing transit stops, * entrances, and elevators. Their presence in the street graph creates a connection between the two - * routable data structures (identifying where stops in the TransitModel are located relative to + * routable data structures (identifying where stops in the TimetableRepository are located relative to * roads). *

    * Other data structures related to street routing, such as elevation data and vehicle parking @@ -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 92% rename from src/main/java/org/opentripplanner/routing/graph/SerializedGraphObject.java rename to application/src/main/java/org/opentripplanner/routing/graph/SerializedGraphObject.java index b2404adc5d1..327428cfccb 100644 --- a/src/main/java/org/opentripplanner/routing/graph/SerializedGraphObject.java +++ b/application/src/main/java/org/opentripplanner/routing/graph/SerializedGraphObject.java @@ -35,7 +35,7 @@ import org.opentripplanner.street.model.vertex.Vertex; import org.opentripplanner.transit.model.basic.SubMode; import org.opentripplanner.transit.model.network.RoutingTripPattern; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,7 +55,7 @@ public class SerializedGraphObject implements Serializable { private static final Logger LOG = LoggerFactory.getLogger(SerializedGraphObject.class); public final Graph graph; - public final TransitModel transitModel; + public final TimetableRepository timetableRepository; public final WorldEnvelopeRepository worldEnvelopeRepository; private final Collection edges; @@ -82,7 +82,7 @@ public class SerializedGraphObject implements Serializable { public SerializedGraphObject( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, WorldEnvelopeRepository worldEnvelopeRepository, BuildConfig buildConfig, RouterConfig routerConfig, @@ -93,7 +93,7 @@ public SerializedGraphObject( ) { this.graph = graph; this.edges = graph.getEdges(); - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.worldEnvelopeRepository = worldEnvelopeRepository; this.buildConfig = buildConfig; this.routerConfig = routerConfig; @@ -184,9 +184,9 @@ private static SerializedGraphObject load(InputStream inputStream, String source ); LOG.debug("Graph read."); serObj.reconstructEdgeLists(); - serObj.transitModel.getStopModel().reindexAfterDeserialization(); - serObj.transitModel.index(); - logSerializationCompleteStatus(serObj.graph, serObj.transitModel); + serObj.timetableRepository.getStopModel().reindexAfterDeserialization(); + serObj.timetableRepository.index(); + logSerializationCompleteStatus(serObj.graph, serObj.timetableRepository); return serObj; } catch (IOException e) { LOG.error("IO exception while loading graph: {}", e.getLocalizedMessage(), e); @@ -256,11 +256,14 @@ private void save(OutputStream outputStream, String graphName, long size) { // ((InstanceCountingClassResolver) kryo.getClassResolver()).summarize(); } - private static void logSerializationCompleteStatus(Graph graph, TransitModel transitModel) { + private static void logSerializationCompleteStatus( + Graph graph, + TimetableRepository timetableRepository + ) { var f = new OtpNumberFormat(); - var nStops = f.formatNumber(transitModel.getStopModel().stopIndexSize()); - var nTransfers = f.formatNumber(transitModel.getTransferService().listAll().size()); - var nPatterns = f.formatNumber(transitModel.getAllTripPatterns().size()); + var nStops = f.formatNumber(timetableRepository.getStopModel().stopIndexSize()); + var nTransfers = f.formatNumber(timetableRepository.getTransferService().listAll().size()); + var nPatterns = f.formatNumber(timetableRepository.getAllTripPatterns().size()); var nVertices = f.formatNumber(graph.countVertices()); var nEdges = f.formatNumber(graph.countEdges()); 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 95% rename from src/main/java/org/opentripplanner/routing/impl/DelegatingTransitAlertServiceImpl.java rename to application/src/main/java/org/opentripplanner/routing/impl/DelegatingTransitAlertServiceImpl.java index 8da6fc21aa7..e63894b1a2c 100644 --- a/src/main/java/org/opentripplanner/routing/impl/DelegatingTransitAlertServiceImpl.java +++ b/application/src/main/java/org/opentripplanner/routing/impl/DelegatingTransitAlertServiceImpl.java @@ -11,7 +11,7 @@ import org.opentripplanner.routing.services.TransitAlertService; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.timetable.Direction; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.alert.TransitAlertProvider; /** @@ -30,14 +30,14 @@ public class DelegatingTransitAlertServiceImpl implements TransitAlertService { private final ArrayList transitAlertServices = new ArrayList<>(); /** - * Constructor which scans over all existing GraphUpdaters associated with a TransitModel + * Constructor which scans over all existing GraphUpdaters associated with a TimetableRepository * instance and retains references to all their TransitAlertService instances. * This implies that these instances are expected to remain in use indefinitely (not be replaced * with new instances or taken out of service over time). */ - public DelegatingTransitAlertServiceImpl(TransitModel transitModel) { - if (transitModel.getUpdaterManager() != null) { - transitModel + public DelegatingTransitAlertServiceImpl(TimetableRepository timetableRepository) { + if (timetableRepository.getUpdaterManager() != null) { + timetableRepository .getUpdaterManager() .getUpdaterList() .stream() 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 94% rename from src/main/java/org/opentripplanner/routing/impl/TransitAlertServiceImpl.java rename to application/src/main/java/org/opentripplanner/routing/impl/TransitAlertServiceImpl.java index 0cc24c691e9..2662eb7d3e5 100644 --- a/src/main/java/org/opentripplanner/routing/impl/TransitAlertServiceImpl.java +++ b/application/src/main/java/org/opentripplanner/routing/impl/TransitAlertServiceImpl.java @@ -13,7 +13,7 @@ import org.opentripplanner.routing.services.TransitAlertService; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.timetable.Direction; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * This is the primary implementation of TransitAlertService, which actually retains its own set @@ -32,12 +32,12 @@ */ public class TransitAlertServiceImpl implements TransitAlertService { - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private Multimap alerts = HashMultimap.create(); - public TransitAlertServiceImpl(TransitModel transitModel) { - this.transitModel = transitModel; + public TransitAlertServiceImpl(TimetableRepository timetableRepository) { + this.timetableRepository = timetableRepository; } @Override @@ -85,8 +85,8 @@ public Collection getStopAlerts( } if (result.isEmpty()) { // Search for alerts on parent-stop - if (transitModel != null) { - var quay = transitModel.getStopModel().getRegularStop(stopId); + if (timetableRepository != null) { + var quay = timetableRepository.getStopModel().getRegularStop(stopId); if (quay != null) { // TODO - SIRI: Add alerts from parent- and multimodal-stops /* 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 95% rename from src/main/java/org/opentripplanner/standalone/OTPMain.java rename to application/src/main/java/org/opentripplanner/standalone/OTPMain.java index d865f8fa28c..915b7091ba6 100644 --- a/src/main/java/org/opentripplanner/standalone/OTPMain.java +++ b/application/src/main/java/org/opentripplanner/standalone/OTPMain.java @@ -17,7 +17,7 @@ import org.opentripplanner.standalone.configure.ConstructApplication; import org.opentripplanner.standalone.configure.LoadApplication; import org.opentripplanner.standalone.server.GrizzlyServer; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.configure.UpdaterConfigurator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -150,7 +150,7 @@ private static void startOTPServer(CommandLineParameters cli) { // with using the embedded router config. new SerializedGraphObject( app.graph(), - app.transitModel(), + app.timetableRepository(), app.worldEnvelopeRepository(), config.buildConfig(), config.routerConfig(), @@ -187,8 +187,8 @@ private static void detectUnusedConfigParams(CommandLineParameters cli, ConfigMo private static void startOtpWebServer(CommandLineParameters params, ConstructApplication app) { // Index graph for travel search - app.transitModel().index(); - app.graph().index(app.transitModel().getStopModel()); + app.timetableRepository().index(); + app.graph().index(app.timetableRepository().getStopModel()); // publishing the config version info make it available to the APIs setOtpConfigVersionsOnServerInfo(app); @@ -205,7 +205,7 @@ private static void startOtpWebServer(CommandLineParameters params, ConstructApp if (params.doServe()) { GrizzlyServer grizzlyServer = app.createGrizzlyServer(); - registerShutdownHookToGracefullyShutDownServer(app.transitModel(), app.raptorConfig()); + registerShutdownHookToGracefullyShutDownServer(app.timetableRepository(), app.raptorConfig()); // Loop to restart server on uncaught fatal exceptions. while (true) { @@ -232,14 +232,14 @@ private static void startOtpWebServer(CommandLineParameters params, ConstructApp * */ private static void registerShutdownHookToGracefullyShutDownServer( - TransitModel transitModel, + TimetableRepository timetableRepository, RaptorConfig raptorConfig ) { ApplicationShutdownSupport.addShutdownHook( "server-shutdown", () -> { LOG.info("OTP shutdown started..."); - UpdaterConfigurator.shutdownGraph(transitModel); + UpdaterConfigurator.shutdownGraph(timetableRepository); raptorConfig.shutdown(); WeakCollectionCleaner.DEFAULT.exit(); DeferredAuthorityFactory.exit(); 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 100% 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 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 3a58bfe9bcd..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,6 +6,7 @@ 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; @@ -261,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 90% rename from src/main/java/org/opentripplanner/standalone/configure/ConstructApplication.java rename to application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplication.java index 52f7970ccd7..560f234187a 100644 --- a/src/main/java/org/opentripplanner/standalone/configure/ConstructApplication.java +++ b/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplication.java @@ -33,7 +33,7 @@ import org.opentripplanner.street.model.StreetLimitationParameters; import org.opentripplanner.street.model.elevation.ElevationUtils; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.configure.UpdaterConfigurator; import org.opentripplanner.visualizer.GraphVisualizer; import org.slf4j.Logger; @@ -69,7 +69,7 @@ public class ConstructApplication { ConstructApplication( CommandLineParameters cli, Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, WorldEnvelopeRepository worldEnvelopeRepository, ConfigModel config, GraphBuilderDataSources graphBuilderDataSources, @@ -90,7 +90,7 @@ public class ConstructApplication { .builder() .configModel(config) .graph(graph) - .transitModel(transitModel) + .timetableRepository(timetableRepository) .graphVisualizer(graphVisualizer) .worldEnvelopeRepository(worldEnvelopeRepository) .emissionsDataModel(emissionsDataModel) @@ -125,7 +125,7 @@ public GraphBuilder createGraphBuilder() { buildConfig(), graphBuilderDataSources, graph(), - transitModel(), + timetableRepository(), factory.worldEnvelopeRepository(), factory.emissionsDataModel(), factory.stopConsolidationRepository(), @@ -156,25 +156,25 @@ private void setupTransitRoutingServer() { enableRequestTraceLogging(); createMetricsLogging(); - creatTransitLayerForRaptor(transitModel(), routerConfig().transitTuningConfig()); + creatTransitLayerForRaptor(timetableRepository(), routerConfig().transitTuningConfig()); /* Create updater modules from JSON config. */ UpdaterConfigurator.configure( graph(), realtimeVehicleRepository(), vehicleRentalRepository(), - transitModel(), + timetableRepository(), routerConfig().updaterConfig() ); initEllipsoidToGeoidDifference(); - initializeTransferCache(routerConfig().transitTuningConfig(), transitModel()); + initializeTransferCache(routerConfig().transitTuningConfig(), timetableRepository()); if (OTPFeature.TransmodelGraphQlApi.isOn()) { TransmodelAPI.setUp( routerConfig().transmodelApi(), - transitModel(), + timetableRepository(), routerConfig().routingRequestDefaults() ); } @@ -200,25 +200,29 @@ private void initEllipsoidToGeoidDifference() { * Create transit layer for Raptor routing. Here we map the scheduled timetables. */ public static void creatTransitLayerForRaptor( - TransitModel transitModel, + TimetableRepository timetableRepository, TransitTuningParameters tuningParameters ) { - if (!transitModel.hasTransit() || !transitModel.isIndexed()) { + if (!timetableRepository.hasTransit() || !timetableRepository.isIndexed()) { LOG.warn( "Cannot create Raptor data, that requires the graph to have transit data and be indexed." ); } LOG.info("Creating transit layer for Raptor routing."); - transitModel.setTransitLayer(TransitLayerMapper.map(tuningParameters, transitModel)); - transitModel.setRealtimeTransitLayer(new TransitLayer(transitModel.getTransitLayer())); - transitModel.setTransitLayerUpdater( - new TransitLayerUpdater(new DefaultTransitService(transitModel)) + timetableRepository.setTransitLayer( + TransitLayerMapper.map(tuningParameters, timetableRepository) + ); + timetableRepository.setRealtimeTransitLayer( + new TransitLayer(timetableRepository.getTransitLayer()) + ); + timetableRepository.setTransitLayerUpdater( + new TransitLayerUpdater(new DefaultTransitService(timetableRepository)) ); } public static void initializeTransferCache( TransitTuningParameters transitTuningConfig, - TransitModel transitModel + TimetableRepository timetableRepository ) { var transferCacheRequests = transitTuningConfig.transferCacheRequests(); if (!transferCacheRequests.isEmpty()) { @@ -231,7 +235,7 @@ public static void initializeTransferCache( LOG.info(progress.startMessage()); transferCacheRequests.forEach(request -> { - transitModel.getTransitLayer().initTransferCacheForRequest(request); + timetableRepository.getTransitLayer().initTransferCacheForRequest(request); //noinspection Convert2MethodRef progress.step(s -> LOG.info(s)); @@ -241,8 +245,8 @@ public static void initializeTransferCache( } } - public TransitModel transitModel() { - return factory.transitModel(); + public TimetableRepository timetableRepository() { + return factory.timetableRepository(); } public DataImportIssueSummary dataImportIssueSummary() { 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 96% rename from src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationFactory.java rename to application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationFactory.java index b307776ef52..e828406a35e 100644 --- a/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationFactory.java +++ b/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationFactory.java @@ -34,7 +34,7 @@ import org.opentripplanner.street.model.StreetLimitationParameters; import org.opentripplanner.street.service.StreetLimitationParametersServiceModule; import org.opentripplanner.transit.configure.TransitModule; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitService; import org.opentripplanner.visualizer.GraphVisualizer; @@ -65,7 +65,7 @@ public interface ConstructApplicationFactory { ConfigModel config(); RaptorConfig raptorConfig(); Graph graph(); - TransitModel transitModel(); + TimetableRepository timetableRepository(); WorldEnvelopeRepository worldEnvelopeRepository(); WorldEnvelopeService worldEnvelopeService(); RealtimeVehicleRepository realtimeVehicleRepository(); @@ -102,7 +102,7 @@ interface Builder { Builder graph(Graph graph); @BindsInstance - Builder transitModel(TransitModel transitModel); + Builder timetableRepository(TimetableRepository timetableRepository); @BindsInstance Builder graphVisualizer(@Nullable GraphVisualizer graphVisualizer); 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 94% rename from src/main/java/org/opentripplanner/standalone/configure/LoadApplication.java rename to application/src/main/java/org/opentripplanner/standalone/configure/LoadApplication.java index 19415e489b4..300eb24f997 100644 --- a/src/main/java/org/opentripplanner/standalone/configure/LoadApplication.java +++ b/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplication.java @@ -12,7 +12,7 @@ import org.opentripplanner.standalone.config.CommandLineParameters; import org.opentripplanner.standalone.config.ConfigModel; import org.opentripplanner.street.model.StreetLimitationParameters; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * This class is responsible for loading configuration and setting up the OTP data store. @@ -54,7 +54,7 @@ public DataSource getInputGraphDataStore() { public ConstructApplication appConstruction(SerializedGraphObject obj) { return createAppConstruction( obj.graph, - obj.transitModel, + obj.timetableRepository, obj.worldEnvelopeRepository, obj.issueSummary, obj.emissionsDataModel, @@ -67,7 +67,7 @@ public ConstructApplication appConstruction(SerializedGraphObject obj) { public ConstructApplication appConstruction() { return createAppConstruction( factory.emptyGraph(), - factory.emptyTransitModel(), + factory.emptyTimetableRepository(), factory.emptyWorldEnvelopeRepository(), DataImportIssueSummary.empty(), factory.emptyEmissionsDataModel(), @@ -89,7 +89,7 @@ public ConfigModel config() { private ConstructApplication createAppConstruction( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, WorldEnvelopeRepository worldEnvelopeRepository, DataImportIssueSummary issueSummary, @Nullable EmissionsDataModel emissionsDataModel, @@ -99,7 +99,7 @@ private ConstructApplication createAppConstruction( return new ConstructApplication( cli, graph, - transitModel, + timetableRepository, worldEnvelopeRepository, config(), graphBuilderDataSources(), 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 94% rename from src/main/java/org/opentripplanner/standalone/configure/LoadApplicationFactory.java rename to application/src/main/java/org/opentripplanner/standalone/configure/LoadApplicationFactory.java index aacb42c4336..8d11d645c48 100644 --- a/src/main/java/org/opentripplanner/standalone/configure/LoadApplicationFactory.java +++ b/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplicationFactory.java @@ -17,7 +17,7 @@ import org.opentripplanner.standalone.config.ConfigModel; import org.opentripplanner.standalone.config.configure.LoadConfigModule; import org.opentripplanner.street.model.StreetLimitationParameters; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * Dagger dependency injection Factory to create components for the OTP load application phase. @@ -41,7 +41,7 @@ public interface LoadApplicationFactory { Graph emptyGraph(); @Singleton - TransitModel emptyTransitModel(); + TimetableRepository emptyTimetableRepository(); @Singleton WorldEnvelopeRepository emptyWorldEnvelopeRepository(); 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 87% rename from src/main/java/org/opentripplanner/standalone/server/MetricsLogging.java rename to application/src/main/java/org/opentripplanner/standalone/server/MetricsLogging.java index 3ed5685015b..c9161c7588a 100644 --- a/src/main/java/org/opentripplanner/standalone/server/MetricsLogging.java +++ b/application/src/main/java/org/opentripplanner/standalone/server/MetricsLogging.java @@ -22,7 +22,7 @@ import org.opentripplanner.graph_builder.issue.api.DataImportIssueSummary; import org.opentripplanner.raptor.configure.RaptorConfig; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripSchedule; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * This class is responsible for wiring up various metrics to micrometer, which we use for @@ -32,7 +32,7 @@ public class MetricsLogging { @Inject public MetricsLogging( - TransitModel transitModel, + TimetableRepository timetableRepository, RaptorConfig raptorConfig, DataImportIssueSummary issueSummary ) { @@ -48,9 +48,9 @@ public MetricsLogging( new ProcessorMetrics().bindTo(Metrics.globalRegistry); new UptimeMetrics().bindTo(Metrics.globalRegistry); - if (transitModel.getTransitLayer() != null) { + if (timetableRepository.getTransitLayer() != null) { new GuavaCacheMetrics( - transitModel.getTransitLayer().getTransferCache().getTransferCache(), + timetableRepository.getTransitLayer().getTransferCache().getTransferCache(), "raptorTransfersCache", List.of(Tag.of("cache", "raptorTransfers")) ) @@ -63,23 +63,23 @@ public MetricsLogging( ) .bindTo(Metrics.globalRegistry); - if (transitModel.getUpdaterManager() != null) { + if (timetableRepository.getUpdaterManager() != null) { new ExecutorServiceMetrics( - transitModel.getUpdaterManager().getPollingUpdaterPool(), + timetableRepository.getUpdaterManager().getPollingUpdaterPool(), "pollingGraphUpdaters", List.of(Tag.of("pool", "pollingGraphUpdaters")) ) .bindTo(Metrics.globalRegistry); new ExecutorServiceMetrics( - transitModel.getUpdaterManager().getNonPollingUpdaterPool(), + timetableRepository.getUpdaterManager().getNonPollingUpdaterPool(), "nonPollingGraphUpdaters", List.of(Tag.of("pool", "nonPollingGraphUpdaters")) ) .bindTo(Metrics.globalRegistry); new ExecutorServiceMetrics( - transitModel.getUpdaterManager().getScheduler(), + timetableRepository.getUpdaterManager().getScheduler(), "graphUpdateScheduler", List.of(Tag.of("pool", "graphUpdateScheduler")) ) 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/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequest.java b/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequest.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequest.java rename to application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequest.java diff --git a/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequestBuilder.java b/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequestBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequestBuilder.java rename to application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequestBuilder.java 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/src/main/java/org/opentripplanner/transit/model/filter/expr/AndMatcher.java b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/AndMatcher.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/filter/expr/AndMatcher.java rename to application/src/main/java/org/opentripplanner/transit/model/filter/expr/AndMatcher.java diff --git a/src/main/java/org/opentripplanner/transit/model/filter/expr/BinaryOperator.java b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/BinaryOperator.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/filter/expr/BinaryOperator.java rename to application/src/main/java/org/opentripplanner/transit/model/filter/expr/BinaryOperator.java diff --git a/src/main/java/org/opentripplanner/transit/model/filter/expr/ContainsMatcher.java b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/ContainsMatcher.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/filter/expr/ContainsMatcher.java rename to application/src/main/java/org/opentripplanner/transit/model/filter/expr/ContainsMatcher.java diff --git a/src/main/java/org/opentripplanner/transit/model/filter/expr/EqualityMatcher.java b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/EqualityMatcher.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/filter/expr/EqualityMatcher.java rename to application/src/main/java/org/opentripplanner/transit/model/filter/expr/EqualityMatcher.java diff --git a/src/main/java/org/opentripplanner/transit/model/filter/expr/ExpressionBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/ExpressionBuilder.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/filter/expr/ExpressionBuilder.java rename to application/src/main/java/org/opentripplanner/transit/model/filter/expr/ExpressionBuilder.java diff --git a/src/main/java/org/opentripplanner/transit/model/filter/expr/Matcher.java b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/Matcher.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/filter/expr/Matcher.java rename to application/src/main/java/org/opentripplanner/transit/model/filter/expr/Matcher.java diff --git a/src/main/java/org/opentripplanner/transit/model/filter/expr/OrMatcher.java b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/OrMatcher.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/filter/expr/OrMatcher.java rename to application/src/main/java/org/opentripplanner/transit/model/filter/expr/OrMatcher.java diff --git a/src/main/java/org/opentripplanner/transit/model/filter/transit/TripOnServiceDateMatcherFactory.java b/application/src/main/java/org/opentripplanner/transit/model/filter/transit/TripOnServiceDateMatcherFactory.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/filter/transit/TripOnServiceDateMatcherFactory.java rename to application/src/main/java/org/opentripplanner/transit/model/filter/transit/TripOnServiceDateMatcherFactory.java 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/CarAccess.java b/application/src/main/java/org/opentripplanner/transit/model/network/CarAccess.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/model/network/CarAccess.java rename to application/src/main/java/org/opentripplanner/transit/model/network/CarAccess.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 99% 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 e7d7af45b6d..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 @@ -9,7 +9,6 @@ import java.util.Objects; 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; @@ -147,7 +146,7 @@ public final class TripPattern this.routingTripPattern = new RoutingTripPattern(this, builder); } - public static TripPatternBuilder of(@Nonnull FeedScopedId id) { + public static TripPatternBuilder of(FeedScopedId id) { return new TripPatternBuilder(id); } @@ -461,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 100% 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 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); } @@ -96,7 +95,6 @@ public Operator getOperator() { return operator; } - @Nonnull public Route getRoute() { return route; } @@ -120,12 +118,10 @@ public String getShortName() { return shortName; } - @Nonnull public TransitMode getMode() { return mode; } - @Nonnull public SubMode getNetexSubMode() { return netexSubmode; } @@ -143,22 +139,18 @@ 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 CarAccess getCarsAllowed() { return carsAllowed; } - @Nonnull public Accessibility getWheelchairBoarding() { return wheelchairBoarding; } @@ -183,7 +175,6 @@ public String getNetexInternalPlanningCode() { *

    * This is planned, by default (e.g. GTFS and if not set explicit). */ - @Nonnull public TripAlteration getNetexAlteration() { return netexAlteration; } @@ -206,7 +197,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 77% rename from src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java rename to application/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java index 1738c66bab0..62d8a727615 100644 --- a/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java +++ b/application/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java @@ -68,9 +68,9 @@ */ public class DefaultTransitService implements TransitEditorService { - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; - private final TransitModelIndex transitModelIndex; + private final TimetableRepositoryIndex timetableRepositoryIndex; /** * This should only be accessed through the getTimetableSnapshot method. @@ -78,118 +78,113 @@ public class DefaultTransitService implements TransitEditorService { private TimetableSnapshot timetableSnapshot; @Inject - public DefaultTransitService(TransitModel transitModel) { - this.transitModel = transitModel; - this.transitModelIndex = transitModel.getTransitModelIndex(); + public DefaultTransitService(TimetableRepository timetableRepository) { + this.timetableRepository = timetableRepository; + this.timetableRepositoryIndex = timetableRepository.getTimetableRepositoryIndex(); } public DefaultTransitService( - TransitModel transitModel, + TimetableRepository timetableRepository, TimetableSnapshot timetableSnapshotBuffer ) { - this(transitModel); + this(timetableRepository); this.timetableSnapshot = timetableSnapshotBuffer; } @Override public Collection getFeedIds() { - return this.transitModel.getFeedIds(); + return this.timetableRepository.getFeedIds(); } @Override public Collection getAgencies() { OTPRequestTimeoutException.checkForTimeout(); - return this.transitModel.getAgencies(); + return this.timetableRepository.getAgencies(); } @Override public Optional findAgencyById(FeedScopedId id) { - return this.transitModel.findAgencyById(id); + return this.timetableRepository.findAgencyById(id); } @Override public FeedInfo getFeedInfo(String feedId) { - return this.transitModel.getFeedInfo(feedId); + return this.timetableRepository.getFeedInfo(feedId); } @Override public void addAgency(Agency agency) { - this.transitModel.addAgency(agency); + this.timetableRepository.addAgency(agency); } @Override public void addFeedInfo(FeedInfo info) { - this.transitModel.addFeedInfo(info); - } - - @Override - public Collection getOperators() { - return this.transitModel.getOperators(); + this.timetableRepository.addFeedInfo(info); } @Override public Collection getNoticesByEntity(AbstractTransitEntity entity) { - return this.transitModel.getNoticesByElement().get(entity); + return this.timetableRepository.getNoticesByElement().get(entity); } @Override public TripPattern getTripPatternForId(FeedScopedId id) { - return this.transitModel.getTripPatternForId(id); + return this.timetableRepository.getTripPatternForId(id); } @Override public Collection getAllTripPatterns() { OTPRequestTimeoutException.checkForTimeout(); - return this.transitModel.getAllTripPatterns(); + return this.timetableRepository.getAllTripPatterns(); } @Override public Collection getNotices() { OTPRequestTimeoutException.checkForTimeout(); - return this.transitModel.getNoticesByElement().values(); + return this.timetableRepository.getNoticesByElement().values(); } @Override public Station getStationById(FeedScopedId id) { - return this.transitModel.getStopModel().getStationById(id); + return this.timetableRepository.getStopModel().getStationById(id); } @Override public MultiModalStation getMultiModalStation(FeedScopedId id) { - return this.transitModel.getStopModel().getMultiModalStation(id); + return this.timetableRepository.getStopModel().getMultiModalStation(id); } @Override public Collection getStations() { OTPRequestTimeoutException.checkForTimeout(); - return this.transitModel.getStopModel().listStations(); + return this.timetableRepository.getStopModel().listStations(); } @Override public Integer getServiceCodeForId(FeedScopedId id) { - return this.transitModel.getServiceCodes().get(id); + return this.timetableRepository.getServiceCodes().get(id); } @Override public TIntSet getServiceCodesRunningForDate(LocalDate serviceDate) { - return transitModelIndex + return timetableRepositoryIndex .getServiceCodesRunningForDate() .getOrDefault(serviceDate, new TIntHashSet()); } @Override public AreaStop getAreaStop(FeedScopedId id) { - return this.transitModel.getStopModel().getAreaStop(id); + return this.timetableRepository.getStopModel().getAreaStop(id); } @Override public Agency getAgencyForId(FeedScopedId id) { - return this.transitModelIndex.getAgencyForId(id); + return this.timetableRepositoryIndex.getAgencyForId(id); } @Override public RegularStop getRegularStop(FeedScopedId id) { - return this.transitModel.getStopModel().getRegularStop(id); + return this.timetableRepository.getStopModel().getRegularStop(id); } @Override @@ -201,7 +196,7 @@ public Route getRouteForId(FeedScopedId id) { return realtimeAddedRoute; } } - return transitModelIndex.getRouteForId(id); + return timetableRepositoryIndex.getRouteForId(id); } /** @@ -210,75 +205,75 @@ public Route getRouteForId(FeedScopedId id) { */ @Override public void addRoutes(Route route) { - this.transitModelIndex.addRoutes(route); + this.timetableRepositoryIndex.addRoutes(route); } @Override public Set getRoutesForStop(StopLocation stop) { OTPRequestTimeoutException.checkForTimeout(); - return this.transitModelIndex.getRoutesForStop(stop); + return this.timetableRepositoryIndex.getRoutesForStop(stop); } @Override public Collection getPatternsForStop(StopLocation stop) { OTPRequestTimeoutException.checkForTimeout(); - return this.transitModelIndex.getPatternsForStop(stop); + return this.timetableRepositoryIndex.getPatternsForStop(stop); } @Override public Collection getTripsForStop(StopLocation stop) { OTPRequestTimeoutException.checkForTimeout(); - return this.transitModelIndex.getTripsForStop(stop); + return this.timetableRepositoryIndex.getTripsForStop(stop); } @Override public Collection getAllOperators() { OTPRequestTimeoutException.checkForTimeout(); - return this.transitModelIndex.getAllOperators(); + return this.timetableRepository.getOperators(); } @Override public Operator getOperatorForId(FeedScopedId id) { - return this.transitModelIndex.getOperatorForId().get(id); + return this.timetableRepositoryIndex.getOperatorForId(id); } @Override public Collection listStopLocations() { OTPRequestTimeoutException.checkForTimeout(); - return transitModel.getStopModel().listStopLocations(); + return timetableRepository.getStopModel().listStopLocations(); } @Override public Collection listRegularStops() { OTPRequestTimeoutException.checkForTimeout(); - return transitModel.getStopModel().listRegularStops(); + return timetableRepository.getStopModel().listRegularStops(); } @Override public Collection listGroupStops() { OTPRequestTimeoutException.checkForTimeout(); - return transitModel.getStopModel().listGroupStops(); + return timetableRepository.getStopModel().listGroupStops(); } @Override public StopLocation getStopLocation(FeedScopedId id) { - return transitModel.getStopModel().getStopLocation(id); + return timetableRepository.getStopModel().getStopLocation(id); } @Override public Collection getStopOrChildStops(FeedScopedId id) { - return transitModel.getStopModel().findStopOrChildStops(id); + return timetableRepository.getStopModel().findStopOrChildStops(id); } @Override public Collection listStopLocationGroups() { OTPRequestTimeoutException.checkForTimeout(); - return transitModel.getStopModel().listStopLocationGroups(); + return timetableRepository.getStopModel().listStopLocationGroups(); } @Override public StopLocationsGroup getStopLocationsGroup(FeedScopedId id) { - return transitModel.getStopModel().getStopLocationsGroup(id); + return timetableRepository.getStopModel().getStopLocationsGroup(id); } @Override @@ -296,7 +291,7 @@ public Trip getTripForId(FeedScopedId id) { @Nullable @Override public Trip getScheduledTripForId(FeedScopedId id) { - return this.transitModelIndex.getTripForId().get(id); + return this.timetableRepositoryIndex.getTripForId(id); } @Override @@ -305,11 +300,11 @@ public Collection getAllTrips() { TimetableSnapshot currentSnapshot = lazyGetTimeTableSnapShot(); if (currentSnapshot != null) { return new CollectionsView<>( - transitModelIndex.getTripForId().values(), - currentSnapshot.getAllRealTimeAddedTrips() + timetableRepositoryIndex.getAllTrips(), + currentSnapshot.listRealTimeAddedTrips() ); } - return Collections.unmodifiableCollection(transitModelIndex.getTripForId().values()); + return Collections.unmodifiableCollection(timetableRepositoryIndex.getAllTrips()); } @Override @@ -318,11 +313,11 @@ public Collection getAllRoutes() { TimetableSnapshot currentSnapshot = lazyGetTimeTableSnapShot(); if (currentSnapshot != null) { return new CollectionsView<>( - transitModelIndex.getAllRoutes(), - currentSnapshot.getAllRealTimeAddedRoutes() + timetableRepositoryIndex.getAllRoutes(), + currentSnapshot.listRealTimeAddedRoutes() ); } - return Collections.unmodifiableCollection(transitModelIndex.getAllRoutes()); + return timetableRepositoryIndex.getAllRoutes(); } @Override @@ -334,12 +329,12 @@ public TripPattern getPatternForTrip(Trip trip) { return realtimeAddedTripPattern; } } - return this.transitModelIndex.getPatternForTrip().get(trip); + return this.timetableRepositoryIndex.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; } @@ -350,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) + timetableRepositoryIndex.getPatternsForRoute(route) ); TimetableSnapshot currentSnapshot = lazyGetTimeTableSnapShot(); if (currentSnapshot != null) { @@ -364,7 +359,7 @@ public Collection getPatternsForRoute(Route route) { @Override public MultiModalStation getMultiModalStationForStation(Station station) { - return this.transitModel.getStopModel().getMultiModalStationForStation(station); + return this.timetableRepository.getStopModel().getMultiModalStationForStation(station); } /** @@ -470,7 +465,7 @@ public List stopTimesForPatternAtStop( * Returns all the patterns for a specific stop. If includeRealtimeUpdates is set, new patterns * added by realtime updates are added to the collection. * A set is used here because trip patterns - * that were updated by realtime data is both part of the TransitModelIndex and the TimetableSnapshot + * that were updated by realtime data is both part of the TimetableRepositoryIndex and the TimetableSnapshot */ @Override public Collection getPatternsForStop( @@ -491,18 +486,18 @@ public Collection getPatternsForStop( @Override public Collection getGroupsOfRoutes() { OTPRequestTimeoutException.checkForTimeout(); - return transitModelIndex.getRoutesForGroupOfRoutes().keySet(); + return timetableRepositoryIndex.getAllGroupOfRoutes(); } @Override public Collection getRoutesForGroupOfRoutes(GroupOfRoutes groupOfRoutes) { OTPRequestTimeoutException.checkForTimeout(); - return transitModelIndex.getRoutesForGroupOfRoutes().get(groupOfRoutes); + return timetableRepositoryIndex.getRoutesForGroupOfRoutes(groupOfRoutes); } @Override public GroupOfRoutes getGroupOfRoutesForId(FeedScopedId id) { - return transitModelIndex.getGroupOfRoutesForId().get(id); + return timetableRepositoryIndex.getGroupOfRoutesForId(id); } /** @@ -520,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(); } /** @@ -545,23 +540,23 @@ public boolean hasRealtimeAddedTripPatterns() { @Nullable private TimetableSnapshot lazyGetTimeTableSnapShot() { if (this.timetableSnapshot == null) { - timetableSnapshot = transitModel.getTimetableSnapshot(); + timetableSnapshot = timetableRepository.getTimetableSnapshot(); } return this.timetableSnapshot; } @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 timetableRepository.getTripOnServiceDateById(tripOnServiceDateId); } @Override @@ -569,13 +564,11 @@ public Collection getAllTripOnServiceDates() { TimetableSnapshot currentSnapshot = lazyGetTimeTableSnapShot(); if (currentSnapshot != null) { return new CollectionsView<>( - transitModelIndex.getTripOnServiceDateForTripAndDay().values(), - currentSnapshot.getAllRealTimeAddedTripOnServiceDate() + timetableRepository.getAllTripsOnServiceDates(), + currentSnapshot.listRealTimeAddedTripOnServiceDate() ); } - return Collections.unmodifiableCollection( - transitModelIndex.getTripOnServiceDateForTripAndDay().values() - ); + return timetableRepository.getAllTripsOnServiceDates(); } @Override @@ -591,7 +584,7 @@ public TripOnServiceDate getTripOnServiceDateForTripAndDay( return tripOnServiceDate; } } - return transitModelIndex.getTripOnServiceDateForTripAndDay().get(tripIdAndServiceDate); + return timetableRepositoryIndex.getTripOnServiceDateForTripAndDay(tripIdAndServiceDate); } /** @@ -603,12 +596,7 @@ public TripOnServiceDate getTripOnServiceDateForTripAndDay( @Override public List getTripOnServiceDates(TripOnServiceDateRequest request) { Matcher matcher = TripOnServiceDateMatcherFactory.of(request); - return transitModelIndex - .getTripOnServiceDateForTripAndDay() - .values() - .stream() - .filter(matcher::match) - .collect(Collectors.toList()); + return getAllTripOnServiceDates().stream().filter(matcher::match).toList(); } /** @@ -617,96 +605,96 @@ public List getTripOnServiceDates(TripOnServiceDateRequest re */ @Override public FeedScopedId getOrCreateServiceIdForDate(LocalDate serviceDate) { - return transitModel.getOrCreateServiceIdForDate(serviceDate); + return timetableRepository.getOrCreateServiceIdForDate(serviceDate); } @Override public void addTransitMode(TransitMode mode) { - this.transitModel.addTransitMode(mode); + this.timetableRepository.addTransitMode(mode); } @Override public Set getTransitModes() { - return this.transitModel.getTransitModes(); + return this.timetableRepository.getTransitModes(); } @Override public Collection getTransfersByStop(StopLocation stop) { - return this.transitModel.getTransfersByStop(stop); + return this.timetableRepository.getTransfersByStop(stop); } @Override public TransitLayer getTransitLayer() { OTPRequestTimeoutException.checkForTimeout(); - return this.transitModel.getTransitLayer(); + return this.timetableRepository.getTransitLayer(); } @Override public TransitLayer getRealtimeTransitLayer() { OTPRequestTimeoutException.checkForTimeout(); - return this.transitModel.getRealtimeTransitLayer(); + return this.timetableRepository.getRealtimeTransitLayer(); } @Override public void setTransitLayer(TransitLayer transitLayer) { - this.transitModel.setTransitLayer(transitLayer); + this.timetableRepository.setTransitLayer(transitLayer); } @Override public void setRealtimeTransitLayer(TransitLayer realtimeTransitLayer) { - transitModel.setRealtimeTransitLayer(realtimeTransitLayer); + timetableRepository.setRealtimeTransitLayer(realtimeTransitLayer); } @Override public boolean hasRealtimeTransitLayer() { - return transitModel.hasRealtimeTransitLayer(); + return timetableRepository.hasRealtimeTransitLayer(); } @Override public CalendarService getCalendarService() { - return this.transitModel.getCalendarService(); + return this.timetableRepository.getCalendarService(); } @Override public ZoneId getTimeZone() { - return this.transitModel.getTimeZone(); + return this.timetableRepository.getTimeZone(); } @Override public TransitAlertService getTransitAlertService() { - return this.transitModel.getTransitAlertService(); + return this.timetableRepository.getTransitAlertService(); } @Override public FlexIndex getFlexIndex() { - return this.transitModelIndex.getFlexIndex(); + return this.timetableRepositoryIndex.getFlexIndex(); } @Override public ZonedDateTime getTransitServiceEnds() { - return transitModel.getTransitServiceEnds(); + return timetableRepository.getTransitServiceEnds(); } @Override public ZonedDateTime getTransitServiceStarts() { - return transitModel.getTransitServiceStarts(); + return timetableRepository.getTransitServiceStarts(); } @Override public Collection findRegularStops(Envelope envelope) { OTPRequestTimeoutException.checkForTimeout(); - return transitModel.getStopModel().findRegularStops(envelope); + return timetableRepository.getStopModel().findRegularStops(envelope); } @Override public Collection findAreaStops(Envelope envelope) { OTPRequestTimeoutException.checkForTimeout(); - return transitModel.getStopModel().findAreaStops(envelope); + return timetableRepository.getStopModel().findAreaStops(envelope); } @Override public GraphUpdaterStatus getUpdaterStatus() { - return transitModel.getUpdaterManager(); + return timetableRepository.getUpdaterManager(); } @Override @@ -724,17 +712,19 @@ public List getModesOfStopLocation(StopLocation stop) { @Override public Deduplicator getDeduplicator() { - return transitModel.getDeduplicator(); + return timetableRepository.getDeduplicator(); } @Override public Set getAllServiceCodes() { - return Collections.unmodifiableSet(transitModelIndex.getServiceCodesRunningForDate().keySet()); + return Collections.unmodifiableSet( + timetableRepositoryIndex.getServiceCodesRunningForDate().keySet() + ); } @Override public Map getServiceCodesRunningForDate() { - return Collections.unmodifiableMap(transitModelIndex.getServiceCodesRunningForDate()); + return Collections.unmodifiableMap(timetableRepositoryIndex.getServiceCodesRunningForDate()); } /** @@ -750,12 +740,12 @@ private Stream getPatternModesOfStop(StopLocation stop) { @Override public TransferService getTransferService() { - return transitModel.getTransferService(); + return timetableRepository.getTransferService(); } @Override public boolean transitFeedCovers(Instant dateTime) { - return transitModel.transitFeedCovers(dateTime); + return timetableRepository.transitFeedCovers(dateTime); } /** diff --git a/src/main/java/org/opentripplanner/transit/service/PatternByServiceDatesFilter.java b/application/src/main/java/org/opentripplanner/transit/service/PatternByServiceDatesFilter.java similarity index 100% rename from src/main/java/org/opentripplanner/transit/service/PatternByServiceDatesFilter.java rename to application/src/main/java/org/opentripplanner/transit/service/PatternByServiceDatesFilter.java 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/TransitModel.java b/application/src/main/java/org/opentripplanner/transit/service/TimetableRepository.java similarity index 91% rename from src/main/java/org/opentripplanner/transit/service/TransitModel.java rename to application/src/main/java/org/opentripplanner/transit/service/TimetableRepository.java index b2347bf6351..f12ade0f83c 100644 --- a/src/main/java/org/opentripplanner/transit/service/TransitModel.java +++ b/application/src/main/java/org/opentripplanner/transit/service/TimetableRepository.java @@ -13,6 +13,7 @@ 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; @@ -20,7 +21,6 @@ import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opentripplanner.ext.flex.trip.FlexTrip; import org.opentripplanner.framework.lang.ObjectUtils; @@ -59,32 +59,32 @@ import org.slf4j.LoggerFactory; /** - * The TransitModel groups together all instances making up OTP's primary internal representation + * The TimetableRepository groups together all instances making up OTP's primary internal representation * of the public transportation network. Although the names of many entities are derived from * GTFS concepts, these are actually independent of the data source from which they are loaded. * Both GTFS and NeTEx entities are mapped to these same internal OTP entities. If a concept exists * in both GTFS and NeTEx, the GTFS name is used in the internal model. For concepts that exist * only in NeTEx, the NeTEx name is used in the internal model. * - * A TransitModel instance also includes references to some transient indexes of its contents, to + * A TimetableRepository instance also includes references to some transient indexes of its contents, to * the TransitLayer derived from it, and to some other services and utilities that operate upon * its contents. * - * The TransitModel stands in opposition to two other aggregates: the Graph (representing the - * street network) and the TransitLayer (representing many of the same things in the TransitModel + * The TimetableRepository stands in opposition to two other aggregates: the Graph (representing the + * street network) and the TransitLayer (representing many of the same things in the TimetableRepository * but rearranged to be more efficient for Raptor routing). * - * At this point the TransitModel is not often read directly. Many requests will look at the - * TransitLayer rather than the TransitModel it's derived from. Both are often accessed via the - * TransitService rather than directly reading the fields of TransitModel or TransitLayer. + * At this point the TimetableRepository is not often read directly. Many requests will look at the + * TransitLayer rather than the TimetableRepository it's derived from. Both are often accessed via the + * TransitService rather than directly reading the fields of TimetableRepository or TransitLayer. * * TODO RT_AB: consider renaming. By some definitions this is not really the model, but a top-level * object grouping together instances of model classes with things that operate on and map those * instances. */ -public class TransitModel implements Serializable { +public class TimetableRepository implements Serializable { - private static final Logger LOG = LoggerFactory.getLogger(TransitModel.class); + private static final Logger LOG = LoggerFactory.getLogger(TimetableRepository.class); private final Collection agencies = new ArrayList<>(); private final Collection operators = new ArrayList<>(); @@ -105,22 +105,22 @@ public class TransitModel implements Serializable { private ZonedDateTime transitServiceEnds = LocalDate.MIN.atStartOfDay(ZoneId.systemDefault()); /** - * The TransitLayer representation (optimized and rearranged for Raptor) of this TransitModel's + * The TransitLayer representation (optimized and rearranged for Raptor) of this TimetableRepository's * scheduled (non-realtime) contents. */ private transient TransitLayer transitLayer; /** * This updater applies realtime changes queued up for the next TimetableSnapshot such that - * this TransitModel.realtimeSnapshot remains aligned with the service represented in - * (this TransitModel instance + that next TimetableSnapshot). This is a way of keeping the + * this TimetableRepository.realtimeSnapshot remains aligned with the service represented in + * (this TimetableRepository instance + that next TimetableSnapshot). This is a way of keeping the * TransitLayer up to date without repeatedly deriving it from scratch every few seconds. The * same incremental changes are applied to both sets of data and they are published together. */ private transient TransitLayerUpdater transitLayerUpdater; /** - * An optionally present second TransitLayer representing the contents of this TransitModel plus + * An optionally present second TransitLayer representing the contents of this TimetableRepository plus * the results of realtime updates in the latest TimetableSnapshot. */ private final transient ConcurrentPublished realtimeTransitLayer = new ConcurrentPublished<>(); @@ -129,7 +129,7 @@ public class TransitModel implements Serializable { private final CalendarServiceData calendarServiceData = new CalendarServiceData(); - private transient TransitModelIndex index; + private transient TimetableRepositoryIndex index; private transient TimetableSnapshotProvider timetableSnapshotProvider = null; private ZoneId timeZone = null; private boolean timeZoneExplicitlySet = false; @@ -149,13 +149,13 @@ public class TransitModel implements Serializable { private transient TransitAlertService transitAlertService; @Inject - public TransitModel(StopModel stopModel, Deduplicator deduplicator) { + public TimetableRepository(StopModel stopModel, Deduplicator deduplicator) { this.stopModel = Objects.requireNonNull(stopModel); this.deduplicator = deduplicator; } /** No-argument constructor, required for deserialization. */ - public TransitModel() { + public TimetableRepository() { this(new StopModel(), new Deduplicator()); } @@ -168,7 +168,7 @@ public void index() { if (index == null) { LOG.info("Index transit model..."); // the transit model indexing updates the stop model index (flex stops added to the stop index) - this.index = new TransitModelIndex(this); + this.index = new TimetableRepositoryIndex(this); LOG.info("Index transit model complete."); } } @@ -265,7 +265,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()); @@ -354,7 +354,11 @@ public Set getAgencyTimeZones() { } public Collection getOperators() { - return operators; + return Collections.unmodifiableCollection(operators); + } + + public void addOperators(Collection operators) { + this.operators.addAll(operators); } /** @@ -411,9 +415,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); } /** @@ -447,8 +451,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()); } /** @@ -544,7 +552,7 @@ public void setHasScheduledService(boolean hasScheduledService) { * possibility that the index is not initialized (during graph build). */ @Nullable - TransitModelIndex getTransitModelIndex() { + TimetableRepositoryIndex getTimetableRepositoryIndex() { return index; } diff --git a/src/main/java/org/opentripplanner/transit/service/TransitModelIndex.java b/application/src/main/java/org/opentripplanner/transit/service/TimetableRepositoryIndex.java similarity index 74% rename from src/main/java/org/opentripplanner/transit/service/TransitModelIndex.java rename to application/src/main/java/org/opentripplanner/transit/service/TimetableRepositoryIndex.java index 36ab937416c..dc618b0943f 100644 --- a/src/main/java/org/opentripplanner/transit/service/TransitModelIndex.java +++ b/application/src/main/java/org/opentripplanner/transit/service/TimetableRepositoryIndex.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; @@ -34,9 +35,9 @@ * For performance reasons these indexes are not part of the serialized state of the graph. * They are rebuilt at runtime after graph deserialization. */ -class TransitModelIndex { +class TimetableRepositoryIndex { - private static final Logger LOG = LoggerFactory.getLogger(TransitModelIndex.class); + private static final Logger LOG = LoggerFactory.getLogger(TimetableRepositoryIndex.class); // TODO: consistently key on model object or id string private final Map agencyForId = new HashMap<>(); @@ -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(); @@ -58,18 +58,18 @@ class TransitModelIndex { private final Map groupOfRoutesForId = new HashMap<>(); private FlexIndex flexIndex = null; - TransitModelIndex(TransitModel transitModel) { + TimetableRepositoryIndex(TimetableRepository timetableRepository) { LOG.info("Transit model index init..."); - for (Agency agency : transitModel.getAgencies()) { + for (Agency agency : timetableRepository.getAgencies()) { this.agencyForId.put(agency.getId(), agency); } - for (Operator operator : transitModel.getOperators()) { + for (Operator operator : timetableRepository.getOperators()) { this.operatorForId.put(operator.getId(), operator); } - for (TripPattern pattern : transitModel.getAllTripPatterns()) { + for (TripPattern pattern : timetableRepository.getAllTripPatterns()) { patternsForRoute.put(pattern.getRoute(), pattern); pattern .scheduledTripsAsStream() @@ -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 : timetableRepository.getAllTripsOnServiceDates()) { tripOnServiceDateForTripAndDay.put( new TripIdAndServiceDate( tripOnServiceDate.getTrip().getId(), @@ -102,10 +101,10 @@ class TransitModelIndex { ); } - initalizeServiceCodesForDate(transitModel); + initalizeServiceCodesForDate(timetableRepository); if (OTPFeature.FlexRouting.isOn()) { - flexIndex = new FlexIndex(transitModel); + flexIndex = new FlexIndex(timetableRepository); for (Route route : flexIndex.getAllFlexRoutes()) { routeForId.put(route.getId(), route); } @@ -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() { @@ -192,8 +185,8 @@ FlexIndex getFlexIndex() { return flexIndex; } - private void initalizeServiceCodesForDate(TransitModel transitModel) { - CalendarService calendarService = transitModel.getCalendarService(); + private void initalizeServiceCodesForDate(TimetableRepository timetableRepository) { + CalendarService calendarService = timetableRepository.getCalendarService(); if (calendarService == null) { return; @@ -223,17 +216,21 @@ private void initalizeServiceCodesForDate(TransitModel transitModel) { for (LocalDate serviceDate : serviceIdsForServiceDate.keySet()) { TIntSet serviceCodesRunning = new TIntHashSet(); for (FeedScopedId serviceId : serviceIdsForServiceDate.get(serviceDate)) { - serviceCodesRunning.add(transitModel.getServiceCodes().get(serviceId)); + serviceCodesRunning.add(timetableRepository.getServiceCodes().get(serviceId)); } serviceCodesRunningForDate.put(serviceDate, serviceCodesRunning); } } - 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/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/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 1e7c4ff8397..7be2a29065a 100644 --- a/src/main/java/org/opentripplanner/transit/service/TransitService.java +++ b/application/src/main/java/org/opentripplanner/transit/service/TransitService.java @@ -54,12 +54,12 @@ * fetching tables of specific information like the routes passing through a particular stop, or for * gaining access to the entirety of the data to perform routing. *

    - * TODO RT_AB: this interface seems to provide direct access to TransitLayer but not TransitModel. - * Is this intentional, because TransitLayer is meant to be read-only and TransitModel is not? + * TODO RT_AB: this interface seems to provide direct access to TransitLayer but not TimetableRepository. + * Is this intentional, because TransitLayer is meant to be read-only and TimetableRepository is not? * Should this be renamed TransitDataService since it seems to provide access to the data but * not to transit routing functionality (which is provided by the RoutingService)? - * The DefaultTransitService implementation has a TransitModel instance and many of its methods - * read through to that TransitModel instance. But that field itself is not exposed, while the + * The DefaultTransitService implementation has a TimetableRepository instance and many of its methods + * read through to that TimetableRepository instance. But that field itself is not exposed, while the * TransitLayer is here. It seems like exposing the raw TransitLayer is still a risk since it's * copy-on-write and shares a lot of objects with any other TransitLayer instances. */ @@ -71,8 +71,6 @@ public interface TransitService { FeedInfo getFeedInfo(String feedId); - Collection getOperators(); - Collection getNoticesByEntity(AbstractTransitEntity entity); /** @@ -140,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(); @@ -234,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); diff --git a/src/main/java/org/opentripplanner/updater/DefaultRealTimeUpdateContext.java b/application/src/main/java/org/opentripplanner/updater/DefaultRealTimeUpdateContext.java similarity index 74% rename from src/main/java/org/opentripplanner/updater/DefaultRealTimeUpdateContext.java rename to application/src/main/java/org/opentripplanner/updater/DefaultRealTimeUpdateContext.java index 0921ed5a30d..f30111608cc 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.TimetableRepository; import org.opentripplanner.transit.service.TransitService; +import org.opentripplanner.updater.siri.EntityResolver; +import org.opentripplanner.updater.siri.SiriFuzzyTripMatcher; public class DefaultRealTimeUpdateContext implements RealTimeUpdateContext { @@ -16,18 +16,18 @@ public class DefaultRealTimeUpdateContext implements RealTimeUpdateContext { public DefaultRealTimeUpdateContext( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, TimetableSnapshot timetableSnapshotBuffer ) { this.graph = graph; - this.transitService = new DefaultTransitService(transitModel, timetableSnapshotBuffer); + this.transitService = new DefaultTransitService(timetableRepository, timetableSnapshotBuffer); } /** * Constructor for unit tests only. */ - public DefaultRealTimeUpdateContext(Graph graph, TransitModel transitModel) { - this(graph, transitModel, null); + public DefaultRealTimeUpdateContext(Graph graph, TimetableRepository timetableRepository) { + this(graph, timetableRepository, null); } @Override 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 95% rename from src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java rename to application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java index 728c07690ab..23b6d741e10 100644 --- a/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java @@ -7,7 +7,7 @@ import org.opentripplanner.framework.tostring.ToStringBuilder; import org.opentripplanner.routing.impl.TransitAlertServiceImpl; import org.opentripplanner.routing.services.TransitAlertService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.spi.HttpHeaders; import org.opentripplanner.updater.spi.PollingGraphUpdater; import org.opentripplanner.updater.spi.WriteToGraphCallback; @@ -31,12 +31,12 @@ public class GtfsRealtimeAlertsUpdater extends PollingGraphUpdater implements Tr public GtfsRealtimeAlertsUpdater( GtfsRealtimeAlertsUpdaterParameters config, - TransitModel transitModel + TimetableRepository timetableRepository ) { super(config); this.url = config.url(); this.headers = HttpHeaders.of().acceptProtobuf().add(config.headers()).build(); - TransitAlertService transitAlertService = new TransitAlertServiceImpl(transitModel); + TransitAlertService transitAlertService = new TransitAlertServiceImpl(timetableRepository); this.transitAlertService = transitAlertService; 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 88% 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..feea541741c 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; @@ -17,11 +13,15 @@ import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.service.realtimevehicles.RealtimeVehicleRepository; import org.opentripplanner.service.vehiclerental.VehicleRentalRepository; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.DefaultRealTimeUpdateContext; 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; @@ -45,7 +45,7 @@ public class UpdaterConfigurator { private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final UpdatersParameters updatersParameters; private final RealtimeVehicleRepository realtimeVehicleRepository; private final VehicleRentalRepository vehicleRentalRepository; @@ -56,13 +56,13 @@ private UpdaterConfigurator( Graph graph, RealtimeVehicleRepository realtimeVehicleRepository, VehicleRentalRepository vehicleRentalRepository, - TransitModel transitModel, + TimetableRepository timetableRepository, UpdatersParameters updatersParameters ) { this.graph = graph; this.realtimeVehicleRepository = realtimeVehicleRepository; this.vehicleRentalRepository = vehicleRentalRepository; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.updatersParameters = updatersParameters; } @@ -70,14 +70,14 @@ public static void configure( Graph graph, RealtimeVehicleRepository realtimeVehicleRepository, VehicleRentalRepository vehicleRentalRepository, - TransitModel transitModel, + TimetableRepository timetableRepository, UpdatersParameters updatersParameters ) { new UpdaterConfigurator( graph, realtimeVehicleRepository, vehicleRentalRepository, - transitModel, + timetableRepository, updatersParameters ) .configure(); @@ -102,7 +102,7 @@ private void configure() { timetableSnapshotBuffer = gtfsTimetableSnapshotSource.getTimetableSnapshotBuffer(); } GraphUpdaterManager updaterManager = new GraphUpdaterManager( - new DefaultRealTimeUpdateContext(graph, transitModel, timetableSnapshotBuffer), + new DefaultRealTimeUpdateContext(graph, timetableRepository, timetableSnapshotBuffer), updaters ); @@ -116,12 +116,12 @@ private void configure() { } // Otherwise add it to the graph else { - transitModel.setUpdaterManager(updaterManager); + timetableRepository.setUpdaterManager(updaterManager); } } - public static void shutdownGraph(TransitModel transitModel) { - GraphUpdaterManager updaterManager = transitModel.getUpdaterManager(); + public static void shutdownGraph(TimetableRepository timetableRepository) { + GraphUpdaterManager updaterManager = timetableRepository.getUpdaterManager(); if (updaterManager != null) { updaterManager.stop(); } @@ -167,7 +167,7 @@ private List createUpdatersFromConfig() { } } for (var configItem : updatersParameters.getGtfsRealtimeAlertsUpdaterParameters()) { - updaters.add(new GtfsRealtimeAlertsUpdater(configItem, transitModel)); + updaters.add(new GtfsRealtimeAlertsUpdater(configItem, timetableRepository)); } for (var configItem : updatersParameters.getPollingStoptimeUpdaterParameters()) { updaters.add(new PollingTripUpdater(configItem, provideGtfsTimetableSnapshot())); @@ -182,7 +182,7 @@ private List createUpdatersFromConfig() { updaters.add(new SiriETGooglePubsubUpdater(configItem, provideSiriTimetableSnapshot())); } for (var configItem : updatersParameters.getSiriSXUpdaterParameters()) { - updaters.add(new SiriSXUpdater(configItem, transitModel)); + updaters.add(new SiriSXUpdater(configItem, timetableRepository)); } for (var configItem : updatersParameters.getMqttGtfsRealtimeUpdaterParameters()) { updaters.add(new MqttGtfsRealtimeUpdater(configItem, provideGtfsTimetableSnapshot())); @@ -219,7 +219,7 @@ private List createUpdatersFromConfig() { updaters.add(new SiriAzureETUpdater(configItem, provideSiriTimetableSnapshot())); } for (var configItem : updatersParameters.getSiriAzureSXUpdaterParameters()) { - updaters.add(new SiriAzureSXUpdater(configItem, transitModel)); + updaters.add(new SiriAzureSXUpdater(configItem, timetableRepository)); } return updaters; @@ -230,7 +230,7 @@ private SiriTimetableSnapshotSource provideSiriTimetableSnapshot() { this.siriTimetableSnapshotSource = new SiriTimetableSnapshotSource( updatersParameters.timetableSnapshotParameters(), - transitModel + timetableRepository ); } @@ -240,7 +240,10 @@ private SiriTimetableSnapshotSource provideSiriTimetableSnapshot() { private TimetableSnapshotSource provideGtfsTimetableSnapshot() { if (gtfsTimetableSnapshotSource == null) { this.gtfsTimetableSnapshotSource = - new TimetableSnapshotSource(updatersParameters.timetableSnapshotParameters(), transitModel); + new TimetableSnapshotSource( + updatersParameters.timetableSnapshotParameters(), + timetableRepository + ); } return gtfsTimetableSnapshotSource; } 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 ed2378a839d..c3bb31ed068 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; @@ -181,7 +180,7 @@ Result build() { } route = createRoute(agency); isAddedRoute = true; - LOG.info("Adding route {} to transitModel.", route); + LOG.info("Adding route {} to timetableRepository.", route); } Trip trip = createTrip(route, calServiceId); @@ -286,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 96% 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..b6aa5310d83 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; @@ -24,8 +24,8 @@ import org.opentripplanner.transit.model.timetable.Trip; import org.opentripplanner.transit.model.timetable.TripTimes; import org.opentripplanner.transit.service.DefaultTransitService; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitEditorService; -import org.opentripplanner.transit.service.TransitModel; import org.opentripplanner.updater.TimetableSnapshotSourceParameters; import org.opentripplanner.updater.spi.DataValidationExceptionMapper; import org.opentripplanner.updater.spi.UpdateError; @@ -69,20 +69,20 @@ public class SiriTimetableSnapshotSource implements TimetableSnapshotProvider { public SiriTimetableSnapshotSource( TimetableSnapshotSourceParameters parameters, - TransitModel transitModel + TimetableRepository timetableRepository ) { this.snapshotManager = new TimetableSnapshotManager( - transitModel.getTransitLayerUpdater(), + timetableRepository.getTransitLayerUpdater(), parameters, - () -> LocalDate.now(transitModel.getTimeZone()) + () -> LocalDate.now(timetableRepository.getTimeZone()) ); this.transitEditorService = - new DefaultTransitService(transitModel, getTimetableSnapshotBuffer()); + new DefaultTransitService(timetableRepository, getTimetableSnapshotBuffer()); this.tripPatternCache = new SiriTripPatternCache(tripPatternIdGenerator, transitEditorService::getPatternForTrip); - transitModel.initTimetableSnapshotProvider(this); + timetableRepository.initTimetableSnapshotProvider(this); } /** @@ -244,7 +244,7 @@ private Result handleModifiedTrip( estimatedVehicleJourney, entityResolver, this::getCurrentTimetable, - snapshotManager::getRealtimeAddedTripPattern + snapshotManager::getNewTripPatternForModifiedTrip ); if (tripAndPattern == null) { @@ -293,7 +293,7 @@ private Result handleModifiedTrip( } /** - * Add a (new) trip to the transitModel and the buffer + * Add a (new) trip to the timetableRepository and the buffer */ private Result addTripToGraphAndBuffer(TripUpdate tripUpdate) { Trip trip = tripUpdate.tripTimes().getTrip(); 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 96% 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..19816bd085f 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); @@ -101,7 +100,7 @@ public synchronized TripPattern getOrCreateTripPattern( .withCreatedByRealtimeUpdater(true) .withOriginalTripPattern(originalTripPattern) .build(); - // TODO: Add pattern to transitModel index? + // TODO: Add pattern to timetableRepository index? // Add pattern to cache cache.put(key, tripPattern); 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 94% 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..83200db30d3 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,17 +1,17 @@ -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; import org.opentripplanner.routing.impl.TransitAlertServiceImpl; import org.opentripplanner.routing.services.TransitAlertService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; 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; @@ -43,7 +43,7 @@ public class SiriSXUpdater extends PollingGraphUpdater implements TransitAlertPr private final SiriHttpLoader siriHttpLoader; private final OtpRetry retry; - public SiriSXUpdater(SiriSXUpdaterParameters config, TransitModel transitModel) { + public SiriSXUpdater(SiriSXUpdaterParameters config, TimetableRepository timetableRepository) { super(config); // TODO: add options to choose different patch services this.url = config.url(); @@ -56,7 +56,7 @@ public SiriSXUpdater(SiriSXUpdaterParameters config, TransitModel transitModel) //Keeping original requestorRef use as base for updated requestorRef to be used in retries this.originalRequestorRef = requestorRef; this.blockReadinessUntilInitialized = config.blockReadinessUntilInitialized(); - this.transitAlertService = new TransitAlertServiceImpl(transitModel); + this.transitAlertService = new TransitAlertServiceImpl(timetableRepository); this.updateHandler = new SiriAlertsUpdateHandler(config.feedId(), transitAlertService, config.earlyStart()); siriHttpLoader = new SiriHttpLoader(url, config.timeout(), config.requestHeaders()); @@ -120,11 +120,11 @@ private void updateSiri() { // Such runnables should be illustrated in documentation as e.g. a little box labeled // "change trip ABC123 by making stop 53 late by 2 minutes." // Also clarify how this runnable works without even using the supplied - // (graph, transitModel) parameters. There are multiple TransitAlertServices and they + // (graph, timetableRepository) parameters. There are multiple TransitAlertServices and they // are not versioned along with the Graph, they are attached to updaters. // // This is submitting a runnable to an executor, but that runnable only writes back to - // objects referenced by updateHandler itself, rather than the graph or transitModel + // objects referenced by updateHandler itself, rather than the graph or timetableRepository // supplied for writing, and apparently with no versioning. This seems like a // misinterpretation of the realtime design. // If this is an intentional choice to live-patch a single server-wide instance of an 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 97% 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..f83fa9d247e 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; @@ -61,8 +60,8 @@ import org.opentripplanner.transit.model.timetable.Trip; import org.opentripplanner.transit.model.timetable.TripTimesFactory; import org.opentripplanner.transit.service.DefaultTransitService; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitEditorService; -import org.opentripplanner.transit.service.TransitModel; import org.opentripplanner.updater.GtfsRealtimeFuzzyTripMatcher; import org.opentripplanner.updater.GtfsRealtimeMapper; import org.opentripplanner.updater.TimetableSnapshotSourceParameters; @@ -109,9 +108,9 @@ public class TimetableSnapshotSource implements TimetableSnapshotProvider { public TimetableSnapshotSource( TimetableSnapshotSourceParameters parameters, - TransitModel transitModel + TimetableRepository timetableRepository ) { - this(parameters, transitModel, () -> LocalDate.now(transitModel.getTimeZone())); + this(parameters, timetableRepository, () -> LocalDate.now(timetableRepository.getTimeZone())); } /** @@ -120,20 +119,24 @@ public TimetableSnapshotSource( */ TimetableSnapshotSource( TimetableSnapshotSourceParameters parameters, - TransitModel transitModel, + TimetableRepository timetableRepository, Supplier localDateNow ) { this.snapshotManager = - new TimetableSnapshotManager(transitModel.getTransitLayerUpdater(), parameters, localDateNow); - this.timeZone = transitModel.getTimeZone(); + new TimetableSnapshotManager( + timetableRepository.getTransitLayerUpdater(), + parameters, + localDateNow + ); + this.timeZone = timetableRepository.getTimeZone(); this.transitEditorService = - new DefaultTransitService(transitModel, snapshotManager.getTimetableSnapshotBuffer()); - this.deduplicator = transitModel.getDeduplicator(); - this.serviceCodes = transitModel.getServiceCodes(); + new DefaultTransitService(timetableRepository, snapshotManager.getTimetableSnapshotBuffer()); + this.deduplicator = timetableRepository.getDeduplicator(); + this.serviceCodes = timetableRepository.getServiceCodes(); this.localDateNow = localDateNow; // Inject this into the transit model - transitModel.initTimetableSnapshotProvider(this); + timetableRepository.initTimetableSnapshotProvider(this); } /** @@ -295,7 +298,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 +519,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 +953,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 7d1c69a75f4..28024656e28 100644 --- a/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls +++ b/application/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls @@ -1522,7 +1522,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). @@ -1607,7 +1607,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" 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 a3d0c013955..9aa743fd42d 100644 --- a/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql +++ b/application/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql @@ -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 { @@ -2187,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 88% rename from src/test/java/org/opentripplanner/ConstantsForTests.java rename to application/src/test/java/org/opentripplanner/ConstantsForTests.java index e74c66e527b..241cc245da1 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; @@ -44,7 +44,7 @@ import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class ConstantsForTests { @@ -124,7 +124,7 @@ public static TestOtpModel buildNewPortlandGraph(boolean withElevation) { try { var deduplicator = new Deduplicator(); var graph = new Graph(deduplicator); - var transitModel = new TransitModel(new StopModel(), deduplicator); + var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); // Add street data from OSM { OsmProvider osmProvider = new OsmProvider(PORTLAND_CENTRAL_OSM, false); @@ -137,10 +137,16 @@ public static TestOtpModel buildNewPortlandGraph(boolean withElevation) { } // Add transit data from GTFS { - addGtfsToGraph(graph, transitModel, PORTLAND_GTFS, new DefaultFareServiceFactory(), "prt"); + addGtfsToGraph( + graph, + timetableRepository, + PORTLAND_GTFS, + new DefaultFareServiceFactory(), + "prt" + ); } // Link transit stops to streets - TestStreetLinkerModule.link(graph, transitModel); + TestStreetLinkerModule.link(graph, timetableRepository); // Add elevation data if (withElevation) { @@ -155,10 +161,10 @@ public static TestOtpModel buildNewPortlandGraph(boolean withElevation) { addPortlandVehicleRentals(graph); - transitModel.index(); - graph.index(transitModel.getStopModel()); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); - return new TestOtpModel(graph, transitModel); + return new TestOtpModel(graph, timetableRepository); } catch (Exception e) { throw new RuntimeException(e); } @@ -169,12 +175,12 @@ public static TestOtpModel buildOsmGraph(File osmFile) { var deduplicator = new Deduplicator(); var stopModel = new StopModel(); var graph = new Graph(deduplicator); - var transitModel = new TransitModel(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(stopModel, deduplicator); // Add street data from OSM OsmProvider osmProvider = new OsmProvider(osmFile, true); OsmModule osmModule = OsmModule.of(osmProvider, graph).build(); osmModule.buildGraph(); - return new TestOtpModel(graph, transitModel); + return new TestOtpModel(graph, timetableRepository); } catch (Exception e) { throw new RuntimeException(e); } @@ -185,14 +191,14 @@ public static TestOtpModel buildOsmAndGtfsGraph(File osmPath, File gtfsPath) { addGtfsToGraph( otpModel.graph(), - otpModel.transitModel(), + otpModel.timetableRepository(), gtfsPath, new DefaultFareServiceFactory(), null ); // Link transit stops to streets - TestStreetLinkerModule.link(otpModel.graph(), otpModel.transitModel()); + TestStreetLinkerModule.link(otpModel.graph(), otpModel.timetableRepository()); return otpModel; } @@ -205,9 +211,9 @@ public static TestOtpModel buildGtfsGraph(File gtfsFile, FareServiceFactory fare var deduplicator = new Deduplicator(); var stopModel = new StopModel(); var graph = new Graph(deduplicator); - var transitModel = new TransitModel(stopModel, deduplicator); - addGtfsToGraph(graph, transitModel, gtfsFile, fareServiceFactory, null); - return new TestOtpModel(graph, transitModel); + var timetableRepository = new TimetableRepository(stopModel, deduplicator); + addGtfsToGraph(graph, timetableRepository, gtfsFile, fareServiceFactory, null); + return new TestOtpModel(graph, timetableRepository); } public static TestOtpModel buildNewMinimalNetexGraph() { @@ -215,7 +221,7 @@ public static TestOtpModel buildNewMinimalNetexGraph() { var deduplicator = new Deduplicator(); var stopModel = new StopModel(); var graph = new Graph(deduplicator); - var transitModel = new TransitModel(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(stopModel, deduplicator); // Add street data from OSM { OsmProvider osmProvider = new OsmProvider(OSLO_EAST_OSM, false); @@ -232,13 +238,13 @@ public static TestOtpModel buildNewMinimalNetexGraph() { var sources = List.of(new ConfiguredDataSource<>(NETEX_MINIMAL_DATA_SOURCE, netexConfig)); new NetexConfigure(buildConfig) - .createNetexModule(sources, transitModel, graph, DataImportIssueStore.NOOP) + .createNetexModule(sources, timetableRepository, graph, DataImportIssueStore.NOOP) .buildGraph(); } // Link transit stops to streets - TestStreetLinkerModule.link(graph, transitModel); + TestStreetLinkerModule.link(graph, timetableRepository); - return new TestOtpModel(graph, transitModel); + return new TestOtpModel(graph, timetableRepository); } catch (Exception e) { throw new RuntimeException(e); } @@ -266,7 +272,7 @@ public synchronized TestOtpModel getCachedPortlandGraphWithElevation() { public static void addGtfsToGraph( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, File file, FareServiceFactory fareServiceFactory, @Nullable String feedId @@ -276,7 +282,7 @@ public static void addGtfsToGraph( var module = new GtfsModule( List.of(bundle), - transitModel, + timetableRepository, graph, DataImportIssueStore.NOOP, ServiceDateInterval.unbounded(), @@ -285,8 +291,8 @@ public static void addGtfsToGraph( module.buildGraph(); - transitModel.index(); - graph.index(transitModel.getStopModel()); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); } private static void addPortlandVehicleRentals(Graph graph) { 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 95% rename from src/test/java/org/opentripplanner/GtfsTest.java rename to application/src/test/java/org/opentripplanner/GtfsTest.java index 9b37c488b8e..0e862c38901 100644 --- a/src/test/java/org/opentripplanner/GtfsTest.java +++ b/application/src/test/java/org/opentripplanner/GtfsTest.java @@ -40,7 +40,7 @@ import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.TimetableSnapshotSourceParameters; import org.opentripplanner.updater.alert.AlertsUpdateHandler; import org.opentripplanner.updater.trip.TimetableSnapshotSource; @@ -50,7 +50,7 @@ public abstract class GtfsTest { public Graph graph; - public TransitModel transitModel; + public TimetableRepository timetableRepository; AlertsUpdateHandler alertsUpdateHandler; TimetableSnapshotSource timetableSnapshotSource; @@ -194,27 +194,27 @@ protected void setUp() throws Exception { alertsUpdateHandler = new AlertsUpdateHandler(false); var deduplicator = new Deduplicator(); graph = new Graph(deduplicator); - transitModel = new TransitModel(new StopModel(), deduplicator); + timetableRepository = new TimetableRepository(new StopModel(), deduplicator); GtfsModule gtfsGraphBuilderImpl = new GtfsModule( gtfsBundleList, - transitModel, + timetableRepository, graph, ServiceDateInterval.unbounded() ); gtfsGraphBuilderImpl.buildGraph(); - transitModel.index(); - graph.index(transitModel.getStopModel()); - serverContext = TestServerContext.createServerContext(graph, transitModel); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); + serverContext = TestServerContext.createServerContext(graph, timetableRepository); timetableSnapshotSource = new TimetableSnapshotSource( TimetableSnapshotSourceParameters.DEFAULT .withPurgeExpiredData(true) .withMaxSnapshotFrequency(Duration.ZERO), - transitModel + timetableRepository ); - alertPatchServiceImpl = new TransitAlertServiceImpl(transitModel); + alertPatchServiceImpl = new TransitAlertServiceImpl(timetableRepository); alertsUpdateHandler.setTransitAlertService(alertPatchServiceImpl); alertsUpdateHandler.setFeedId(feedId.getId()); 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/application/src/test/java/org/opentripplanner/TestOtpModel.java b/application/src/test/java/org/opentripplanner/TestOtpModel.java new file mode 100644 index 00000000000..36caf1dec43 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/TestOtpModel.java @@ -0,0 +1,12 @@ +package org.opentripplanner; + +import org.opentripplanner.routing.graph.Graph; +import org.opentripplanner.transit.service.TimetableRepository; + +public record TestOtpModel(Graph graph, TimetableRepository timetableRepository) { + public TestOtpModel index() { + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); + return this; + } +} diff --git a/src/test/java/org/opentripplanner/TestServerContext.java b/application/src/test/java/org/opentripplanner/TestServerContext.java similarity index 91% rename from src/test/java/org/opentripplanner/TestServerContext.java rename to application/src/test/java/org/opentripplanner/TestServerContext.java index 90dca6ff840..04a222c4434 100644 --- a/src/test/java/org/opentripplanner/TestServerContext.java +++ b/application/src/test/java/org/opentripplanner/TestServerContext.java @@ -24,7 +24,7 @@ import org.opentripplanner.street.service.DefaultStreetLimitationParametersService; import org.opentripplanner.street.service.StreetLimitationParametersService; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitService; public class TestServerContext { @@ -34,17 +34,17 @@ private TestServerContext() {} /** Create a context for unit testing, using the default RouteRequest. */ public static OtpServerRequestContext createServerContext( Graph graph, - TransitModel transitModel + TimetableRepository timetableRepository ) { - transitModel.index(); + timetableRepository.index(); final RouterConfig routerConfig = RouterConfig.DEFAULT; - var transitService = new DefaultTransitService(transitModel); + var transitService = new DefaultTransitService(timetableRepository); DefaultServerRequestContext context = DefaultServerRequestContext.create( routerConfig.transitTuningConfig(), routerConfig.routingRequestDefaults(), new RaptorConfig<>(routerConfig.transitTuningConfig()), graph, - new DefaultTransitService(transitModel), + new DefaultTransitService(timetableRepository), Metrics.globalRegistry, routerConfig.vectorTileConfig(), createWorldEnvelopeService(), @@ -58,7 +58,7 @@ public static OtpServerRequestContext createServerContext( null, null ); - creatTransitLayerForRaptor(transitModel, routerConfig.transitTuningConfig()); + creatTransitLayerForRaptor(timetableRepository, routerConfig.transitTuningConfig()); return context; } 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 93% rename from src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java rename to application/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java index 7cd9a0910b1..663ce2d5f3f 100644 --- a/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java +++ b/application/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java @@ -11,7 +11,7 @@ import static org.opentripplanner.model.plan.TestItineraryBuilder.newItinerary; import static org.opentripplanner.service.realtimevehicles.model.RealtimeVehicle.StopStatus.IN_TRANSIT_TO; import static org.opentripplanner.test.support.JsonAssertions.assertEqualJson; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import static org.opentripplanner.transit.model.basic.TransitMode.BUS; import static org.opentripplanner.transit.model.basic.TransitMode.FERRY; import static org.opentripplanner.transit.model.timetable.OccupancyStatus.FEW_SEATS_AVAILABLE; @@ -30,7 +30,6 @@ 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; @@ -80,7 +79,7 @@ import org.opentripplanner.service.vehiclerental.model.VehicleRentalVehicle; import org.opentripplanner.standalone.config.framework.json.JsonSupport; import org.opentripplanner.test.support.FilePatternSource; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Money; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.AbstractBuilder; @@ -95,13 +94,13 @@ import org.opentripplanner.transit.model.timetable.RealTimeTripTimes; import org.opentripplanner.transit.model.timetable.TripTimesFactory; import org.opentripplanner.transit.service.DefaultTransitService; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitEditorService; -import org.opentripplanner.transit.service.TransitModel; import org.opentripplanner.transit.service.TransitService; class GraphQLIntegrationTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Place A = TEST_MODEL.place("A", 5.0, 8.0); private static final Place B = TEST_MODEL.place("B", 6.0, 8.5); @@ -116,7 +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 final Route ROUTE = TimetableRepositoryForTest.route("a-route").build(); private static VehicleRentalStation VEHICLE_RENTAL_STATION = new TestVehicleRentalStationBuilder() .withVehicles(10) @@ -161,9 +160,12 @@ static void setup() { var stopModel = TEST_MODEL.stopModelBuilder(); STOP_LOCATIONS.forEach(stopModel::withRegularStop); var model = stopModel.build(); - var transitModel = new TransitModel(model, DEDUPLICATOR); + var timetableRepository = new TimetableRepository(model, DEDUPLICATOR); - var trip = TransitModelForTest.trip("123").withHeadsign(I18NString.of("Trip Headsign")).build(); + var trip = TimetableRepositoryForTest + .trip("123") + .withHeadsign(I18NString.of("Trip Headsign")) + .build(); var stopTimes = TEST_MODEL.stopTimesEvery5Minutes(3, trip, T11_00); var tripTimes = TripTimesFactory.tripTimes(trip, stopTimes, DEDUPLICATOR); final TripPattern pattern = TEST_MODEL @@ -171,11 +173,11 @@ static void setup() { .withScheduledTimeTableBuilder(builder -> builder.addTripTimes(tripTimes)) .build(); - transitModel.addTripPattern(id("pattern-1"), pattern); + timetableRepository.addTripPattern(id("pattern-1"), pattern); var feedId = "testfeed"; var feedInfo = FeedInfo.dummyForTest(feedId); - transitModel.addFeedInfo(feedInfo); + timetableRepository.addFeedInfo(feedInfo); var agency = Agency .of(new FeedScopedId(feedId, "agency-xx")) @@ -183,15 +185,15 @@ static void setup() { .withUrl("www.otp-foo.bar") .withTimezone("Europe/Berlin") .build(); - transitModel.addAgency(agency); + timetableRepository.addAgency(agency); - transitModel.initTimeZone(ZoneIds.BERLIN); - transitModel.index(); + timetableRepository.initTimeZone(ZoneIds.BERLIN); + timetableRepository.index(); var routes = Arrays .stream(TransitMode.values()) .sorted(Comparator.comparing(Enum::name)) .map(m -> - TransitModelForTest + TimetableRepositoryForTest .route(m.name()) .withMode(m) .withLongName(I18NString.of("Long name for %s".formatted(m))) @@ -202,8 +204,10 @@ static void setup() { .toList(); var busRoute = routes.stream().filter(r -> r.getMode().equals(BUS)).findFirst().get(); - TransitEditorService transitService = new DefaultTransitService(transitModel) { - private final TransitAlertService alertService = new TransitAlertServiceImpl(transitModel); + TransitEditorService transitService = new DefaultTransitService(timetableRepository) { + private final TransitAlertService alertService = new TransitAlertServiceImpl( + timetableRepository + ); @Override public List getModesOfStopLocation(StopLocation stop) { @@ -352,7 +356,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); @@ -385,7 +391,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")) @@ -406,7 +411,6 @@ private static List getTransitAlert(EntitySelector.Stop entitySele .toList(); } - @Nonnull private static WalkStepBuilder walkStep(String name) { return WalkStep .builder() @@ -415,7 +419,6 @@ private static WalkStepBuilder walkStep(String name) { .withAngle(10); } - @Nonnull private static FareProduct fareProduct(String name) { return new FareProduct( id(name), @@ -431,7 +434,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() @@ -469,7 +471,7 @@ public List findClosestPlaces( List filterByNetwork, TransitService transitService ) { - var stop = TransitModelForTest.of().stop("A").build(); + var stop = TimetableRepositoryForTest.of().stop("A").build(); return List.of( new PlaceAtDistance(stop, 0), new PlaceAtDistance(VEHICLE_RENTAL_STATION, 30), 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 97% 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 index f2992a30d92..3ca29f7c531 100644 --- 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 @@ -38,7 +38,7 @@ import org.opentripplanner.service.vehiclerental.internal.DefaultVehicleRentalService; import org.opentripplanner.street.search.TraverseMode; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class LegacyRouteRequestMapperTest implements PlanTestConstants { @@ -46,9 +46,9 @@ class LegacyRouteRequestMapperTest implements PlanTestConstants { static { Graph graph = new Graph(); - var transitModel = new TransitModel(); - transitModel.initTimeZone(ZoneIds.BERLIN); - final DefaultTransitService transitService = new DefaultTransitService(transitModel); + var timetableRepository = new TimetableRepository(); + timetableRepository.initTimeZone(ZoneIds.BERLIN); + final DefaultTransitService transitService = new DefaultTransitService(timetableRepository); context = new GraphQLRequestContext( new TestRoutingService(List.of()), 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 98% 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 index f47f7a7004a..d4e48b63141 100644 --- 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 @@ -34,7 +34,7 @@ import org.opentripplanner.service.vehiclerental.internal.DefaultVehicleRentalService; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class RouteRequestMapperTest { @@ -62,9 +62,9 @@ class RouteRequestMapperTest { static { Graph graph = new Graph(); - var transitModel = new TransitModel(); - transitModel.initTimeZone(ZoneIds.BERLIN); - final DefaultTransitService transitService = new DefaultTransitService(transitModel); + var timetableRepository = new TimetableRepository(); + timetableRepository.initTimeZone(ZoneIds.BERLIN); + final DefaultTransitService transitService = new DefaultTransitService(timetableRepository); CONTEXT = new GraphQLRequestContext( new TestRoutingService(List.of()), 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 89% 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..b8eeb2d13d9 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; @@ -54,25 +54,25 @@ import org.opentripplanner.standalone.server.DefaultServerRequestContext; import org.opentripplanner.street.model.StreetLimitationParameters; import org.opentripplanner.street.service.DefaultStreetLimitationParametersService; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.StopLocation; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class TripRequestMapperTest implements PlanTestConstants { - private static TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Duration MAX_FLEXIBLE = Duration.ofMinutes(20); private static final Function STOP_TO_ID = s -> s.getId().toString(); - private static final Route route1 = TransitModelForTest.route("route1").build(); - private static final Route route2 = TransitModelForTest.route("route2").build(); + private static final Route route1 = TimetableRepositoryForTest.route("route1").build(); + private static final Route route2 = TimetableRepositoryForTest.route("route2").build(); private static final RegularStop stop1 = TEST_MODEL.stop("ST:stop1", 1, 1).build(); private static final RegularStop stop2 = TEST_MODEL.stop("ST:stop2", 2, 1).build(); @@ -96,20 +96,24 @@ public class TripRequestMapperTest implements PlanTestConstants { .withRegularStop(stop3) .build(); - var transitModel = new TransitModel(stopModel, new Deduplicator()); - transitModel.initTimeZone(ZoneIds.STOCKHOLM); + var timetableRepository = new TimetableRepository(stopModel, new Deduplicator()); + timetableRepository.initTimeZone(ZoneIds.STOCKHOLM); var calendarServiceData = new CalendarServiceData(); LocalDate serviceDate = itinerary.startTime().toLocalDate(); patterns.forEach(pattern -> { - transitModel.addTripPattern(pattern.getId(), pattern); + timetableRepository.addTripPattern(pattern.getId(), pattern); final int serviceCode = pattern.getScheduledTimetable().getTripTimes(0).getServiceCode(); - transitModel.getServiceCodes().put(pattern.getId(), serviceCode); + timetableRepository.getServiceCodes().put(pattern.getId(), serviceCode); calendarServiceData.putServiceDatesForServiceId(pattern.getId(), List.of(serviceDate)); }); - transitModel.updateCalendarServiceData(true, calendarServiceData, DataImportIssueStore.NOOP); - transitModel.index(); - transitService = new DefaultTransitService(transitModel); + timetableRepository.updateCalendarServiceData( + true, + calendarServiceData, + DataImportIssueStore.NOOP + ); + timetableRepository.index(); + transitService = new DefaultTransitService(timetableRepository); } @BeforeEach @@ -311,39 +315,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 92% 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 index 579f9b73761..58054a3c778 100644 --- 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 @@ -11,7 +11,7 @@ import org.opentripplanner.model.plan.Itinerary; import org.opentripplanner.model.plan.Place; import org.opentripplanner.model.plan.TestItineraryBuilder; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class TripPlanTimePenaltyDtoTest { @@ -20,7 +20,7 @@ class TripPlanTimePenaltyDtoTest { Cost.costOfSeconds(21) ); - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); private final Place placeA = Place.forStop(testModel.stop("A").build()); private final Place placeB = Place.forStop(testModel.stop("B").build()); 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 87% 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 index a86e270a2af..dc924ac765a 100644 --- a/src/test/java/org/opentripplanner/ext/restapi/resources/PlannerResourceTest.java +++ b/application/src/test/java/org/opentripplanner/ext/restapi/resources/PlannerResourceTest.java @@ -15,14 +15,14 @@ import org.opentripplanner.routing.api.request.RequestModes; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.standalone.api.OtpServerRequestContext; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class PlannerResourceTest { static OtpServerRequestContext context() { - var transitModel = new TransitModel(); - transitModel.initTimeZone(ZoneIds.BERLIN); - return TestServerContext.createServerContext(new Graph(), transitModel); + var timetableRepository = new TimetableRepository(); + timetableRepository.initTimeZone(ZoneIds.BERLIN); + return TestServerContext.createServerContext(new Graph(), timetableRepository); } @Test 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 75% rename from src/test/java/org/opentripplanner/framework/collection/CollectionUtilsTest.java rename to application/src/test/java/org/opentripplanner/framework/collection/CollectionUtilsTest.java index e2eaab520bc..6686ac8e0d9 100644 --- a/src/test/java/org/opentripplanner/framework/collection/CollectionUtilsTest.java +++ b/application/src/test/java/org/opentripplanner/framework/collection/CollectionUtilsTest.java @@ -7,9 +7,11 @@ 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; @@ -19,7 +21,7 @@ class CollectionUtilsTest { @Test void testIsEmpty() { - assertTrue(CollectionUtils.isEmpty(null)); + assertTrue(CollectionUtils.isEmpty((List) null)); assertTrue(CollectionUtils.isEmpty(List.of())); assertFalse(CollectionUtils.isEmpty(List.of(1))); } @@ -49,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 96% 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 cc306c133ac..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,7 +9,7 @@ */ 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"); 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 100% 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 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 86% 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..bb3144aa904 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/DirectTransferGeneratorTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/DirectTransferGeneratorTest.java @@ -26,7 +26,7 @@ import org.opentripplanner.street.model.edge.Edge; import org.opentripplanner.street.model.vertex.StreetVertex; import org.opentripplanner.street.model.vertex.TransitStopVertex; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.network.StopPattern; import org.opentripplanner.transit.model.network.TripPattern; @@ -54,7 +54,7 @@ class DirectTransferGeneratorTest extends GraphRoutingTest { public void testDirectTransfersWithoutPatterns() { var otpModel = model(false); var graph = otpModel.graph(); - var transitModel = otpModel.transitModel(); + var timetableRepository = otpModel.timetableRepository(); var req = new RouteRequest(); req.journey().transfer().setMode(StreetMode.WALK); var transferRequests = List.of(req); @@ -62,14 +62,14 @@ public void testDirectTransfersWithoutPatterns() { new DirectTransferGenerator( graph, - transitModel, + timetableRepository, DataImportIssueStore.NOOP, MAX_TRANSFER_DURATION, transferRequests ) .buildGraph(); - assertTransfers(transitModel.getAllPathTransfers()); + assertTransfers(timetableRepository.getAllPathTransfers()); } @Test @@ -77,14 +77,14 @@ public void testDirectTransfersWithPatterns() { var otpModel = model(true); var graph = otpModel.graph(); graph.hasStreets = false; - var transitModel = otpModel.transitModel(); + var timetableRepository = otpModel.timetableRepository(); var req = new RouteRequest(); req.journey().transfer().setMode(StreetMode.WALK); var transferRequests = List.of(req); new DirectTransferGenerator( graph, - transitModel, + timetableRepository, DataImportIssueStore.NOOP, MAX_TRANSFER_DURATION, transferRequests @@ -92,7 +92,7 @@ public void testDirectTransfersWithPatterns() { .buildGraph(); assertTransfers( - transitModel.getAllPathTransfers(), + timetableRepository.getAllPathTransfers(), tr(S0, 556, S11), tr(S0, 935, S21), tr(S11, 751, S21), @@ -111,12 +111,12 @@ public void testDirectTransfersWithRestrictedPatterns() { var otpModel = model(true, true); var graph = otpModel.graph(); graph.hasStreets = false; - var transitModel = otpModel.transitModel(); + var timetableRepository = otpModel.timetableRepository(); var transferRequests = List.of(new RouteRequest()); new DirectTransferGenerator( graph, - transitModel, + timetableRepository, DataImportIssueStore.NOOP, MAX_TRANSFER_DURATION, transferRequests @@ -124,7 +124,7 @@ public void testDirectTransfersWithRestrictedPatterns() { .buildGraph(); assertTransfers( - transitModel.getAllPathTransfers(), + timetableRepository.getAllPathTransfers(), tr(S0, 2780, S12), tr(S0, 935, S21), tr(S11, 2224, S12), @@ -148,18 +148,18 @@ public void testSingleRequestWithoutPatterns() { var otpModel = model(false); var graph = otpModel.graph(); graph.hasStreets = true; - var transitModel = otpModel.transitModel(); + var timetableRepository = otpModel.timetableRepository(); new DirectTransferGenerator( graph, - transitModel, + timetableRepository, DataImportIssueStore.NOOP, MAX_TRANSFER_DURATION, transferRequests ) .buildGraph(); - assertTransfers(transitModel.getAllPathTransfers()); + assertTransfers(timetableRepository.getAllPathTransfers()); } @Test @@ -171,11 +171,11 @@ public void testSingleRequestWithPatterns() { var otpModel = model(true); var graph = otpModel.graph(); graph.hasStreets = true; - var transitModel = otpModel.transitModel(); + var timetableRepository = otpModel.timetableRepository(); new DirectTransferGenerator( graph, - transitModel, + timetableRepository, DataImportIssueStore.NOOP, MAX_TRANSFER_DURATION, transferRequests @@ -183,7 +183,7 @@ public void testSingleRequestWithPatterns() { .buildGraph(); assertTransfers( - transitModel.getAllPathTransfers(), + timetableRepository.getAllPathTransfers(), tr(S0, 100, List.of(V0, V11), S11), tr(S0, 100, List.of(V0, V21), S21), tr(S11, 100, List.of(V11, V21), S21) @@ -203,18 +203,18 @@ public void testMultipleRequestsWithoutPatterns() { var otpModel = model(false); var graph = otpModel.graph(); graph.hasStreets = true; - var transitModel = otpModel.transitModel(); + var timetableRepository = otpModel.timetableRepository(); new DirectTransferGenerator( graph, - transitModel, + timetableRepository, DataImportIssueStore.NOOP, MAX_TRANSFER_DURATION, transferRequests ) .buildGraph(); - assertTransfers(transitModel.getAllPathTransfers()); + assertTransfers(timetableRepository.getAllPathTransfers()); } @Test @@ -230,11 +230,11 @@ public void testMultipleRequestsWithPatterns() { TestOtpModel model = model(true); var graph = model.graph(); graph.hasStreets = true; - var transitModel = model.transitModel(); + var timetableRepository = model.timetableRepository(); new DirectTransferGenerator( graph, - transitModel, + timetableRepository, DataImportIssueStore.NOOP, MAX_TRANSFER_DURATION, transferRequests @@ -242,7 +242,7 @@ public void testMultipleRequestsWithPatterns() { .buildGraph(); assertTransfers( - transitModel.getAllPathTransfers(), + timetableRepository.getAllPathTransfers(), tr(S0, 100, List.of(V0, V11), S11), tr(S0, 100, List.of(V0, V21), S21), tr(S11, 100, List.of(V11, V21), S21), @@ -256,21 +256,21 @@ public void testTransferOnIsolatedStations() { var graph = otpModel.graph(); graph.hasStreets = false; - var transitModel = otpModel.transitModel(); + var timetableRepository = otpModel.timetableRepository(); var req = new RouteRequest(); req.journey().transfer().setMode(StreetMode.WALK); var transferRequests = List.of(req); new DirectTransferGenerator( graph, - transitModel, + timetableRepository, DataImportIssueStore.NOOP, MAX_TRANSFER_DURATION, transferRequests ) .buildGraph(); - assertTrue(transitModel.getAllPathTransfers().isEmpty()); + assertTrue(timetableRepository.getAllPathTransfers().isEmpty()); } private TestOtpModel model(boolean addPatterns) { @@ -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); @@ -327,11 +332,11 @@ public void build() { street(V11, V22, 110, StreetTraversalPermission.PEDESTRIAN_AND_BICYCLE); if (addPatterns) { - var agency = TransitModelForTest.agency("Agency"); + var agency = TimetableRepositoryForTest.agency("Agency"); tripPattern( TripPattern - .of(TransitModelForTest.id("TP1")) + .of(TimetableRepositoryForTest.id("TP1")) .withRoute(route("R1", TransitMode.BUS, agency)) .withStopPattern( new StopPattern(List.of(st(S11, !withBoardingConstraint, true), st(S12), st(S13))) @@ -341,7 +346,7 @@ public void build() { tripPattern( TripPattern - .of(TransitModelForTest.id("TP2")) + .of(TimetableRepositoryForTest.id("TP2")) .withRoute(route("R2", TransitMode.BUS, agency)) .withStopPattern(new StopPattern(List.of(st(S21), st(S22), st(S23)))) .build() 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 83% 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 index 8123661990e..650282d6e7d 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/GtfsModuleTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/GtfsModuleTest.java @@ -19,7 +19,7 @@ import org.opentripplanner.test.support.ResourceLoader; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class GtfsModuleTest { @@ -30,14 +30,14 @@ void addShapesForFrequencyTrips() { var bundle = new GtfsBundle(ConstantsForTests.SIMPLE_GTFS); var module = new GtfsModule( List.of(bundle), - model.transitModel, + model.timetableRepository, model.graph, ServiceDateInterval.unbounded() ); module.buildGraph(); - var frequencyTripPattern = model.transitModel + var frequencyTripPattern = model.timetableRepository .getAllTripPatterns() .stream() .filter(p -> !p.getScheduledTimetable().getFrequencyEntries().isEmpty()) @@ -49,7 +49,7 @@ void addShapesForFrequencyTrips() { assertNotNull(tripPattern.getGeometry()); assertNotNull(tripPattern.getHopGeometry(0)); - var pattern = model.transitModel.getTripPatternForId(tripPattern.getId()); + var pattern = model.timetableRepository.getTripPatternForId(tripPattern.getId()); assertNotNull(pattern.getGeometry()); assertNotNull(pattern.getHopGeometry(0)); } @@ -61,7 +61,7 @@ void duplicateFeedId() { var module = new GtfsModule( bundles, - model.transitModel, + model.timetableRepository, model.graph, ServiceDateInterval.unbounded() ); @@ -72,11 +72,11 @@ private static TestModels buildTestModel() { var deduplicator = new Deduplicator(); var stopModel = new StopModel(); var graph = new Graph(deduplicator); - var transitModel = new TransitModel(stopModel, deduplicator); - return new TestModels(graph, transitModel); + var timetableRepository = new TimetableRepository(stopModel, deduplicator); + return new TestModels(graph, timetableRepository); } - record TestModels(Graph graph, TransitModel transitModel) {} + record TestModels(Graph graph, TimetableRepository timetableRepository) {} static GtfsBundle bundle(String feedId) { var b = new GtfsBundle(ResourceLoader.of(GtfsModuleTest.class).file("/gtfs/interlining")); @@ -109,14 +109,17 @@ void interline(List bundles, int expectedTransfers) { var module = new GtfsModule( bundles, - model.transitModel, + model.timetableRepository, model.graph, ServiceDateInterval.unbounded() ); module.buildGraph(); - assertEquals(expectedTransfers, model.transitModel.getTransferService().listAll().size()); + assertEquals( + expectedTransfers, + model.timetableRepository.getTransferService().listAll().size() + ); } } } 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 92% 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..f411bf6757c 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; @@ -24,12 +24,12 @@ import org.opentripplanner.street.model.vertex.VertexFactory; import org.opentripplanner.street.model.vertex.VertexLabel; import org.opentripplanner.test.support.ResourceLoader; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * We test that the platform area at Herrenberg station (https://www.openstreetmap.org/way/27558650) @@ -37,7 +37,7 @@ */ class OsmBoardingLocationsModuleTest { - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); File file = ResourceLoader .of(OsmBoardingLocationsModuleTest.class) @@ -69,7 +69,7 @@ static Stream testCases() { void addAndLinkBoardingLocations(boolean areaVisibility, Set linkedVertices) { var deduplicator = new Deduplicator(); var graph = new Graph(deduplicator); - var transitModel = new TransitModel(new StopModel(), deduplicator); + var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); var factory = new VertexFactory(graph); var provider = new OsmProvider(file, false); @@ -97,8 +97,8 @@ void addAndLinkBoardingLocations(boolean areaVisibility, Set linkedVerti TransitStopVertex.of().withStop(busStop).withModes(Set.of(TransitMode.BUS)) ); - transitModel.index(); - graph.index(transitModel.getStopModel()); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); assertEquals(0, busVertex.getIncoming().size()); assertEquals(0, busVertex.getOutgoing().size()); @@ -106,7 +106,7 @@ void addAndLinkBoardingLocations(boolean areaVisibility, Set linkedVerti assertEquals(0, platformVertex.getIncoming().size()); assertEquals(0, platformVertex.getOutgoing().size()); - new OsmBoardingLocationsModule(graph, transitModel).buildGraph(); + new OsmBoardingLocationsModule(graph, timetableRepository).buildGraph(); var boardingLocations = graph.getVerticesOfType(OsmBoardingLocationVertex.class); assertEquals(5, boardingLocations.size()); // 3 nodes connected to the street network, plus one "floating" and one area centroid created by the module 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 92% 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 index e4d62a0dbd6..359ed3e938f 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/StreetLinkerModuleTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/StreetLinkerModuleTest.java @@ -7,7 +7,7 @@ import static org.opentripplanner._support.geometry.Coordinates.KONGSBERG_PLATFORM_1; import static org.opentripplanner.street.model.StreetTraversalPermission.CAR; import static org.opentripplanner.street.model.StreetTraversalPermission.PEDESTRIAN; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.Arrays; import java.util.List; @@ -23,7 +23,7 @@ import org.opentripplanner.street.model.edge.StreetTransitStopLink; import org.opentripplanner.street.model.vertex.SplitterVertex; import org.opentripplanner.street.model.vertex.TransitStopVertex; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.network.CarAccess; import org.opentripplanner.transit.model.network.Route; @@ -35,7 +35,7 @@ import org.opentripplanner.transit.model.timetable.Trip; import org.opentripplanner.transit.model.timetable.TripTimesFactory; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class StreetLinkerModuleTest { @@ -77,7 +77,7 @@ void linkRegularStop() { void linkFlexStop() { OTPFeature.FlexRouting.testOn(() -> { var model = new TestModel(); - var flexTrip = TransitModelForTest.of().unscheduledTrip("flex", model.stop()); + var flexTrip = TimetableRepositoryForTest.of().unscheduledTrip("flex", model.stop()); model.withFlexTrip(flexTrip); var module = model.streetLinkerModule(); @@ -138,7 +138,7 @@ private static class TestModel { private final TransitStopVertex stopVertex; private final StreetLinkerModule module; private final RegularStop stop; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; public TestModel() { var from = StreetModelForTest.intersectionVertex( @@ -164,13 +164,13 @@ public TestModel() { .build(); builder.withRegularStop(stop); - transitModel = new TransitModel(builder.build(), new Deduplicator()); + timetableRepository = new TimetableRepository(builder.build(), new Deduplicator()); stopVertex = TransitStopVertex.of().withStop(stop).build(); graph.addVertex(stopVertex); graph.hasStreets = true; - module = new StreetLinkerModule(graph, transitModel, DataImportIssueStore.NOOP, false); + module = new StreetLinkerModule(graph, timetableRepository, DataImportIssueStore.NOOP, false); assertFalse(stopVertex.isConnectedToGraph()); assertTrue(stopVertex.getIncoming().isEmpty()); @@ -194,7 +194,7 @@ public RegularStop stop() { } public void withFlexTrip(UnscheduledTrip flexTrip) { - transitModel.addFlexTrip(flexTrip.getId(), flexTrip); + timetableRepository.addFlexTrip(flexTrip.getId(), flexTrip); } public void withCarsAllowedTrip(Trip trip, StopLocation... stops) { 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 71% 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 index 38680c357c4..49627c6231d 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/TestStreetLinkerModule.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/TestStreetLinkerModule.java @@ -2,12 +2,12 @@ import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.routing.graph.Graph; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class TestStreetLinkerModule { /** For test only */ - public static void link(Graph graph, TransitModel model) { + public static void link(Graph graph, TimetableRepository model) { new StreetLinkerModule(graph, model, DataImportIssueStore.NOOP, false).buildGraph(); } } 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 91% 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 index 23f4ffc72ca..d7f75f530d1 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/VehicleParkingLinkingTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/VehicleParkingLinkingTest.java @@ -2,7 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.List; import org.junit.jupiter.api.BeforeEach; @@ -18,12 +18,12 @@ import org.opentripplanner.street.model.vertex.IntersectionVertex; import org.opentripplanner.street.model.vertex.VehicleParkingEntranceVertex; import org.opentripplanner.street.model.vertex.VertexFactory; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class VehicleParkingLinkingTest { private Graph graph; - private TransitModel transitModel; + private TimetableRepository timetableRepository; private IntersectionVertex A; private IntersectionVertex B; @@ -36,7 +36,7 @@ public void setup() { VehicleParkingTestGraphData graphData = new VehicleParkingTestGraphData(); graphData.initGraph(); graph = graphData.getGraph(); - transitModel = graphData.getTransitModel(); + timetableRepository = graphData.getTimetableRepository(); A = graphData.getAVertex(); B = graphData.getBVertex(); vertexFactory = new VertexFactory(graph); @@ -53,7 +53,7 @@ public void entranceWithVertexLinkingTest() { .build(); var parkingVertex = vertexFactory.vehicleParkingEntrance(parking); - TestStreetLinkerModule.link(graph, transitModel); + TestStreetLinkerModule.link(graph, timetableRepository); assertEquals(1, parkingVertex.getOutgoing().size()); parkingVertex.getOutgoing().forEach(e -> assertEquals(e.getToVertex(), A)); @@ -76,7 +76,7 @@ public void entranceWithoutVertexLinkingTest() { .build(); var parkingVertex = vertexFactory.vehicleParkingEntrance(parking.getEntrances().get(0)); - TestStreetLinkerModule.link(graph, transitModel); + TestStreetLinkerModule.link(graph, timetableRepository); var streetLinks = graph.getEdgesOfType(StreetVehicleParkingLink.class); assertEquals(2, streetLinks.size()); @@ -110,7 +110,7 @@ public void carParkingEntranceToAllTraversableStreetLinkingTest() { .build(); var parkingVertex = vertexFactory.vehicleParkingEntrance(parking.getEntrances().get(0)); - TestStreetLinkerModule.link(graph, transitModel); + TestStreetLinkerModule.link(graph, timetableRepository); var streetLinks = graph.getEdgesOfType(StreetVehicleParkingLink.class); assertEquals(4, streetLinks.size()); @@ -145,7 +145,7 @@ public void removeEntranceWithNonExistingVertexTest() { graph.remove(A); - TestStreetLinkerModule.link(graph, transitModel); + TestStreetLinkerModule.link(graph, timetableRepository); assertEquals(1, vehicleParking.getEntrances().size()); @@ -175,7 +175,7 @@ public void removeVehicleParkingWithOneEntranceAndNonExistingVertexTest() { graph.remove(A); - TestStreetLinkerModule.link(graph, transitModel); + TestStreetLinkerModule.link(graph, timetableRepository); assertEquals(0, graph.getVerticesOfType(VehicleParkingEntranceVertex.class).size()); 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 91% 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..4f9a837ef6c 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,17 +3,16 @@ 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; import org.opentripplanner.street.model.vertex.VertexLabel; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.site.RegularStop; class CalculateWorldEnvelopeModuleTest { - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); private final List vertexes = List.of(new V(10d, 12d), new V(11d, 13d), new V(14d, 15d)); @@ -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 83% 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..bb15be82d9e 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,11 +3,11 @@ 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; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class IslandPruningUtils { @@ -21,20 +21,20 @@ static Graph buildOsmGraph( try { var deduplicator = new Deduplicator(); var graph = new Graph(deduplicator); - var transitModel = new TransitModel(new StopModel(), deduplicator); + var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); // Add street data from OSM OsmProvider osmProvider = new OsmProvider(osmFile, true); OsmModule osmModule = OsmModule.of(osmProvider, graph).withEdgeNamer(new TestNamer()).build(); osmModule.buildGraph(); - transitModel.index(); - graph.index(transitModel.getStopModel()); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); // Prune floating islands and set noThru where necessary PruneIslands pruneIslands = new PruneIslands( graph, - transitModel, + timetableRepository, DataImportIssueStore.NOOP, null ); 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 95% 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 index f069a518fc0..2085e7a238a 100644 --- 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 @@ -6,13 +6,13 @@ import java.util.Set; import org.junit.jupiter.api.Test; import org.opentripplanner.street.model.vertex.TransitStopVertex; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.site.RegularStop; class SubgraphOnlyFerryTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final RegularStop regularStop1 = TEST_MODEL.stop("TEST-1").build(); private static final RegularStop regularStop2 = TEST_MODEL.stop("TEST-2").build(); 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 93% 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..adef7774936 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; @@ -33,7 +33,7 @@ import org.opentripplanner.test.support.ResourceLoader; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class LinkingTest { @@ -114,16 +114,16 @@ public void testStopsLinkedIdentically() { // build the graph without the added stops TestOtpModel model = buildGraphNoTransit(); Graph g1 = model.graph(); - TransitModel transitModel1 = model.transitModel(); + TimetableRepository timetableRepository1 = model.timetableRepository(); addRegularStopGrid(g1); - link(g1, transitModel1); + link(g1, timetableRepository1); TestOtpModel model2 = buildGraphNoTransit(); Graph g2 = model2.graph(); - TransitModel transitModel2 = model2.transitModel(); + TimetableRepository timetableRepository2 = model2.timetableRepository(); addExtraStops(g2); addRegularStopGrid(g2); - link(g2, transitModel2); + link(g2, timetableRepository2); var transitStopVertices = g1.getVerticesOfType(TransitStopVertex.class); assertEquals(1350, transitStopVertices.size()); @@ -152,7 +152,7 @@ public static TestOtpModel buildGraphNoTransit() { var deduplicator = new Deduplicator(); var stopModel = new StopModel(); var gg = new Graph(deduplicator); - var transitModel = new TransitModel(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(stopModel, deduplicator); File file = ResourceLoader.of(LinkingTest.class).file("columbus.osm.pbf"); OsmProvider provider = new OsmProvider(file, false); @@ -160,7 +160,7 @@ public static TestOtpModel buildGraphNoTransit() { OsmModule osmModule = OsmModule.of(provider, gg).build(); osmModule.buildGraph(); - return new TestOtpModel(gg, transitModel); + return new TestOtpModel(gg, timetableRepository); } private static List outgoingStls(final TransitStopVertex tsv) { 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 87% 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 index a45b8eef239..4c8b6a176d3 100644 --- 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 @@ -8,9 +8,9 @@ import org.opentripplanner.street.model.vertex.TransitStopVertex; import org.opentripplanner.street.search.TraverseMode; import org.opentripplanner.street.search.TraverseModeSet; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.site.RegularStop; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * Get graphs of Columbus Ohio with real OSM streets and a synthetic transit system for use in @@ -18,7 +18,7 @@ */ class TestGraph { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); /** Add a regular grid of stops to the graph */ public static void addRegularStopGrid(Graph graph) { @@ -60,9 +60,9 @@ public static void addExtraStops(Graph graph) { } /** link the stops in the graph */ - public static void link(Graph graph, TransitModel transitModel) { - transitModel.index(); - graph.index(transitModel.getStopModel()); + public static void link(Graph graph, TimetableRepository timetableRepository) { + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); VertexLinker linker = graph.getLinker(); 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 93% 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..75c56dd2fb3 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; @@ -20,7 +20,7 @@ import org.opentripplanner.test.support.ResourceLoader; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class UnconnectedAreasTest { @@ -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,15 +151,15 @@ 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); - var transitModel = new TransitModel(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(stopModel, deduplicator); OsmProvider provider = new OsmProvider(RESOURCE_LOADER.file(osmFileName), false); OsmModule loader = OsmModule .of(provider, graph) @@ -171,7 +171,7 @@ private Graph buildOSMGraph(String osmFileName, DataImportIssueStore issueStore) loader.buildGraph(); - TestStreetLinkerModule.link(graph, transitModel); + TestStreetLinkerModule.link(graph, timetableRepository); return graph; } @@ -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/src/test/java/org/opentripplanner/gtfs/GenerateTripPatternsOperationTest.java b/application/src/test/java/org/opentripplanner/gtfs/GenerateTripPatternsOperationTest.java similarity index 92% rename from src/test/java/org/opentripplanner/gtfs/GenerateTripPatternsOperationTest.java rename to application/src/test/java/org/opentripplanner/gtfs/GenerateTripPatternsOperationTest.java index 74819deabc2..8b91e3c3d08 100644 --- a/src/test/java/org/opentripplanner/gtfs/GenerateTripPatternsOperationTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/GenerateTripPatternsOperationTest.java @@ -1,6 +1,6 @@ package org.opentripplanner.gtfs; -import static org.opentripplanner.transit.model._data.TransitModelForTest.trip; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.trip; import java.util.Collection; import java.util.List; @@ -19,7 +19,7 @@ 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._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -50,12 +50,12 @@ class GenerateTripPatternsOperationTest { @BeforeAll static void setupClass() { - TransitModelForTest transitModelForTest = TransitModelForTest.of(); - stopA = transitModelForTest.stop("stopA").build(); - stopB = transitModelForTest.stop("stopB").build(); - stopC = transitModelForTest.stop("stopC").build(); + TimetableRepositoryForTest timetableRepositoryForTest = TimetableRepositoryForTest.of(); + stopA = timetableRepositoryForTest.stop("stopA").build(); + stopB = timetableRepositoryForTest.stop("stopB").build(); + stopC = timetableRepositoryForTest.stop("stopC").build(); stopModel = - transitModelForTest + timetableRepositoryForTest .stopModelBuilder() .withRegularStop(stopA) .withRegularStop(stopB) @@ -69,7 +69,7 @@ static void setupClass() { stopTimeC = new StopTime(); stopTimeC.setStop(stopC); - FeedScopedId serviceId1 = TransitModelForTest.id("SERVICE_ID_1"); + FeedScopedId serviceId1 = TimetableRepositoryForTest.id("SERVICE_ID_1"); trip1 = trip("TRIP_ID_1") .withServiceId(serviceId1) @@ -79,7 +79,7 @@ static void setupClass() { .build(); // same route, mode, submode and direction as trip1 - FeedScopedId serviceId2 = TransitModelForTest.id("SERVICE_ID_2"); + FeedScopedId serviceId2 = TimetableRepositoryForTest.id("SERVICE_ID_2"); trip2 = trip("TRIP_ID_2") .withServiceId(serviceId2) @@ -90,7 +90,7 @@ static void setupClass() { .build(); // same route, direction as trip1, different mode - FeedScopedId serviceId3 = TransitModelForTest.id("SERVICE_ID_3"); + FeedScopedId serviceId3 = TimetableRepositoryForTest.id("SERVICE_ID_3"); trip3 = trip("TRIP_ID_3") .withServiceId(serviceId3) @@ -100,7 +100,7 @@ static void setupClass() { .build(); // same route, mode, direction as trip1, different submode - FeedScopedId serviceId4 = TransitModelForTest.id("SERVICE_ID_4"); + FeedScopedId serviceId4 = TimetableRepositoryForTest.id("SERVICE_ID_4"); trip4 = trip("TRIP_ID_4") .withServiceId(serviceId4) @@ -111,7 +111,7 @@ static void setupClass() { .build(); // same route, mode as trip1, different direction - FeedScopedId serviceId5 = TransitModelForTest.id("SERVICE_ID_5"); + FeedScopedId serviceId5 = TimetableRepositoryForTest.id("SERVICE_ID_5"); trip5 = trip("TRIP_ID_5") .withServiceId(serviceId5) 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 96% rename from src/test/java/org/opentripplanner/gtfs/interlining/InterlineProcessorTest.java rename to application/src/test/java/org/opentripplanner/gtfs/interlining/InterlineProcessorTest.java index e14a33cd276..1fd24f17f3b 100644 --- a/src/test/java/org/opentripplanner/gtfs/interlining/InterlineProcessorTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/interlining/InterlineProcessorTest.java @@ -16,7 +16,7 @@ import org.opentripplanner.model.calendar.CalendarServiceData; import org.opentripplanner.model.plan.PlanTestConstants; import org.opentripplanner.model.transfer.DefaultTransferService; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.StopPattern; @@ -25,7 +25,7 @@ class InterlineProcessorTest implements PlanTestConstants { - private static TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); List patterns = List.of( tripPattern("trip-1", "block-1", "service-1"), @@ -150,7 +150,7 @@ void staySeatedNotAllowed() { } private static TripPattern tripPattern(String tripId, String blockId, String serviceId) { - var trip = TransitModelForTest + var trip = TimetableRepositoryForTest .trip(tripId) .withGtfsBlockId(blockId) .withServiceId(new FeedScopedId("1", serviceId)) @@ -165,7 +165,7 @@ private static TripPattern tripPattern(String tripId, String blockId, String ser var tripTimes = TripTimesFactory.tripTimes(trip, stopTimes, new Deduplicator()); return TripPattern - .of(TransitModelForTest.id(tripId)) + .of(TimetableRepositoryForTest.id(tripId)) .withRoute(trip.getRoute()) .withStopPattern(stopPattern) .withScheduledTimeTableBuilder(builder -> builder.addTripTimes(tripTimes)) 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 92% rename from src/test/java/org/opentripplanner/gtfs/mapping/AgencyMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/AgencyMapperTest.java index c37df887927..e0390fee6b2 100644 --- a/src/test/java/org/opentripplanner/gtfs/mapping/AgencyMapperTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/mapping/AgencyMapperTest.java @@ -11,7 +11,7 @@ import java.util.Collections; import org.junit.jupiter.api.Test; import org.onebusaway.gtfs.model.Agency; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; public class AgencyMapperTest { @@ -32,7 +32,7 @@ public class AgencyMapperTest { private static final String FARE_URL = "www.url.com/fare"; private static final String BRANDING_URL = "www.url.com/brand"; - private final AgencyMapper subject = new AgencyMapper(TransitModelForTest.FEED_ID); + private final AgencyMapper subject = new AgencyMapper(TimetableRepositoryForTest.FEED_ID); static { AGENCY.setId(ID); @@ -58,7 +58,7 @@ public void testMap() throws Exception { result = subject.map(AGENCY); - assertEquals(TransitModelForTest.FEED_ID, result.getId().getFeedId()); + assertEquals(TimetableRepositoryForTest.FEED_ID, result.getId().getFeedId()); assertEquals(ID, result.getId().getId()); assertEquals(NAME, result.getName()); assertEquals(LANG, result.getLang()); 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 95% rename from src/test/java/org/opentripplanner/gtfs/mapping/BoardingAreaMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/BoardingAreaMapperTest.java index 083db3bcb84..cb4ff3caaa3 100644 --- a/src/test/java/org/opentripplanner/gtfs/mapping/BoardingAreaMapperTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/mapping/BoardingAreaMapperTest.java @@ -12,7 +12,7 @@ import org.junit.jupiter.api.Test; import org.onebusaway.gtfs.model.AgencyAndId; import org.onebusaway.gtfs.model.Stop; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.site.BoardingArea; import org.opentripplanner.transit.model.site.RegularStop; @@ -40,7 +40,7 @@ public class BoardingAreaMapperTest { private static final int VEHICLE_TYPE = 5; private static final int WHEELCHAIR_BOARDING = 1; - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final RegularStop PARENT_STOP = TEST_MODEL.stop(PARENT).build(); diff --git a/src/test/java/org/opentripplanner/gtfs/mapping/CarAccessMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/CarAccessMapperTest.java similarity index 100% rename from src/test/java/org/opentripplanner/gtfs/mapping/CarAccessMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/CarAccessMapperTest.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 97% rename from src/test/java/org/opentripplanner/gtfs/mapping/RouteMapperTest.java rename to application/src/test/java/org/opentripplanner/gtfs/mapping/RouteMapperTest.java index 01eeaa662fa..2119c7299d0 100644 --- a/src/test/java/org/opentripplanner/gtfs/mapping/RouteMapperTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/mapping/RouteMapperTest.java @@ -14,7 +14,7 @@ import org.onebusaway.gtfs.model.AgencyAndId; import org.onebusaway.gtfs.model.Route; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.network.BikeAccess; import org.opentripplanner.transit.model.organization.Branding; @@ -51,7 +51,7 @@ public class RouteMapperTest { private static final Route ROUTE = new Route(); private final RouteMapper subject = new RouteMapper( - new AgencyMapper(TransitModelForTest.FEED_ID), + new AgencyMapper(TimetableRepositoryForTest.FEED_ID), DataImportIssueStore.NOOP, new TranslationHelper() ); 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 34db649102a..4132b73826c 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; @@ -123,17 +127,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 96% rename from src/test/java/org/opentripplanner/inspector/vector/VectorTileResponseFactoryTest.java rename to application/src/test/java/org/opentripplanner/inspector/vector/VectorTileResponseFactoryTest.java index 1489cd87c13..6c874c7108f 100644 --- a/src/test/java/org/opentripplanner/inspector/vector/VectorTileResponseFactoryTest.java +++ b/application/src/test/java/org/opentripplanner/inspector/vector/VectorTileResponseFactoryTest.java @@ -11,13 +11,13 @@ import org.opentripplanner.inspector.vector.geofencing.GeofencingZonesLayerBuilder; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.standalone.api.OtpServerRequestContext; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class VectorTileResponseFactoryTest { public static final OtpServerRequestContext SERVER_CONTEXT = TestServerContext.createServerContext( new Graph(), - new TransitModel() + new TimetableRepository() ); enum LayerType { 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 79% rename from src/test/java/org/opentripplanner/model/ShapeGeometryTest.java rename to application/src/test/java/org/opentripplanner/model/ShapeGeometryTest.java index 167bd2a2972..bcfd93513ce 100644 --- a/src/test/java/org/opentripplanner/model/ShapeGeometryTest.java +++ b/application/src/test/java/org/opentripplanner/model/ShapeGeometryTest.java @@ -6,17 +6,17 @@ import org.opentripplanner.ConstantsForTests; import org.opentripplanner.TestOtpModel; import org.opentripplanner.transit.model.network.TripPattern; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class ShapeGeometryTest { @Test public void useShapeGeometries() { TestOtpModel model = ConstantsForTests.buildGtfsGraph(ConstantsForTests.SHAPE_DIST_GTFS); - TransitModel transitModel = model.transitModel(); + TimetableRepository timetableRepository = model.timetableRepository(); // data includes 2 trips, of which one has incorrect shape_dist_traveled parametrization in stop_times - for (TripPattern pattern : transitModel.getAllTripPatterns()) { + for (TripPattern pattern : timetableRepository.getAllTripPatterns()) { // examine if shape extraction worked at first stop intervals, where dist parameter is wrong assertTrue(pattern.getHopGeometry(0).getCoordinates().length > 2); assertTrue(pattern.getHopGeometry(1).getCoordinates().length > 2); diff --git a/src/test/java/org/opentripplanner/model/TimetableSnapshotTest.java b/application/src/test/java/org/opentripplanner/model/TimetableSnapshotTest.java similarity index 85% rename from src/test/java/org/opentripplanner/model/TimetableSnapshotTest.java rename to application/src/test/java/org/opentripplanner/model/TimetableSnapshotTest.java index ffdfc027b76..0f1d42e9620 100644 --- a/src/test/java/org/opentripplanner/model/TimetableSnapshotTest.java +++ b/application/src/test/java/org/opentripplanner/model/TimetableSnapshotTest.java @@ -1,5 +1,6 @@ package org.opentripplanner.model; +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.assertNotEquals; @@ -14,37 +15,47 @@ import com.google.transit.realtime.GtfsRealtime.TripUpdate; import java.time.LocalDate; import java.time.ZoneId; +import java.util.Collection; import java.util.ConcurrentModificationException; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.SortedSet; +import java.util.concurrent.atomic.AtomicBoolean; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.opentripplanner.ConstantsForTests; import org.opentripplanner.TestOtpModel; import org.opentripplanner._support.time.ZoneIds; +import org.opentripplanner.routing.algorithm.raptoradapter.transit.mappers.TransitLayerUpdater; +import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.framework.Result; import org.opentripplanner.transit.model.network.TripPattern; +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.TransitModel; +import org.opentripplanner.transit.model.timetable.TripTimesFactory; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.spi.UpdateError; import org.opentripplanner.updater.trip.BackwardsDelayPropagationType; public class TimetableSnapshotTest { private static final ZoneId timeZone = ZoneIds.GMT; + public static final LocalDate SERVICE_DATE = LocalDate.of(2024, 1, 1); private static Map patternIndex; static String feedId; @BeforeAll public static void setUp() throws Exception { TestOtpModel model = ConstantsForTests.buildGtfsGraph(ConstantsForTests.SIMPLE_GTFS); - TransitModel transitModel = model.transitModel(); + TimetableRepository timetableRepository = model.timetableRepository(); - feedId = transitModel.getFeedIds().iterator().next(); + feedId = timetableRepository.getFeedIds().iterator().next(); patternIndex = new HashMap<>(); - for (TripPattern tripPattern : transitModel.getAllTripPatterns()) { + for (TripPattern tripPattern : timetableRepository.getAllTripPatterns()) { tripPattern .scheduledTripsAsStream() .forEach(trip -> patternIndex.put(trip.getId(), tripPattern)); @@ -261,6 +272,49 @@ public void testPurge() { assertFalse(resolver.isDirty()); } + @Test + void testUniqueDirtyTimetablesAfterMultipleUpdates() { + TimetableSnapshot snapshot = new TimetableSnapshot(); + TripPattern pattern = patternIndex.get(new FeedScopedId(feedId, "1.1")); + Trip trip = pattern.scheduledTripsAsStream().findFirst().orElseThrow(); + + TripTimes updatedTriptimes = TripTimesFactory.tripTimes( + trip, + List.of(new StopTime()), + new Deduplicator() + ); + RealTimeTripUpdate realTimeTripUpdate = new RealTimeTripUpdate( + pattern, + updatedTriptimes, + SERVICE_DATE, + TripOnServiceDate.of(trip.getId()).withTrip(trip).withServiceDate(SERVICE_DATE).build(), + true, + true + ); + + snapshot.update(realTimeTripUpdate); + snapshot.update(realTimeTripUpdate); + assertTrue(snapshot.isDirty()); + + AtomicBoolean updateIsCalled = new AtomicBoolean(); + + TransitLayerUpdater transitLayer = new TransitLayerUpdater(null) { + @Override + public void update( + Collection updatedTimetables, + Map> timetables + ) { + updateIsCalled.set(true); + assertThat(updatedTimetables).hasSize(1); + assertThat(timetables).hasSize(1); + } + }; + + snapshot.commit(transitLayer, true); + + assertTrue(updateIsCalled.get()); + } + @Test void testCannotUpdateReadOnlyTimetableSnapshot() { TimetableSnapshot committedSnapshot = createCommittedSnapshot(); diff --git a/src/test/java/org/opentripplanner/model/TimetableTest.java b/application/src/test/java/org/opentripplanner/model/TimetableTest.java similarity index 99% rename from src/test/java/org/opentripplanner/model/TimetableTest.java rename to application/src/test/java/org/opentripplanner/model/TimetableTest.java index 9135abd96ee..a615041d7a1 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; @@ -33,7 +32,7 @@ import org.opentripplanner.transit.model.framework.Result; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.timetable.RealTimeState; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.spi.UpdateError; import org.opentripplanner.updater.trip.BackwardsDelayPropagationType; import org.opentripplanner.updater.trip.TripUpdateBuilder; @@ -52,12 +51,12 @@ public class TimetableTest { @BeforeAll public static void setUp() throws Exception { TestOtpModel model = ConstantsForTests.buildGtfsGraph(ConstantsForTests.SIMPLE_GTFS); - TransitModel transitModel = model.transitModel(); + TimetableRepository timetableRepository = model.timetableRepository(); - feedId = transitModel.getFeedIds().stream().findFirst().get(); + feedId = timetableRepository.getFeedIds().stream().findFirst().get(); patternIndex = new HashMap<>(); - for (TripPattern pattern : transitModel.getAllTripPatterns()) { + for (TripPattern pattern : timetableRepository.getAllTripPatterns()) { pattern.scheduledTripsAsStream().forEach(trip -> patternIndex.put(trip.getId(), pattern)); } @@ -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 96% rename from src/test/java/org/opentripplanner/model/TripPatternTest.java rename to application/src/test/java/org/opentripplanner/model/TripPatternTest.java index bad159eb3cd..f629902f3e1 100644 --- a/src/test/java/org/opentripplanner/model/TripPatternTest.java +++ b/application/src/test/java/org/opentripplanner/model/TripPatternTest.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.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.StopPattern; import org.opentripplanner.transit.model.network.TripPattern; @@ -28,7 +28,7 @@ public class TripPatternTest { */ @Test public void testSetHopGeometriesFromPattern() { - var testModel = TransitModelForTest.of(); + var testModel = TimetableRepositoryForTest.of(); var stationOrigin = testModel.station("S1").withCoordinate(0.0, 0.0).build(); var stationDestination = testModel.station("S2").withCoordinate(1.0, 1.0).build(); var stopOrigin = testModel @@ -103,7 +103,7 @@ public TripPattern setupTripPattern( } var stopPattern = builder.build(); - var route = TransitModelForTest.route("R1").build(); + var route = TimetableRepositoryForTest.route("R1").build(); return TripPattern .of(new FeedScopedId("Test", "T1")) diff --git a/src/test/java/org/opentripplanner/model/TripTimeOnDateTest.java b/application/src/test/java/org/opentripplanner/model/TripTimeOnDateTest.java similarity index 83% rename from src/test/java/org/opentripplanner/model/TripTimeOnDateTest.java rename to application/src/test/java/org/opentripplanner/model/TripTimeOnDateTest.java index 78002e46eae..97e34b134bf 100644 --- a/src/test/java/org/opentripplanner/model/TripTimeOnDateTest.java +++ b/application/src/test/java/org/opentripplanner/model/TripTimeOnDateTest.java @@ -5,7 +5,7 @@ import java.time.LocalTime; import org.junit.jupiter.api.Test; import org.opentripplanner.model.plan.PlanTestConstants; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.timetable.TripTimesFactory; @@ -14,9 +14,9 @@ class TripTimeOnDateTest implements PlanTestConstants { @Test void gtfsSequence() { - var testModel = TransitModelForTest.of(); + var testModel = TimetableRepositoryForTest.of(); var pattern = testModel.pattern(TransitMode.BUS).build(); - var trip = TransitModelForTest.trip("123").build(); + var trip = TimetableRepositoryForTest.trip("123").build(); var stopTimes = testModel.stopTimesEvery5Minutes(3, trip, T11_00); var tripTimes = TripTimesFactory.tripTimes(trip, stopTimes, new Deduplicator()); 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 95% 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 index 135a3045c3c..9516ce03a32 100644 --- a/src/test/java/org/opentripplanner/model/calendar/impl/CalendarServiceDataFactoryImplTest.java +++ b/application/src/test/java/org/opentripplanner/model/calendar/impl/CalendarServiceDataFactoryImplTest.java @@ -8,7 +8,7 @@ import static org.opentripplanner.gtfs.GtfsContextBuilder.contextBuilder; import static org.opentripplanner.model.calendar.ServiceCalendarDate.EXCEPTION_TYPE_REMOVE; import static org.opentripplanner.model.calendar.impl.CalendarServiceDataFactoryImpl.merge; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.io.IOException; import java.time.LocalDate; @@ -28,7 +28,7 @@ import org.opentripplanner.model.calendar.CalendarServiceData; import org.opentripplanner.model.calendar.ServiceCalendarDate; import org.opentripplanner.model.impl.OtpTransitServiceBuilder; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; /** @@ -123,7 +123,7 @@ public void testServiceGetServiceDatesForServiceId() { private static GtfsContext createCtxBuilder() throws IOException { GtfsContextBuilder ctxBuilder = contextBuilder( - TransitModelForTest.FEED_ID, + TimetableRepositoryForTest.FEED_ID, ConstantsForTests.SIMPLE_GTFS ); OtpTransitServiceBuilder builder = ctxBuilder @@ -132,7 +132,7 @@ private static GtfsContext createCtxBuilder() throws IOException { // Supplement test data with at least one entity in all collections builder.getCalendarDates().add(removeMondayFromAlldays()); - builder.getFeedInfos().add(FeedInfo.dummyForTest(TransitModelForTest.FEED_ID)); + builder.getFeedInfos().add(FeedInfo.dummyForTest(TimetableRepositoryForTest.FEED_ID)); return ctxBuilder.build(); } 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 91% rename from src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderLimitPeriodTest.java rename to application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderLimitPeriodTest.java index 27e6e56c645..b37a0f55703 100644 --- a/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderLimitPeriodTest.java +++ b/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderLimitPeriodTest.java @@ -16,7 +16,7 @@ import org.opentripplanner.model.calendar.ServiceCalendar; import org.opentripplanner.model.calendar.ServiceCalendarDate; import org.opentripplanner.model.calendar.ServiceDateInterval; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.EntityById; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -45,12 +45,12 @@ public class OtpTransitServiceBuilderLimitPeriodTest { private static final LocalDate D1 = LocalDate.of(2020, 1, 8); private static final LocalDate D2 = LocalDate.of(2020, 1, 15); private static final LocalDate D3 = LocalDate.of(2020, 1, 31); - private static final FeedScopedId SERVICE_C_IN = TransitModelForTest.id("CalSrvIn"); - private static final FeedScopedId SERVICE_D_IN = TransitModelForTest.id("CalSrvDIn"); - private static final FeedScopedId SERVICE_C_OUT = TransitModelForTest.id("CalSrvOut"); - private static final FeedScopedId SERVICE_D_OUT = TransitModelForTest.id("CalSrvDOut"); + private static final FeedScopedId SERVICE_C_IN = TimetableRepositoryForTest.id("CalSrvIn"); + private static final FeedScopedId SERVICE_D_IN = TimetableRepositoryForTest.id("CalSrvDIn"); + private static final FeedScopedId SERVICE_C_OUT = TimetableRepositoryForTest.id("CalSrvOut"); + private static final FeedScopedId SERVICE_D_OUT = TimetableRepositoryForTest.id("CalSrvDOut"); private static final Deduplicator DEDUPLICATOR = new Deduplicator(); - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final RegularStop STOP_1 = TEST_MODEL.stop("Stop-1").build(); private static final RegularStop STOP_2 = TEST_MODEL.stop("Stop-2").build(); private static final List STOP_TIMES = List.of( @@ -59,7 +59,7 @@ public class OtpTransitServiceBuilderLimitPeriodTest { ); private static final StopPattern STOP_PATTERN = new StopPattern(STOP_TIMES); private static int SEQ_NR = 0; - private final Route route = TransitModelForTest.route(newId().getId()).build(); + private final Route route = TimetableRepositoryForTest.route(newId().getId()).build(); private final Trip tripCSIn = createTrip("TCalIn", SERVICE_C_IN); private final Trip tripCSOut = createTrip("TCalOut", SERVICE_C_OUT); private final Trip tripCSDIn = createTrip("TDateIn", SERVICE_D_IN); @@ -192,11 +192,11 @@ private static StopTime createStopTime(RegularStop stop, int time) { } private static FeedScopedId newId() { - return TransitModelForTest.id(Integer.toString(++SEQ_NR)); + return TimetableRepositoryForTest.id(Integer.toString(++SEQ_NR)); } private TripPattern createTripPattern(Collection trips) { - FeedScopedId patternId = TransitModelForTest.id( + FeedScopedId patternId = TimetableRepositoryForTest.id( trips.stream().map(t -> t.getId().getId()).collect(Collectors.joining(":")) ); TripPatternBuilder tpb = TripPattern @@ -213,7 +213,7 @@ private TripPattern createTripPattern(Collection trips) { } private Trip createTrip(String id, FeedScopedId serviceId) { - return TransitModelForTest + return TimetableRepositoryForTest .trip(id) .withServiceId(serviceId) .withDirection(Direction.INBOUND) 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 93% rename from src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderTest.java rename to application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderTest.java index 9fd0bd4d8cb..d1c406d4ae1 100644 --- a/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderTest.java +++ b/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderTest.java @@ -17,15 +17,15 @@ import org.opentripplanner.model.ShapePoint; import org.opentripplanner.model.calendar.ServiceCalendar; import org.opentripplanner.model.calendar.ServiceCalendarDate; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.organization.Agency; public class OtpTransitServiceBuilderTest { - private static final String FEED_ID = TransitModelForTest.FEED_ID; - private static final FeedScopedId SERVICE_WEEKDAYS_ID = TransitModelForTest.id("weekdays"); + private static final String FEED_ID = TimetableRepositoryForTest.FEED_ID; + private static final FeedScopedId SERVICE_WEEKDAYS_ID = TimetableRepositoryForTest.id("weekdays"); private static OtpTransitServiceBuilder subject; 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 94% rename from src/test/java/org/opentripplanner/model/impl/OtpTransitServiceImplTest.java rename to application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceImplTest.java index 9ecdbbeb451..48bff78273f 100644 --- a/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceImplTest.java +++ b/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceImplTest.java @@ -6,7 +6,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.opentripplanner.gtfs.GtfsContextBuilder.contextBuilder; -import static org.opentripplanner.transit.model._data.TransitModelForTest.FEED_ID; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.FEED_ID; import java.io.IOException; import java.util.ArrayList; @@ -20,7 +20,7 @@ import org.opentripplanner.model.OtpTransitService; import org.opentripplanner.model.ShapePoint; import org.opentripplanner.model.StopTime; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.organization.Agency; import org.opentripplanner.transit.model.site.Pathway; @@ -31,7 +31,7 @@ public class OtpTransitServiceImplTest { - private static final FeedScopedId STATION_ID = TransitModelForTest.id("station"); + private static final FeedScopedId STATION_ID = TimetableRepositoryForTest.id("station"); // The subject is used as read only; hence static is ok private static OtpTransitService subject; @@ -132,7 +132,7 @@ public void testGetAllTrips() { @Test public void testGetStopForId() { - RegularStop stop = subject.stopModel().getRegularStop(TransitModelForTest.id("P")); + RegularStop stop = subject.stopModel().getRegularStop(TimetableRepositoryForTest.id("P")); assertEquals("RegularStop{F:P P}", stop.toString()); } @@ -146,7 +146,9 @@ public void testGetStopsForStation() { @Test public void testGetShapePointsForShapeId() { - List shapePoints = subject.getShapePointsForShapeId(TransitModelForTest.id("5")); + List shapePoints = subject.getShapePointsForShapeId( + TimetableRepositoryForTest.id("5") + ); assertEquals( "[#1 (41,-72), #2 (41,-72), #3 (40,-72), #4 (41,-73), #5 (41,-74)]", shapePoints.stream().map(OtpTransitServiceImplTest::toString).toList().toString() 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 94% 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..58bb8d84ba0 100644 --- a/src/test/java/org/opentripplanner/model/plan/ItineraryTest.java +++ b/application/src/test/java/org/opentripplanner/model/plan/ItineraryTest.java @@ -16,7 +16,7 @@ import org.opentripplanner.framework.model.TimeAndCost; import org.opentripplanner.model.SystemNotice; import org.opentripplanner.street.search.TraverseMode; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; public class ItineraryTest implements PlanTestConstants { @@ -65,7 +65,7 @@ void testDerivedFieldsWithBusAllTheWay() { assertEquals(newTime(T11_00), result.firstLeg().getStartTime()); assertEquals(newTime(T11_10), result.firstLeg().getEndTime()); assertEquals(TransitMode.BUS, result.getTransitLeg(0).getMode()); - assertEquals(TransitModelForTest.id("55"), result.firstLeg().getTrip().getId()); + assertEquals(TimetableRepositoryForTest.id("55"), result.firstLeg().getTrip().getId()); assertEquals(7500, result.firstLeg().getDistanceMeters(), 1E-3); assertEquals("A ~ BUS 55 11:00 11:10 ~ B [C₁720]", result.toStr()); @@ -89,7 +89,7 @@ void testDerivedFieldsWithTrainAllTheWay() { assertEquals(newTime(T11_05), result.firstLeg().getStartTime()); assertEquals(newTime(T11_15), result.firstLeg().getEndTime()); assertEquals(TransitMode.RAIL, result.getTransitLeg(0).getMode()); - assertEquals(TransitModelForTest.id("20"), result.firstLeg().getTrip().getId()); + assertEquals(TimetableRepositoryForTest.id("20"), result.firstLeg().getTrip().getId()); assertEquals(15_000, result.firstLeg().getDistanceMeters(), 1E-3); assertEquals("A ~ RAIL R2 11:05 11:15 ~ B [C₁720]", result.toStr()); @@ -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 96% rename from src/test/java/org/opentripplanner/model/plan/PlaceTest.java rename to application/src/test/java/org/opentripplanner/model/plan/PlaceTest.java index 95d7cf629a2..3062d71facd 100644 --- a/src/test/java/org/opentripplanner/model/plan/PlaceTest.java +++ b/application/src/test/java/org/opentripplanner/model/plan/PlaceTest.java @@ -16,7 +16,7 @@ import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.street.model.vertex.SimpleVertex; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.service.StopModel; @@ -51,7 +51,7 @@ public void sameLocationBasedOnCoordinates() { @Test public void sameLocationBasedOnStopId() { - var testModel = TransitModelForTest.of(); + var testModel = TimetableRepositoryForTest.of(); var s1 = testModel.stop("1").withCoordinate(1.0, 1.0).build(); var s2 = testModel.stop("2").withCoordinate(1.0, 2.0).build(); 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 70% rename from src/test/java/org/opentripplanner/model/plan/PlanTestConstants.java rename to application/src/test/java/org/opentripplanner/model/plan/PlanTestConstants.java index edb967b5b16..e5ec76af8af 100644 --- a/src/test/java/org/opentripplanner/model/plan/PlanTestConstants.java +++ b/application/src/test/java/org/opentripplanner/model/plan/PlanTestConstants.java @@ -3,7 +3,7 @@ import static org.opentripplanner.framework.time.TimeUtils.time; import org.opentripplanner.framework.time.DurationUtils; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; public interface PlanTestConstants { int NOT_SET = -999_999; @@ -55,55 +55,55 @@ public interface PlanTestConstants { int T11_55 = time("11:55"); /** - * @deprecated Create the TransitModelForTest per test, do not share between tests - it has state + * @deprecated Create the TimetableRepositoryForTest per test, do not share between tests - it has state */ @Deprecated - TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); /** - * @deprecated Depend on TransitModelForTest. Create per test, do not share between tests - it has state + * @deprecated Depend on TimetableRepositoryForTest. Create per test, do not share between tests - it has state */ @Deprecated Place A = Place.forStop(TEST_MODEL.stop("A").withCoordinate(5.0, 8.0).build()); /** - * @deprecated Depend on TransitModelForTest. Create per test, do not share between tests - it has state + * @deprecated Depend on TimetableRepositoryForTest. Create per test, do not share between tests - it has state */ @Deprecated Place B = Place.forStop(TEST_MODEL.stop("B").withCoordinate(6.0, 8.5).build()); /** - * @deprecated Depend on TransitModelForTest. Create per test, do not share between tests - it has state + * @deprecated Depend on TimetableRepositoryForTest. Create per test, do not share between tests - it has state */ @Deprecated Place C = Place.forStop(TEST_MODEL.stop("C").withCoordinate(7.0, 9.0).build()); /** - * @deprecated Depend on TransitModelForTest. Create per test, do not share between tests - it has state + * @deprecated Depend on TimetableRepositoryForTest. Create per test, do not share between tests - it has state */ @Deprecated Place D = Place.forStop(TEST_MODEL.stop("D").withCoordinate(8.0, 9.5).build()); /** - * @deprecated Depend on TransitModelForTest. Create per test, do not share between tests - it has state + * @deprecated Depend on TimetableRepositoryForTest. Create per test, do not share between tests - it has state */ @Deprecated Place E = Place.forStop(TEST_MODEL.stop("E").withCoordinate(9.0, 10.0).build()); /** - * @deprecated Depend on TransitModelForTest. Create per test, do not share between tests - it has state + * @deprecated Depend on TimetableRepositoryForTest. Create per test, do not share between tests - it has state */ @Deprecated Place F = Place.forStop(TEST_MODEL.stop("F").withCoordinate(9.0, 10.5).build()); /** - * @deprecated Depend on TransitModelForTest. Create per test, do not share between tests - it has state + * @deprecated Depend on TimetableRepositoryForTest. Create per test, do not share between tests - it has state */ @Deprecated Place G = Place.forStop(TEST_MODEL.stop("G").withCoordinate(9.5, 11.0).build()); /** - * @deprecated Depend on TransitModelForTest. Create per test, do not share between tests - it has state + * @deprecated Depend on TimetableRepositoryForTest. Create per test, do not share between tests - it has state */ @Deprecated Place H = Place.forStop(TEST_MODEL.stop("H").withCoordinate(10.0, 11.5).build()); 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 84% rename from src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilderTest.java rename to application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilderTest.java index 4b26ccb1c55..8d3d6ed7c1e 100644 --- a/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilderTest.java +++ b/application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilderTest.java @@ -5,14 +5,14 @@ import java.time.LocalDate; import org.junit.jupiter.api.Test; import org.opentripplanner._support.time.ZoneIds; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; class ScheduledTransitLegBuilderTest { @Test void transferZoneId() { - var pattern = TransitModelForTest.of().pattern(TransitMode.BUS).build(); + var pattern = TimetableRepositoryForTest.of().pattern(TransitMode.BUS).build(); var leg = new ScheduledTransitLegBuilder<>() .withZoneId(ZoneIds.BERLIN) .withServiceDate(LocalDate.of(2023, 11, 15)) 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 82% rename from src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegTest.java rename to application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegTest.java index b41ace81e8d..89eb13c56af 100644 --- a/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegTest.java +++ b/application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegTest.java @@ -3,14 +3,14 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.time.OffsetDateTime; import java.time.ZonedDateTime; import java.util.List; import org.junit.jupiter.api.Test; import org.opentripplanner._support.time.ZoneIds; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.timetable.RealTimeTripTimes; @@ -22,13 +22,13 @@ class ScheduledTransitLegTest { static final ZonedDateTime TIME = OffsetDateTime .parse("2023-04-17T17:49:06+02:00") .toZonedDateTime(); - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); - private static final Route ROUTE = TransitModelForTest.route(id("2")).build(); - private static final TripPattern PATTERN = TransitModelForTest + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); + private static final Route ROUTE = TimetableRepositoryForTest.route(id("2")).build(); + private static final TripPattern PATTERN = TimetableRepositoryForTest .tripPattern("1", ROUTE) .withStopPattern(TEST_MODEL.stopPattern(3)) .build(); - private static final Trip TRIP = TransitModelForTest.trip("trip1").build(); + private static final Trip TRIP = TimetableRepositoryForTest.trip("trip1").build(); private static final ScheduledTripTimes TRIP_TIMES = ScheduledTripTimes .of() .withArrivalTimes("10:00 11:00 12:00") 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 94% rename from src/test/java/org/opentripplanner/model/plan/TestItineraryBuilder.java rename to application/src/test/java/org/opentripplanner/model/plan/TestItineraryBuilder.java index ec04d9f6d96..d23759907c2 100644 --- a/src/test/java/org/opentripplanner/model/plan/TestItineraryBuilder.java +++ b/application/src/test/java/org/opentripplanner/model/plan/TestItineraryBuilder.java @@ -4,9 +4,9 @@ import static org.opentripplanner.street.search.TraverseMode.BICYCLE; import static org.opentripplanner.street.search.TraverseMode.CAR; import static org.opentripplanner.street.search.TraverseMode.WALK; -import static org.opentripplanner.transit.model._data.TransitModelForTest.FEED_ID; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; -import static org.opentripplanner.transit.model._data.TransitModelForTest.route; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.FEED_ID; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.route; import java.time.Duration; import java.time.LocalDate; @@ -29,7 +29,7 @@ import org.opentripplanner.model.transfer.TransferConstraint; import org.opentripplanner.street.model._data.StreetModelForTest; import org.opentripplanner.street.search.TraverseMode; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Money; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.Deduplicator; @@ -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); @@ -425,7 +440,7 @@ public Itinerary build() { /** Create a dummy trip */ private static Trip trip(String id, Route route) { - return TransitModelForTest + return TimetableRepositoryForTest .trip(id) .withRoute(route) .withHeadsign(I18NString.of("Trip headsign %s".formatted(id))) 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 90% 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 index 2d7df788ad3..d0d17cc95ab 100644 --- a/src/test/java/org/opentripplanner/model/plan/legreference/LegReferenceSerializerTest.java +++ b/application/src/test/java/org/opentripplanner/model/plan/legreference/LegReferenceSerializerTest.java @@ -6,18 +6,18 @@ import java.time.LocalDate; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; class LegReferenceSerializerTest { - private static final FeedScopedId TRIP_ID = TransitModelForTest.id("Trip"); + private static final FeedScopedId TRIP_ID = TimetableRepositoryForTest.id("Trip"); private static final LocalDate SERVICE_DATE = LocalDate.of(2022, 1, 31); private static final int FROM_STOP_POS = 1; - private static final FeedScopedId FROM_STOP_ID = TransitModelForTest.id("Boarding Stop"); + private static final FeedScopedId FROM_STOP_ID = TimetableRepositoryForTest.id("Boarding Stop"); private static final int TO_STOP_POS = 3; - private static final FeedScopedId TO_STOP_ID = TransitModelForTest.id("Alighting Stop"); + private static final FeedScopedId TO_STOP_ID = TimetableRepositoryForTest.id("Alighting Stop"); /** * Token based on the initial format, without stop ids. 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 85% 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 315b12dfefc..d663e7bed2f 100644 --- a/src/test/java/org/opentripplanner/model/plan/legreference/ScheduledTransitLegReferenceTest.java +++ b/application/src/test/java/org/opentripplanner/model/plan/legreference/ScheduledTransitLegReferenceTest.java @@ -4,7 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.time.LocalDate; import java.util.List; @@ -14,7 +14,7 @@ import org.opentripplanner.model.calendar.CalendarServiceData; import org.opentripplanner.model.plan.PlanTestConstants; import org.opentripplanner.model.plan.ScheduledTransitLeg; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.TripPattern; @@ -25,12 +25,12 @@ import org.opentripplanner.transit.model.timetable.TripTimesFactory; import org.opentripplanner.transit.service.DefaultTransitService; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitService; class ScheduledTransitLegReferenceTest { - private static TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final int SERVICE_CODE = 555; private static final LocalDate SERVICE_DATE = LocalDate.of(2023, 1, 1); private static final int NUMBER_OF_STOPS = 3; @@ -53,16 +53,16 @@ static void buildTransitService() { stop4 = TEST_MODEL.stop("STOP4", 0, 0).withParentStation(parentStation).build(); // build transit data - Trip trip = TransitModelForTest.trip("1").build(); + Trip trip = TimetableRepositoryForTest.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)) + TripPattern tripPattern = TimetableRepositoryForTest + .tripPattern("1", TimetableRepositoryForTest.route(id("1")).build()) + .withStopPattern(TimetableRepositoryForTest.stopPattern(stop1, stop2, stop3)) .withScheduledTimeTableBuilder(builder -> builder.addTripTimes(tripTimes)) .build(); @@ -79,15 +79,21 @@ static void buildTransitService() { .withRegularStop(stop3) .withRegularStop(stop4) .build(); - TransitModel transitModel = new TransitModel(stopModel, new Deduplicator()); - transitModel.addTripPattern(tripPattern.getId(), tripPattern); - transitModel.getServiceCodes().put(tripPattern.getId(), SERVICE_CODE); + TimetableRepository timetableRepository = new TimetableRepository( + stopModel, + new Deduplicator() + ); + timetableRepository.addTripPattern(tripPattern.getId(), tripPattern); + timetableRepository.getServiceCodes().put(tripPattern.getId(), SERVICE_CODE); CalendarServiceData calendarServiceData = new CalendarServiceData(); calendarServiceData.putServiceDatesForServiceId(tripPattern.getId(), List.of(SERVICE_DATE)); - transitModel.updateCalendarServiceData(true, calendarServiceData, DataImportIssueStore.NOOP); + timetableRepository.updateCalendarServiceData( + true, + calendarServiceData, + DataImportIssueStore.NOOP + ); - transitModel.addTripOnServiceDate( - TRIP_ON_SERVICE_DATE_ID, + timetableRepository.addTripOnServiceDate( TripOnServiceDate .of(TRIP_ON_SERVICE_DATE_ID) .withTrip(trip) @@ -95,10 +101,10 @@ static void buildTransitService() { .build() ); - transitModel.index(); + timetableRepository.index(); // build transit service - transitService = new DefaultTransitService(transitModel); + transitService = new DefaultTransitService(timetableRepository); } @Test @@ -171,7 +177,7 @@ void getLegFromReferenceMismatchOnBoardingStop() { SERVICE_DATE, 0, 1, - TransitModelForTest.id("invalid stop id"), + TimetableRepositoryForTest.id("invalid stop id"), stopIdAtPosition1, null ); @@ -220,7 +226,7 @@ void legReferenceCannotReferToBothTripAndTripOnServiceDate() { NUMBER_OF_STOPS, stopIdAtPosition0, stopIdAtPosition1, - TransitModelForTest.id("trip on date id") + TimetableRepositoryForTest.id("trip on date id") ) ); } @@ -248,7 +254,7 @@ void getLegFromReferenceWithUnknownTripOnDate() { NUMBER_OF_STOPS, stopIdAtPosition0, stopIdAtPosition1, - TransitModelForTest.id("unknown trip on date id") + TimetableRepositoryForTest.id("unknown trip on date id") ); assertNull(scheduledTransitLegReference.getLeg(transitService)); } 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 96% 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 index 10b59007c17..f9896c66d6a 100644 --- 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 @@ -27,11 +27,11 @@ import org.opentripplanner.model.plan.PlanTestConstants; import org.opentripplanner.model.plan.SortOrder; import org.opentripplanner.model.plan.TestItineraryBuilder; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class PageCursorTest implements PlanTestConstants { - public static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + public static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); public static final Place A = Place.forStop( TEST_MODEL.stop("A").withCoordinate(5.0, 8.0).build() ); 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 68% rename from src/test/java/org/opentripplanner/model/transfer/TransferTestData.java rename to application/src/test/java/org/opentripplanner/model/transfer/TransferTestData.java index 19e0f82e8d5..6d70936657d 100644 --- a/src/test/java/org/opentripplanner/model/transfer/TransferTestData.java +++ b/application/src/test/java/org/opentripplanner/model/transfer/TransferTestData.java @@ -1,6 +1,6 @@ package org.opentripplanner.model.transfer; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.Station; @@ -8,7 +8,7 @@ public class TransferTestData { - private static TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); static final Station STATION = TEST_MODEL.station("Central Station").build(); @@ -32,14 +32,14 @@ public class TransferTestData { .build(); static final RegularStop ANY_STOP = TEST_MODEL.stop("any", 60.0, 11.0).build(); - static final Route ROUTE_1 = TransitModelForTest.route("1").build(); - static final Route ROUTE_2 = TransitModelForTest.route("2").build(); - static final Route ANY_ROUTE = TransitModelForTest.route("ANY").build(); + static final Route ROUTE_1 = TimetableRepositoryForTest.route("1").build(); + static final Route ROUTE_2 = TimetableRepositoryForTest.route("2").build(); + static final Route ANY_ROUTE = TimetableRepositoryForTest.route("ANY").build(); - static final Trip TRIP_11 = TransitModelForTest.trip("11").withRoute(ROUTE_1).build(); - static final Trip TRIP_12 = TransitModelForTest.trip("12").withRoute(ROUTE_1).build(); - static final Trip TRIP_21 = TransitModelForTest.trip("21").withRoute(ROUTE_2).build(); - static final Trip ANY_TRIP = TransitModelForTest.trip("999").withRoute(ANY_ROUTE).build(); + static final Trip TRIP_11 = TimetableRepositoryForTest.trip("11").withRoute(ROUTE_1).build(); + static final Trip TRIP_12 = TimetableRepositoryForTest.trip("12").withRoute(ROUTE_1).build(); + static final Trip TRIP_21 = TimetableRepositoryForTest.trip("21").withRoute(ROUTE_2).build(); + static final Trip ANY_TRIP = TimetableRepositoryForTest.trip("999").withRoute(ANY_ROUTE).build(); static final TransferPoint STATION_POINT = new StationTransferPoint(STATION); diff --git a/src/test/java/org/opentripplanner/netex/NetexEpipBundleSmokeTest.java b/application/src/test/java/org/opentripplanner/netex/NetexEpipBundleSmokeTest.java similarity index 100% rename from src/test/java/org/opentripplanner/netex/NetexEpipBundleSmokeTest.java rename to application/src/test/java/org/opentripplanner/netex/NetexEpipBundleSmokeTest.java 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 98% rename from src/test/java/org/opentripplanner/netex/mapping/FlexStopsMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/FlexStopsMapperTest.java index 7529ae52a34..4721ef03bf3 100644 --- a/src/test/java/org/opentripplanner/netex/mapping/FlexStopsMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/FlexStopsMapperTest.java @@ -17,7 +17,7 @@ import org.locationtech.jts.geom.Coordinate; import org.opentripplanner.framework.geometry.GeometryUtils; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.site.AreaStop; import org.opentripplanner.transit.model.site.GroupStop; @@ -126,7 +126,7 @@ class FlexStopsMapperTest { .withValue("UnrestrictedPublicTransportAreas") ); - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); private final StopModelBuilder stopModelBuilder = testModel.stopModelBuilder(); @Test 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 82% rename from src/test/java/org/opentripplanner/netex/mapping/MultiModalStationMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/MultiModalStationMapperTest.java index 218942d29ef..47442ce5fe2 100644 --- a/src/test/java/org/opentripplanner/netex/mapping/MultiModalStationMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/MultiModalStationMapperTest.java @@ -1,6 +1,7 @@ package org.opentripplanner.netex.mapping; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import java.util.List; import org.junit.jupiter.api.Test; @@ -8,7 +9,7 @@ import org.opentripplanner.graph_builder.issue.service.DefaultDataImportIssueStore; import org.opentripplanner.netex.NetexTestDataSupport; import org.opentripplanner.netex.mapping.support.FeedScopedIdFactory; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.rutebanken.netex.model.StopPlace; class MultiModalStationMapperTest { @@ -16,7 +17,9 @@ class MultiModalStationMapperTest { @Test void testMissingCoordinates() { DataImportIssueStore dataIssueStore = new DefaultDataImportIssueStore(); - FeedScopedIdFactory feedScopeIdFactory = new FeedScopedIdFactory(TransitModelForTest.FEED_ID); + FeedScopedIdFactory feedScopeIdFactory = new FeedScopedIdFactory( + TimetableRepositoryForTest.FEED_ID + ); MultiModalStationMapper multiModalStationMapper = new MultiModalStationMapper( dataIssueStore, feedScopeIdFactory 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 98% rename from src/test/java/org/opentripplanner/netex/mapping/NetexTestDataSample.java rename to application/src/test/java/org/opentripplanner/netex/mapping/NetexTestDataSample.java index b72c9b05277..56c672c7ef8 100644 --- a/src/test/java/org/opentripplanner/netex/mapping/NetexTestDataSample.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/NetexTestDataSample.java @@ -14,7 +14,7 @@ import java.util.List; import org.opentripplanner.netex.index.hierarchy.HierarchicalMap; import org.opentripplanner.netex.index.hierarchy.HierarchicalMapById; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.DefaultEntityById; import org.opentripplanner.transit.model.framework.EntityById; import org.opentripplanner.transit.model.site.RegularStop; @@ -63,7 +63,7 @@ public class NetexTestDataSample { .withName(new MultilingualString().withValue("everyday")); private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd"); - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); private final JourneyPattern journeyPattern; private final HierarchicalMapById journeyPatternById = new HierarchicalMapById<>(); @@ -89,7 +89,7 @@ public NetexTestDataSample() { JAXBElement lineRef = createWrappedRef(line.getId(), LineRefStructure.class); // Add OTP Route (correspond to Netex Line) - otpRouteByid.add(TransitModelForTest.route(line.getId()).build()); + otpRouteByid.add(TimetableRepositoryForTest.route(line.getId()).build()); // Add Netex Route (not the same as an OTP Route) String routeId = "RUT:Route:1"; 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 96% rename from src/test/java/org/opentripplanner/netex/mapping/NoticeAssignmentMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/NoticeAssignmentMapperTest.java index 99fcc2cb0e8..09a806169ab 100644 --- a/src/test/java/org/opentripplanner/netex/mapping/NoticeAssignmentMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/NoticeAssignmentMapperTest.java @@ -11,7 +11,7 @@ import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.model.StopTime; import org.opentripplanner.netex.index.hierarchy.HierarchicalMapById; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.AbstractTransitEntity; import org.opentripplanner.transit.model.framework.DefaultEntityById; import org.opentripplanner.transit.model.framework.EntityById; @@ -47,7 +47,7 @@ public void mapNoticeAssignment() { noticeAssignment.setNoticedObjectRef(new VersionOfObjectRefStructure().withRef(ROUTE_ID)); noticeAssignment.setNotice(NOTICE); - Route route = TransitModelForTest.route(ROUTE_ID).build(); + Route route = TimetableRepositoryForTest.route(ROUTE_ID).build(); EntityById routesById = new DefaultEntityById<>(); routesById.add(route); @@ -89,7 +89,7 @@ public void mapNoticeAssignmentOnStopPoint() { ) ); - var trip = TransitModelForTest.trip("1").build(); + var trip = TimetableRepositoryForTest.trip("1").build(); StopTime stopTime1 = createStopTime(1, trip); StopTime stopTime2 = createStopTime(2, trip); 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 97% rename from src/test/java/org/opentripplanner/netex/mapping/RouteMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/RouteMapperTest.java index 665650d0389..955a3fec34a 100644 --- a/src/test/java/org/opentripplanner/netex/mapping/RouteMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/RouteMapperTest.java @@ -15,7 +15,7 @@ import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.model.impl.OtpTransitServiceBuilder; import org.opentripplanner.netex.index.NetexEntityIndex; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.DefaultEntityById; import org.opentripplanner.transit.model.network.BikeAccess; import org.opentripplanner.transit.model.network.GroupOfRoutes; @@ -102,7 +102,7 @@ void mapRouteWithAgencySpecified() { transitBuilder.getGroupsOfRoutesByRouteId(), transitBuilder.getGroupOfRouteById(), netexIndex.readOnlyView(), - TransitModelForTest.TIME_ZONE_ID, + TimetableRepositoryForTest.TIME_ZONE_ID, EMPTY_FERRY_WITHOUT_BICYCLE_IDS ); @@ -210,7 +210,7 @@ void mapRouteWithBranding() { ArrayListMultimap.create(), new DefaultEntityById<>(), netexIndex.readOnlyView(), - TransitModelForTest.TIME_ZONE_ID, + TimetableRepositoryForTest.TIME_ZONE_ID, EMPTY_FERRY_WITHOUT_BICYCLE_IDS ); @@ -246,7 +246,7 @@ void mapRouteWithGroupOfRoutes() { transitBuilder.getGroupsOfRoutesByRouteId(), transitBuilder.getGroupOfRouteById(), netexIndex.readOnlyView(), - TransitModelForTest.TIME_ZONE_ID, + TimetableRepositoryForTest.TIME_ZONE_ID, EMPTY_FERRY_WITHOUT_BICYCLE_IDS ); @@ -278,7 +278,7 @@ private Line createExampleFerry(String id) { } private Agency createAgency() { - return TransitModelForTest + return TimetableRepositoryForTest .agency("Ruter AS") .copy() .withId(MappingSupport.ID_FACTORY.createId(AUTHORITY_ID)) 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 97% rename from src/test/java/org/opentripplanner/netex/mapping/StopTimesMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/StopTimesMapperTest.java index 54f38421b8d..1f1ade2aa66 100644 --- a/src/test/java/org/opentripplanner/netex/mapping/StopTimesMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/StopTimesMapperTest.java @@ -17,7 +17,7 @@ import org.opentripplanner.model.StopTime; import org.opentripplanner.netex.index.hierarchy.HierarchicalMap; import org.opentripplanner.netex.index.hierarchy.HierarchicalMapById; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.DefaultEntityById; import org.opentripplanner.transit.model.timetable.Trip; import org.rutebanken.netex.model.StopPointInJourneyPattern; @@ -30,7 +30,7 @@ public class StopTimesMapperTest { private static final BigInteger TWO = BigInteger.valueOf(2); private static final LocalTime QUARTER_PAST_FIVE = LocalTime.of(5, 15); - public static final Trip TRIP = TransitModelForTest.trip("T1").build(); + public static final Trip TRIP = TimetableRepositoryForTest.trip("T1").build(); @Test public void testCalculateOtpTime() { 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 93% rename from src/test/java/org/opentripplanner/netex/mapping/TripMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/TripMapperTest.java index ebb83d44709..a4684fdba8f 100644 --- a/src/test/java/org/opentripplanner/netex/mapping/TripMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/TripMapperTest.java @@ -12,7 +12,7 @@ import org.opentripplanner.model.impl.OtpTransitServiceBuilder; import org.opentripplanner.netex.index.hierarchy.HierarchicalMap; import org.opentripplanner.netex.index.hierarchy.HierarchicalMapById; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.timetable.Trip; @@ -33,7 +33,7 @@ public class TripMapperTest { private static final String ROUTE_ID = "RUT:Route:1"; private static final String SERVICE_JOURNEY_ID = NetexTestDataSample.SERVICE_JOURNEY_ID; private static final String JOURNEY_PATTERN_ID = "RUT:JourneyPattern:1"; - private static final FeedScopedId SERVICE_ID = TransitModelForTest.id("S001"); + private static final FeedScopedId SERVICE_ID = TimetableRepositoryForTest.id("S001"); private static final DataImportIssueStore issueStore = DataImportIssueStore.NOOP; private static final JAXBElement LINE_REF = MappingSupport.createWrappedRef( @@ -50,7 +50,7 @@ public void mapTripWithWheelchairAccess() { var access = new AccessibilityAssessment(); var transitBuilder = new OtpTransitServiceBuilder(new StopModel(), issueStore); - transitBuilder.getRoutes().add(TransitModelForTest.route(ROUTE_ID).build()); + transitBuilder.getRoutes().add(TimetableRepositoryForTest.route(ROUTE_ID).build()); TripMapper tripMapper = new TripMapper( ID_FACTORY, @@ -82,7 +82,7 @@ public void mapTrip() { new StopModel(), issueStore ); - transitBuilder.getRoutes().add(TransitModelForTest.route(ROUTE_ID).build()); + transitBuilder.getRoutes().add(TimetableRepositoryForTest.route(ROUTE_ID).build()); TripMapper tripMapper = new TripMapper( ID_FACTORY, @@ -109,7 +109,7 @@ public void mapTripWithRouteRefViaJourneyPattern() { new StopModel(), issueStore ); - transitBuilder.getRoutes().add(TransitModelForTest.route(ROUTE_ID).build()); + transitBuilder.getRoutes().add(TimetableRepositoryForTest.route(ROUTE_ID).build()); JourneyPattern journeyPattern = new JourneyPattern().withId(JOURNEY_PATTERN_ID); journeyPattern.setRouteRef(new RouteRefStructure().withRef(ROUTE_ID)); 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 97% rename from src/test/java/org/opentripplanner/netex/mapping/TripPatternMapperTest.java rename to application/src/test/java/org/opentripplanner/netex/mapping/TripPatternMapperTest.java index 95af8f623e5..3af2f41391d 100644 --- a/src/test/java/org/opentripplanner/netex/mapping/TripPatternMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/TripPatternMapperTest.java @@ -13,7 +13,7 @@ import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.netex.index.hierarchy.HierarchicalMap; import org.opentripplanner.netex.index.hierarchy.HierarchicalMapById; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.DefaultEntityById; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -31,7 +31,7 @@ */ class TripPatternMapperTest { - private static final FeedScopedId SERVICE_ID = TransitModelForTest.id("S01"); + private static final FeedScopedId SERVICE_ID = TimetableRepositoryForTest.id("S01"); @Test void testMapTripPattern() { 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 81% 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 index aff56902c07..042887aee7a 100644 --- a/src/test/java/org/opentripplanner/netex/mapping/calendar/CalendarServiceBuilderTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/calendar/CalendarServiceBuilderTest.java @@ -2,7 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; -import static org.opentripplanner.transit.model._data.TransitModelForTest.FEED_ID; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.FEED_ID; import java.time.LocalDate; import java.util.Collection; @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.model.calendar.ServiceCalendarDate; import org.opentripplanner.netex.mapping.support.FeedScopedIdFactory; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; public class CalendarServiceBuilderTest { @@ -18,9 +18,9 @@ public class CalendarServiceBuilderTest { private static final LocalDate D1 = LocalDate.of(2020, 11, 1); private static final LocalDate D2 = LocalDate.of(2020, 11, 2); - private static final FeedScopedId EXP_SID_1 = TransitModelForTest.id("S000001"); - private static final FeedScopedId EXP_SID_2 = TransitModelForTest.id("S000002"); - private static final FeedScopedId EXP_SID_3 = TransitModelForTest.id("S000003"); + private static final FeedScopedId EXP_SID_1 = TimetableRepositoryForTest.id("S000001"); + private static final FeedScopedId EXP_SID_2 = TimetableRepositoryForTest.id("S000002"); + private static final FeedScopedId EXP_SID_3 = TimetableRepositoryForTest.id("S000003"); @Test public void addDatesForAGivenService() { @@ -64,8 +64,8 @@ public void createServiceCalendar() { @Test public void createServiceId() { CalendarServiceBuilder subject = new CalendarServiceBuilder(new FeedScopedIdFactory(FEED_ID)); - assertEquals(TransitModelForTest.id("S000001"), subject.createServiceId()); - assertEquals(TransitModelForTest.id("S000002"), subject.createServiceId()); + assertEquals(TimetableRepositoryForTest.id("S000001"), subject.createServiceId()); + assertEquals(TimetableRepositoryForTest.id("S000002"), subject.createServiceId()); } private void assertServiceDateExistInList( 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 87% 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 index 41f2fb2ca12..4a7aac19e01 100644 --- a/src/test/java/org/opentripplanner/raptor/moduletests/D03_UnpreferredRouteTest.java +++ b/application/src/test/java/org/opentripplanner/raptor/moduletests/D03_UnpreferredRouteTest.java @@ -19,7 +19,7 @@ import org.opentripplanner.raptor.configure.RaptorConfig; import org.opentripplanner.raptor.moduletests.support.ModuleTestDebugLogging; import org.opentripplanner.routing.api.request.framework.CostLinearFunction; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; /** @@ -32,8 +32,8 @@ public class D03_UnpreferredRouteTest implements RaptorTestConstants { private static final String EXPECTED = "Walk 30s ~ A ~ BUS %s 0:01 0:02:40 ~ B ~ Walk 20s " + "[0:00:30 0:03 2m30s Tₓ0 C₁%d]"; - private static final FeedScopedId ROUTE_ID_1 = TransitModelForTest.id("1"); - private static final FeedScopedId ROUTE_ID_2 = TransitModelForTest.id("2"); + private static final FeedScopedId ROUTE_ID_1 = TimetableRepositoryForTest.id("1"); + private static final FeedScopedId ROUTE_ID_2 = TimetableRepositoryForTest.id("2"); private static final CostLinearFunction UNPREFERRED_C1 = CostLinearFunction.of("5m + 1t"); private final TestTransitData data = new TestTransitData(); private final RaptorRequestBuilder requestBuilder = new RaptorRequestBuilder<>(); @@ -45,11 +45,17 @@ public class D03_UnpreferredRouteTest implements RaptorTestConstants { public void setup() { // Given 2 identical routes R1 and R2 data.withRoute( - route(pattern("R1", STOP_A, STOP_B).withRoute(TransitModelForTest.route(ROUTE_ID_1).build())) + route( + pattern("R1", STOP_A, STOP_B) + .withRoute(TimetableRepositoryForTest.route(ROUTE_ID_1).build()) + ) .withTimetable(schedule("00:01, 00:02:40")) ); data.withRoute( - route(pattern("R2", STOP_A, STOP_B).withRoute(TransitModelForTest.route(ROUTE_ID_2).build())) + route( + pattern("R2", STOP_A, STOP_B) + .withRoute(TimetableRepositoryForTest.route(ROUTE_ID_2).build()) + ) .withTimetable(schedule("00:01, 00:02:40")) ); 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 96% rename from src/test/java/org/opentripplanner/routing/TestHalfEdges.java rename to application/src/test/java/org/opentripplanner/routing/TestHalfEdges.java index ba7e024e57a..2411444db49 100644 --- a/src/test/java/org/opentripplanner/routing/TestHalfEdges.java +++ b/application/src/test/java/org/opentripplanner/routing/TestHalfEdges.java @@ -48,21 +48,21 @@ import org.opentripplanner.street.search.request.StreetSearchRequestBuilder; import org.opentripplanner.street.search.state.State; import org.opentripplanner.street.search.strategy.EuclideanRemainingWeightHeuristic; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.Deduplicator; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class TestHalfEdges { - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); private Graph graph; private StreetEdge top, bottom, left, right, leftBack, rightBack; private IntersectionVertex br, tr, bl, tl; private TransitStopVertex station1; private TransitStopVertex station2; - private TransitModel transitModel; + private TimetableRepository timetableRepository; @BeforeEach public void setUp() { @@ -162,7 +162,7 @@ public void setUp() { var s2 = testModel.stop("morx station", 40.0099999, -74.002).build(); stopModelBuilder.withRegularStop(s1).withRegularStop(s2); - transitModel = new TransitModel(stopModelBuilder.build(), deduplicator); + timetableRepository = new TimetableRepository(stopModelBuilder.build(), deduplicator); station1 = factory.transitStop(TransitStopVertex.of().withStop(s1)); station2 = factory.transitStop(TransitStopVertex.of().withStop(s2)); @@ -172,8 +172,8 @@ public void setUp() { //Linkers aren't run otherwise in testNetworkLinker graph.hasStreets = true; - transitModel.index(); - graph.index(transitModel.getStopModel()); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); } @Test @@ -595,14 +595,16 @@ public void testStreetSplittingAlerts() { @Test public void testStreetLocationFinder() { StreetIndex finder = graph.getStreetIndex(); - GraphFinder graphFinder = new DirectGraphFinder(transitModel.getStopModel()::findRegularStops); + GraphFinder graphFinder = new DirectGraphFinder( + timetableRepository.getStopModel()::findRegularStops + ); Set tempEdges = new HashSet<>(); // test that the local stop finder finds stops 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 +612,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 +627,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 +650,8 @@ public void testTemporaryVerticesContainer() { try ( var container = new TemporaryVerticesContainer( graph, - walking, + walking.from(), + walking.to(), StreetMode.WALK, StreetMode.WALK ) @@ -673,7 +676,7 @@ public void testTemporaryVerticesContainer() { @Test public void testNetworkLinker() { int numVerticesBefore = graph.getVertices().size(); - TestStreetLinkerModule.link(graph, transitModel); + TestStreetLinkerModule.link(graph, timetableRepository); int numVerticesAfter = graph.getVertices().size(); assertEquals(4, numVerticesAfter - numVerticesBefore); Collection outgoing = station1.getOutgoing(); 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 80% rename from src/test/java/org/opentripplanner/routing/algorithm/FilterTest.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/FilterTest.java index de40617d3d3..958bf97d41a 100644 --- a/src/test/java/org/opentripplanner/routing/algorithm/FilterTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/FilterTest.java @@ -2,7 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.Collection; import java.util.List; @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.routing.api.request.request.filter.SelectRequest; import org.opentripplanner.routing.api.request.request.filter.TransitFilterRequest; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.MainAndSubMode; import org.opentripplanner.transit.model.basic.SubMode; import org.opentripplanner.transit.model.basic.TransitMode; @@ -27,17 +27,17 @@ public class FilterTest { static final String AGENCY_ID_2 = "RUT:Agency:2"; static final String AGENCY_ID_3 = "RUT:Agency:3"; - static final Agency AGENCY_1 = TransitModelForTest + static final Agency AGENCY_1 = TimetableRepositoryForTest .agency("A") .copy() .withId(id(AGENCY_ID_1)) .build(); - static final Agency AGENCY_2 = TransitModelForTest + static final Agency AGENCY_2 = TimetableRepositoryForTest .agency("B") .copy() .withId(id(AGENCY_ID_2)) .build(); - static final Agency AGENCY_3 = TransitModelForTest + static final Agency AGENCY_3 = TimetableRepositoryForTest .agency("C") .copy() .withId(id(AGENCY_ID_3)) @@ -53,7 +53,7 @@ public class FilterTest { static final String JOURNEY_PATTERN_ID_3 = "RUT:JourneyPattern:3"; static final String JOURNEY_PATTERN_ID_4 = "RUT:JourneyPattern:4"; - static final StopPattern STOP_PATTERN = TransitModelForTest.of().stopPattern(2); + static final StopPattern STOP_PATTERN = TimetableRepositoryForTest.of().stopPattern(2); private static final SubMode LOCAL_BUS = SubMode.getOrBuildAndCacheForever("localBus"); private static final SubMode NIGHT_BUS = SubMode.getOrBuildAndCacheForever("nightBus"); @@ -61,10 +61,10 @@ public class FilterTest { final String GROUP_OF_Routes_ID_1 = "RUT:GroupOfLines:1"; final String GROUP_OF_Routes_ID_2 = "RUT:GroupOfLines:2"; - final GroupOfRoutes GROUP_OF_ROUTES_1 = TransitModelForTest + final GroupOfRoutes GROUP_OF_ROUTES_1 = TimetableRepositoryForTest .groupOfRoutes(GROUP_OF_Routes_ID_1) .build(); - final GroupOfRoutes GROUP_OF_ROUTES_2 = TransitModelForTest + final GroupOfRoutes GROUP_OF_ROUTES_2 = TimetableRepositoryForTest .groupOfRoutes(GROUP_OF_Routes_ID_2) .build(); @@ -83,20 +83,20 @@ public class FilterTest { """ ) public void testOne() { - Route route1 = TransitModelForTest.route(ROUTE_ID_1).withAgency(AGENCY_1).build(); - Route route2 = TransitModelForTest.route(ROUTE_ID_2).withAgency(AGENCY_2).build(); - Route route3 = TransitModelForTest.route(ROUTE_ID_3).withAgency(AGENCY_3).build(); + Route route1 = TimetableRepositoryForTest.route(ROUTE_ID_1).withAgency(AGENCY_1).build(); + Route route2 = TimetableRepositoryForTest.route(ROUTE_ID_2).withAgency(AGENCY_2).build(); + Route route3 = TimetableRepositoryForTest.route(ROUTE_ID_3).withAgency(AGENCY_3).build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_3, route3) .withStopPattern(STOP_PATTERN) .build() @@ -129,20 +129,20 @@ public void testOne() { """ ) public void testTwo() { - Route route1 = TransitModelForTest.route(ROUTE_ID_1).withAgency(AGENCY_1).build(); - Route route2 = TransitModelForTest.route(ROUTE_ID_2).withAgency(AGENCY_2).build(); - Route route3 = TransitModelForTest.route(ROUTE_ID_3).withAgency(AGENCY_3).build(); + Route route1 = TimetableRepositoryForTest.route(ROUTE_ID_1).withAgency(AGENCY_1).build(); + Route route2 = TimetableRepositoryForTest.route(ROUTE_ID_2).withAgency(AGENCY_2).build(); + Route route3 = TimetableRepositoryForTest.route(ROUTE_ID_3).withAgency(AGENCY_3).build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_3, route3) .withStopPattern(STOP_PATTERN) .build() @@ -174,34 +174,34 @@ public void testTwo() { """ ) public void testThree() { - Route route1 = TransitModelForTest + Route route1 = TimetableRepositoryForTest .route(ROUTE_ID_1) .withAgency(AGENCY_1) .withMode(TransitMode.BUS) .withNetexSubmode("schoolBus") .build(); - Route route2 = TransitModelForTest + Route route2 = TimetableRepositoryForTest .route(ROUTE_ID_2) .withAgency(AGENCY_2) .withMode(TransitMode.RAIL) .withNetexSubmode("railShuttle") .build(); - Route route3 = TransitModelForTest + Route route3 = TimetableRepositoryForTest .route(ROUTE_ID_3) .withAgency(AGENCY_3) .withMode(TransitMode.TRAM) .build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_3, route3) .withStopPattern(STOP_PATTERN) .build() @@ -249,20 +249,20 @@ public void testThree() { """ ) public void testFour() { - Route route1 = TransitModelForTest.route(ROUTE_ID_1).build(); - Route route2 = TransitModelForTest.route(ROUTE_ID_2).build(); - Route route3 = TransitModelForTest.route(ROUTE_ID_3).build(); + Route route1 = TimetableRepositoryForTest.route(ROUTE_ID_1).build(); + Route route2 = TimetableRepositoryForTest.route(ROUTE_ID_2).build(); + Route route3 = TimetableRepositoryForTest.route(ROUTE_ID_3).build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_3, route3) .withStopPattern(STOP_PATTERN) .build() @@ -302,15 +302,15 @@ public void testFour() { """ ) public void testFive() { - Route route1 = TransitModelForTest.route(ROUTE_ID_1).build(); - Route route2 = TransitModelForTest.route(ROUTE_ID_2).build(); + Route route1 = TimetableRepositoryForTest.route(ROUTE_ID_1).build(); + Route route2 = TimetableRepositoryForTest.route(ROUTE_ID_2).build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build() @@ -347,20 +347,20 @@ public void testFive() { """ ) public void testSix() { - Route route1 = TransitModelForTest.route(ROUTE_ID_1).withAgency(AGENCY_1).build(); - Route route2 = TransitModelForTest.route(ROUTE_ID_2).withAgency(AGENCY_1).build(); - Route route3 = TransitModelForTest.route(ROUTE_ID_3).withAgency(AGENCY_1).build(); + Route route1 = TimetableRepositoryForTest.route(ROUTE_ID_1).withAgency(AGENCY_1).build(); + Route route2 = TimetableRepositoryForTest.route(ROUTE_ID_2).withAgency(AGENCY_1).build(); + Route route3 = TimetableRepositoryForTest.route(ROUTE_ID_3).withAgency(AGENCY_1).build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_3, route3) .withStopPattern(STOP_PATTERN) .build() @@ -397,20 +397,20 @@ public void testSix() { """ ) public void testSeven() { - Route route1 = TransitModelForTest.route(ROUTE_ID_1).withAgency(AGENCY_1).build(); - Route route2 = TransitModelForTest.route(ROUTE_ID_2).withAgency(AGENCY_2).build(); - Route route3 = TransitModelForTest.route(ROUTE_ID_3).withAgency(AGENCY_2).build(); + Route route1 = TimetableRepositoryForTest.route(ROUTE_ID_1).withAgency(AGENCY_1).build(); + Route route2 = TimetableRepositoryForTest.route(ROUTE_ID_2).withAgency(AGENCY_2).build(); + Route route3 = TimetableRepositoryForTest.route(ROUTE_ID_3).withAgency(AGENCY_2).build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_3, route3) .withStopPattern(STOP_PATTERN) .build() @@ -448,32 +448,32 @@ public void testSeven() { """ ) public void testEight() { - final Route route1 = TransitModelForTest + final Route route1 = TimetableRepositoryForTest .route(ROUTE_ID_1) .withMode(TransitMode.BUS) .withAgency(AGENCY_1) .build(); - final Route route2 = TransitModelForTest + final Route route2 = TimetableRepositoryForTest .route(ROUTE_ID_2) .withMode(TransitMode.RAIL) .withAgency(AGENCY_1) .build(); - final Route route3 = TransitModelForTest + final Route route3 = TimetableRepositoryForTest .route(ROUTE_ID_3) .withMode(TransitMode.BUS) .withAgency(AGENCY_2) .build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_3, route3) .withStopPattern(STOP_PATTERN) .build() @@ -513,41 +513,41 @@ public void testEight() { """ ) public void testNine() { - Route route1 = TransitModelForTest + Route route1 = TimetableRepositoryForTest .route(ROUTE_ID_1) .withAgency(AGENCY_1) .withMode(TransitMode.BUS) .build(); - Route route2 = TransitModelForTest + Route route2 = TimetableRepositoryForTest .route(ROUTE_ID_2) .withAgency(AGENCY_1) .withMode(TransitMode.RAIL) .build(); - Route route3 = TransitModelForTest + Route route3 = TimetableRepositoryForTest .route(ROUTE_ID_3) .withAgency(AGENCY_1) .withMode(TransitMode.BUS) .build(); - Route route4 = TransitModelForTest + Route route4 = TimetableRepositoryForTest .route(ROUTE_ID_4) .withAgency(AGENCY_2) .withMode(TransitMode.BUS) .build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_3, route3) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_4, route4) .withStopPattern(STOP_PATTERN) .build() @@ -589,37 +589,37 @@ public void testNine() { """ ) public void testTen() { - final Route route1 = TransitModelForTest + final Route route1 = TimetableRepositoryForTest .route(ROUTE_ID_1) .withMode(TransitMode.BUS) .withAgency(AGENCY_1) .build(); - final Route route2 = TransitModelForTest + final Route route2 = TimetableRepositoryForTest .route(ROUTE_ID_2) .withMode(TransitMode.RAIL) .withAgency(AGENCY_1) .build(); - final Route route3 = TransitModelForTest + final Route route3 = TimetableRepositoryForTest .route(ROUTE_ID_3) .withMode(TransitMode.BUS) .withAgency(AGENCY_1) .build(); - final Route route4 = TransitModelForTest.route(ROUTE_ID_4).withAgency(AGENCY_2).build(); + final Route route4 = TimetableRepositoryForTest.route(ROUTE_ID_4).withAgency(AGENCY_2).build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_3, route3) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_4, route4) .withStopPattern(STOP_PATTERN) .build() @@ -646,19 +646,19 @@ public void testTen() { @Test void testDifferentSubModesInRoute() { - final Route route1 = TransitModelForTest + final Route route1 = TimetableRepositoryForTest .route(ROUTE_ID_1) .withMode(TransitMode.BUS) .withAgency(AGENCY_1) .build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .withNetexSubmode(LOCAL_BUS) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route1) .withStopPattern(STOP_PATTERN) .withNetexSubmode(NIGHT_BUS) @@ -696,21 +696,21 @@ private static Collection bannedPatterns( @Test public void testGroupOfLinesSelectFunctionality() { - var route1 = TransitModelForTest + var route1 = TimetableRepositoryForTest .route(ROUTE_ID_1) .withGroupOfRoutes(List.of(GROUP_OF_ROUTES_1)) .build(); - var route2 = TransitModelForTest + var route2 = TimetableRepositoryForTest .route(ROUTE_ID_2) .withGroupOfRoutes(List.of(GROUP_OF_ROUTES_2)) .build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build() @@ -734,21 +734,21 @@ public void testGroupOfLinesSelectFunctionality() { @Test public void testGroupOfLinesExcludeFunctionality() { - var route1 = TransitModelForTest + var route1 = TimetableRepositoryForTest .route(ROUTE_ID_1) .withGroupOfRoutes(List.of(GROUP_OF_ROUTES_1)) .build(); - var route2 = TransitModelForTest + var route2 = TimetableRepositoryForTest .route(ROUTE_ID_2) .withGroupOfRoutes(List.of(GROUP_OF_ROUTES_2)) .build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build() 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 81% 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..8108274c318 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; @@ -44,7 +48,7 @@ import org.opentripplanner.street.model.vertex.Vertex; import org.opentripplanner.street.model.vertex.VertexFactory; import org.opentripplanner.street.model.vertex.VertexLabel; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.Deduplicator; @@ -56,8 +60,9 @@ 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; +import org.opentripplanner.transit.service.TimetableRepository; public abstract class GraphRoutingTest { @@ -66,21 +71,21 @@ public abstract class GraphRoutingTest { protected TestOtpModel modelOf(Builder builder) { builder.build(); Graph graph = builder.graph(); - TransitModel transitModel = builder.transitModel(); - return new TestOtpModel(graph, transitModel).index(); + TimetableRepository timetableRepository = builder.timetableRepository(); + return new TestOtpModel(graph, timetableRepository).index(); } public abstract static class Builder { private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final VertexFactory vertexFactory; private final VehicleParkingHelper vehicleParkingHelper; protected Builder() { var deduplicator = new Deduplicator(); graph = new Graph(deduplicator); - transitModel = new TransitModel(new StopModel(), deduplicator); + timetableRepository = new TimetableRepository(new StopModel(), deduplicator); vertexFactory = new VertexFactory(graph); vehicleParkingHelper = new VehicleParkingHelper(graph); } @@ -91,8 +96,8 @@ public Graph graph() { return graph; } - public TransitModel transitModel() { - return transitModel; + public TimetableRepository timetableRepository() { + return timetableRepository; } public T v(VertexLabel label) { @@ -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, @@ -213,46 +229,64 @@ public List elevator(StreetTraversalPermission permission, Vertex. // -- Transit network (pathways, linking) public Entrance entranceEntity(String id, double latitude, double longitude) { return Entrance - .of(TransitModelForTest.id(id)) + .of(TimetableRepositoryForTest.id(id)) .withName(new NonLocalizedString(id)) .withCode(id) .withCoordinate(latitude, longitude) .build(); } - RegularStop stopEntity(String id, double latitude, double longitude, boolean noTransfers) { - var stopModelBuilder = transitModel.getStopModel().withContext(); - var testModel = new TransitModelForTest(stopModelBuilder); + RegularStop stopEntity( + String id, + double latitude, + double longitude, + @Nullable Station parentStation + ) { + var stopModelBuilder = timetableRepository.getStopModel().withContext(); + var testModel = new TimetableRepositoryForTest(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(); - transitModel.mergeStopModels(stopModelBuilder.withRegularStop(stop).build()); + timetableRepository.mergeStopModels(stopModelBuilder.withRegularStop(stop).build()); return stop; } + public Station stationEntity(String id, Consumer stationBuilder) { + var stopModelBuilder = timetableRepository.getStopModel().withContext(); + var testModel = new TimetableRepositoryForTest(stopModelBuilder); + + var builder = testModel.station(id); + stationBuilder.accept(builder); + var station = builder.build(); + + timetableRepository.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, @@ -404,7 +454,7 @@ public VehicleParking vehicleParking( ) { var vehicleParking = VehicleParking .builder() - .id(TransitModelForTest.id(id)) + .id(TimetableRepositoryForTest.id(id)) .coordinate(new WgsCoordinate(y, x)) .bicyclePlaces(bicyclePlaces) .carPlaces(carPlaces) @@ -427,7 +477,7 @@ public VehicleParking.VehicleParkingEntranceCreator vehicleParkingEntrance( ) { return builder -> builder - .entranceId(TransitModelForTest.id(id)) + .entranceId(TimetableRepositoryForTest.id(id)) .name(new NonLocalizedString(id)) .coordinate(new WgsCoordinate(streetVertex.getCoordinate())) .vertex(streetVertex) @@ -451,12 +501,12 @@ public List biLink( } public Route route(String id, TransitMode mode, Agency agency) { - return TransitModelForTest.route(id).withAgency(agency).withMode(mode).build(); + return TimetableRepositoryForTest.route(id).withAgency(agency).withMode(mode).build(); } // Transit public void tripPattern(TripPattern tripPattern) { - transitModel.addTripPattern(tripPattern.getId(), tripPattern); + timetableRepository.addTripPattern(tripPattern.getId(), tripPattern); } public StopTime st(TransitStopVertex s1) { 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 92% 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..1ee0ec9c481 100644 --- a/src/test/java/org/opentripplanner/routing/algorithm/StreetModeLinkingTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/StreetModeLinkingTest.java @@ -15,7 +15,7 @@ import org.opentripplanner.street.model.StreetTraversalPermission; import org.opentripplanner.street.model.vertex.Vertex; import org.opentripplanner.street.search.TemporaryVerticesContainer; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; /** * This tests linking of GenericLocations to streets for each StreetMode. The test has 5 parallel @@ -77,7 +77,7 @@ public void build() { graph = otpModel.graph(); graph.hasStreets = true; - TestStreetLinkerModule.link(graph, otpModel.transitModel()); + TestStreetLinkerModule.link(graph, otpModel.timetableRepository()); } @Test @@ -110,8 +110,8 @@ public void testCarParkLinking() { assertLinking(setup.apply(47.501, 19.04), "E1E2 street", "D1D2 street", StreetMode.CAR_TO_PARK); assertLinking( rr -> { - rr.setFrom(new GenericLocation(null, TransitModelForTest.id("STOP"), null, null)); - rr.setTo(new GenericLocation(null, TransitModelForTest.id("STOP"), null, null)); + rr.setFrom(new GenericLocation(null, TimetableRepositoryForTest.id("STOP"), null, null)); + rr.setTo(new GenericLocation(null, TimetableRepositoryForTest.id("STOP"), null, null)); }, "E1E2 street", "D1D2 street", @@ -180,8 +180,8 @@ private void assertLinkedFromTo( private void assertLinkedFromTo(String stopId, String streetName, StreetMode... streetModes) { assertLinking( rr -> { - rr.setFrom(new GenericLocation(null, TransitModelForTest.id(stopId), null, null)); - rr.setTo(new GenericLocation(null, TransitModelForTest.id(stopId), null, null)); + rr.setFrom(new GenericLocation(null, TimetableRepositoryForTest.id(stopId), null, null)); + rr.setTo(new GenericLocation(null, TimetableRepositoryForTest.id(stopId), null, null)); }, streetName, streetName, @@ -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 76% rename from src/test/java/org/opentripplanner/routing/algorithm/TestBanning.java rename to application/src/test/java/org/opentripplanner/routing/algorithm/TestBanning.java index 075fceed4eb..07d9074c350 100644 --- a/src/test/java/org/opentripplanner/routing/algorithm/TestBanning.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/TestBanning.java @@ -2,14 +2,14 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.Collection; import java.util.List; import org.junit.jupiter.api.Test; import org.opentripplanner.routing.api.request.request.filter.SelectRequest; import org.opentripplanner.routing.api.request.request.filter.TransitFilterRequest; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.network.StopPattern; @@ -56,24 +56,32 @@ public void testSetWhiteListedOnRequest() { } private List getTestPatterns() { - Agency agency1 = TransitModelForTest.agency("A").copy().withId(id("RUT:Agency:1")).build(); - Agency agency2 = TransitModelForTest.agency("B").copy().withId(id("RUT:Agency:2")).build(); + Agency agency1 = TimetableRepositoryForTest + .agency("A") + .copy() + .withId(id("RUT:Agency:1")) + .build(); + Agency agency2 = TimetableRepositoryForTest + .agency("B") + .copy() + .withId(id("RUT:Agency:2")) + .build(); - Route route1 = TransitModelForTest.route("RUT:Route:1").withAgency(agency1).build(); - Route route2 = TransitModelForTest.route("RUT:Route:2").withAgency(agency1).build(); - Route route3 = TransitModelForTest.route("RUT:Route:3").withAgency(agency2).build(); + Route route1 = TimetableRepositoryForTest.route("RUT:Route:1").withAgency(agency1).build(); + Route route2 = TimetableRepositoryForTest.route("RUT:Route:2").withAgency(agency1).build(); + Route route3 = TimetableRepositoryForTest.route("RUT:Route:3").withAgency(agency2).build(); - final StopPattern stopPattern = TransitModelForTest.of().stopPattern(2); + final StopPattern stopPattern = TimetableRepositoryForTest.of().stopPattern(2); return List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern("RUT:JourneyPattern:1", route1) .withStopPattern(stopPattern) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern("RUT:JourneyPattern:2", route2) .withStopPattern(stopPattern) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern("RUT:JourneyPattern:3", route3) .withStopPattern(stopPattern) .build() 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 84% 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..1cd19823f17 100644 --- a/src/test/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChainTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChainTest.java @@ -35,16 +35,16 @@ import org.opentripplanner.routing.api.response.RoutingError; import org.opentripplanner.routing.api.response.RoutingErrorCode; import org.opentripplanner.routing.services.TransitAlertService; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; /** * 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 TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Place A = Place.forStop(TEST_MODEL.stop("A").build()); private static final Place B = Place.forStop(TEST_MODEL.stop("B").build()); private static final Place C = Place.forStop(TEST_MODEL.stop("C").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 98% 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 index 751dcc7ad3c..713e72e344c 100644 --- 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 @@ -20,11 +20,11 @@ import org.opentripplanner.model.plan.PlanTestConstants; import org.opentripplanner.model.plan.SortOrder; import org.opentripplanner.routing.algorithm.filterchain.framework.sort.SortOrderComparator; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; public class PagingFilterTest implements PlanTestConstants { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Place A = TEST_MODEL.place("A", 10, 11); private static final Place B = TEST_MODEL.place("B", 10, 13); 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 96% 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 index 3626ada63b3..da55d884d5c 100644 --- 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 @@ -9,12 +9,12 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.model.plan.Itinerary; import org.opentripplanner.model.plan.Place; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.network.grouppriority.DefaultTransitGroupPriorityCalculator; class SingleCriteriaComparatorTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final DefaultTransitGroupPriorityCalculator GROUP_PRIORITY_CALCULATOR = new DefaultTransitGroupPriorityCalculator(); private static final Place A = TEST_MODEL.place("A", 10, 11); 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 91% 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 index c8cd04212e5..ea8ed58ae3a 100644 --- 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 @@ -9,11 +9,11 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.model.plan.Itinerary; import org.opentripplanner.model.plan.Place; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class ItemTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Place A = TEST_MODEL.place("A", 10, 11); private static final Place B = TEST_MODEL.place("B", 10, 11); private static final Itinerary ITINERARY = newItinerary(A).bus(1, 1, 2, B).build(); 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 97% 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 index d5f2323ad90..3a192853684 100644 --- 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 @@ -11,12 +11,12 @@ import org.opentripplanner.model.plan.Itinerary; import org.opentripplanner.model.plan.Place; import org.opentripplanner.routing.algorithm.filterchain.filters.system.SingleCriteriaComparator; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.network.grouppriority.DefaultTransitGroupPriorityCalculator; class McMaxLimitFilterTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final DefaultTransitGroupPriorityCalculator GROUP_PRIORITY_CALCULATOR = new DefaultTransitGroupPriorityCalculator(); private static final Place A = TEST_MODEL.place("A", 10, 11); 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 91% 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 index 379eb207155..8c64d7231d8 100644 --- 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 @@ -12,7 +12,7 @@ import org.opentripplanner.routing.alertpatch.TransitAlert; import org.opentripplanner.routing.impl.TransitAlertServiceImpl; import org.opentripplanner.transit.model.framework.FeedScopedId; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class TransitAlertFilterTest implements PlanTestConstants { @@ -20,7 +20,7 @@ class TransitAlertFilterTest implements PlanTestConstants { @Test void testFilter() { - var transitAlertService = new TransitAlertServiceImpl(new TransitModel()); + var transitAlertService = new TransitAlertServiceImpl(new TimetableRepository()); transitAlertService.setAlerts( List.of( TransitAlert 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 94% 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 index 692f3a61ca7..7ee32b845f2 100644 --- 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 @@ -7,13 +7,13 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.model.plan.Place; import org.opentripplanner.model.plan.PlanTestConstants; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.site.RegularStopBuilder; import org.opentripplanner.transit.model.site.Station; class GroupByAllSameStationsTest implements PlanTestConstants { - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); Station STATION_1 = testModel.station("1").build(); Station STATION_2 = testModel.station("2").build(); 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 93% 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 index 26d3ca1d04b..48772cb69e2 100644 --- 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 @@ -8,13 +8,13 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.model.plan.Itinerary; import org.opentripplanner.model.plan.PlanTestConstants; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.network.Route; class GroupBySameRoutesAndStopsTest implements PlanTestConstants { - Route routeA = TransitModelForTest.route("A").build(); - Route routeB = TransitModelForTest.route("B").build(); + Route routeA = TimetableRepositoryForTest.route("A").build(); + Route routeB = TimetableRepositoryForTest.route("B").build(); Itinerary i1 = newItinerary(A) .bus(routeA, 21, T11_06, T11_28, E) 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 92% 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 7b877abcf3a..d1940119655 100644 --- a/src/test/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapperTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapperTest.java @@ -4,6 +4,7 @@ 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; @@ -45,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; @@ -56,7 +58,7 @@ import org.opentripplanner.routing.graph.Graph; 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._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.network.StopPattern; @@ -64,11 +66,11 @@ import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.timetable.booking.RoutingBookingInfo; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class RaptorPathToItineraryMapperTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final int BOARD_COST_SEC = 60; private static final int TRANSFER_COST_SEC = 120; private static final double[] TRANSIT_RELUCTANCE = new double[] { 1.0 }; @@ -77,7 +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 static final Route ROUTE = TransitModelForTest.route("route").build(); + private static final Route ROUTE = TimetableRepositoryForTest.route("route").build(); public static final RaptorCostCalculator COST_CALCULATOR = new DefaultCostCalculator<>( BOARD_COST_SEC, @@ -193,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); @@ -246,6 +251,16 @@ private TestTripSchedule transferAtSameStopSchedule() { 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<>(); @@ -279,11 +294,11 @@ private RaptorPathToItineraryMapper getRaptorPathToItineraryMa .of(2022, Month.OCTOBER, 10, 12, 0, 0) .atZone(ZoneIds.STOCKHOLM) .toInstant(); - TransitModel transitModel = new TransitModel(); - transitModel.initTimeZone(ZoneIds.CET); + TimetableRepository timetableRepository = new TimetableRepository(); + timetableRepository.initTimeZone(ZoneIds.CET); return new RaptorPathToItineraryMapper<>( new Graph(), - new DefaultTransitService(transitModel), + new DefaultTransitService(timetableRepository), getTransitLayer(), dateTime.atZone(ZoneIds.CET), new RouteRequest() 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 99% 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 index 8dbf5536ea2..98acfeeb7af 100644 --- a/src/test/java/org/opentripplanner/routing/algorithm/mapping/SnapshotTestBase.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/SnapshotTestBase.java @@ -85,7 +85,8 @@ public static void loadGraphBeforeClass(boolean withElevation) { protected OtpServerRequestContext serverContext() { if (serverContext == null) { TestOtpModel model = getGraph(); - serverContext = TestServerContext.createServerContext(model.graph(), model.transitModel()); + serverContext = + TestServerContext.createServerContext(model.graph(), model.timetableRepository()); } return serverContext; 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 94% 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 index 58a56ccb96f..db41d9b5768 100644 --- 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 @@ -10,7 +10,7 @@ import java.util.Map; import org.junit.jupiter.api.Test; import org.opentripplanner.model.StopTime; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.network.RoutingTripPattern; import org.opentripplanner.transit.model.network.StopPattern; @@ -20,7 +20,7 @@ class TransitLayerTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final TripTimes TRIP_TIMES; private static final RoutingTripPattern TRIP_PATTERN; @@ -30,17 +30,17 @@ class TransitLayerTest { var stopTime = new StopTime(); stopTime.setStop(stop); var stopPattern = new StopPattern(List.of(stopTime)); - var route = TransitModelForTest.route("1").build(); + var route = TimetableRepositoryForTest.route("1").build(); TRIP_PATTERN = TripPattern - .of(TransitModelForTest.id("P1")) + .of(TimetableRepositoryForTest.id("P1")) .withRoute(route) .withStopPattern(stopPattern) .build() .getRoutingTripPattern(); TRIP_TIMES = TripTimesFactory.tripTimes( - TransitModelForTest.trip("1").withRoute(route).build(), + TimetableRepositoryForTest.trip("1").withRoute(route).build(), List.of(new StopTime()), new Deduplicator() ); 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 86% 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 index dd9a2fffa66..c7f76fc3377 100644 --- 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 @@ -11,7 +11,7 @@ import org.junit.jupiter.params.provider.MethodSource; import org.opentripplanner.model.Frequency; import org.opentripplanner.model.StopTime; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.network.RoutingTripPattern; @@ -24,11 +24,11 @@ class TripPatternForDateTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final RegularStop STOP = TEST_MODEL.stop("TEST:STOP", 0, 0).build(); - private static final Route ROUTE = TransitModelForTest.route("1").build(); + private static final Route ROUTE = TimetableRepositoryForTest.route("1").build(); private static final TripTimes tripTimes = TripTimesFactory.tripTimes( - TransitModelForTest.trip("1").withRoute(ROUTE).build(), + TimetableRepositoryForTest.trip("1").withRoute(ROUTE).build(), List.of(new StopTime()), new Deduplicator() ); @@ -46,7 +46,7 @@ void shouldExcludeAndIncludeBasedOnFrequency(List freqs) { stopTime.setStop(STOP); StopPattern stopPattern = new StopPattern(List.of(stopTime)); RoutingTripPattern tripPattern = TripPattern - .of(TransitModelForTest.id("P1")) + .of(TimetableRepositoryForTest.id("P1")) .withRoute(ROUTE) .withStopPattern(stopPattern) .build() 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 99% 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 index 214ea55eb3c..80ec5de7ed4 100644 --- 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 @@ -26,7 +26,7 @@ import org.opentripplanner.raptor.spi.RaptorBoardOrAlightEvent; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripSchedule; import org.opentripplanner.routing.algorithm.raptoradapter.transit.request.TestRouteData; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.RoutingTripPattern; @@ -35,7 +35,7 @@ public class ConstrainedBoardingSearchTest { - private static final FeedScopedId ID = TransitModelForTest.id("ID"); + private static final FeedScopedId ID = TimetableRepositoryForTest.id("ID"); private static final TransferConstraint GUARANTEED_CONSTRAINT = TransferConstraint .of() .guaranteed() 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 96% 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 index fb2a9bf04d0..1aaf3dcd8ef 100644 --- 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 @@ -4,8 +4,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.opentripplanner.raptor._data.transit.TestRoute.route; -import static org.opentripplanner.transit.model._data.TransitModelForTest.agency; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.agency; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.time.Duration; import java.util.List; @@ -25,7 +25,7 @@ import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.api.request.framework.CostLinearFunction; import org.opentripplanner.test.support.TestTableParser; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.RouteBuilder; import org.opentripplanner.transit.model.organization.Agency; @@ -212,7 +212,7 @@ RouteRequest createRouteRequest() { } private static TestTripPattern pattern(boolean unpreferredRoute, boolean unpreferredAgency) { - RouteBuilder builder = TransitModelForTest.route( + RouteBuilder builder = TimetableRepositoryForTest.route( unpreferredRoute ? UNPREFERRED_ROUTE_ID : DEFAULT_ROUTE_ID ); 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 90% 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 index 35aa9e1d7a2..9f7458376cc 100644 --- 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 @@ -1,9 +1,9 @@ package org.opentripplanner.routing.algorithm.raptoradapter.transit.mappers; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.transit.model._data.TransitModelForTest.agency; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; -import static org.opentripplanner.transit.model._data.TransitModelForTest.route; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.agency; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.route; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; 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 71% 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..a8e00056a3f 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,24 +16,27 @@ 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.transit.model._data.TransitModelForTest; +import org.opentripplanner.routing.api.request.via.PassThroughViaLocation; +import org.opentripplanner.routing.api.request.via.VisitViaLocation; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; +import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.site.StopLocation; class RaptorRequestMapperTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); 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 92% 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 index 9296ee2730c..1301eea3844 100644 --- 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 @@ -6,7 +6,7 @@ import java.util.List; import org.junit.jupiter.api.Test; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TransitTuningParameters; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.Station; import org.opentripplanner.transit.model.site.StopLocation; @@ -15,7 +15,7 @@ class TransitLayerMapperTest { - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); private final Station STATION_A = testModel .station("A") 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 94% 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 27f80062555..2b0751c7456 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,20 +10,19 @@ 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; import org.opentripplanner.model.plan.PlanTestConstants; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripPatternForDate; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.timetable.TripTimes; import org.opentripplanner.transit.model.timetable.TripTimesFactory; public class TripPatternForDateMapperTest { - private static TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final LocalDate SERVICE_DATE = LocalDate.of(2009, 8, 7); private static final int SERVICE_CODE = 555; @@ -36,7 +35,7 @@ public class TripPatternForDateMapperTest { @BeforeAll public static void setUp() throws Exception { var pattern = TEST_MODEL.pattern(BUS).build(); - var trip = TransitModelForTest.trip("1").build(); + var trip = TimetableRepositoryForTest.trip("1").build(); var tripTimes = TripTimesFactory.tripTimes( trip, TEST_MODEL.stopTimesEvery5Minutes(5, trip, PlanTestConstants.T11_00), @@ -101,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 93% 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 index ea815a2f47f..b81792877ae 100644 --- 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 @@ -1,7 +1,7 @@ package org.opentripplanner.routing.algorithm.raptoradapter.transit.request; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.time.LocalDate; import java.time.ZonedDateTime; @@ -13,7 +13,7 @@ import org.opentripplanner.framework.time.ServiceDateUtils; import org.opentripplanner.model.StopTime; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripPatternForDate; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.RoutingTripPattern; @@ -25,7 +25,7 @@ public class RaptorRoutingRequestTransitDataCreatorTest { - private static TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); public static final FeedScopedId TP_ID_1 = id("1"); public static final FeedScopedId TP_ID_2 = id("2"); @@ -101,7 +101,7 @@ private static TripPatternForDates findTripPatternForDate( private TripTimes createTripTimesForTest() { return ScheduledTripTimes .of() - .withTrip(TransitModelForTest.trip("Test").build()) + .withTrip(TimetableRepositoryForTest.trip("Test").build()) .withDepartureTimes("00:00 02:00") .build(); } @@ -120,7 +120,7 @@ private static StopTime createStopTime() { private static RoutingTripPattern createTripPattern(FeedScopedId id) { return TripPattern .of(id) - .withRoute(TransitModelForTest.route("1").withMode(TransitMode.BUS).build()) + .withRoute(TimetableRepositoryForTest.route("1").withMode(TransitMode.BUS).build()) .withStopPattern(new StopPattern(List.of(createStopTime(), createStopTime()))) .build() .getRoutingTripPattern(); 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 96% 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 index c3fe0756bb0..ea4b7174e79 100644 --- 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 @@ -27,7 +27,7 @@ import org.opentripplanner.routing.api.request.request.filter.SelectRequest; import org.opentripplanner.routing.api.request.request.filter.TransitFilter; import org.opentripplanner.routing.api.request.request.filter.TransitFilterRequest; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.basic.MainAndSubMode; import org.opentripplanner.transit.model.basic.SubMode; @@ -51,11 +51,11 @@ class RouteRequestTransitDataProviderFilterTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); - private static final Route ROUTE = TransitModelForTest.route("1").build(); + private static final Route ROUTE = TimetableRepositoryForTest.route("1").build(); - private static final FeedScopedId TRIP_ID = TransitModelForTest.id("T1"); + private static final FeedScopedId TRIP_ID = TimetableRepositoryForTest.id("T1"); private static final RegularStop STOP_FOR_TEST = TEST_MODEL.stop("TEST:STOP", 0, 0).build(); @@ -102,8 +102,8 @@ void testWheelchairAccess(Accessibility wheelchair, WheelchairPreferences access var stopPattern = new StopPattern(List.of(stopTimeStart, stopTimeEnd)); var tripPattern = TripPattern - .of(TransitModelForTest.id("P1")) - .withRoute(TransitModelForTest.route("1").build()) + .of(TimetableRepositoryForTest.id("P1")) + .withRoute(TimetableRepositoryForTest.route("1").build()) .withStopPattern(stopPattern) .build() .getRoutingTripPattern(); @@ -153,8 +153,8 @@ void testRealtimeCancelledStops(boolean includeRealtimeCancellations) { var stopTime4 = getStopTime("TEST:4", PickDrop.SCHEDULED); var stopPattern = new StopPattern(List.of(stopTime1, stopTime2, stopTime3, stopTime4)); var tripPattern = TripPattern - .of(TransitModelForTest.id("P1")) - .withRoute(TransitModelForTest.route("1").build()) + .of(TimetableRepositoryForTest.id("P1")) + .withRoute(TimetableRepositoryForTest.route("1").build()) .withStopPattern(stopPattern) .build() .getRoutingTripPattern(); @@ -303,7 +303,7 @@ void matchModeFilterAndBannedAgencyFilter() { SubMode.of(TransmodelTransportSubmode.UNKNOWN.getValue()) ) ), - List.of(TransitModelForTest.OTHER_AGENCY.getId()) + List.of(TimetableRepositoryForTest.OTHER_AGENCY.getId()) ) ); @@ -339,7 +339,7 @@ void matchCombinedModesAndBannedAgencyFilter() { SubMode.of(TransmodelTransportSubmode.UNKNOWN.getValue()) ) ), - List.of(TransitModelForTest.OTHER_AGENCY.getId()) + List.of(TimetableRepositoryForTest.OTHER_AGENCY.getId()) ) ); @@ -368,7 +368,10 @@ void matchSelectedAgencyExcludedSubMode() { TransitFilterRequest .of() .addSelect( - SelectRequest.of().withAgencies(List.of(TransitModelForTest.AGENCY.getId())).build() + SelectRequest + .of() + .withAgencies(List.of(TimetableRepositoryForTest.AGENCY.getId())) + .build() ) .addNot( SelectRequest @@ -734,8 +737,8 @@ void includeRealtimeCancellationsTest() { @Test void testBikesAllowed() { - RouteBuilder routeBuilder = TransitModelForTest.route("1"); - TripBuilder trip = Trip.of(TransitModelForTest.id("T1")).withRoute(routeBuilder.build()); + RouteBuilder routeBuilder = TimetableRepositoryForTest.route("1"); + TripBuilder trip = Trip.of(TimetableRepositoryForTest.id("T1")).withRoute(routeBuilder.build()); assertEquals( BikeAccess.UNKNOWN, @@ -921,20 +924,20 @@ private boolean validateModesOnTripTimes( } private TripPatternForDate createTestTripPatternForDate() { - Route route = TransitModelForTest.route("1").build(); + Route route = TimetableRepositoryForTest.route("1").build(); var stopTime = new StopTime(); stopTime.setStop(STOP_FOR_TEST); StopPattern stopPattern = new StopPattern(List.of(stopTime)); RoutingTripPattern tripPattern = TripPattern - .of(TransitModelForTest.id("P1")) + .of(TimetableRepositoryForTest.id("P1")) .withRoute(route) .withStopPattern(stopPattern) .build() .getRoutingTripPattern(); TripTimes tripTimes = TripTimesFactory.tripTimes( - TransitModelForTest.trip("1").withRoute(route).build(), + TimetableRepositoryForTest.trip("1").withRoute(route).build(), List.of(new StopTime()), new Deduplicator() ); 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 94% 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 8648ea20324..1d266ce9953 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 @@ -17,7 +17,7 @@ import org.opentripplanner.raptor.spi.RaptorTimeTable; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripPatternForDate; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripSchedule; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.network.Route; @@ -59,7 +59,7 @@ public TestRouteData(Route route, List stops, List times) { tripPattern = TripPattern - .of(TransitModelForTest.id("TP:" + route)) + .of(TimetableRepositoryForTest.id("TP:" + route)) .withRoute(this.route) .withStopPattern(new StopPattern(stopTimesFistTrip)) .withScheduledTimeTableBuilder(builder -> builder.addAllTripTimes(tripTimes)) @@ -167,7 +167,7 @@ private Trip parseTripInfo( Deduplicator deduplicator ) { var trip = Trip - .of(TransitModelForTest.id(route + "-" + stopTimesByTrip.size() + 1)) + .of(TimetableRepositoryForTest.id(route + "-" + stopTimesByTrip.size() + 1)) .withRoute(this.route) .build(); var stopTimes = stopTimes(trip, stops, tripTimes); @@ -260,9 +260,12 @@ public Builder withSubmode(String submode) { } public TestRouteData build() { - var routeBuilder = TransitModelForTest.route(route).withMode(mode).withShortName(route); + var routeBuilder = TimetableRepositoryForTest + .route(route) + .withMode(mode) + .withShortName(route); if (agency != null) { - routeBuilder.withAgency(TransitModelForTest.agency(agency)); + routeBuilder.withAgency(TimetableRepositoryForTest.agency(agency)); } if (submode != null) { routeBuilder.withNetexSubmode(submode); 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 86% 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 index c8d99f1bfaf..729b643667a 100644 --- 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 @@ -1,13 +1,13 @@ package org.opentripplanner.routing.algorithm.raptoradapter.transit.request; import java.time.LocalDate; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.Station; public final class TestTransitCaseData { - private static TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); public static final Station STATION_A = TEST_MODEL .station("A") 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 98% 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 index 4155d46fe63..90dd9e5915e 100644 --- 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 @@ -11,7 +11,7 @@ import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.routing.algorithm.transferoptimization.model.TripStopTime; import org.opentripplanner.routing.algorithm.transferoptimization.model.TripToTripTransfer; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.timetable.Trip; /** @@ -154,7 +154,7 @@ public TripToTripTransfer build() { private static Trip createDummyTrip(T trip) { // Set an uniq id: pattern + the first stop departure time - return TransitModelForTest + return TimetableRepositoryForTest .trip(trip.pattern().debugInfo() + ":" + TimeUtils.timeToStrCompact(trip.departure(0))) .build(); } 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 96% 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..7b2a4d7e7a6 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,11 +17,11 @@ 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; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; /** * Create search from point A to point B via point C. Search will start at 12:00 and will find two @@ -50,7 +50,7 @@ public class ViaRoutingWorkerTest { private static List firstSearch; private static List secondSearch; - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); private final Place fromA = testModel.place("A", 5.0, 8.0); private final Place viaC = testModel.place("C", 7.0, 9.0); @@ -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 95% 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..7e40bb9670e 100644 --- a/src/test/java/org/opentripplanner/routing/core/ItineraryFaresTest.java +++ b/application/src/test/java/org/opentripplanner/routing/core/ItineraryFaresTest.java @@ -12,10 +12,9 @@ import static org.opentripplanner.model.plan.PlanTestConstants.T11_30; import static org.opentripplanner.model.plan.PlanTestConstants.T11_50; import static org.opentripplanner.model.plan.TestItineraryBuilder.newItinerary; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.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 98% rename from src/test/java/org/opentripplanner/routing/graph/DefaultRoutingServiceTest.java rename to application/src/test/java/org/opentripplanner/routing/graph/DefaultRoutingServiceTest.java index 8c56bb89a1f..a019a7059e5 100644 --- a/src/test/java/org/opentripplanner/routing/graph/DefaultRoutingServiceTest.java +++ b/application/src/test/java/org/opentripplanner/routing/graph/DefaultRoutingServiceTest.java @@ -36,7 +36,7 @@ public class DefaultRoutingServiceTest extends GtfsTest { @Override public void setUp() throws Exception { super.setUp(); - transitService = new DefaultTransitService(transitModel); + transitService = new DefaultTransitService(timetableRepository); } @Override 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 91% rename from src/test/java/org/opentripplanner/routing/graph/GraphSerializationTest.java rename to application/src/test/java/org/opentripplanner/routing/graph/GraphSerializationTest.java index f1f9ff8bfe6..03bd2d2b5cc 100644 --- a/src/test/java/org/opentripplanner/routing/graph/GraphSerializationTest.java +++ b/application/src/test/java/org/opentripplanner/routing/graph/GraphSerializationTest.java @@ -29,7 +29,7 @@ import org.opentripplanner.standalone.config.RouterConfig; import org.opentripplanner.street.model.StreetLimitationParameters; import org.opentripplanner.transit.model.framework.Deduplicator; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * Tests that saving a graph and reloading it (round trip through serialization and deserialization) @@ -67,7 +67,7 @@ public void testRoundTripSerializationForGTFSGraph() throws Exception { TestOtpModel model = ConstantsForTests.buildNewPortlandGraph(true); var weRepo = new DefaultWorldEnvelopeRepository(); var emissionsDataModel = new EmissionsDataModel(); - testRoundTrip(model.graph(), model.transitModel(), weRepo, emissionsDataModel); + testRoundTrip(model.graph(), model.timetableRepository(), weRepo, emissionsDataModel); } /** @@ -78,7 +78,12 @@ public void testRoundTripSerializationForNetexGraph() throws Exception { TestOtpModel model = ConstantsForTests.buildNewMinimalNetexGraph(); var worldEnvelopeRepository = new DefaultWorldEnvelopeRepository(); var emissionsDataModel = new EmissionsDataModel(); - testRoundTrip(model.graph(), model.transitModel(), worldEnvelopeRepository, emissionsDataModel); + testRoundTrip( + model.graph(), + model.timetableRepository(), + worldEnvelopeRepository, + emissionsDataModel + ); } // Ideally we'd also test comparing two separate but identical complex graphs, built separately from the same inputs. @@ -175,7 +180,7 @@ private static void assertNoDifferences(Graph g1, Graph g2) { */ private void testRoundTrip( Graph originalGraph, - TransitModel originalTransitModel, + TimetableRepository originalTimetableRepository, WorldEnvelopeRepository worldEnvelopeRepository, EmissionsDataModel emissionsDataModel ) throws Exception { @@ -185,7 +190,7 @@ private void testRoundTrip( streetLimitationParameters.initMaxCarSpeed(40); SerializedGraphObject serializedObj = new SerializedGraphObject( originalGraph, - originalTransitModel, + originalTimetableRepository, worldEnvelopeRepository, BuildConfig.DEFAULT, RouterConfig.DEFAULT, @@ -197,23 +202,23 @@ private void testRoundTrip( serializedObj.save(new FileDataSource(tempFile, FileType.GRAPH)); SerializedGraphObject deserializedGraph = SerializedGraphObject.load(tempFile); Graph copiedGraph1 = deserializedGraph.graph; - TransitModel copiedTransitModel1 = deserializedGraph.transitModel; + TimetableRepository copiedTimetableRepository1 = deserializedGraph.timetableRepository; // Index both graph - we do no know if the original is indexed, because it is cached and // might be indexed by other tests. - originalTransitModel.index(); - originalGraph.index(originalTransitModel.getStopModel()); + originalTimetableRepository.index(); + originalGraph.index(originalTimetableRepository.getStopModel()); - copiedTransitModel1.index(); - copiedGraph1.index(copiedTransitModel1.getStopModel()); + copiedTimetableRepository1.index(); + copiedGraph1.index(copiedTimetableRepository1.getStopModel()); assertNoDifferences(originalGraph, copiedGraph1); SerializedGraphObject deserializedGraph2 = SerializedGraphObject.load(tempFile); Graph copiedGraph2 = deserializedGraph2.graph; - TransitModel copiedTransitModel2 = deserializedGraph2.transitModel; - copiedTransitModel2.index(); - copiedGraph2.index(copiedTransitModel2.getStopModel()); + TimetableRepository copiedTimetableRepository2 = deserializedGraph2.timetableRepository; + copiedTimetableRepository2.index(); + copiedGraph2.index(copiedTimetableRepository2.getStopModel()); assertNoDifferences(copiedGraph1, copiedGraph2); } } 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 95% rename from src/test/java/org/opentripplanner/routing/graphfinder/DirectGraphFinderTest.java rename to application/src/test/java/org/opentripplanner/routing/graphfinder/DirectGraphFinderTest.java index cb439a9cea3..c407fa08098 100644 --- a/src/test/java/org/opentripplanner/routing/graphfinder/DirectGraphFinderTest.java +++ b/application/src/test/java/org/opentripplanner/routing/graphfinder/DirectGraphFinderTest.java @@ -29,7 +29,7 @@ public void build() { } } ); - stopModel = model.transitModel().getStopModel(); + stopModel = model.timetableRepository().getStopModel(); } @Test 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 84% rename from src/test/java/org/opentripplanner/routing/graphfinder/NearbyStopTest.java rename to application/src/test/java/org/opentripplanner/routing/graphfinder/NearbyStopTest.java index a81d7c39c5e..6f5fe5c3760 100644 --- a/src/test/java/org/opentripplanner/routing/graphfinder/NearbyStopTest.java +++ b/application/src/test/java/org/opentripplanner/routing/graphfinder/NearbyStopTest.java @@ -4,11 +4,11 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class NearbyStopTest { - private static TransitModelForTest MODEL = TransitModelForTest.of(); + private static TimetableRepositoryForTest MODEL = TimetableRepositoryForTest.of(); // TODO Add tests for all public methods in NearbyStop here 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 94% rename from src/test/java/org/opentripplanner/routing/graphfinder/PlaceFinderTraverseVisitorTest.java rename to application/src/test/java/org/opentripplanner/routing/graphfinder/PlaceFinderTraverseVisitorTest.java index b69a6533334..95ad1aa316e 100644 --- a/src/test/java/org/opentripplanner/routing/graphfinder/PlaceFinderTraverseVisitorTest.java +++ b/application/src/test/java/org/opentripplanner/routing/graphfinder/PlaceFinderTraverseVisitorTest.java @@ -4,9 +4,9 @@ import static org.opentripplanner.model.plan.PlanTestConstants.T11_00; import static org.opentripplanner.model.plan.PlanTestConstants.T11_05; import static org.opentripplanner.model.plan.PlanTestConstants.T11_10; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; -import static org.opentripplanner.transit.model._data.TransitModelForTest.route; -import static org.opentripplanner.transit.model._data.TransitModelForTest.tripPattern; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.route; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.tripPattern; import java.util.List; import org.junit.jupiter.api.Test; @@ -15,7 +15,7 @@ import org.opentripplanner.model.StopTime; import org.opentripplanner.service.vehiclerental.model.TestVehicleRentalStationBuilder; import org.opentripplanner.street.search.state.TestStateBuilder; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.network.StopPattern; @@ -23,11 +23,11 @@ import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.Station; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class PlaceFinderTraverseVisitorTest { - static TransitModelForTest model = TransitModelForTest.of(); + static TimetableRepositoryForTest model = TimetableRepositoryForTest.of(); static final Station STATION1 = Station .of(id("S1")) .withName(new NonLocalizedString("Station 1")) @@ -55,7 +55,7 @@ public class PlaceFinderTraverseVisitorTest { static final Route r = route("r").build(); - static TransitModel a = new TransitModel(); + static TimetableRepository a = new TimetableRepository(); static { a.addTransitMode(TransitMode.BUS); 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 87% rename from src/test/java/org/opentripplanner/routing/graphfinder/StopFinderTraverseVisitorTest.java rename to application/src/test/java/org/opentripplanner/routing/graphfinder/StopFinderTraverseVisitorTest.java index 428e476babd..92bafe8e36b 100644 --- a/src/test/java/org/opentripplanner/routing/graphfinder/StopFinderTraverseVisitorTest.java +++ b/application/src/test/java/org/opentripplanner/routing/graphfinder/StopFinderTraverseVisitorTest.java @@ -6,12 +6,12 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.street.model.vertex.TransitStopVertex; import org.opentripplanner.street.search.state.TestStateBuilder; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.site.RegularStop; class StopFinderTraverseVisitorTest { - static final RegularStop STOP = TransitModelForTest.of().stop("a-stop", 1, 1).build(); + static final RegularStop STOP = TimetableRepositoryForTest.of().stop("a-stop", 1, 1).build(); @Test void deduplicateStops() { 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 97% rename from src/test/java/org/opentripplanner/routing/graphfinder/StreetGraphFinderTest.java rename to application/src/test/java/org/opentripplanner/routing/graphfinder/StreetGraphFinderTest.java index 76f231577dd..622b76a431a 100644 --- a/src/test/java/org/opentripplanner/routing/graphfinder/StreetGraphFinderTest.java +++ b/application/src/test/java/org/opentripplanner/routing/graphfinder/StreetGraphFinderTest.java @@ -13,7 +13,7 @@ import org.opentripplanner.street.model.StreetTraversalPermission; import org.opentripplanner.street.model.vertex.IntersectionVertex; import org.opentripplanner.street.model.vertex.TransitStopVertex; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.network.StopPattern; @@ -39,7 +39,7 @@ protected void setUp() throws Exception { new Builder() { @Override public void build() { - var a = TransitModelForTest.agency("Agency"); + var a = TimetableRepositoryForTest.agency("Agency"); R1 = route("R1", TransitMode.BUS, a); R2 = route("R2", TransitMode.TRAM, a); @@ -99,7 +99,7 @@ public void build() { tripPattern( TP1 = TripPattern - .of(TransitModelForTest.id("TP1")) + .of(TimetableRepositoryForTest.id("TP1")) .withRoute(R1) .withStopPattern(new StopPattern(List.of(st(S1), st(S2)))) .build() @@ -107,7 +107,7 @@ public void build() { tripPattern( TP2 = TripPattern - .of(TransitModelForTest.id("TP2")) + .of(TimetableRepositoryForTest.id("TP2")) .withRoute(R2) .withStopPattern(new StopPattern(List.of(st(S1), st(S3)))) .build() @@ -116,7 +116,7 @@ public void build() { } ); - transitService = new DefaultTransitService(otpModel.transitModel()); + transitService = new DefaultTransitService(otpModel.timetableRepository()); graphFinder = new StreetGraphFinder(otpModel.graph()); } 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 96% rename from src/test/java/org/opentripplanner/routing/linking/LinkStopToPlatformTest.java rename to application/src/test/java/org/opentripplanner/routing/linking/LinkStopToPlatformTest.java index 23607d2e0b3..f0ddc08087e 100644 --- a/src/test/java/org/opentripplanner/routing/linking/LinkStopToPlatformTest.java +++ b/application/src/test/java/org/opentripplanner/routing/linking/LinkStopToPlatformTest.java @@ -29,11 +29,11 @@ import org.opentripplanner.street.model.vertex.Vertex; import org.opentripplanner.street.search.TraverseMode; import org.opentripplanner.street.search.TraverseModeSet; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,13 +41,13 @@ public class LinkStopToPlatformTest { private static final Logger LOG = LoggerFactory.getLogger(LinkStopToPlatformTest.class); private static final GeometryFactory geometryFactory = GeometryUtils.getGeometryFactory(); - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); private Graph prepareTest(Coordinate[] platform, int[] visible, Coordinate[] stops) { var deduplicator = new Deduplicator(); var stopModel = new StopModel(); Graph graph = new Graph(deduplicator); - var transitModel = new TransitModel(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(stopModel, deduplicator); ArrayList vertices = new ArrayList<>(); Coordinate[] closedGeom = new Coordinate[platform.length + 1]; @@ -106,8 +106,8 @@ private Graph prepareTest(Coordinate[] platform, int[] visible, Coordinate[] sto transitStops[i] = testModel.stop("TestStop " + i).withCoordinate(stop.y, stop.x).build(); } - transitModel.index(); - graph.index(transitModel.getStopModel()); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); for (RegularStop s : transitStops) { var v = TransitStopVertex.of().withStop(s).build(); 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 83% 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..055fba784a9 100644 --- a/src/test/java/org/opentripplanner/routing/stoptimes/AlternativeLegsTest.java +++ b/application/src/test/java/org/opentripplanner/routing/stoptimes/AlternativeLegsTest.java @@ -34,7 +34,7 @@ public String getFeedName() { @Test void testPreviousLegs() { - var transitService = new DefaultTransitService(transitModel); + var transitService = new DefaultTransitService(timetableRepository); var originalLeg = new ScheduledTransitLegReference( new FeedScopedId(this.feedId.getId(), "1.2"), @@ -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], " + @@ -70,7 +68,7 @@ void testPreviousLegs() { @Test void testNextLegs() { - var transitService = new DefaultTransitService(transitModel); + var transitService = new DefaultTransitService(timetableRepository); var originalLeg = new ScheduledTransitLegReference( new FeedScopedId(this.feedId.getId(), "2.2"), @@ -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], " + @@ -106,7 +102,7 @@ void testNextLegs() { @Test void testCircularRoutes() { - var transitService = new DefaultTransitService(transitModel); + var transitService = new DefaultTransitService(timetableRepository); var originalLeg = new ScheduledTransitLegReference( new FeedScopedId(this.feedId.getId(), "19.1"), @@ -126,16 +122,15 @@ 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); } @Test void testComplexCircularRoutes() { - var transitService = new DefaultTransitService(transitModel); + var transitService = new DefaultTransitService(timetableRepository); var originalLeg = new ScheduledTransitLegReference( new FeedScopedId(this.feedId.getId(), "19.1"), @@ -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 95% rename from src/test/java/org/opentripplanner/routing/stoptimes/StopTimesHelperTest.java rename to application/src/test/java/org/opentripplanner/routing/stoptimes/StopTimesHelperTest.java index 61fffd7a905..b5b4d471e53 100644 --- a/src/test/java/org/opentripplanner/routing/stoptimes/StopTimesHelperTest.java +++ b/application/src/test/java/org/opentripplanner/routing/stoptimes/StopTimesHelperTest.java @@ -16,7 +16,7 @@ import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class StopTimesHelperTest { @@ -29,9 +29,9 @@ class StopTimesHelperTest { @BeforeAll public static void setUp() throws Exception { TestOtpModel model = ConstantsForTests.buildGtfsGraph(ConstantsForTests.SIMPLE_GTFS); - TransitModel transitModel = model.transitModel(); - transitService = new DefaultTransitService(transitModel); - feedId = transitModel.getFeedIds().iterator().next(); + TimetableRepository timetableRepository = model.timetableRepository(); + transitService = new DefaultTransitService(timetableRepository); + feedId = timetableRepository.getFeedIds().iterator().next(); stopId = new FeedScopedId(feedId, "J"); var originalPattern = transitService.getPatternForTrip( transitService.getTripForId(new FeedScopedId(feedId, "5.1")) @@ -45,9 +45,9 @@ public static void setUp() throws Exception { .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); + timetableRepository.addTripPattern(pattern.getId(), pattern); + timetableRepository.index(); + transitService = new DefaultTransitService(timetableRepository); } /** 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 93% rename from src/test/java/org/opentripplanner/routing/trippattern/FrequencyEntryTest.java rename to application/src/test/java/org/opentripplanner/routing/trippattern/FrequencyEntryTest.java index 49ca6d9221b..130438eb75b 100644 --- a/src/test/java/org/opentripplanner/routing/trippattern/FrequencyEntryTest.java +++ b/application/src/test/java/org/opentripplanner/routing/trippattern/FrequencyEntryTest.java @@ -7,7 +7,7 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.model.Frequency; import org.opentripplanner.model.StopTime; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.site.RegularStop; @@ -22,15 +22,15 @@ public class FrequencyEntryTest { private static final TripTimes tripTimes; static { - Trip trip = TransitModelForTest.trip("testtrip").build(); + Trip trip = TimetableRepositoryForTest.trip("testtrip").build(); List stopTimes = new ArrayList<>(); int time = 0; for (int i = 0; i < STOP_NUM; ++i) { - FeedScopedId id = TransitModelForTest.id(i + ""); + FeedScopedId id = TimetableRepositoryForTest.id(i + ""); - RegularStop stop = TransitModelForTest.of().stop(id.getId(), 0.0, 0.0).build(); + RegularStop stop = TimetableRepositoryForTest.of().stop(id.getId(), 0.0, 0.0).build(); StopTime stopTime = new StopTime(); stopTime.setStop(stop); 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 80% 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 index 9fe74c66353..7dee554efdd 100644 --- a/src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingTestGraphData.java +++ b/application/src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingTestGraphData.java @@ -7,7 +7,7 @@ import org.opentripplanner.street.model.vertex.VertexFactory; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class VehicleParkingTestGraphData { @@ -15,13 +15,13 @@ public class VehicleParkingTestGraphData { protected Graph graph; - protected TransitModel transitModel; + protected TimetableRepository timetableRepository; public void initGraph() { var deduplicator = new Deduplicator(); var stopModel = new StopModel(); graph = new Graph(deduplicator); - transitModel = new TransitModel(stopModel, deduplicator); + timetableRepository = new TimetableRepository(stopModel, deduplicator); graph.hasStreets = true; var factory = new VertexFactory(graph); @@ -36,8 +36,8 @@ public Graph getGraph() { return graph; } - public TransitModel getTransitModel() { - return transitModel; + public TimetableRepository getTimetableRepository() { + return timetableRepository; } public IntersectionVertex getAVertex() { 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 97% rename from src/test/java/org/opentripplanner/service/paging/TestPagingModel.java rename to application/src/test/java/org/opentripplanner/service/paging/TestPagingModel.java index 938a201576f..c4db100b56f 100644 --- a/src/test/java/org/opentripplanner/service/paging/TestPagingModel.java +++ b/application/src/test/java/org/opentripplanner/service/paging/TestPagingModel.java @@ -14,7 +14,7 @@ import org.opentripplanner.model.plan.TestItineraryBuilder; import org.opentripplanner.model.plan.paging.cursor.PageCursor; import org.opentripplanner.routing.algorithm.filterchain.framework.sort.SortOrderComparator; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class TestPagingModel { @@ -54,7 +54,7 @@ class TestPagingModel { private static final Instant TRANSIT_START_TIME = TestItineraryBuilder.newTime(0).toInstant(); - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Place A = Place.forStop(TEST_MODEL.stop("A").build()); private static final Place B = Place.forStop(TEST_MODEL.stop("B").build()); 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 69% 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 index a1c9dddaab0..7ca1ac6a760 100644 --- a/src/test/java/org/opentripplanner/service/realtimevehicles/internal/DefaultRealtimeVehicleServiceTest.java +++ b/application/src/test/java/org/opentripplanner/service/realtimevehicles/internal/DefaultRealtimeVehicleServiceTest.java @@ -2,25 +2,25 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.opentripplanner.framework.geometry.WgsCoordinate.GREENWICH; -import static org.opentripplanner.transit.model._data.TransitModelForTest.route; -import static org.opentripplanner.transit.model._data.TransitModelForTest.tripPattern; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.route; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.tripPattern; import java.time.Instant; import java.util.List; import org.junit.jupiter.api.Test; import org.opentripplanner.service.realtimevehicles.model.RealtimeVehicle; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; 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.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class DefaultRealtimeVehicleServiceTest { private static final Route ROUTE = route("r1").build(); - private static final TransitModelForTest MODEL = TransitModelForTest.of(); - private static final StopPattern STOP_PATTERN = TransitModelForTest.stopPattern( + private static final TimetableRepositoryForTest MODEL = TimetableRepositoryForTest.of(); + private static final StopPattern STOP_PATTERN = TimetableRepositoryForTest.stopPattern( MODEL.stop("1").build(), MODEL.stop("2").build() ); @@ -34,7 +34,9 @@ class DefaultRealtimeVehicleServiceTest { @Test void originalPattern() { - var service = new DefaultRealtimeVehicleService(new DefaultTransitService(new TransitModel())); + var service = new DefaultRealtimeVehicleService( + new DefaultTransitService(new TimetableRepository()) + ); service.setRealtimeVehicles(ORIGINAL, VEHICLES); var updates = service.getRealtimeVehicles(ORIGINAL); assertEquals(VEHICLES, updates); @@ -42,7 +44,9 @@ void originalPattern() { @Test void realtimeAddedPattern() { - var service = new DefaultRealtimeVehicleService(new DefaultTransitService(new TransitModel())); + var service = new DefaultRealtimeVehicleService( + new DefaultTransitService(new TimetableRepository()) + ); var realtimePattern = tripPattern("realtime-added", ROUTE) .withStopPattern(STOP_PATTERN) .withOriginalTripPattern(ORIGINAL) 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 98% 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..60daef889b0 100644 --- a/src/test/java/org/opentripplanner/street/integration/BarrierRoutingTest.java +++ b/application/src/test/java/org/opentripplanner/street/integration/BarrierRoutingTest.java @@ -45,7 +45,7 @@ public static void createGraph() { ResourceLoader.of(BarrierRoutingTest.class).file("herrenberg-barrier-gates.osm.pbf") ); graph = model.graph(); - graph.index(model.transitModel().getStopModel()); + graph.index(model.timetableRepository().getStopModel()); } /** @@ -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 96% 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..d5d6f7452db 100644 --- a/src/test/java/org/opentripplanner/street/integration/BicycleRoutingTest.java +++ b/application/src/test/java/org/opentripplanner/street/integration/BicycleRoutingTest.java @@ -34,8 +34,8 @@ public class BicycleRoutingTest { ); herrenbergGraph = model.graph(); - model.transitModel().index(); - herrenbergGraph.index(model.transitModel().getStopModel()); + model.timetableRepository().index(); + herrenbergGraph.index(model.timetableRepository().getStopModel()); } /** @@ -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 94% 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..50ab7d5ea55 100644 --- a/src/test/java/org/opentripplanner/street/integration/WalkRoutingTest.java +++ b/application/src/test/java/org/opentripplanner/street/integration/WalkRoutingTest.java @@ -29,8 +29,8 @@ class WalkRoutingTest { ); roundabout = model.graph(); - model.transitModel().index(); - roundabout.index(model.transitModel().getStopModel()); + model.timetableRepository().index(); + roundabout.index(model.timetableRepository().getStopModel()); } /** @@ -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 97% 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..8d06e06a0c1 100644 --- a/src/test/java/org/opentripplanner/street/model/_data/StreetModelForTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/_data/StreetModelForTest.java @@ -1,8 +1,7 @@ package org.opentripplanner.street.model._data; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.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 97% 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 index 6ba4dea0216..748e3b608fe 100644 --- a/src/test/java/org/opentripplanner/street/model/edge/StreetTransitEntityLinkTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/edge/StreetTransitEntityLinkTest.java @@ -25,7 +25,7 @@ import org.opentripplanner.street.search.request.StreetSearchRequest; 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._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.site.RegularStop; @@ -33,7 +33,7 @@ class StreetTransitEntityLinkTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final RegularStop ACCESSIBLE_STOP = stopForTest( "A:accessible", 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 98% 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 index 8a3316e44e0..8c6127e716e 100644 --- a/src/test/java/org/opentripplanner/street/model/edge/StreetVehicleParkingLinkTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/edge/StreetVehicleParkingLinkTest.java @@ -5,7 +5,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.params.provider.Arguments.of; import static org.opentripplanner.street.model._data.StreetModelForTest.intersectionVertex; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.Set; import java.util.stream.Stream; 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 95% 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 index 81bee23ad54..e28bf75583d 100644 --- a/src/test/java/org/opentripplanner/street/model/edge/VehicleParkingEdgeTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/edge/VehicleParkingEdgeTest.java @@ -14,7 +14,7 @@ import org.opentripplanner.street.model.vertex.VehicleParkingEntranceVertex; import org.opentripplanner.street.search.request.StreetSearchRequest; import org.opentripplanner.street.search.state.State; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class VehicleParkingEdgeTest { @@ -133,7 +133,7 @@ private VehicleParking createVehicleParking( ) { return StreetModelForTest .vehicleParking() - .id(TransitModelForTest.id("VehicleParking")) + .id(TimetableRepositoryForTest.id("VehicleParking")) .bicyclePlaces(bicyclePlaces) .carPlaces(carPlaces) .availability(availability) @@ -145,7 +145,7 @@ private VehicleParking.VehicleParkingEntranceCreator vehicleParkingEntrance() { String id = "Entrance"; return builder -> builder - .entranceId(TransitModelForTest.id(id)) + .entranceId(TimetableRepositoryForTest.id(id)) .name(new NonLocalizedString(id)) .coordinate(new WgsCoordinate(0, 0)); } 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 85% 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..298e4fe467f 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,14 +5,13 @@ 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._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.site.AreaStop; class OsmVertexTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final AreaStop AREA_STOP1 = TEST_MODEL.areaStop("flex-zone-1").build(); private static final AreaStop AREA_STOP2 = TEST_MODEL.areaStop("flex-zone-2").build(); @@ -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 89% 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 index 3c33573621e..4e7f222a26f 100644 --- a/src/test/java/org/opentripplanner/street/search/request/StreetSearchRequestMapperTest.java +++ b/application/src/test/java/org/opentripplanner/street/search/request/StreetSearchRequestMapperTest.java @@ -10,7 +10,7 @@ import org.opentripplanner.routing.api.request.RequestModes; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.api.request.StreetMode; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class StreetSearchRequestMapperTest { @@ -20,7 +20,7 @@ void map() { Instant dateTime = Instant.parse("2022-11-10T10:00:00Z"); routeRequest.setDateTime(dateTime); - var from = new GenericLocation(null, TransitModelForTest.id("STOP"), null, null); + var from = new GenericLocation(null, TimetableRepositoryForTest.id("STOP"), null, null); routeRequest.setFrom(from); var to = new GenericLocation(60.0, 20.0); routeRequest.setTo(to); @@ -44,7 +44,7 @@ void mapToTransferRequest() { Instant dateTime = Instant.parse("2022-11-10T10:00:00Z"); routeRequest.setDateTime(dateTime); - var from = new GenericLocation(null, TransitModelForTest.id("STOP"), null, null); + var from = new GenericLocation(null, TimetableRepositoryForTest.id("STOP"), null, null); routeRequest.setFrom(from); var to = new GenericLocation(60.0, 20.0); routeRequest.setTo(to); 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 98% 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..9605d950ae0 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; @@ -36,7 +35,7 @@ import org.opentripplanner.street.model.vertex.TransitStopVertex; import org.opentripplanner.street.search.TraverseMode; import org.opentripplanner.street.search.request.StreetSearchRequest; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.site.RegularStop; @@ -45,7 +44,7 @@ */ public class TestStateBuilder { - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); private static final Instant DEFAULT_START_TIME = OffsetDateTime .parse("2023-04-18T12:00:00+02:00") @@ -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/TimetableRepositoryArchitectureTest.java similarity index 98% rename from src/test/java/org/opentripplanner/transit/model/TransitModelArchitectureTest.java rename to application/src/test/java/org/opentripplanner/transit/model/TimetableRepositoryArchitectureTest.java index 11db763d97f..d2ae7e2e47d 100644 --- a/src/test/java/org/opentripplanner/transit/model/TransitModelArchitectureTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/TimetableRepositoryArchitectureTest.java @@ -15,7 +15,7 @@ import org.opentripplanner._support.arch.ArchComponent; import org.opentripplanner._support.arch.Package; -public class TransitModelArchitectureTest { +public class TimetableRepositoryArchitectureTest { private static final Package TRANSIT_FRAMEWORK = TRANSIT_MODEL.subPackage("framework"); private static final Package BASIC = TRANSIT_MODEL.subPackage("basic"); diff --git a/src/test/java/org/opentripplanner/transit/model/_data/PatternTestModel.java b/application/src/test/java/org/opentripplanner/transit/model/_data/PatternTestModel.java similarity index 71% rename from src/test/java/org/opentripplanner/transit/model/_data/PatternTestModel.java rename to application/src/test/java/org/opentripplanner/transit/model/_data/PatternTestModel.java index 0b149ae4ee4..5b3883005de 100644 --- a/src/test/java/org/opentripplanner/transit/model/_data/PatternTestModel.java +++ b/application/src/test/java/org/opentripplanner/transit/model/_data/PatternTestModel.java @@ -1,6 +1,6 @@ package org.opentripplanner.transit.model._data; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.Route; @@ -13,17 +13,22 @@ public class PatternTestModel { - public static final Route ROUTE_1 = TransitModelForTest.route("1").build(); + public static final Route ROUTE_1 = TimetableRepositoryForTest.route("1").build(); private static final FeedScopedId SERVICE_ID = id("service"); - private static final Trip TRIP = TransitModelForTest + private static final Trip TRIP = TimetableRepositoryForTest .trip("t1") .withRoute(ROUTE_1) .withServiceId(SERVICE_ID) .build(); - private static final TransitModelForTest MODEL = new TransitModelForTest(StopModel.of()); + private static final TimetableRepositoryForTest MODEL = new TimetableRepositoryForTest( + 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 StopPattern STOP_PATTERN = TimetableRepositoryForTest.stopPattern( + STOP_1, + STOP_1 + ); /** * Creates a trip pattern that has a stop pattern, trip times and a trip with a service id. @@ -36,7 +41,7 @@ public static TripPattern pattern() { .withDepartureTimes("10:00 10:05") .build(); - return TransitModelForTest + return TimetableRepositoryForTest .tripPattern("1", ROUTE_1) .withStopPattern(STOP_PATTERN) .withScheduledTimeTableBuilder(builder -> builder.addTripTimes(tt)) diff --git a/src/test/java/org/opentripplanner/transit/model/_data/TransitModelForTest.java b/application/src/test/java/org/opentripplanner/transit/model/_data/TimetableRepositoryForTest.java similarity index 97% rename from src/test/java/org/opentripplanner/transit/model/_data/TransitModelForTest.java rename to application/src/test/java/org/opentripplanner/transit/model/_data/TimetableRepositoryForTest.java index 0f6d872c639..1da4b5b06e0 100644 --- a/src/test/java/org/opentripplanner/transit/model/_data/TransitModelForTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/_data/TimetableRepositoryForTest.java @@ -50,7 +50,7 @@ * state between tests. For now, it is just the stop index - but we want to * use this to encapsulate the StopModel completely. */ -public class TransitModelForTest { +public class TimetableRepositoryForTest { public static final String FEED_ID = "F"; public static final String TIME_ZONE_ID = "Europe/Paris"; @@ -91,12 +91,12 @@ public class TransitModelForTest { private final StopModelBuilder stopModelBuilder; - public TransitModelForTest(StopModelBuilder stopModelBuilder) { + public TimetableRepositoryForTest(StopModelBuilder stopModelBuilder) { this.stopModelBuilder = stopModelBuilder; } - public static TransitModelForTest of() { - return new TransitModelForTest(StopModel.of()); + public static TimetableRepositoryForTest of() { + return new TimetableRepositoryForTest(StopModel.of()); } public static FeedScopedId id(String id) { 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 87% 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 index 5cdd6f37e5c..5306d31077a 100644 --- a/src/test/java/org/opentripplanner/transit/model/basic/NoticeTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/basic/NoticeTest.java @@ -7,7 +7,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class NoticeTest { @@ -16,7 +16,7 @@ class NoticeTest { private static final String PUBLIC_CODE = "public code"; private static final Notice subject = Notice - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withPublicCode(PUBLIC_CODE) .withText(TEXT) .build(); @@ -45,7 +45,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withPublicCode("X").build())); assertFalse(subject.sameAs(subject.copy().withText("X").build())); } diff --git a/src/test/java/org/opentripplanner/transit/model/filter/expr/AndMatcherTest.java b/application/src/test/java/org/opentripplanner/transit/model/filter/expr/AndMatcherTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/filter/expr/AndMatcherTest.java rename to application/src/test/java/org/opentripplanner/transit/model/filter/expr/AndMatcherTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/filter/expr/ContainsMatcherTest.java b/application/src/test/java/org/opentripplanner/transit/model/filter/expr/ContainsMatcherTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/filter/expr/ContainsMatcherTest.java rename to application/src/test/java/org/opentripplanner/transit/model/filter/expr/ContainsMatcherTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/filter/expr/EqualityMatcherTest.java b/application/src/test/java/org/opentripplanner/transit/model/filter/expr/EqualityMatcherTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/filter/expr/EqualityMatcherTest.java rename to application/src/test/java/org/opentripplanner/transit/model/filter/expr/EqualityMatcherTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/filter/expr/OrMatcherTest.java b/application/src/test/java/org/opentripplanner/transit/model/filter/expr/OrMatcherTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/filter/expr/OrMatcherTest.java rename to application/src/test/java/org/opentripplanner/transit/model/filter/expr/OrMatcherTest.java diff --git a/src/test/java/org/opentripplanner/transit/model/filter/transit/TripOnServiceDateMatcherFactoryTest.java b/application/src/test/java/org/opentripplanner/transit/model/filter/transit/TripOnServiceDateMatcherFactoryTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/model/filter/transit/TripOnServiceDateMatcherFactoryTest.java rename to application/src/test/java/org/opentripplanner/transit/model/filter/transit/TripOnServiceDateMatcherFactoryTest.java 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 89% 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..c89d45cc036 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,18 +5,17 @@ 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; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; public class EntityByIdTest { - private static final FeedScopedId ID = TransitModelForTest.id("99"); + private static final FeedScopedId ID = TimetableRepositoryForTest.id("99"); private static final TestEntity E = TestEntity.of(ID).build(); private static final String E_TO_STRING = E.toString(); private static final String LIST_OF_E_TO_STRING = String.format("[%s]", E_TO_STRING); private static final String MAP_OF_E_TO_STRING = String.format("{%s=%s}", ID, E_TO_STRING); - private static final FeedScopedId FAKE_ID = TransitModelForTest.id("77"); + private static final FeedScopedId FAKE_ID = TimetableRepositoryForTest.id("77"); private final EntityById subject = new DefaultEntityById<>(); @Test @@ -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 90% 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 index ca61e3c30f3..2788b62bae9 100644 --- a/src/test/java/org/opentripplanner/transit/model/network/GroupOfRoutesTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/network/GroupOfRoutesTest.java @@ -7,7 +7,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; public class GroupOfRoutesTest { @@ -18,7 +18,7 @@ public class GroupOfRoutesTest { private static final String DESCRIPTION = "description"; private static final GroupOfRoutes subject = GroupOfRoutes - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withPrivateCode(PRIVATE_CODE) .withShortName(SHORT_NAME) .withName(NAME) @@ -52,7 +52,7 @@ public void sameValue() { // Make a copy, and set the same name (nothing is changed) var other = subject.copy().build(); assertTrue(subject.sameAs(other)); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName("X").build())); assertFalse(subject.sameAs(subject.copy().withDescription("X").build())); assertFalse(subject.sameAs(subject.copy().withShortName("X").build())); 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 92% 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 index e21465547a1..65bc3bb53a9 100644 --- a/src/test/java/org/opentripplanner/transit/model/network/RouteTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/network/RouteTest.java @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.SubMode; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -39,9 +39,9 @@ class RouteTest { private static final String FLEXIBLE_LINE_TYPE = "flexible line type"; private static final Integer GTFS_SORT_ORDER = 0; private static final String URL = "url"; - public static final Agency AGENCY = TransitModelForTest.AGENCY; + public static final Agency AGENCY = TimetableRepositoryForTest.AGENCY; private static final Route subject = Route - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withShortName(SHORT_NAME) .withLongName(LONG_NAME) .withDescription(DESCRIPTION) @@ -96,7 +96,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withShortName("X").build())); assertFalse(subject.sameAs(subject.copy().withLongName(new NonLocalizedString("X")).build())); assertFalse(subject.sameAs(subject.copy().withDescription("X").build())); @@ -116,7 +116,9 @@ void sameAs() { .build() ) ); - assertFalse(subject.sameAs(subject.copy().withAgency(TransitModelForTest.agency("X")).build())); + assertFalse( + subject.sameAs(subject.copy().withAgency(TimetableRepositoryForTest.agency("X")).build()) + ); assertFalse( subject.sameAs( subject 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 87% 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 index 1bce2edf9dc..2b3a59cefab 100644 --- a/src/test/java/org/opentripplanner/transit/model/network/StopPatternTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/network/StopPatternTest.java @@ -6,12 +6,12 @@ import java.util.List; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.timetable.Trip; class StopPatternTest { - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); @Test void boardingAlightingConditions() { @@ -25,7 +25,7 @@ void boardingAlightingConditions() { var areaStop = testModel.areaStop("area").build(); - Trip t = TransitModelForTest.trip("trip").build(); + Trip t = TimetableRepositoryForTest.trip("trip").build(); StopPattern stopPattern = new StopPattern( List.of( @@ -54,7 +54,7 @@ void replaceStop() { var s3 = testModel.stop("3").build(); var s4 = testModel.stop("4").build(); - var pattern = TransitModelForTest.stopPattern(s1, s2, s3); + var pattern = TimetableRepositoryForTest.stopPattern(s1, s2, s3); assertEquals(List.of(s1, s2, s3), pattern.getStops()); 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 87% 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 index b2adc7544a3..bb0ec765331 100644 --- a/src/test/java/org/opentripplanner/transit/model/network/TripPatternTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/network/TripPatternTest.java @@ -6,13 +6,13 @@ import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.opentripplanner.framework.geometry.GeometryUtils.makeLineString; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.List; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.locationtech.jts.geom.LineString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.site.RegularStop; @@ -20,13 +20,13 @@ class TripPatternTest { private static final String ID = "1"; private static final String NAME = "short name"; - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); - private static final Route ROUTE = TransitModelForTest.route("routeId").build(); + private static final Route ROUTE = TimetableRepositoryForTest.route("routeId").build(); public static final RegularStop STOP_A = TEST_MODEL.stop("A").build(); public static final RegularStop STOP_B = TEST_MODEL.stop("B").build(); public static final RegularStop STOP_C = TEST_MODEL.stop("C").build(); - private static final StopPattern STOP_PATTERN = TransitModelForTest.stopPattern( + private static final StopPattern STOP_PATTERN = TimetableRepositoryForTest.stopPattern( STOP_A, STOP_B, STOP_C @@ -77,7 +77,7 @@ void sameAs() { assertFalse(subject.sameAs(subject.copy().withName("X").build())); assertFalse( subject.sameAs( - subject.copy().withRoute(TransitModelForTest.route("anotherId").build()).build() + subject.copy().withRoute(TimetableRepositoryForTest.route("anotherId").build()).build() ) ); assertFalse(subject.sameAs(subject.copy().withMode(TransitMode.RAIL).build())); 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 81% 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 index c1aeeea1a59..997d16bcff8 100644 --- 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 @@ -3,12 +3,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.timetable.Trip; class TripAdapterTest { - private final Trip trip = TransitModelForTest.trip("Trip").build(); + private final Trip trip = TimetableRepositoryForTest.trip("Trip").build(); private final TripAdapter subject = new TripAdapter(trip); 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 91% 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 index b2cf1a57db3..d5b0bff33a3 100644 --- a/src/test/java/org/opentripplanner/transit/model/organization/AgencyTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/organization/AgencyTest.java @@ -7,7 +7,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class AgencyTest { @@ -21,7 +21,7 @@ class AgencyTest { private static final String LANG = "image"; private static final Agency subject = Agency - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withName(NAME) .withUrl(URL) .withTimezone(TIMEZONE) @@ -60,7 +60,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName("X").build())); assertFalse(subject.sameAs(subject.copy().withUrl("X").build())); assertFalse(subject.sameAs(subject.copy().withTimezone("CET").build())); 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 90% 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 index 39b081fc6d8..37e6217cd15 100644 --- a/src/test/java/org/opentripplanner/transit/model/organization/BrandingTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/organization/BrandingTest.java @@ -7,7 +7,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; public class BrandingTest { @@ -19,7 +19,7 @@ public class BrandingTest { private static final String IMAGE = "test_image"; Branding subject = Branding - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withShortName(SHORT_NAME) .withName(NAME) .withUrl(URL) @@ -53,7 +53,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName("X").build())); assertFalse(subject.sameAs(subject.copy().withShortName("X").build())); assertFalse(subject.sameAs(subject.copy().withUrl("X").build())); 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 88% 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 index 44374f54e91..12decb1fc82 100644 --- a/src/test/java/org/opentripplanner/transit/model/organization/OperatorTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/organization/OperatorTest.java @@ -7,7 +7,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class OperatorTest { @@ -17,7 +17,7 @@ class OperatorTest { private static final String PHONE = "+47 95566333"; private static final Operator subject = Operator - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withName(NAME) .withUrl(URL) .withPhone(PHONE) @@ -46,7 +46,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName("X").build())); assertFalse(subject.sameAs(subject.copy().withUrl("X").build())); assertFalse(subject.sameAs(subject.copy().withPhone("X").build())); 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 90% 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 index a36b6611368..542dcaadc36 100644 --- a/src/test/java/org/opentripplanner/transit/model/site/AreaStopTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/AreaStopTest.java @@ -13,7 +13,7 @@ import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.service.StopModel; class AreaStopTest { @@ -24,7 +24,7 @@ class AreaStopTest { private static final I18NString URL = new NonLocalizedString("url"); - private static final String ZONE_ID = TransitModelForTest.TIME_ZONE_ID; + private static final String ZONE_ID = TimetableRepositoryForTest.TIME_ZONE_ID; private static final Geometry GEOMETRY = Polygons.OSLO; @@ -35,7 +35,7 @@ class AreaStopTest { private static AreaStopBuilder areaStopBuilder() { return StopModel .of() - .areaStop(TransitModelForTest.id(ID)) + .areaStop(TimetableRepositoryForTest.id(ID)) .withName(NAME) .withDescription(DESCRIPTION) .withUrl(URL) @@ -70,7 +70,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName(new NonLocalizedString("X")).build())); assertFalse( subject.sameAs(subject.copy().withDescription(new NonLocalizedString("X")).build()) 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 85% 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 index bc7c3455c24..235f4c089ff 100644 --- a/src/test/java/org/opentripplanner/transit/model/site/BoardingAreaTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/BoardingAreaTest.java @@ -10,17 +10,20 @@ import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class BoardingAreaTest { private static final String ID = "1"; private static final I18NString NAME = new NonLocalizedString("name"); private static final I18NString DESCRIPTION = new NonLocalizedString("description"); - private static final RegularStop PARENT_STOP = TransitModelForTest.of().stop("stopId").build(); + private static final RegularStop PARENT_STOP = TimetableRepositoryForTest + .of() + .stop("stopId") + .build(); private static final BoardingArea subject = BoardingArea - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withName(NAME) .withDescription(DESCRIPTION) .withParentStop(PARENT_STOP) @@ -52,7 +55,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName(new NonLocalizedString("X")).build())); assertFalse( subject.sameAs(subject.copy().withDescription(new NonLocalizedString("X")).build()) 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 89% 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 index 738238caa0f..0a9bb5cb5a4 100644 --- a/src/test/java/org/opentripplanner/transit/model/site/EntranceTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/EntranceTest.java @@ -10,7 +10,7 @@ import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; class EntranceTest { @@ -23,11 +23,11 @@ class EntranceTest { public static final WgsCoordinate COORDINATE = new WgsCoordinate(0, 0); private static final StopLevel LEVEL = new StopLevel("level", 0); private static final Accessibility WHEELCHAIR_ACCESSIBILITY = Accessibility.POSSIBLE; - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Station PARENT_STATION = TEST_MODEL.station("stationId").build(); private static final Entrance subject = Entrance - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withName(NAME) .withDescription(DESCRIPTION) .withCode(CODE) @@ -67,7 +67,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName(new NonLocalizedString("X")).build())); assertFalse( subject.sameAs(subject.copy().withDescription(new NonLocalizedString("X")).build()) 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 85% 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 index 442ca61377f..c98f18d7aec 100644 --- a/src/test/java/org/opentripplanner/transit/model/site/FareZoneTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/FareZoneTest.java @@ -7,14 +7,14 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class FareZoneTest { private static final String ID = "1"; private static final String NAME = "name"; private static final FareZone subject = FareZone - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withName(NAME) .build(); @@ -41,7 +41,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName("X").build())); } } 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 86% 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 index 9b340f3d331..f1816e5a4b7 100644 --- a/src/test/java/org/opentripplanner/transit/model/site/GroupOfStationsTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/GroupOfStationsTest.java @@ -9,11 +9,11 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class GroupOfStationsTest { - private static TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final String ID = "1"; private static final I18NString NAME = new NonLocalizedString("name"); @@ -26,7 +26,7 @@ class GroupOfStationsTest { .build(); private static final GroupOfStations subject = GroupOfStations - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withName(NAME) .addChildStation(STATION) .build(); @@ -55,7 +55,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName(new NonLocalizedString("X")).build())); assertFalse( subject.sameAs( 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 86% 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 index b57566b68ed..654ec304792 100644 --- a/src/test/java/org/opentripplanner/transit/model/site/GroupStopTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/GroupStopTest.java @@ -14,12 +14,12 @@ import org.opentripplanner._support.geometry.Polygons; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.service.StopModel; class GroupStopTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final String ID = "1"; private static final I18NString NAME = new NonLocalizedString("name"); @@ -29,7 +29,7 @@ class GroupStopTest { .build(); private static final GroupStop subject = StopModel .of() - .groupStop(TransitModelForTest.id(ID)) + .groupStop(TimetableRepositoryForTest.id(ID)) .withName(NAME) .addLocation(STOP_LOCATION) .build(); @@ -45,7 +45,7 @@ void testGroupStopGeometry() { GroupStop groupStop = StopModel .of() - .groupStop(TransitModelForTest.id(ID)) + .groupStop(TimetableRepositoryForTest.id(ID)) .withName(NAME) .addLocation(stopLocation1) .addLocation(stopLocation2) @@ -66,7 +66,7 @@ void testGroupStopEncompassingAreaGeometry() { GroupStop groupStop = StopModel .of() - .groupStop(TransitModelForTest.id(ID)) + .groupStop(TimetableRepositoryForTest.id(ID)) .withName(NAME) .addLocation(stopLocation) .withEncompassingAreaGeometries(List.of(Polygons.BERLIN)) @@ -105,11 +105,14 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName(new NonLocalizedString("X")).build())); assertFalse( subject.sameAs( - subject.copy().addLocation(TransitModelForTest.of().stop("2:stop", 1d, 2d).build()).build() + subject + .copy() + .addLocation(TimetableRepositoryForTest.of().stop("2:stop", 1d, 2d).build()) + .build() ) ); } 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 87% 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 index 615b0c49674..93be75e5c13 100644 --- a/src/test/java/org/opentripplanner/transit/model/site/MultiModalStationTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/MultiModalStationTest.java @@ -11,20 +11,20 @@ import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class MultiModalStationTest { private static final String ID = "1"; private static final I18NString NAME = new NonLocalizedString("name"); - private static TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Station STATION_1 = TEST_MODEL.station("1:1").build(); private static final Station STATION_2 = TEST_MODEL.station("1:2").build(); public static final Set CHILD_STATIONS = Set.of(STATION_1, STATION_2); private static final MultiModalStation subject = MultiModalStation - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withName(NAME) .withChildStations(CHILD_STATIONS) .withCoordinate(new WgsCoordinate(1, 1)) @@ -54,7 +54,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName(new NonLocalizedString("X")).build())); assertFalse(subject.sameAs(subject.copy().withChildStations(Set.of(STATION_1)).build())); } 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 89% 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 index c5cdae2b54b..77de36ceb71 100644 --- a/src/test/java/org/opentripplanner/transit/model/site/PathwayNodeTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/PathwayNodeTest.java @@ -10,7 +10,7 @@ import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; class PathwayNodeTest { @@ -18,7 +18,7 @@ class PathwayNodeTest { private static final String ID = "1"; private static final I18NString NAME = new NonLocalizedString("name"); private static final I18NString DESCRIPTION = new NonLocalizedString("description"); - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Station PARENT_STATION = TEST_MODEL.station("stationId").build(); private static final String CODE = "code"; @@ -26,7 +26,7 @@ class PathwayNodeTest { private static final StopLevel LEVEL = new StopLevel("level", 0); private static final Accessibility WHEELCHAIR_ACCESSIBILITY = Accessibility.POSSIBLE; private static final PathwayNode subject = PathwayNode - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withName(NAME) .withDescription(DESCRIPTION) .withCode(CODE) @@ -66,7 +66,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName(new NonLocalizedString("X")).build())); assertFalse( subject.sameAs(subject.copy().withDescription(new NonLocalizedString("X")).build()) 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 87% 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 index 9b5e526b6dd..09bf034e6ba 100644 --- a/src/test/java/org/opentripplanner/transit/model/site/PathwayTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/PathwayTest.java @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.framework.geometry.WgsCoordinate; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class PathwayTest { @@ -17,14 +17,14 @@ class PathwayTest { private static final String NAME = "name"; private static final PathwayMode MODE = PathwayMode.ESCALATOR; private static final PathwayNode FROM = PathwayNode - .of(TransitModelForTest.id("1:node")) + .of(TimetableRepositoryForTest.id("1:node")) .withCoordinate(new WgsCoordinate(20, 30)) .build(); - private static final RegularStop TO = TransitModelForTest.of().stop("1:stop").build(); + private static final RegularStop TO = TimetableRepositoryForTest.of().stop("1:stop").build(); public static final int TRAVERSAL_TIME = 120; private final Pathway subject = Pathway - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withPathwayMode(MODE) .withSignpostedAs(NAME) .withFromStop(FROM) @@ -66,7 +66,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withSignpostedAs("X").build())); assertFalse(subject.sameAs(subject.copy().withReverseSignpostedAs("X").build())); assertFalse(subject.sameAs(subject.copy().withPathwayMode(PathwayMode.ELEVATOR).build())); 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 88% 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 index 104d732e37e..028a8b0b218 100644 --- a/src/test/java/org/opentripplanner/transit/model/site/RegularStopTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/RegularStopTest.java @@ -11,7 +11,7 @@ import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.basic.SubMode; import org.opentripplanner.transit.model.basic.TransitMode; @@ -22,7 +22,7 @@ class RegularStopTest { private static final String ID = "1"; private static final I18NString NAME = new NonLocalizedString("name"); private static final I18NString DESCRIPTION = new NonLocalizedString("description"); - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Station PARENT_STATION = TEST_MODEL.station("stationId").build(); private static final String CODE = "code"; @@ -32,12 +32,12 @@ class RegularStopTest { private static final String NETEX_SUBMODE_NAME = "submode"; private static final SubMode NETEX_SUBMODE = SubMode.of(NETEX_SUBMODE_NAME); private static final TransitMode VEHICLE_TYPE = TransitMode.BUS; - public static final ZoneId TIME_ZONE = ZoneId.of(TransitModelForTest.TIME_ZONE_ID); + public static final ZoneId TIME_ZONE = ZoneId.of(TimetableRepositoryForTest.TIME_ZONE_ID); private static final String PLATFORM_CODE = "platformCode"; private static final RegularStop subject = StopModel .of() - .regularStop(TransitModelForTest.id(ID)) + .regularStop(TimetableRepositoryForTest.id(ID)) .withName(NAME) .withDescription(DESCRIPTION) .withCode(CODE) @@ -86,7 +86,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName(new NonLocalizedString("X")).build())); assertFalse( subject.sameAs(subject.copy().withDescription(new NonLocalizedString("X")).build()) @@ -97,7 +97,10 @@ void sameAs() { assertFalse(subject.sameAs(subject.copy().withVehicleType(TransitMode.TRAM).build())); assertFalse( subject.sameAs( - subject.copy().withTimeZone(ZoneId.of(TransitModelForTest.OTHER_TIME_ZONE_ID)).build() + subject + .copy() + .withTimeZone(ZoneId.of(TimetableRepositoryForTest.OTHER_TIME_ZONE_ID)) + .build() ) ); assertFalse(subject.sameAs(subject.copy().withPlatformCode("X").build())); 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 84% 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 index 9ff75583bfc..958816bc74d 100644 --- a/src/test/java/org/opentripplanner/transit/model/site/StationTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/StationTest.java @@ -11,7 +11,7 @@ import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class StationTest { @@ -22,13 +22,13 @@ class StationTest { public static final WgsCoordinate COORDINATE = new WgsCoordinate(0, 0); private static final StopTransferPriority PRIORITY = StopTransferPriority.ALLOWED; - private static final ZoneId TIMEZONE = ZoneId.of(TransitModelForTest.TIME_ZONE_ID); + private static final ZoneId TIMEZONE = ZoneId.of(TimetableRepositoryForTest.TIME_ZONE_ID); private static final I18NString URL = new NonLocalizedString("url"); - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Station PARENT_STATION = TEST_MODEL.station("stationId").build(); private static final Station subject = Station - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withName(NAME) .withDescription(DESCRIPTION) .withCode(CODE) @@ -67,7 +67,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName(new NonLocalizedString("X")).build())); assertFalse(subject.sameAs(subject.copy().withCode("X").build())); assertFalse( @@ -80,7 +80,10 @@ void sameAs() { assertFalse(subject.sameAs(subject.copy().withUrl(new NonLocalizedString("X")).build())); assertFalse( subject.sameAs( - subject.copy().withTimezone(ZoneId.of(TransitModelForTest.OTHER_TIME_ZONE_ID)).build() + subject + .copy() + .withTimezone(ZoneId.of(TimetableRepositoryForTest.OTHER_TIME_ZONE_ID)) + .build() ) ); } 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 95% 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 index 5b3a8f76052..29da6582d8f 100644 --- a/src/test/java/org/opentripplanner/transit/model/timetable/RealTimeTripTimesTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/timetable/RealTimeTripTimesTest.java @@ -5,7 +5,7 @@ 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.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import static org.opentripplanner.transit.model.timetable.TimetableValidationError.ErrorCode.NEGATIVE_DWELL_TIME; import static org.opentripplanner.transit.model.timetable.TimetableValidationError.ErrorCode.NEGATIVE_HOP_TIME; @@ -16,7 +16,7 @@ import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.model.StopTime; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.DataValidationException; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -24,7 +24,7 @@ class RealTimeTripTimesTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final String TRIP_ID = "testTripId"; @@ -40,7 +40,7 @@ class RealTimeTripTimesTest { ); static TripTimes createInitialTripTimes() { - Trip trip = TransitModelForTest.trip(TRIP_ID).build(); + Trip trip = TimetableRepositoryForTest.trip(TRIP_ID).build(); List stopTimes = new LinkedList<>(); @@ -69,7 +69,7 @@ class Headsign { @Test void shouldHandleBothNullScenario() { - Trip trip = TransitModelForTest.trip("TRIP").build(); + Trip trip = TimetableRepositoryForTest.trip("TRIP").build(); List stopTimes = List.of(EMPTY_STOPPOINT, EMPTY_STOPPOINT, EMPTY_STOPPOINT); TripTimes tripTimes = TripTimesFactory.tripTimes(trip, stopTimes, new Deduplicator()); @@ -80,7 +80,7 @@ void shouldHandleBothNullScenario() { @Test void shouldHandleTripOnlyHeadSignScenario() { - Trip trip = TransitModelForTest.trip("TRIP").withHeadsign(DIRECTION).build(); + Trip trip = TimetableRepositoryForTest.trip("TRIP").withHeadsign(DIRECTION).build(); List stopTimes = List.of(EMPTY_STOPPOINT, EMPTY_STOPPOINT, EMPTY_STOPPOINT); TripTimes tripTimes = TripTimesFactory.tripTimes(trip, stopTimes, new Deduplicator()); @@ -91,7 +91,7 @@ void shouldHandleTripOnlyHeadSignScenario() { @Test void shouldHandleStopsOnlyHeadSignScenario() { - Trip trip = TransitModelForTest.trip("TRIP").build(); + Trip trip = TimetableRepositoryForTest.trip("TRIP").build(); StopTime stopWithHeadsign = new StopTime(); stopWithHeadsign.setStopHeadsign(STOP_TEST_DIRECTION); List stopTimes = List.of(stopWithHeadsign, stopWithHeadsign, stopWithHeadsign); @@ -104,7 +104,7 @@ void shouldHandleStopsOnlyHeadSignScenario() { @Test void shouldHandleStopsEqualToTripHeadSignScenario() { - Trip trip = TransitModelForTest.trip("TRIP").withHeadsign(DIRECTION).build(); + Trip trip = TimetableRepositoryForTest.trip("TRIP").withHeadsign(DIRECTION).build(); StopTime stopWithHeadsign = new StopTime(); stopWithHeadsign.setStopHeadsign(DIRECTION); List stopTimes = List.of(stopWithHeadsign, stopWithHeadsign, stopWithHeadsign); @@ -117,7 +117,7 @@ void shouldHandleStopsEqualToTripHeadSignScenario() { @Test void shouldHandleDifferingTripAndStopHeadSignScenario() { - Trip trip = TransitModelForTest.trip("TRIP").withHeadsign(DIRECTION).build(); + Trip trip = TimetableRepositoryForTest.trip("TRIP").withHeadsign(DIRECTION).build(); StopTime stopWithHeadsign = new StopTime(); stopWithHeadsign.setStopHeadsign(STOP_TEST_DIRECTION); List stopTimes = List.of(stopWithHeadsign, EMPTY_STOPPOINT, EMPTY_STOPPOINT); 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 95% 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 index e2c1148ef51..75bf99a3fcc 100644 --- a/src/test/java/org/opentripplanner/transit/model/timetable/ScheduledTripTimesTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/timetable/ScheduledTripTimesTest.java @@ -5,20 +5,20 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.BitSet; import java.util.List; import org.junit.jupiter.api.Test; import org.opentripplanner.framework.time.TimeUtils; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.framework.DataValidationException; import org.opentripplanner.transit.model.framework.FeedScopedId; class ScheduledTripTimesTest { - private static final Trip TRIP = TransitModelForTest.trip("Trip-1").build(); + private static final Trip TRIP = TimetableRepositoryForTest.trip("Trip-1").build(); private static final List STOP_IDS = List.of(id("A"), id("B"), id("C")); private static final int SERVICE_CODE = 5; 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 76% 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 index a4051211c51..e86b4133256 100644 --- a/src/test/java/org/opentripplanner/transit/model/timetable/StopTimeKeyTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/timetable/StopTimeKeyTest.java @@ -5,7 +5,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class StopTimeKeyTest { @@ -13,7 +13,7 @@ class StopTimeKeyTest { private static final int STOP_SEQUENCE_NUMBER = 1; private static final StopTimeKey subject = StopTimeKey - .of(TransitModelForTest.id(ID), STOP_SEQUENCE_NUMBER) + .of(TimetableRepositoryForTest.id(ID), STOP_SEQUENCE_NUMBER) .build(); @Test @@ -29,6 +29,6 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); } } 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 76% 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 index 7dd67665e92..acccea2b531 100644 --- a/src/test/java/org/opentripplanner/transit/model/timetable/TimetableValidationErrorTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/timetable/TimetableValidationErrorTest.java @@ -3,7 +3,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; class TimetableValidationErrorTest { @@ -11,7 +11,7 @@ class TimetableValidationErrorTest { private TimetableValidationError subject = new TimetableValidationError( TimetableValidationError.ErrorCode.NEGATIVE_HOP_TIME, 3, - TransitModelForTest.trip("A").withMode(TransitMode.BUS).withShortName("Line A").build() + TimetableRepositoryForTest.trip("A").withMode(TransitMode.BUS).withShortName("Line A").build() ); @Test 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 77% 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 index c72d56b6aeb..d84af565fab 100644 --- a/src/test/java/org/opentripplanner/transit/model/timetable/TripOnServiceDateTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/timetable/TripOnServiceDateTest.java @@ -7,20 +7,20 @@ import java.time.LocalDate; import java.util.List; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class TripOnServiceDateTest { private static final String ID = "1"; private static final TripAlteration TRIP_ALTERATION = TripAlteration.CANCELLATION; private static final List REPLACEMENT_FOR = List.of( - TripOnServiceDate.of(TransitModelForTest.id("id1")).build() + TripOnServiceDate.of(TimetableRepositoryForTest.id("id1")).build() ); public static final LocalDate SERVICE_DATE = LocalDate.now(); public static final String TRIP_ID = "tripId"; private static final TripOnServiceDate subject = TripOnServiceDate - .of(TransitModelForTest.id(ID)) - .withTrip(TransitModelForTest.trip(TRIP_ID).build()) + .of(TimetableRepositoryForTest.id(ID)) + .withTrip(TimetableRepositoryForTest.trip(TRIP_ID).build()) .withServiceDate(SERVICE_DATE) .withTripAlteration(TRIP_ALTERATION) .withReplacementFor(REPLACEMENT_FOR) @@ -43,7 +43,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse( subject.sameAs(subject.copy().withServiceDate(LocalDate.now().plusDays(1)).build()) ); @@ -52,7 +52,9 @@ void sameAs() { subject.sameAs( subject .copy() - .withReplacementFor(List.of(TripOnServiceDate.of(TransitModelForTest.id("id2")).build())) + .withReplacementFor( + List.of(TripOnServiceDate.of(TimetableRepositoryForTest.id("id2")).build()) + ) .build() ) ); 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 91% 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 index eeaa979257d..441ce74927a 100644 --- a/src/test/java/org/opentripplanner/transit/model/timetable/TripTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/timetable/TripTest.java @@ -6,7 +6,7 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.basic.SubMode; import org.opentripplanner.transit.model.basic.TransitMode; @@ -21,7 +21,7 @@ class TripTest { private static final String ID = "1"; private static final String SHORT_NAME = "name"; private static final Accessibility WHEELCHAIR_ACCESSIBILITY = Accessibility.POSSIBLE; - public static final Route ROUTE = TransitModelForTest.route("routeId").build(); + public static final Route ROUTE = TimetableRepositoryForTest.route("routeId").build(); private static final Direction DIRECTION = Direction.INBOUND; public static final NonLocalizedString HEAD_SIGN = new NonLocalizedString("head sign"); private static final BikeAccess BIKE_ACCESS = BikeAccess.ALLOWED; @@ -39,7 +39,7 @@ class TripTest { private static final FeedScopedId SERVICE_ID = FeedScopedId.parse("x:serviceId"); private static final FeedScopedId SHAPE_ID = FeedScopedId.parse("x:shapeId"); private static final Trip subject = Trip - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withShortName(SHORT_NAME) .withRoute(ROUTE) .withDirection(DIRECTION) @@ -66,7 +66,7 @@ void shouldCopyFieldsFromRoute() { .withBikesAllowed(BIKE_ACCESS) .build(); - var subject = Trip.of(TransitModelForTest.id(ID)).withRoute(routeWithModes).build(); + var subject = Trip.of(TimetableRepositoryForTest.id(ID)).withRoute(routeWithModes).build(); assertEquals(TRANSIT_MODE, subject.getMode()); assertEquals(NETEX_SUBMODE, subject.getNetexSubMode()); @@ -101,14 +101,14 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withShortName("X").build())); assertFalse( subject.sameAs(subject.copy().withWheelchairBoarding(Accessibility.NOT_POSSIBLE).build()) ); assertFalse( subject.sameAs( - subject.copy().withRoute(TransitModelForTest.route("otherRouteId").build()).build() + subject.copy().withRoute(TimetableRepositoryForTest.route("otherRouteId").build()).build() ) ); assertFalse(subject.sameAs(subject.copy().withDirection(Direction.OUTBOUND).build())); 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 84% rename from src/test/java/org/opentripplanner/transit/service/DefaultTransitServiceTest.java rename to application/src/test/java/org/opentripplanner/transit/service/DefaultTransitServiceTest.java index b04a1258984..ec95c91a3f7 100644 --- a/src/test/java/org/opentripplanner/transit/service/DefaultTransitServiceTest.java +++ b/application/src/test/java/org/opentripplanner/transit/service/DefaultTransitServiceTest.java @@ -14,7 +14,7 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.model.RealTimeTripUpdate; import org.opentripplanner.model.TimetableSnapshot; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.network.StopPattern; import org.opentripplanner.transit.model.network.TripPattern; @@ -26,7 +26,7 @@ class DefaultTransitServiceTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); static TransitService service; static Station STATION = TEST_MODEL.station("C").build(); @@ -40,7 +40,10 @@ class DefaultTransitServiceTest { static TripPattern FERRY_PATTERN = TEST_MODEL.pattern(FERRY).build(); static TripPattern BUS_PATTERN = TEST_MODEL.pattern(BUS).build(); - static StopPattern REAL_TIME_STOP_PATTERN = TransitModelForTest.stopPattern(STOP_A, STOP_B); + static StopPattern REAL_TIME_STOP_PATTERN = TimetableRepositoryForTest.stopPattern( + STOP_A, + STOP_B + ); static TripPattern REAL_TIME_PATTERN = TEST_MODEL .pattern(BUS) .withStopPattern(REAL_TIME_STOP_PATTERN) @@ -56,16 +59,16 @@ static void setup() { .withStation(STATION) .build(); - var transitModel = new TransitModel(stopModel, new Deduplicator()); - transitModel.addTripPattern(RAIL_PATTERN.getId(), RAIL_PATTERN); - transitModel.index(); + var timetableRepository = new TimetableRepository(stopModel, new Deduplicator()); + timetableRepository.addTripPattern(RAIL_PATTERN.getId(), RAIL_PATTERN); + timetableRepository.index(); - transitModel.initTimetableSnapshotProvider(() -> { + timetableRepository.initTimetableSnapshotProvider(() -> { TimetableSnapshot timetableSnapshot = new TimetableSnapshot(); RealTimeTripTimes tripTimes = RealTimeTripTimes.of( ScheduledTripTimes .of() - .withTrip(TransitModelForTest.trip("REAL_TIME_TRIP").build()) + .withTrip(TimetableRepositoryForTest.trip("REAL_TIME_TRIP").build()) .withDepartureTimes(new int[] { 0, 1 }) .build() ); @@ -77,7 +80,7 @@ static void setup() { }); service = - new DefaultTransitService(transitModel) { + new DefaultTransitService(timetableRepository) { @Override public Collection getPatternsForStop(StopLocation stop) { if (stop.equals(STOP_B)) { diff --git a/src/test/java/org/opentripplanner/transit/service/PatternByServiceDatesFilterTest.java b/application/src/test/java/org/opentripplanner/transit/service/PatternByServiceDatesFilterTest.java similarity index 100% rename from src/test/java/org/opentripplanner/transit/service/PatternByServiceDatesFilterTest.java rename to application/src/test/java/org/opentripplanner/transit/service/PatternByServiceDatesFilterTest.java 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 97% rename from src/test/java/org/opentripplanner/transit/service/StopModelTest.java rename to application/src/test/java/org/opentripplanner/transit/service/StopModelTest.java index b24b547a07e..aa98a85b0a7 100644 --- a/src/test/java/org/opentripplanner/transit/service/StopModelTest.java +++ b/application/src/test/java/org/opentripplanner/transit/service/StopModelTest.java @@ -11,7 +11,7 @@ import org.opentripplanner.framework.geometry.GeometryUtils; import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.site.AreaStop; import org.opentripplanner.transit.model.site.GroupOfStations; @@ -28,7 +28,7 @@ class StopModelTest { .getGeometryFactory() .createPoint(COOR_A.asJtsCoordinate()); public static final NonLocalizedString NAME = NonLocalizedString.ofNullable("Name"); - private static final FeedScopedId ID = TransitModelForTest.id("A"); + private static final FeedScopedId ID = TimetableRepositoryForTest.id("A"); private static final Station STATION = Station .of(ID) .withName(NAME) diff --git a/src/test/java/org/opentripplanner/transit/service/TransitModelTest.java b/application/src/test/java/org/opentripplanner/transit/service/TimetableRepositoryTest.java similarity index 71% rename from src/test/java/org/opentripplanner/transit/service/TransitModelTest.java rename to application/src/test/java/org/opentripplanner/transit/service/TimetableRepositoryTest.java index 95c20245f9a..04740f655e3 100644 --- a/src/test/java/org/opentripplanner/transit/service/TransitModelTest.java +++ b/application/src/test/java/org/opentripplanner/transit/service/TimetableRepositoryTest.java @@ -16,11 +16,13 @@ import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.timetable.Trip; -class TransitModelTest { +class TimetableRepositoryTest { public static final String FAKE_FEED_ID = "FAKE"; public static final FeedScopedId SAMPLE_TRIP_ID = new FeedScopedId(FAKE_FEED_ID, "1.2"); - private static final ResourceLoader RESOURCE_LOADER = ResourceLoader.of(TransitModelTest.class); + private static final ResourceLoader RESOURCE_LOADER = ResourceLoader.of( + TimetableRepositoryTest.class + ); @Test void validateTimeZones() { @@ -28,22 +30,22 @@ void validateTimeZones() { var deduplicator = new Deduplicator(); var stopModel = new StopModel(); var graph = new Graph(deduplicator); - var transitModel = new TransitModel(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(stopModel, deduplicator); ConstantsForTests.addGtfsToGraph( graph, - transitModel, + timetableRepository, ConstantsForTests.SIMPLE_GTFS, new DefaultFareServiceFactory(), FAKE_FEED_ID ); // Then time zone should match the one provided in the feed - assertEquals("America/New_York", transitModel.getTimeZone().getId()); + assertEquals("America/New_York", timetableRepository.getTimeZone().getId()); // 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(); + TimetableRepositoryIndex timetableRepositoryIndex = timetableRepository.getTimetableRepositoryIndex(); + Trip trip = timetableRepositoryIndex.getTripForId(SAMPLE_TRIP_ID); + Timetable timetable = timetableRepositoryIndex.getPatternForTrip(trip).getScheduledTimetable(); assertEquals(20 * 60, timetable.getTripTimes(trip).getDepartureTime(0)); // Should throw on second bundle, with different agency time zone @@ -52,7 +54,7 @@ void validateTimeZones() { () -> ConstantsForTests.addGtfsToGraph( graph, - transitModel, + timetableRepository, RESOURCE_LOADER.file("kcm_gtfs.zip"), new DefaultFareServiceFactory(), null @@ -70,15 +72,15 @@ void validateTimeZonesWithExplicitTimeZone() { var deduplicator = new Deduplicator(); var stopModel = new StopModel(); var graph = new Graph(deduplicator); - var transitModel = new TransitModel(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(stopModel, deduplicator); // Whit explicit time zone - transitModel.initTimeZone(ZoneIds.CHICAGO); + timetableRepository.initTimeZone(ZoneIds.CHICAGO); // First GTFS bundle should be added successfully ConstantsForTests.addGtfsToGraph( graph, - transitModel, + timetableRepository, ConstantsForTests.SIMPLE_GTFS, new DefaultFareServiceFactory(), FAKE_FEED_ID @@ -87,22 +89,22 @@ void validateTimeZonesWithExplicitTimeZone() { // Should load second bundle, with different agency time zone ConstantsForTests.addGtfsToGraph( graph, - transitModel, + timetableRepository, RESOURCE_LOADER.file("kcm_gtfs.zip"), new DefaultFareServiceFactory(), null ); - new TimeZoneAdjusterModule(transitModel).buildGraph(); + new TimeZoneAdjusterModule(timetableRepository).buildGraph(); - TransitModelIndex transitModelIndex = transitModel.getTransitModelIndex(); + TimetableRepositoryIndex timetableRepositoryIndex = timetableRepository.getTimetableRepositoryIndex(); // Then time zone should match the one provided in the feed - assertEquals("America/Chicago", transitModel.getTimeZone().getId()); + assertEquals("America/Chicago", timetableRepository.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 = timetableRepositoryIndex.getTripForId(SAMPLE_TRIP_ID); + Timetable timetable = timetableRepositoryIndex.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 99% 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 61a23b10ff6..fe847aa9efc 100644 --- a/src/test/java/org/opentripplanner/transit/speed_test/SpeedIntegrationTest.java +++ b/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedIntegrationTest.java @@ -90,7 +90,7 @@ void runMultiCriteriaWithDestinationPruning() { private static void runProfile(SpeedTestProfile profile) { var opts = speedTestOptions(profile); var config = SpeedTestConfig.config(opts.rootDir()); - var speedTest = new SpeedTest(opts, config, model.graph(), model.transitModel()); + var speedTest = new SpeedTest(opts, config, model.graph(), model.timetableRepository()); // We want to validate the Raptor paths without changes done by the OptimizeTransfers // and itinerary filter chain(set to debug in config) 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 89% 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 index 85a33281f81..38fb11712b8 100644 --- a/src/test/java/org/opentripplanner/transit/speed_test/SpeedTest.java +++ b/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedTest.java @@ -32,7 +32,7 @@ import org.opentripplanner.standalone.config.routerconfig.VectorTileConfig; import org.opentripplanner.standalone.server.DefaultServerRequestContext; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.speed_test.model.SpeedTestProfile; import org.opentripplanner.transit.speed_test.model.testcase.CsvFileSupport; import org.opentripplanner.transit.speed_test.model.testcase.ExpectedResults; @@ -53,7 +53,7 @@ public class SpeedTest { private static final String TRAVEL_SEARCH_FILENAME = "travelSearch"; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final SpeedTestTimer timer = new SpeedTestTimer(); @@ -73,11 +73,11 @@ public SpeedTest( SpeedTestCmdLineOpts opts, SpeedTestConfig config, Graph graph, - TransitModel transitModel + TimetableRepository timetableRepository ) { this.opts = opts; this.config = config; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.tcIO = new CsvFileSupport( @@ -91,17 +91,17 @@ public SpeedTest( this.testCaseDefinitions = tcIO.readTestCaseDefinitions(); this.expectedResultsByTcId = tcIO.readExpectedResults(); - var transitService = new DefaultTransitService(transitModel); + var transitService = new DefaultTransitService(timetableRepository); UpdaterConfigurator.configure( graph, new DefaultRealtimeVehicleService(transitService), new DefaultVehicleRentalService(), - transitModel, + timetableRepository, config.updatersConfig ); - if (transitModel.getUpdaterManager() != null) { - transitModel.getUpdaterManager().startUpdaters(); + if (timetableRepository.getUpdaterManager() != null) { + timetableRepository.getUpdaterManager().startUpdaters(); } this.serverContext = @@ -110,7 +110,7 @@ public SpeedTest( config.request, new RaptorConfig<>(config.transitRoutingParams), graph, - new DefaultTransitService(transitModel), + new DefaultTransitService(timetableRepository), timer.getRegistry(), VectorTileConfig.DEFAULT, TestServerContext.createWorldEnvelopeService(), @@ -124,11 +124,11 @@ public SpeedTest( null, null ); - // Creating transitLayerForRaptor should be integrated into the TransitModel, but for now + // Creating transitLayerForRaptor should be integrated into the TimetableRepository, but for now // we do it manually here - creatTransitLayerForRaptor(transitModel, config.transitRoutingParams); + creatTransitLayerForRaptor(timetableRepository, config.transitRoutingParams); - initializeTransferCache(config.transitRoutingParams, transitModel); + initializeTransferCache(config.transitRoutingParams, timetableRepository); timer.setUp(opts.groupResultsByCategory()); } @@ -145,20 +145,20 @@ public static void main(String[] args) { var config = SpeedTestConfig.config(opts.rootDir()); loadOtpFeatures(opts); var model = loadGraph(opts.rootDir(), config.graph); - var transitModel = model.transitModel(); + var timetableRepository = model.timetableRepository(); var buildConfig = model.buildConfig(); var graph = model.graph(); // create a new test - var speedTest = new SpeedTest(opts, config, graph, transitModel); + var speedTest = new SpeedTest(opts, config, graph, timetableRepository); - assertTestDateHasData(transitModel, config, buildConfig); + assertTestDateHasData(timetableRepository, config, buildConfig); // and run it speedTest.runTest(); - if (speedTest.transitModel.getUpdaterManager() != null) { - speedTest.transitModel.getUpdaterManager().stop(); + if (speedTest.timetableRepository.getUpdaterManager() != null) { + speedTest.timetableRepository.getUpdaterManager().stop(); } } catch (OtpAppException ae) { System.err.println(ae.getMessage()); @@ -249,7 +249,7 @@ private RoutingResponse performRouting(TestCase testCase) { opts, config, profile, - transitModel.getTimeZone() + timetableRepository.getTimeZone() ); var routingRequest = speedTestRequest.toRouteRequest(); return serverContext.routingService().route(routingRequest); @@ -272,10 +272,10 @@ private static LoadModel loadGraph(File baseDir, URI path) { throw new IllegalStateException(); } - TransitModel transitModel = serializedGraphObject.transitModel; - transitModel.index(); - graph.index(transitModel.getStopModel()); - return new LoadModel(graph, transitModel, serializedGraphObject.buildConfig); + TimetableRepository timetableRepository = serializedGraphObject.timetableRepository; + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); + return new LoadModel(graph, timetableRepository, serializedGraphObject.buildConfig); } private void initProfileStatistics() { @@ -361,5 +361,5 @@ private List trimItineraries(RoutingResponse routingResponse) { /* inline classes */ - record LoadModel(Graph graph, TransitModel transitModel, BuildConfig buildConfig) {} + record LoadModel(Graph graph, TimetableRepository timetableRepository, BuildConfig buildConfig) {} } 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 89% 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 index 4113d5979b1..82db561bddf 100644 --- 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 @@ -3,17 +3,17 @@ import org.opentripplanner.framework.application.OtpAppException; import org.opentripplanner.framework.application.OtpFileNames; import org.opentripplanner.standalone.config.BuildConfig; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.speed_test.options.SpeedTestConfig; public class AssertSpeedTestSetup { public static void assertTestDateHasData( - TransitModel transitModel, + TimetableRepository timetableRepository, SpeedTestConfig config, BuildConfig buildConfig ) { - int numberOfPatternForTestDate = transitModel + int numberOfPatternForTestDate = timetableRepository .getTransitLayer() .getTripPatternsForRunningDate(config.testDate) .size(); diff --git a/src/test/java/org/opentripplanner/updater/GtfsRealtimeFuzzyTripMatcherTest.java b/application/src/test/java/org/opentripplanner/updater/GtfsRealtimeFuzzyTripMatcherTest.java similarity index 93% rename from src/test/java/org/opentripplanner/updater/GtfsRealtimeFuzzyTripMatcherTest.java rename to application/src/test/java/org/opentripplanner/updater/GtfsRealtimeFuzzyTripMatcherTest.java index ffd150095b6..4da03a6b517 100644 --- a/src/test/java/org/opentripplanner/updater/GtfsRealtimeFuzzyTripMatcherTest.java +++ b/application/src/test/java/org/opentripplanner/updater/GtfsRealtimeFuzzyTripMatcherTest.java @@ -12,10 +12,10 @@ public class GtfsRealtimeFuzzyTripMatcherTest extends GtfsTest { @Test public void testMatch() { - String feedId = transitModel.getFeedIds().iterator().next(); + String feedId = timetableRepository.getFeedIds().iterator().next(); GtfsRealtimeFuzzyTripMatcher matcher = new GtfsRealtimeFuzzyTripMatcher( - new DefaultTransitService(transitModel) + new DefaultTransitService(timetableRepository) ); TripDescriptor trip1 = TripDescriptor .newBuilder() 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 99% rename from src/test/java/org/opentripplanner/updater/alert/AlertsUpdateHandlerTest.java rename to application/src/test/java/org/opentripplanner/updater/alert/AlertsUpdateHandlerTest.java index 6e590ce4957..077de6d072d 100644 --- a/src/test/java/org/opentripplanner/updater/alert/AlertsUpdateHandlerTest.java +++ b/application/src/test/java/org/opentripplanner/updater/alert/AlertsUpdateHandlerTest.java @@ -25,13 +25,15 @@ import org.opentripplanner.routing.alertpatch.TransitAlert; import org.opentripplanner.routing.impl.TransitAlertServiceImpl; import org.opentripplanner.routing.services.TransitAlertService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class AlertsUpdateHandlerTest { private AlertsUpdateHandler handler; - private final TransitAlertService service = new TransitAlertServiceImpl(new TransitModel()); + private final TransitAlertService service = new TransitAlertServiceImpl( + new TimetableRepository() + ); @BeforeEach public void setUp() { 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 94% 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..d5d8c9e8a74 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,10 +16,9 @@ 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; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.SubMode; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.AbstractTransitEntity; @@ -35,26 +34,27 @@ import org.opentripplanner.transit.model.timetable.TripOnServiceDate; import org.opentripplanner.transit.service.DefaultTransitService; import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.TimetableRepository; 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; class AddedTripBuilderTest { - private static final Agency AGENCY = TransitModelForTest.AGENCY; + private static final Agency AGENCY = TimetableRepositoryForTest.AGENCY; private static final ZoneId TIME_ZONE = AGENCY.getTimezone(); private static final Operator OPERATOR = Operator - .of(TransitModelForTest.id("OPERATOR_ID")) + .of(TimetableRepositoryForTest.id("OPERATOR_ID")) .withName("OPERATOR_NAME") .build(); - private static final Route REPLACED_ROUTE = TransitModelForTest + private static final Route REPLACED_ROUTE = TimetableRepositoryForTest .route("REPLACED_ROUTE") .withAgency(AGENCY) .withOperator(OPERATOR) .build(); private static final String LINE_REF = "ROUTE_ID"; - private static final FeedScopedId TRIP_ID = TransitModelForTest.id("TRIP_ID"); + private static final FeedScopedId TRIP_ID = TimetableRepositoryForTest.id("TRIP_ID"); private static final LocalDate SERVICE_DATE = LocalDate.of(2023, 2, 17); private static final TransitMode TRANSIT_MODE = TransitMode.RAIL; private static final String SUB_MODE = "replacementRailService"; @@ -62,7 +62,7 @@ class AddedTripBuilderTest { private static final String HEADSIGN = "TEST TRIP TOWARDS TEST ISLAND"; /* Transit model */ - private static final TransitModelForTest MODEL_TEST = TransitModelForTest.of(); + private static final TimetableRepositoryForTest MODEL_TEST = TimetableRepositoryForTest.of(); private static final RegularStop STOP_A = MODEL_TEST.stop("A").build(); private static final RegularStop STOP_B = MODEL_TEST.stop("B").build(); @@ -77,7 +77,10 @@ class AddedTripBuilderTest { .build(); private final Deduplicator DEDUPLICATOR = new Deduplicator(); - private final TransitModel TRANSIT_MODEL = new TransitModel(STOP_MODEL, DEDUPLICATOR); + private final TimetableRepository TRANSIT_MODEL = new TimetableRepository( + STOP_MODEL, + DEDUPLICATOR + ); private TransitEditorService transitService; private EntityResolver ENTITY_RESOLVER; @@ -85,15 +88,15 @@ class AddedTripBuilderTest { void setUp() { // Add entities to transit model for the entity resolver TRANSIT_MODEL.addAgency(AGENCY); - final TripPattern pattern = TransitModelForTest + final TripPattern pattern = TimetableRepositoryForTest .tripPattern("REPLACED_ROUTE_PATTERN_ID", REPLACED_ROUTE) - .withStopPattern(TransitModelForTest.stopPattern(STOP_A, STOP_B)) + .withStopPattern(TimetableRepositoryForTest.stopPattern(STOP_A, STOP_B)) .build(); TRANSIT_MODEL.addTripPattern(pattern.getId(), pattern); // Crate a scheduled calendar, to have the SERVICE_DATE be within the transit feed coverage CalendarServiceData calendarServiceData = new CalendarServiceData(); - var cal_id = TransitModelForTest.id("CAL_1"); + var cal_id = TimetableRepositoryForTest.id("CAL_1"); calendarServiceData.putServiceDatesForServiceId( cal_id, List.of(SERVICE_DATE.minusDays(1), SERVICE_DATE, SERVICE_DATE.plusDays(1)) @@ -107,7 +110,10 @@ void setUp() { // Create the entity resolver only after the model has been indexed ENTITY_RESOLVER = - new EntityResolver(new DefaultTransitService(TRANSIT_MODEL), TransitModelForTest.FEED_ID); + new EntityResolver( + new DefaultTransitService(TRANSIT_MODEL), + TimetableRepositoryForTest.FEED_ID + ); } @Test @@ -250,7 +256,7 @@ void testAddedTripOnAddedRoute() { var firstTrip = firstAddedTrip.successValue().tripTimes().getTrip(); - var tripId2 = TransitModelForTest.id("TRIP_ID_2"); + var tripId2 = TimetableRepositoryForTest.id("TRIP_ID_2"); var secondAddedTrip = new AddedTripBuilder( transitService, @@ -559,7 +565,7 @@ void testGetTransportMode( ) { // Arrange var route = Route - .of(TransitModelForTest.id(LINE_REF)) + .of(TimetableRepositoryForTest.id(LINE_REF)) .withShortName(SHORT_NAME) .withAgency(AGENCY) .withMode(TransitMode.valueOf(replacedRouteMode)) 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 93% 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..17fee84cc56 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; @@ -17,7 +17,7 @@ import org.opentripplanner.model.PickDrop; import org.opentripplanner.model.StopTime; import org.opentripplanner.model.calendar.CalendarServiceData; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.Route; @@ -32,7 +32,7 @@ import org.opentripplanner.transit.model.timetable.TripTimesFactory; import org.opentripplanner.transit.service.DefaultTransitService; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.spi.UpdateError; import uk.org.siri.siri20.DepartureBoardingActivityEnumeration; @@ -40,9 +40,9 @@ class ModifiedTripBuilderTest { /* Transit model */ - private static final Agency AGENCY = TransitModelForTest.AGENCY; + private static final Agency AGENCY = TimetableRepositoryForTest.AGENCY; private static final ZoneId TIME_ZONE = AGENCY.getTimezone(); - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Station STATION_A = TEST_MODEL.station("A").build(); private static final Station STATION_B = TEST_MODEL.station("B").build(); private static final Station STATION_C = TEST_MODEL.station("C").build(); @@ -65,19 +65,19 @@ class ModifiedTripBuilderTest { .build(); private static final RegularStop STOP_D = TEST_MODEL.stop("D").build(); - private static final Route ROUTE = TransitModelForTest + private static final Route ROUTE = TimetableRepositoryForTest .route("ROUTE_ID") .withAgency(AGENCY) .build(); - private static final TripPattern PATTERN = TransitModelForTest + private static final TripPattern PATTERN = TimetableRepositoryForTest .tripPattern("PATTERN_ID", ROUTE) - .withStopPattern(TransitModelForTest.stopPattern(STOP_A_1, STOP_B_1, STOP_C_1)) + .withStopPattern(TimetableRepositoryForTest.stopPattern(STOP_A_1, STOP_B_1, STOP_C_1)) .build(); - private static final FeedScopedId SERVICE_ID = TransitModelForTest.id("CAL_1"); + private static final FeedScopedId SERVICE_ID = TimetableRepositoryForTest.id("CAL_1"); - private static final Trip TRIP = TransitModelForTest + private static final Trip TRIP = TimetableRepositoryForTest .trip("TRIP") .withRoute(ROUTE) .withServiceId(SERVICE_ID) @@ -127,14 +127,17 @@ class ModifiedTripBuilderTest { .withRegularStop(STOP_C_1) .withRegularStop(STOP_D) .build(); - private final TransitModel transitModel = new TransitModel(stopModel, DEDUPLICATOR); + private final TimetableRepository timetableRepository = new TimetableRepository( + stopModel, + DEDUPLICATOR + ); private EntityResolver entityResolver; @BeforeEach void setUp() { // Add entities to transit model for the entity resolver - transitModel.addAgency(AGENCY); - transitModel.addTripPattern(PATTERN.getId(), PATTERN); + timetableRepository.addAgency(AGENCY); + timetableRepository.addTripPattern(PATTERN.getId(), PATTERN); // Crate a scheduled calendar, to have the SERVICE_DATE be within the transit feed coverage CalendarServiceData calendarServiceData = new CalendarServiceData(); @@ -142,15 +145,22 @@ void setUp() { 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); + timetableRepository.getServiceCodes().put(SERVICE_ID, 0); + timetableRepository.updateCalendarServiceData( + true, + calendarServiceData, + DataImportIssueStore.NOOP + ); // Create transit model index - transitModel.index(); + timetableRepository.index(); // Create the entity resolver only after the model has been indexed entityResolver = - new EntityResolver(new DefaultTransitService(transitModel), TransitModelForTest.FEED_ID); + new EntityResolver( + new DefaultTransitService(timetableRepository), + TimetableRepositoryForTest.FEED_ID + ); } @Test @@ -159,7 +169,7 @@ void testUpdateNoCalls() { TRIP_TIMES, PATTERN, SERVICE_DATE, - transitModel.getTimeZone(), + timetableRepository.getTimeZone(), entityResolver, List.of(), false, @@ -188,7 +198,7 @@ void testUpdateCancellation() { TRIP_TIMES, PATTERN, SERVICE_DATE, - transitModel.getTimeZone(), + timetableRepository.getTimeZone(), entityResolver, List.of(), true, @@ -211,7 +221,7 @@ void testUpdateSameStops() { TRIP_TIMES, PATTERN, SERVICE_DATE, - transitModel.getTimeZone(), + timetableRepository.getTimeZone(), entityResolver, List.of( TestCall @@ -261,7 +271,7 @@ void testUpdateValidationFailure() { TRIP_TIMES, PATTERN, SERVICE_DATE, - transitModel.getTimeZone(), + timetableRepository.getTimeZone(), entityResolver, List.of( TestCall @@ -309,7 +319,7 @@ void testUpdateSameStopsDepartEarly() { TRIP_TIMES, PATTERN, SERVICE_DATE, - transitModel.getTimeZone(), + timetableRepository.getTimeZone(), entityResolver, List.of( TestCall @@ -359,7 +369,7 @@ void testUpdateUpdatedStop() { TRIP_TIMES, PATTERN, SERVICE_DATE, - transitModel.getTimeZone(), + timetableRepository.getTimeZone(), entityResolver, List.of( TestCall @@ -414,7 +424,7 @@ void testUpdateCascading() { TRIP_TIMES, PATTERN, SERVICE_DATE, - transitModel.getTimeZone(), + timetableRepository.getTimeZone(), entityResolver, List.of( TestCall @@ -464,7 +474,7 @@ void testUpdateCascading() { firstResult.successValue().tripTimes(), PATTERN, SERVICE_DATE, - transitModel.getTimeZone(), + timetableRepository.getTimeZone(), entityResolver, List.of( TestCall 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..94c4af8d22e 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; @@ -80,15 +80,17 @@ public String getFeedName() { public void setUp() throws Exception { super.setUp(); - realTimeUpdateContext = new DefaultRealTimeUpdateContext(graph, transitModel); + realTimeUpdateContext = new DefaultRealTimeUpdateContext(graph, timetableRepository); if (transitService == null) { - transitService = new DefaultTransitService(transitModel); - transitModel.setUpdaterManager(new GraphUpdaterManager(realTimeUpdateContext, List.of())); + transitService = new DefaultTransitService(timetableRepository); + timetableRepository.setUpdaterManager( + new GraphUpdaterManager(realTimeUpdateContext, List.of()) + ); } else { transitAlertService.getAllAlerts().clear(); } if (alertsUpdateHandler == null) { - transitAlertService = new TransitAlertServiceImpl(transitModel); + transitAlertService = new TransitAlertServiceImpl(timetableRepository); alertsUpdateHandler = new SiriAlertsUpdateHandler(FEED_ID, transitAlertService, Duration.ZERO); } @@ -457,7 +459,7 @@ public void testSiriSxUpdateForTripByVehicleJourney() { assertTrue(transitAlertService.getAllAlerts().isEmpty()); - var modelZoneId = transitModel.getTimeZone(); + var modelZoneId = timetableRepository.getTimeZone(); var situationNumber = "TST:SituationNumber:1234"; var startTime = LocalDateTime.parse("2014-01-01T00:00:00").atZone(modelZoneId); var endTime = LocalDateTime.parse("2014-01-01T23:59:59").atZone(modelZoneId); @@ -496,7 +498,7 @@ public void testSiriSxUpdateForTripAndStopByVehicleJourney() { assertTrue(transitAlertService.getAllAlerts().isEmpty()); - ZoneId zoneId = transitModel.getTimeZone(); + ZoneId zoneId = timetableRepository.getTimeZone(); final String situationNumber = "TST:SituationNumber:1234"; final ZonedDateTime startTime = LocalDateTime.parse("2014-01-01T00:00:00").atZone(zoneId); final ZonedDateTime endTime = LocalDateTime.parse("2014-01-01T23:59:59").atZone(zoneId); 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 99% 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 d10dbc05090..901842adb45 100644 --- a/src/ext-test/java/org/opentripplanner/ext/siri/SiriTimetableSnapshotSourceTest.java +++ b/application/src/test/java/org/opentripplanner/updater/siri/SiriTimetableSnapshotSourceTest.java @@ -1,8 +1,8 @@ -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.transit.model._data.TimetableRepositoryForTest.id; import static org.opentripplanner.updater.spi.UpdateResultAssertions.assertFailure; import org.junit.jupiter.api.Disabled; 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/src/test/java/org/opentripplanner/updater/trip/RealtimeTestConstants.java b/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestConstants.java similarity index 79% rename from src/test/java/org/opentripplanner/updater/trip/RealtimeTestConstants.java rename to application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestConstants.java index bad0c1982e9..489dfef8956 100644 --- a/src/test/java/org/opentripplanner/updater/trip/RealtimeTestConstants.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestConstants.java @@ -1,10 +1,10 @@ package org.opentripplanner.updater.trip; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.time.LocalDate; import java.time.ZoneId; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.organization.Operator; @@ -14,7 +14,7 @@ public interface RealtimeTestConstants { LocalDate SERVICE_DATE = LocalDate.of(2024, 5, 8); - FeedScopedId SERVICE_ID = TransitModelForTest.id("CAL_1"); + FeedScopedId SERVICE_ID = TimetableRepositoryForTest.id("CAL_1"); String STOP_A1_ID = "A1"; String STOP_B1_ID = "B1"; String STOP_C1_ID = "C1"; @@ -24,8 +24,8 @@ public interface RealtimeTestConstants { 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); + TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); + ZoneId TIME_ZONE = ZoneId.of(TimetableRepositoryForTest.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(); @@ -44,5 +44,5 @@ public interface RealtimeTestConstants { .withRegularStop(STOP_D1) .build(); - Route ROUTE_1 = TransitModelForTest.route(ROUTE_1_ID).build(); + Route ROUTE_1 = TimetableRepositoryForTest.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 89% rename from src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironment.java rename to application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironment.java index 682bff038b6..8231d8868f1 100644 --- a/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironment.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironment.java @@ -1,6 +1,6 @@ package org.opentripplanner.updater.trip; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import static org.opentripplanner.updater.trip.UpdateIncrementality.DIFFERENTIAL; import static org.opentripplanner.updater.trip.UpdateIncrementality.FULL_DATASET; @@ -10,20 +10,20 @@ import java.util.List; import java.util.Objects; import org.opentripplanner.DateTimeHelper; -import org.opentripplanner.ext.siri.SiriTimetableSnapshotSource; -import org.opentripplanner.ext.siri.updater.EstimatedTimetableHandler; import org.opentripplanner.model.TimetableSnapshot; import org.opentripplanner.routing.graph.Graph; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.timetable.TripTimes; import org.opentripplanner.transit.model.timetable.TripTimesStringBuilder; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; 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; @@ -42,7 +42,7 @@ public final class RealtimeTestEnvironment implements RealtimeTestConstants { false ); - public final TransitModel transitModel; + public final TimetableRepository timetableRepository; private final SiriTimetableSnapshotSource siriSource; private final TimetableSnapshotSource gtfsSource; private final DateTimeHelper dateTimeHelper; @@ -66,19 +66,19 @@ public static RealtimeTestEnvironmentBuilder gtfs() { return new RealtimeTestEnvironmentBuilder().withSourceType(SourceType.GTFS_RT); } - RealtimeTestEnvironment(SourceType sourceType, TransitModel transitModel) { + RealtimeTestEnvironment(SourceType sourceType, TimetableRepository timetableRepository) { Objects.requireNonNull(sourceType); - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; - this.transitModel.index(); + this.timetableRepository.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 if (sourceType == SourceType.SIRI) { - siriSource = new SiriTimetableSnapshotSource(PARAMETERS, transitModel); + siriSource = new SiriTimetableSnapshotSource(PARAMETERS, timetableRepository); gtfsSource = null; } else { - gtfsSource = new TimetableSnapshotSource(PARAMETERS, transitModel); + gtfsSource = new TimetableSnapshotSource(PARAMETERS, timetableRepository); siriSource = null; } dateTimeHelper = new DateTimeHelper(TIME_ZONE, SERVICE_DATE); @@ -88,7 +88,7 @@ public static RealtimeTestEnvironmentBuilder gtfs() { * Returns a new fresh TransitService */ public TransitService getTransitService() { - return new DefaultTransitService(transitModel); + return new DefaultTransitService(timetableRepository); } /** @@ -103,7 +103,7 @@ public TripTimes getTripTimesForTrip(FeedScopedId tripId, LocalDate serviceDate) } public String getFeedId() { - return TransitModelForTest.FEED_ID; + return TimetableRepositoryForTest.FEED_ID; } private EstimatedTimetableHandler getEstimatedTimetableHandler(boolean fuzzyMatching) { @@ -219,7 +219,7 @@ private UpdateResult applyEstimatedTimetable( DIFFERENTIAL, new DefaultRealTimeUpdateContext( new Graph(), - transitModel, + timetableRepository, siriSource.getTimetableSnapshotBuffer() ) ); diff --git a/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironmentBuilder.java b/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironmentBuilder.java similarity index 73% rename from src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironmentBuilder.java rename to application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironmentBuilder.java index 88f4bf41012..99be7a86a43 100644 --- a/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironmentBuilder.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironmentBuilder.java @@ -1,6 +1,6 @@ package org.opentripplanner.updater.trip; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.List; import java.util.Objects; @@ -9,7 +9,7 @@ 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._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.site.StopLocation; @@ -17,12 +17,15 @@ 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; +import org.opentripplanner.transit.service.TimetableRepository; public class RealtimeTestEnvironmentBuilder implements RealtimeTestConstants { private RealtimeTestEnvironment.SourceType sourceType; - private final TransitModel transitModel = new TransitModel(STOP_MODEL, new Deduplicator()); + private final TimetableRepository timetableRepository = new TimetableRepository( + STOP_MODEL, + new Deduplicator() + ); RealtimeTestEnvironmentBuilder withSourceType(RealtimeTestEnvironment.SourceType sourceType) { this.sourceType = sourceType; @@ -31,24 +34,28 @@ RealtimeTestEnvironmentBuilder withSourceType(RealtimeTestEnvironment.SourceType public RealtimeTestEnvironmentBuilder addTrip(TripInput trip) { createTrip(trip); - transitModel.index(); + timetableRepository.index(); return this; } public RealtimeTestEnvironment build() { Objects.requireNonNull(sourceType, "sourceType cannot be null"); - transitModel.initTimeZone(TIME_ZONE); - transitModel.addAgency(TransitModelForTest.AGENCY); + timetableRepository.initTimeZone(TIME_ZONE); + timetableRepository.addAgency(TimetableRepositoryForTest.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); + timetableRepository.getServiceCodes().put(SERVICE_ID, 0); + timetableRepository.updateCalendarServiceData( + true, + calendarServiceData, + DataImportIssueStore.NOOP + ); - return new RealtimeTestEnvironment(sourceType, transitModel); + return new RealtimeTestEnvironment(sourceType, timetableRepository); } private Trip createTrip(TripInput tripInput) { @@ -65,10 +72,10 @@ private Trip createTrip(TripInput tripInput) { .withServiceDate(SERVICE_DATE) .build(); - transitModel.addTripOnServiceDate(tripOnServiceDate.getId(), tripOnServiceDate); + timetableRepository.addTripOnServiceDate(tripOnServiceDate); if (tripInput.route().getOperator() != null) { - transitModel.getOperators().add(tripInput.route().getOperator()); + timetableRepository.addOperators(List.of(tripInput.route().getOperator())); } var stopTimes = IntStream @@ -81,17 +88,17 @@ private Trip createTrip(TripInput tripInput) { TripTimes tripTimes = TripTimesFactory.tripTimes(trip, stopTimes, null); - final TripPattern pattern = TransitModelForTest + final TripPattern pattern = TimetableRepositoryForTest .tripPattern(tripInput.id() + "Pattern", tripInput.route()) .withStopPattern( - TransitModelForTest.stopPattern( + TimetableRepositoryForTest.stopPattern( tripInput.stops().stream().map(TripInput.StopCall::stop).toList() ) ) .withScheduledTimeTableBuilder(builder -> builder.addTripTimes(tripTimes)) .build(); - transitModel.addTripPattern(pattern.getId(), pattern); + timetableRepository.addTripPattern(pattern.getId(), pattern); return trip; } 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 88% rename from src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotManagerTest.java rename to application/src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotManagerTest.java index 1f3f71a2588..93c5ddbdc55 100644 --- a/src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotManagerTest.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotManagerTest.java @@ -15,7 +15,7 @@ import org.junit.jupiter.params.provider.MethodSource; import org.opentripplanner.model.RealTimeTripUpdate; import org.opentripplanner.model.TimetableSnapshot; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.timetable.RealTimeTripTimes; import org.opentripplanner.transit.model.timetable.ScheduledTripTimes; @@ -27,18 +27,21 @@ class TimetableSnapshotManagerTest { private static final LocalDate TOMORROW = TODAY.plusDays(1); private static final LocalDate YESTERDAY = TODAY.minusDays(1); - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); - private static final TripPattern PATTERN = TransitModelForTest - .tripPattern("pattern", TransitModelForTest.route("r1").build()) + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); + private static final TripPattern PATTERN = TimetableRepositoryForTest + .tripPattern("pattern", TimetableRepositoryForTest.route("r1").build()) .withStopPattern( - TransitModelForTest.stopPattern(TEST_MODEL.stop("1").build(), TEST_MODEL.stop("2").build()) + TimetableRepositoryForTest.stopPattern( + TEST_MODEL.stop("1").build(), + TEST_MODEL.stop("2").build() + ) ) .build(); private static final RealTimeTripTimes TRIP_TIMES = RealTimeTripTimes.of( ScheduledTripTimes .of() .withArrivalTimes("00:00 00:01") - .withTrip(TransitModelForTest.trip("trip").build()) + .withTrip(TimetableRepositoryForTest.trip("trip").build()) .build() ); 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 96% 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..e817c6e18bb 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; @@ -34,7 +33,7 @@ import org.opentripplanner.transit.model.timetable.Trip; import org.opentripplanner.transit.model.timetable.TripTimes; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitService; import org.opentripplanner.updater.GtfsRealtimeFuzzyTripMatcher; import org.opentripplanner.updater.TimetableSnapshotSourceParameters; @@ -49,7 +48,7 @@ public class TimetableSnapshotSourceTest { ZoneIds.NEW_YORK ) .build(); - private TransitModel transitModel; + private TimetableRepository timetableRepository; private TransitService transitService; private final GtfsRealtimeFuzzyTripMatcher TRIP_MATCHER_NOOP = null; @@ -59,8 +58,8 @@ public class TimetableSnapshotSourceTest { @BeforeEach public void setUp() { TestOtpModel model = ConstantsForTests.buildGtfsGraph(ConstantsForTests.SIMPLE_GTFS); - transitModel = model.transitModel(); - transitService = new DefaultTransitService(transitModel); + timetableRepository = model.timetableRepository(); + transitService = new DefaultTransitService(timetableRepository); feedId = transitService.getFeedIds().stream().findFirst().get(); } @@ -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,11 +281,10 @@ public void testHandleModifiedTrip() { } } - @Nonnull private TimetableSnapshotSource defaultUpdater() { return new TimetableSnapshotSource( new TimetableSnapshotSourceParameters(Duration.ZERO, true), - transitModel, + timetableRepository, () -> SERVICE_DATE ); } diff --git a/src/test/java/org/opentripplanner/updater/trip/TripInput.java b/application/src/test/java/org/opentripplanner/updater/trip/TripInput.java similarity index 100% rename from src/test/java/org/opentripplanner/updater/trip/TripInput.java rename to application/src/test/java/org/opentripplanner/updater/trip/TripInput.java 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 94% 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 6b662e8c8f3..77b54c0e962 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 @@ -12,7 +12,7 @@ import java.util.List; import org.junit.jupiter.api.Test; import org.opentripplanner.model.PickDrop; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.timetable.RealTimeState; @@ -63,8 +63,8 @@ void addedTripWithNewRoute() { assertEquals(TransitMode.RAIL, route.getMode()); TransitService transitService = env.getTransitService(); - var fromTransitModel = transitService.getRouteForId(route.getId()); - assertEquals(fromTransitModel, route); + var fromTimetableRepository = transitService.getRouteForId(route.getId()); + assertEquals(fromTimetableRepository, route); var patternsForRoute = transitService.getPatternsForRoute(route); assertEquals(1, patternsForRoute.size()); assertEquals(pattern, patternsForRoute.stream().findFirst().orElseThrow()); @@ -128,11 +128,11 @@ private TripPattern assertAddedTrip(String tripId, RealtimeTestEnvironment env) var snapshot = env.getTimetableSnapshot(); TransitService transitService = env.getTransitService(); - Trip trip = transitService.getTripForId(TransitModelForTest.id(ADDED_TRIP_ID)); + Trip trip = transitService.getTripForId(TimetableRepositoryForTest.id(ADDED_TRIP_ID)); assertNotNull(trip); assertNotNull(transitService.getPatternForTrip(trip)); - var stopA = env.transitModel.getStopModel().getRegularStop(STOP_A1.getId()); + var stopA = env.timetableRepository.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 98% 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 b8bd5c4574b..e79ca7f6ce5 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,7 +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.transit.model._data.TimetableRepositoryForTest.id; import static org.opentripplanner.updater.spi.UpdateResultAssertions.assertSuccess; import static org.opentripplanner.updater.trip.UpdateIncrementality.DIFFERENTIAL; 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 98% 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 f45a82b9ba0..8231e21bce7 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,7 +5,7 @@ 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.transit.model._data.TimetableRepositoryForTest.id; import static org.opentripplanner.updater.spi.UpdateResultAssertions.assertSuccess; import org.junit.jupiter.api.Test; 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 97% 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 f9799ba6512..c4b4c9e9bbd 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,7 +6,7 @@ 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.transit.model._data.TimetableRepositoryForTest.id; import static org.opentripplanner.updater.spi.UpdateResultAssertions.assertSuccess; import static org.opentripplanner.updater.trip.UpdateIncrementality.DIFFERENTIAL; @@ -88,7 +88,7 @@ void scheduledTripWithPreviouslySkipped() { // stoptime updates have gone through var snapshot = env.getTimetableSnapshot(); - assertNull(snapshot.getRealtimeAddedTripPattern(id(TRIP_2_ID), SERVICE_DATE)); + assertNull(snapshot.getNewTripPatternForModifiedTrip(id(TRIP_2_ID), SERVICE_DATE)); assertNewTripTimesIsUpdated(env, TRIP_2_ID); 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 100% 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 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 100% 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 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 95% 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 index 33455cf9b9a..27b6a038418 100644 --- a/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdaterTest.java +++ b/application/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdaterTest.java @@ -3,7 +3,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.opentripplanner.standalone.config.framework.json.JsonSupport.newNodeAdapterForTest; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import com.google.common.util.concurrent.Futures; import java.util.List; @@ -17,7 +17,7 @@ import org.opentripplanner.routing.vehicle_parking.VehicleParkingSpaces; import org.opentripplanner.standalone.config.routerconfig.updaters.VehicleParkingUpdaterConfig; import org.opentripplanner.transit.model.framework.FeedScopedId; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.DefaultRealTimeUpdateContext; import org.opentripplanner.updater.GraphUpdaterManager; import org.opentripplanner.updater.GraphWriterRunnable; @@ -118,7 +118,7 @@ private void runUpdaterOnce(VehicleParkingAvailabilityUpdater updater) { class GraphUpdaterMock extends GraphUpdaterManager { private static final Graph GRAPH = new Graph(); - private static final TransitModel TRANSIT_MODEL = new TransitModel(); + private static final TimetableRepository TRANSIT_MODEL = new TimetableRepository(); public static final DefaultRealTimeUpdateContext REAL_TIME_UPDATE_CONTEXT = new DefaultRealTimeUpdateContext( GRAPH, TRANSIT_MODEL 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 95% 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 index e504e42eb6c..f83680f8aff 100644 --- a/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdaterTest.java +++ b/application/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdaterTest.java @@ -20,7 +20,7 @@ import org.opentripplanner.street.model.edge.StreetVehicleParkingLink; import org.opentripplanner.street.model.edge.VehicleParkingEdge; import org.opentripplanner.street.model.vertex.VehicleParkingEntranceVertex; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.DefaultRealTimeUpdateContext; import org.opentripplanner.updater.GraphUpdaterManager; import org.opentripplanner.updater.GraphWriterRunnable; @@ -31,7 +31,7 @@ class VehicleParkingUpdaterTest { private DataSource dataSource; private Graph graph; - private TransitModel transitModel; + private TimetableRepository timetableRepository; private DefaultRealTimeUpdateContext realTimeUpdateContext; private VehicleParkingUpdater vehicleParkingUpdater; @@ -42,14 +42,14 @@ public void setup() { VehicleParkingTestGraphData graphData = new VehicleParkingTestGraphData(); graphData.initGraph(); graph = graphData.getGraph(); - transitModel = graphData.getTransitModel(); - realTimeUpdateContext = new DefaultRealTimeUpdateContext(graph, transitModel); + timetableRepository = graphData.getTimetableRepository(); + realTimeUpdateContext = new DefaultRealTimeUpdateContext(graph, timetableRepository); dataSource = (DataSource) Mockito.mock(DataSource.class); when(dataSource.update()).thenReturn(true); - transitModel.index(); - graph.index(transitModel.getStopModel()); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); var parameters = new VehicleParkingUpdaterParameters() { @Override @@ -270,7 +270,11 @@ private void assertVehicleParkingsInGraph(int vehicleParkingNumber) { private void runUpdaterOnce() { class GraphUpdaterMock extends GraphUpdaterManager { - public GraphUpdaterMock(Graph graph, TransitModel transitModel, List updaters) { + public GraphUpdaterMock( + Graph graph, + TimetableRepository timetableRepository, + List updaters + ) { super(realTimeUpdateContext, updaters); } @@ -283,7 +287,7 @@ public Future execute(GraphWriterRunnable runnable) { var graphUpdaterManager = new GraphUpdaterMock( graph, - transitModel, + timetableRepository, List.of(vehicleParkingUpdater) ); graphUpdaterManager.startUpdaters(); 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 90% 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 4f10fb2d64b..5fa7c5e8df0 100644 --- a/src/test/java/org/opentripplanner/updater/vehicle_position/RealtimeVehicleMatcherTest.java +++ b/application/src/test/java/org/opentripplanner/updater/vehicle_position/RealtimeVehicleMatcherTest.java @@ -29,7 +29,7 @@ import org.opentripplanner.model.StopTime; import org.opentripplanner.service.realtimevehicles.internal.DefaultRealtimeVehicleService; import org.opentripplanner.standalone.config.routerconfig.updaters.VehiclePositionsUpdaterConfig; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.Route; @@ -41,9 +41,9 @@ public class RealtimeVehicleMatcherTest { - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); - private static final Route ROUTE = TransitModelForTest.route("1").build(); + private static final Route ROUTE = TimetableRepositoryForTest.route("1").build(); private static final Set FEATURES = Set.of( POSITION, STOP_POSITION, @@ -51,7 +51,7 @@ public class RealtimeVehicleMatcherTest { ); ZoneId zoneId = ZoneIds.BERLIN; String tripId = "trip1"; - FeedScopedId scopedTripId = TransitModelForTest.id(tripId); + FeedScopedId scopedTripId = TimetableRepositoryForTest.id(tripId); @Test public void matchRealtimeVehiclesToTrip() { @@ -89,15 +89,15 @@ public void tripNotFoundInPattern() { final String secondTripId = "trip2"; - var trip1 = TransitModelForTest.trip(tripId).build(); - var trip2 = TransitModelForTest.trip(secondTripId).build(); + var trip1 = TimetableRepositoryForTest.trip(tripId).build(); + var trip2 = TimetableRepositoryForTest.trip(secondTripId).build(); var stopTimes = testModel.stopTimesEvery5Minutes(3, trip1, T11_00); var pattern = tripPattern(trip1, stopTimes); // Map positions to trips in feed RealtimeVehiclePatternMatcher matcher = new RealtimeVehiclePatternMatcher( - TransitModelForTest.FEED_ID, + TimetableRepositoryForTest.FEED_ID, ignored -> trip2, ignored -> pattern, (id, time) -> pattern, @@ -119,8 +119,8 @@ public void sequenceId() { var service = new DefaultRealtimeVehicleService(null); var tripId = "trip1"; - var scopedTripId = TransitModelForTest.id(tripId); - var trip1 = TransitModelForTest.trip(tripId).build(); + var scopedTripId = TimetableRepositoryForTest.id(tripId); + var trip1 = TimetableRepositoryForTest.trip(tripId).build(); var stopTimes = List.of( testModel.stopTime(trip1, 10), @@ -134,7 +134,7 @@ public void sequenceId() { // Map positions to trips in feed RealtimeVehiclePatternMatcher matcher = new RealtimeVehiclePatternMatcher( - TransitModelForTest.FEED_ID, + TimetableRepositoryForTest.FEED_ID, tripForId::get, patternForTrip::get, (id, time) -> patternForTrip.get(id), @@ -176,7 +176,7 @@ void invalidStopSequence() { private void testVehiclePositions(VehiclePosition pos) { var service = new DefaultRealtimeVehicleService(null); - var trip = TransitModelForTest.trip(tripId).build(); + var trip = TimetableRepositoryForTest.trip(tripId).build(); var stopTimes = List.of( testModel.stopTime(trip, 0), testModel.stopTime(trip, 1), @@ -193,7 +193,7 @@ private void testVehiclePositions(VehiclePosition pos) { // Map positions to trips in feed var matcher = new RealtimeVehiclePatternMatcher( - TransitModelForTest.FEED_ID, + TimetableRepositoryForTest.FEED_ID, tripForId::get, patternForTrip::get, (id, time) -> patternForTrip.get(id), @@ -224,7 +224,7 @@ private void testVehiclePositions(VehiclePosition pos) { private void testVehiclePositionOccupancy(VehiclePosition pos) { var service = new DefaultRealtimeVehicleService(null); - var trip = TransitModelForTest.trip(tripId).build(); + var trip = TimetableRepositoryForTest.trip(tripId).build(); var stopTimes = List.of( testModel.stopTime(trip, 0), testModel.stopTime(trip, 1), @@ -241,7 +241,7 @@ private void testVehiclePositionOccupancy(VehiclePosition pos) { // Map positions to trips in feed RealtimeVehiclePatternMatcher matcher = new RealtimeVehiclePatternMatcher( - TransitModelForTest.FEED_ID, + TimetableRepositoryForTest.FEED_ID, tripForId::get, patternForTrip::get, (id, time) -> patternForTrip.get(id), @@ -267,11 +267,11 @@ public void clearOldTrips() { var tripId1 = "trip1"; var tripId2 = "trip2"; - var scopedTripId1 = TransitModelForTest.id(tripId1); - var scopedTripId2 = TransitModelForTest.id(tripId2); + var scopedTripId1 = TimetableRepositoryForTest.id(tripId1); + var scopedTripId2 = TimetableRepositoryForTest.id(tripId2); - var trip1 = TransitModelForTest.trip(tripId1).build(); - var trip2 = TransitModelForTest.trip(tripId2).build(); + var trip1 = TimetableRepositoryForTest.trip(tripId1).build(); + var trip2 = TimetableRepositoryForTest.trip(tripId2).build(); var stopTimes1 = List.of( testModel.stopTime(trip1, 0), @@ -297,7 +297,7 @@ public void clearOldTrips() { // Map positions to trips in feed RealtimeVehiclePatternMatcher matcher = new RealtimeVehiclePatternMatcher( - TransitModelForTest.FEED_ID, + TimetableRepositoryForTest.FEED_ID, tripForId::get, patternForTrip::get, (id, time) -> patternForTrip.get(id), @@ -337,7 +337,7 @@ static Stream inferenceTestCases() { @ParameterizedTest(name = "{0} should resolve to {1}") @MethodSource("inferenceTestCases") void inferServiceDayOfTripAt6(String time, String expectedDate) { - var trip = TransitModelForTest.trip(tripId).build(); + var trip = TimetableRepositoryForTest.trip(tripId).build(); var sixOclock = (int) Duration.ofHours(18).toSeconds(); var fivePast6 = sixOclock + 300; @@ -357,7 +357,7 @@ void inferServiceDayOfTripAt6(String time, String expectedDate) { @Test void inferServiceDateCloseToMidnight() { - var trip = TransitModelForTest.trip(tripId).build(); + var trip = TimetableRepositoryForTest.trip(tripId).build(); var fiveToMidnight = LocalTime.parse("23:55").toSecondOfDay(); var fivePastMidnight = fiveToMidnight + (10 * 60); 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 97% 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 index 99910e04f7c..4eea85b4dc9 100644 --- a/src/test/java/org/opentripplanner/updater/vehicle_rental/GeofencingVertexUpdaterTest.java +++ b/application/src/test/java/org/opentripplanner/updater/vehicle_rental/GeofencingVertexUpdaterTest.java @@ -4,7 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.opentripplanner.street.model._data.StreetModelForTest.intersectionVertex; import static org.opentripplanner.street.model._data.StreetModelForTest.streetEdge; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.List; import org.junit.jupiter.api.Test; 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 92% 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..2ca93a10f28 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,13 +9,12 @@ 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; import org.opentripplanner.service.vehiclerental.internal.DefaultVehicleRentalService; import org.opentripplanner.service.vehiclerental.model.VehicleRentalPlace; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.DefaultRealTimeUpdateContext; import org.opentripplanner.updater.GraphUpdaterManager; import org.opentripplanner.updater.GraphWriterRunnable; @@ -46,7 +45,10 @@ void failingDatasourceCountsAsPrimed() { static class MockManager extends GraphUpdaterManager { public MockManager(VehicleRentalUpdater updater) { - super(new DefaultRealTimeUpdateContext(new Graph(), new TransitModel()), List.of(updater)); + super( + new DefaultRealTimeUpdateContext(new Graph(), new TimetableRepository()), + List.of(updater) + ); } @Override @@ -81,7 +83,6 @@ private boolean hasFailed() { static class FakeParams implements VehicleRentalDataSourceParameters { - @Nonnull @Override public String url() { return "https://example.com"; @@ -93,13 +94,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/src/test/resources/org/opentripplanner/apis/gtfs/expectations/stops.json b/application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/stops.json similarity index 100% rename from src/test/resources/org/opentripplanner/apis/gtfs/expectations/stops.json rename to application/src/test/resources/org/opentripplanner/apis/gtfs/expectations/stops.json 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/src/test/resources/org/opentripplanner/apis/gtfs/queries/stops.graphql b/application/src/test/resources/org/opentripplanner/apis/gtfs/queries/stops.graphql similarity index 100% rename from src/test/resources/org/opentripplanner/apis/gtfs/queries/stops.graphql rename to application/src/test/resources/org/opentripplanner/apis/gtfs/queries/stops.graphql 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/application/src/test/resources/org/opentripplanner/apis/vectortiles/style.json b/application/src/test/resources/org/opentripplanner/apis/vectortiles/style.json new file mode 100644 index 00000000000..8a0e457396e --- /dev/null +++ b/application/src/test/resources/org/opentripplanner/apis/vectortiles/style.json @@ -0,0 +1,812 @@ +{ + "name" : "OTP Debug Tiles", + "sources" : { + "background" : { + "id" : "background", + "tiles" : [ + "https://a.tile.openstreetmap.org/{z}/{x}/{y}.png" + ], + "maxzoom" : 19, + "tileSize" : 256, + "attribution" : "© OpenStreetMap Contributors", + "type" : "raster" + }, + "vectorSource" : { + "id" : "vectorSource", + "url" : "https://example.com", + "type" : "vector" + } + }, + "layers" : [ + { + "id" : "background", + "type" : "raster", + "source" : "background", + "minzoom" : 0, + "metadata" : { + "group" : "Other" + } + }, + { + "id" : "NONE", + "source" : "vectorSource", + "source-layer" : "edges", + "type" : "line", + "minzoom" : 6, + "maxzoom" : 23, + "paint" : { + "line-color" : "#000", + "line-width" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.2, + 23, + 8.0 + ], + "line-offset" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.3, + 23, + 6.0 + ] + }, + "filter" : [ + "==", + "permission", + "NONE" + ], + "layout" : { + "line-cap" : "round", + "visibility" : "none" + }, + "metadata" : { + "group" : "Traversal permissions" + } + }, + { + "id" : "PEDESTRIAN", + "source" : "vectorSource", + "source-layer" : "edges", + "type" : "line", + "minzoom" : 6, + "maxzoom" : 23, + "paint" : { + "line-color" : "#2ba812", + "line-width" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.2, + 23, + 8.0 + ], + "line-offset" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.3, + 23, + 6.0 + ] + }, + "filter" : [ + "==", + "permission", + "PEDESTRIAN" + ], + "layout" : { + "line-cap" : "round", + "visibility" : "none" + }, + "metadata" : { + "group" : "Traversal permissions" + } + }, + { + "id" : "BICYCLE", + "source" : "vectorSource", + "source-layer" : "edges", + "type" : "line", + "minzoom" : 6, + "maxzoom" : 23, + "paint" : { + "line-color" : "#10d3b6", + "line-width" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.2, + 23, + 8.0 + ], + "line-offset" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.3, + 23, + 6.0 + ] + }, + "filter" : [ + "==", + "permission", + "BICYCLE" + ], + "layout" : { + "line-cap" : "round", + "visibility" : "none" + }, + "metadata" : { + "group" : "Traversal permissions" + } + }, + { + "id" : "PEDESTRIAN_AND_BICYCLE", + "source" : "vectorSource", + "source-layer" : "edges", + "type" : "line", + "minzoom" : 6, + "maxzoom" : 23, + "paint" : { + "line-color" : "#10d3b6", + "line-width" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.2, + 23, + 8.0 + ], + "line-offset" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.3, + 23, + 6.0 + ] + }, + "filter" : [ + "==", + "permission", + "PEDESTRIAN_AND_BICYCLE" + ], + "layout" : { + "line-cap" : "round", + "visibility" : "none" + }, + "metadata" : { + "group" : "Traversal permissions" + } + }, + { + "id" : "CAR", + "source" : "vectorSource", + "source-layer" : "edges", + "type" : "line", + "minzoom" : 6, + "maxzoom" : 23, + "paint" : { + "line-color" : "#f92e13", + "line-width" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.2, + 23, + 8.0 + ], + "line-offset" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.3, + 23, + 6.0 + ] + }, + "filter" : [ + "==", + "permission", + "CAR" + ], + "layout" : { + "line-cap" : "round", + "visibility" : "none" + }, + "metadata" : { + "group" : "Traversal permissions" + } + }, + { + "id" : "PEDESTRIAN_AND_CAR", + "source" : "vectorSource", + "source-layer" : "edges", + "type" : "line", + "minzoom" : 6, + "maxzoom" : 23, + "paint" : { + "line-color" : "#e25f8f", + "line-width" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.2, + 23, + 8.0 + ], + "line-offset" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.3, + 23, + 6.0 + ] + }, + "filter" : [ + "==", + "permission", + "PEDESTRIAN_AND_CAR" + ], + "layout" : { + "line-cap" : "round", + "visibility" : "none" + }, + "metadata" : { + "group" : "Traversal permissions" + } + }, + { + "id" : "BICYCLE_AND_CAR", + "source" : "vectorSource", + "source-layer" : "edges", + "type" : "line", + "minzoom" : 6, + "maxzoom" : 23, + "paint" : { + "line-color" : "#e25f8f", + "line-width" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.2, + 23, + 8.0 + ], + "line-offset" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.3, + 23, + 6.0 + ] + }, + "filter" : [ + "==", + "permission", + "BICYCLE_AND_CAR" + ], + "layout" : { + "line-cap" : "round", + "visibility" : "none" + }, + "metadata" : { + "group" : "Traversal permissions" + } + }, + { + "id" : "ALL", + "source" : "vectorSource", + "source-layer" : "edges", + "type" : "line", + "minzoom" : 6, + "maxzoom" : 23, + "paint" : { + "line-color" : "#adb2b0", + "line-width" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.2, + 23, + 8.0 + ], + "line-offset" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.3, + 23, + 6.0 + ] + }, + "filter" : [ + "==", + "permission", + "ALL" + ], + "layout" : { + "line-cap" : "round", + "visibility" : "none" + }, + "metadata" : { + "group" : "Traversal permissions" + } + }, + { + "id" : "permission-text", + "source" : "vectorSource", + "source-layer" : "edges", + "type" : "symbol", + "minzoom" : 17, + "maxzoom" : 23, + "paint" : { + "text-color" : "#000", + "text-halo-color" : "#fff", + "text-halo-blur" : 4, + "text-halo-width" : 3 + }, + "filter" : [ + "in", + "class", + "StreetEdge", + "AreaEdge", + "EscalatorEdge", + "PathwayEdge", + "ElevatorHopEdge", + "TemporaryPartialStreetEdge", + "TemporaryFreeEdge" + ], + "layout" : { + "symbol-placement" : "line-center", + "symbol-spacing" : 1000, + "text-field" : "{permission}", + "text-font" : [ + "KlokanTech Noto Sans Regular" + ], + "text-size" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 10, + 6.0, + 24, + 12.0 + ], + "text-max-width" : 100, + "text-keep-upright" : true, + "text-rotation-alignment" : "map", + "text-overlap" : "never", + "text-offset" : [ + 0, + 1.0 + ], + "visibility" : "none" + }, + "metadata" : { + "group" : "Traversal permissions" + } + }, + { + "id" : "edge", + "type" : "line", + "source" : "vectorSource", + "source-layer" : "edges", + "minzoom" : 6, + "maxzoom" : 23, + "paint" : { + "line-color" : "#f21d52", + "line-width" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.2, + 23, + 8.0 + ], + "line-offset" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.3, + 23, + 6.0 + ] + }, + "filter" : [ + "in", + "class", + "StreetEdge", + "AreaEdge", + "EscalatorEdge", + "PathwayEdge", + "ElevatorHopEdge", + "TemporaryPartialStreetEdge", + "TemporaryFreeEdge" + ], + "layout" : { + "line-cap" : "round", + "visibility" : "none" + }, + "metadata" : { + "group" : "Edges" + } + }, + { + "id" : "edge-name", + "type" : "symbol", + "source" : "vectorSource", + "source-layer" : "edges", + "minzoom" : 17, + "maxzoom" : 23, + "paint" : { + "text-color" : "#000", + "text-halo-color" : "#fff", + "text-halo-blur" : 4, + "text-halo-width" : 3 + }, + "filter" : [ + "in", + "class", + "StreetEdge", + "AreaEdge", + "EscalatorEdge", + "PathwayEdge", + "ElevatorHopEdge", + "TemporaryPartialStreetEdge", + "TemporaryFreeEdge" + ], + "layout" : { + "symbol-placement" : "line-center", + "symbol-spacing" : 1000, + "text-field" : "{name}", + "text-font" : [ + "KlokanTech Noto Sans Regular" + ], + "text-size" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 10, + 6.0, + 24, + 12.0 + ], + "text-max-width" : 100, + "text-keep-upright" : true, + "text-rotation-alignment" : "map", + "text-overlap" : "never", + "visibility" : "none" + }, + "metadata" : { + "group" : "Edges" + } + }, + { + "id" : "link", + "type" : "line", + "source" : "vectorSource", + "source-layer" : "edges", + "minzoom" : 13, + "maxzoom" : 23, + "paint" : { + "line-color" : "#22DD9E", + "line-width" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.2, + 23, + 8.0 + ], + "line-offset" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.3, + 23, + 6.0 + ] + }, + "filter" : [ + "in", + "class", + "StreetTransitStopLink", + "StreetTransitEntranceLink", + "BoardingLocationToStopLink", + "StreetVehicleRentalLink", + "StreetVehicleParkingLink", + "StreetStationCentroidLink" + ], + "layout" : { + "line-cap" : "round", + "visibility" : "none" + }, + "metadata" : { + "group" : "Edges" + } + }, + { + "id" : "vertex", + "type" : "circle", + "source" : "vectorSource", + "source-layer" : "vertices", + "minzoom" : 15, + "maxzoom" : 23, + "paint" : { + "circle-stroke-color" : "#140d0e", + "circle-stroke-width" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 15, + 0.2, + 23, + 3.0 + ], + "circle-radius" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 15, + 1.0, + 23, + 7.0 + ], + "circle-color" : "#BC55F2" + }, + "layout" : { + "visibility" : "none" + }, + "metadata" : { + "group" : "Vertices" + } + }, + { + "id" : "parking-vertex", + "type" : "circle", + "source" : "vectorSource", + "source-layer" : "vertices", + "minzoom" : 13, + "maxzoom" : 23, + "paint" : { + "circle-stroke-color" : "#140d0e", + "circle-stroke-width" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 15, + 0.2, + 23, + 3.0 + ], + "circle-radius" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 1.4, + 23, + 10.0 + ], + "circle-color" : "#136b04" + }, + "filter" : [ + "in", + "class", + "VehicleParkingEntranceVertex" + ], + "layout" : { + "visibility" : "none" + }, + "metadata" : { + "group" : "Vertices" + } + }, + { + "id" : "area-stop", + "type" : "fill", + "source" : "vectorSource", + "source-layer" : "stops", + "minzoom" : 6, + "maxzoom" : 23, + "paint" : { + "fill-color" : "#22DD9E", + "fill-opacity" : 0.5, + "fill-outline-color" : "#140d0e" + }, + "metadata" : { + "group" : "Stops" + } + }, + { + "id" : "group-stop", + "type" : "fill", + "source" : "vectorSource", + "source-layer" : "stops", + "minzoom" : 6, + "maxzoom" : 23, + "paint" : { + "fill-color" : "#22DD9E", + "fill-opacity" : 0.5, + "fill-outline-color" : "#140d0e" + }, + "metadata" : { + "group" : "Stops" + } + }, + { + "id" : "regular-stop", + "type" : "circle", + "source" : "vectorSource", + "source-layer" : "stops", + "minzoom" : 10, + "maxzoom" : 23, + "paint" : { + "circle-stroke-color" : "#140d0e", + "circle-stroke-width" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 11, + 0.5, + 23, + 5.0 + ], + "circle-radius" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 11, + 0.5, + 23, + 10.0 + ], + "circle-color" : "#fcf9fa" + }, + "metadata" : { + "group" : "Stops" + } + } + ], + "version" : 8, + "glyphs" : "https://cdn.jsdelivr.net/gh/klokantech/klokantech-gl-fonts@master/{fontstack}/{range}.pbf" +} \ No newline at end of file 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/codegen.ts b/client/codegen.ts index b5b68a0650a..60299a21a97 100644 --- a/client/codegen.ts +++ b/client/codegen.ts @@ -2,7 +2,7 @@ import type { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { overwrite: true, - schema: '../src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql', + schema: '../application/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql', documents: 'src/**/*.{ts,tsx}', generates: { 'src/gql/': { diff --git a/client/package-lock.json b/client/package-lock.json index 00490ce16d6..4245121a10e 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -36,7 +36,7 @@ "eslint-plugin-import": "2.30.0", "eslint-plugin-jsx-a11y": "6.10.0", "eslint-plugin-react": "7.36.1", - "eslint-plugin-react-hooks": "4.6.2", + "eslint-plugin-react-hooks": "5.0.0", "eslint-plugin-react-refresh": "0.4.12", "jsdom": "25.0.0", "prettier": "3.3.3", @@ -6400,15 +6400,16 @@ } }, "node_modules/eslint-plugin-react-hooks": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.2.tgz", - "integrity": "sha512-QzliNJq4GinDBcD8gPB5v0wh6g8q3SUi6EFF0x8N/BL9PoVs0atuGc47ozMRyOWAKdwaZ5OnbOEa3WR+dSGKuQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-5.0.0.tgz", + "integrity": "sha512-hIOwI+5hYGpJEc4uPRmz2ulCjAGD/N13Lukkh8cLV0i2IRk/bdZDYjgLVHj+U9Z704kLIdIO6iueGvxNur0sgw==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, "peerDependencies": { - "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0" + "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0" } }, "node_modules/eslint-plugin-react-refresh": { diff --git a/client/package.json b/client/package.json index 0e822b4a641..ff555a85f9b 100644 --- a/client/package.json +++ b/client/package.json @@ -45,7 +45,7 @@ "eslint-plugin-import": "2.30.0", "eslint-plugin-jsx-a11y": "6.10.0", "eslint-plugin-react": "7.36.1", - "eslint-plugin-react-hooks": "4.6.2", + "eslint-plugin-react-hooks": "5.0.0", "eslint-plugin-react-refresh": "0.4.12", "jsdom": "25.0.0", "prettier": "3.3.3", 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 ca072fa5589..73df12fe103 100644 --- a/client/src/components/SearchBar/SearchBar.tsx +++ b/client/src/components/SearchBar/SearchBar.tsx @@ -1,4 +1,4 @@ -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'; @@ -15,6 +15,8 @@ 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'; +import { SwapLocationsButton } from './SwapLocationsButton.tsx'; type SearchBarProps = { onRoute: () => void; @@ -37,6 +39,7 @@ export function SearchBar({ onRoute, tripQueryVariables, setTripQueryVariables, + @@ -50,17 +53,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/SwapLocationsButton.tsx b/client/src/components/SearchBar/SwapLocationsButton.tsx new file mode 100644 index 00000000000..28d25f2fac7 --- /dev/null +++ b/client/src/components/SearchBar/SwapLocationsButton.tsx @@ -0,0 +1,24 @@ +import { TripQueryVariables } from '../../gql/graphql.ts'; +import icon from '../../static/img/swap.svg'; + +export function SwapLocationsButton({ + tripQueryVariables, + setTripQueryVariables, +}: { + tripQueryVariables: TripQueryVariables; + setTripQueryVariables: (tripQueryVariables: TripQueryVariables) => void; +}) { + const swapFromTo = () => { + setTripQueryVariables({ + ...tripQueryVariables, + from: tripQueryVariables.to, + to: tripQueryVariables.from, + }); + }; + + return ( + + ); +} 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/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/swap.svg b/client/src/static/img/swap.svg new file mode 100644 index 00000000000..858e5e99831 --- /dev/null +++ b/client/src/static/img/swap.svg @@ -0,0 +1,5 @@ + + + + + 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 ef8183b0832..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 diff --git a/client/src/style.css b/client/src/style.css index 37100d65006..c33f5dff711 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,11 +50,33 @@ 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; +} + +.search-bar .swap-from-to { + border: none; + background: none; + margin: 30px 0 auto 0; +} + +.search-bar .swap-from-to img { + width: 15px; +} + .itinerary-list-container { width: 36rem; overflow-y: auto; @@ -158,3 +180,20 @@ .maplibregl-ctrl-group.layer-select label { margin-left: 6px; } + +.maplibregl-ctrl-group.layer-select h4 { + font-size: 17px; +} + +.maplibregl-ctrl-group.layer-select .group-label { + font-size: 15px; + margin-bottom: 5px; +} + +.maplibregl-ctrl-group.layer-select div.group { + margin-top: 10px; +} + +.maplibregl-ctrl-group.layer-select div.layer { + margin-left: 17px; +} 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/dev/onboarding-checklist.md b/doc/dev/onboarding-checklist.md new file mode 100644 index 00000000000..201238a7fd4 --- /dev/null +++ b/doc/dev/onboarding-checklist.md @@ -0,0 +1,22 @@ +# Onboarding Checklist +* What is OTP? + * [Website](https://www.opentripplanner.org/) + * History + * [Timeline](https://github.com/opentripplanner/OpenTripPlanner/graphs/contributors) +* Community + * Dev meetings + * Gitter + * Issues/PRs + * Calendar +* OTP modules + * [Diagram](https://github.com/opentripplanner/OpenTripPlanner/issues/6155) +* Data standards + * Transit + * Map/Street network + * Rental + * Parking + * Elevation +* Transit model +* Street model +* How to run OTP +* Coding conventions 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/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 0bf4a3c29ec..f5281db0f4e 100644 --- a/doc/user/BuildConfiguration.md +++ b/doc/user/BuildConfiguration.md @@ -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 f5b89026bad..aa5a970afe4 100644 --- a/doc/user/Changelog.md +++ b/doc/user/Changelog.md @@ -9,6 +9,14 @@ based on merged pull requests. Search GitHub issues and pull requests for smalle - 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) +- Rename TransitModel to TransitRepository [#6148](https://github.com/opentripplanner/OpenTripPlanner/pull/6148) [](AUTOMATIC_CHANGELOG_PLACEHOLDER_DO_NOT_REMOVE) ## 2.6.0 (2024-09-18) 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 ee0fe1eab9a..f5633ff17b1 100644 --- a/doc/user/Developers-Guide.md +++ b/doc/user/Developers-Guide.md @@ -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 @@ -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 c00502b2726..ea3d0d12c74 100644 --- a/doc/user/RouteRequest.md +++ b/doc/user/RouteRequest.md @@ -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 2c42bea6d74..711eca3fb87 100644 --- a/doc/user/RouterConfiguration.md +++ b/doc/user/RouterConfiguration.md @@ -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 3d03cb0a5ae..cc5e1d75901 100644 --- a/doc/user/UpdaterConfig.md +++ b/doc/user/UpdaterConfig.md @@ -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 3d365de5862..5c4b59e864e 100644 --- a/doc/user/apis/GraphQL-Tutorial.md +++ b/doc/user/apis/GraphQL-Tutorial.md @@ -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/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/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 1f5bb3ed8a3..0b4dd2ea10c 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.7.0-SNAPSHOT - jar @@ -56,17 +58,17 @@ - 158 + 165 32.0 2.52 - 2.17.2 - 3.1.8 - 5.11.0 - 1.13.4 + 2.18.0 + 3.1.9 + 5.11.2 + 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,43 +178,10 @@ 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 - 3.5.0 + 3.5.1 me.fabriciorby @@ -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.3.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.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.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.14.2 + + + 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 diff --git a/renovate.json5 b/renovate.json5 index 045bbe07d22..3514f3d9aff 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -26,7 +26,11 @@ "com.azure.resourcemanager:azure-resourcemanager-servicebus", "com.azure:azure-core", "com.azure:azure-messaging-servicebus", - "com.azure:azure-identity" + "com.azure:azure-identity", + // there is a breaking change in this package which is breaking our workflow, that cannot + // be reverted: https://github.com/dotansimha/graphql-code-generator/issues/10167 + // once that is resolved, we can remove this line + "@graphql-codegen/client-preset" ], "enabled": false }, @@ -147,7 +151,8 @@ { "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" }, 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/apis/vectortiles/DebugStyleSpec.java b/src/main/java/org/opentripplanner/apis/vectortiles/DebugStyleSpec.java deleted file mode 100644 index 21cdfee9ef7..00000000000 --- a/src/main/java/org/opentripplanner/apis/vectortiles/DebugStyleSpec.java +++ /dev/null @@ -1,178 +0,0 @@ -package org.opentripplanner.apis.vectortiles; - -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.opentripplanner.apis.vectortiles.model.StyleBuilder; -import org.opentripplanner.apis.vectortiles.model.StyleSpec; -import org.opentripplanner.apis.vectortiles.model.TileSource; -import org.opentripplanner.apis.vectortiles.model.TileSource.RasterSource; -import org.opentripplanner.apis.vectortiles.model.VectorSourceLayer; -import org.opentripplanner.apis.vectortiles.model.ZoomDependentNumber; -import org.opentripplanner.apis.vectortiles.model.ZoomDependentNumber.ZoomStop; -import org.opentripplanner.service.vehiclerental.street.StreetVehicleRentalLink; -import org.opentripplanner.street.model.edge.AreaEdge; -import org.opentripplanner.street.model.edge.BoardingLocationToStopLink; -import org.opentripplanner.street.model.edge.Edge; -import org.opentripplanner.street.model.edge.ElevatorHopEdge; -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.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.edge.TemporaryPartialStreetEdge; -import org.opentripplanner.street.model.vertex.VehicleParkingEntranceVertex; - -/** - * A Mapbox/Mapblibre style specification for rendering debug information about transit and - * street data. - */ -public class DebugStyleSpec { - - private static final TileSource BACKGROUND_SOURCE = new RasterSource( - "background", - List.of("https://a.tile.openstreetmap.org/{z}/{x}/{y}.png"), - 19, - 256, - "© OpenStreetMap Contributors" - ); - private static final String MAGENTA = "#f21d52"; - private static final String BRIGHT_GREEN = "#22DD9E"; - private static final String DARK_GREEN = "#136b04"; - private static final String PURPLE = "#BC55F2"; - private static final String BLACK = "#140d0e"; - private static final int MAX_ZOOM = 23; - private static final ZoomDependentNumber LINE_WIDTH = new ZoomDependentNumber( - 1.3f, - List.of(new ZoomStop(13, 0.5f), new ZoomStop(MAX_ZOOM, 10)) - ); - private static final ZoomDependentNumber CIRCLE_STROKE = new ZoomDependentNumber( - 1, - List.of(new ZoomStop(15, 0.2f), new ZoomStop(MAX_ZOOM, 3)) - ); - private static final Class[] EDGES_TO_DISPLAY = new Class[] { - StreetEdge.class, - AreaEdge.class, - EscalatorEdge.class, - PathwayEdge.class, - ElevatorHopEdge.class, - TemporaryPartialStreetEdge.class, - TemporaryFreeEdge.class, - }; - - static StyleSpec build( - VectorSourceLayer regularStops, - VectorSourceLayer areaStops, - VectorSourceLayer groupStops, - VectorSourceLayer edges, - VectorSourceLayer vertices - ) { - var vectorSources = Stream - .of(regularStops, edges, vertices) - .map(VectorSourceLayer::vectorSource); - var allSources = Stream - .concat(Stream.of(BACKGROUND_SOURCE), vectorSources) - .collect(Collectors.toSet()); - return new StyleSpec( - "OTP Debug Tiles", - allSources, - List.of( - StyleBuilder.ofId("background").typeRaster().source(BACKGROUND_SOURCE).minZoom(0), - StyleBuilder - .ofId("edge") - .typeLine() - .vectorSourceLayer(edges) - .lineColor(MAGENTA) - .edgeFilter(EDGES_TO_DISPLAY) - .lineWidth(LINE_WIDTH) - .minZoom(6) - .maxZoom(MAX_ZOOM) - .intiallyHidden(), - StyleBuilder - .ofId("edge-name") - .typeSymbol() - .lineText("name") - .vectorSourceLayer(edges) - .edgeFilter(EDGES_TO_DISPLAY) - .minZoom(17) - .maxZoom(MAX_ZOOM) - .intiallyHidden(), - StyleBuilder - .ofId("link") - .typeLine() - .vectorSourceLayer(edges) - .lineColor(BRIGHT_GREEN) - .edgeFilter( - StreetTransitStopLink.class, - StreetTransitEntranceLink.class, - BoardingLocationToStopLink.class, - StreetVehicleRentalLink.class, - StreetVehicleParkingLink.class - ) - .lineWidth(LINE_WIDTH) - .minZoom(13) - .maxZoom(MAX_ZOOM) - .intiallyHidden(), - StyleBuilder - .ofId("vertex") - .typeCircle() - .vectorSourceLayer(vertices) - .circleStroke(BLACK, CIRCLE_STROKE) - .circleRadius( - new ZoomDependentNumber(1, List.of(new ZoomStop(15, 1), new ZoomStop(MAX_ZOOM, 7))) - ) - .circleColor(PURPLE) - .minZoom(15) - .maxZoom(MAX_ZOOM) - .intiallyHidden(), - StyleBuilder - .ofId("parking-vertex") - .typeCircle() - .vectorSourceLayer(vertices) - .vertexFilter(VehicleParkingEntranceVertex.class) - .circleStroke(BLACK, CIRCLE_STROKE) - .circleRadius( - new ZoomDependentNumber(1, List.of(new ZoomStop(13, 1.4f), new ZoomStop(MAX_ZOOM, 10))) - ) - .circleColor(DARK_GREEN) - .minZoom(13) - .maxZoom(MAX_ZOOM) - .intiallyHidden(), - StyleBuilder - .ofId("area-stop") - .typeFill() - .vectorSourceLayer(areaStops) - .fillColor(BRIGHT_GREEN) - .fillOpacity(0.5f) - .fillOutlineColor(BLACK) - .minZoom(6) - .maxZoom(MAX_ZOOM), - StyleBuilder - .ofId("group-stop") - .typeFill() - .vectorSourceLayer(groupStops) - .fillColor(BRIGHT_GREEN) - .fillOpacity(0.5f) - .fillOutlineColor(BLACK) - .minZoom(6) - .maxZoom(MAX_ZOOM), - StyleBuilder - .ofId("regular-stop") - .typeCircle() - .vectorSourceLayer(regularStops) - .circleStroke( - BLACK, - new ZoomDependentNumber(1, List.of(new ZoomStop(11, 0.5f), new ZoomStop(MAX_ZOOM, 5))) - ) - .circleRadius( - new ZoomDependentNumber(1, List.of(new ZoomStop(11, 0.5f), new ZoomStop(MAX_ZOOM, 10))) - ) - .circleColor("#fcf9fa") - .minZoom(10) - .maxZoom(MAX_ZOOM) - ) - ); - } -} 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/TestOtpModel.java b/src/test/java/org/opentripplanner/TestOtpModel.java deleted file mode 100644 index a2fc5305ce9..00000000000 --- a/src/test/java/org/opentripplanner/TestOtpModel.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.opentripplanner; - -import org.opentripplanner.routing.graph.Graph; -import org.opentripplanner.transit.service.TransitModel; - -public record TestOtpModel(Graph graph, TransitModel transitModel) { - public TestOtpModel index() { - transitModel.index(); - graph.index(transitModel.getStopModel()); - return this; - } -} 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 c899606bd0b..00000000000 --- a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/plan-extended.json +++ /dev/null @@ -1,352 +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, - "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 - } - ] - } - ] - } - } -} 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/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 7823ae91bab..00000000000 --- a/src/test/resources/org/opentripplanner/apis/gtfs/queries/plan-extended.graphql +++ /dev/null @@ -1,159 +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 - id - realtimeState - } - } - } -} 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/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 - } - } - } - } -} diff --git a/src/test/resources/org/opentripplanner/apis/vectortiles/style.json b/src/test/resources/org/opentripplanner/apis/vectortiles/style.json deleted file mode 100644 index 5a2ed9572e2..00000000000 --- a/src/test/resources/org/opentripplanner/apis/vectortiles/style.json +++ /dev/null @@ -1,307 +0,0 @@ -{ - "name" : "OTP Debug Tiles", - "sources" : { - "background" : { - "id" : "background", - "tiles" : [ - "https://a.tile.openstreetmap.org/{z}/{x}/{y}.png" - ], - "maxzoom" : 19, - "tileSize" : 256, - "attribution" : "© OpenStreetMap Contributors", - "type" : "raster" - }, - "vectorSource" : { - "id" : "vectorSource", - "url" : "https://example.com", - "type" : "vector" - } - }, - "layers" : [ - { - "id" : "background", - "type" : "raster", - "source" : "background", - "minzoom" : 0 - }, - { - "id" : "edge", - "type" : "line", - "source" : "vectorSource", - "source-layer" : "edges", - "minzoom" : 6, - "maxzoom" : 23, - "paint" : { - "line-color" : "#f21d52", - "line-width" : { - "base" : 1.3, - "stops" : [ - [ - 13, - 0.5 - ], - [ - 23, - 10.0 - ] - ] - } - }, - "filter" : [ - "in", - "class", - "StreetEdge", - "AreaEdge", - "EscalatorEdge", - "PathwayEdge", - "ElevatorHopEdge", - "TemporaryPartialStreetEdge", - "TemporaryFreeEdge" - ], - "layout" : { - "line-cap" : "round", - "visibility" : "none" - } - }, - { - "id" : "edge-name", - "type" : "symbol", - "source" : "vectorSource", - "source-layer" : "edges", - "minzoom" : 17, - "maxzoom" : 23, - "paint" : { - "text-color" : "#000", - "text-halo-color" : "#fff", - "text-halo-blur" : 4, - "text-halo-width" : 3 - }, - "filter" : [ - "in", - "class", - "StreetEdge", - "AreaEdge", - "EscalatorEdge", - "PathwayEdge", - "ElevatorHopEdge", - "TemporaryPartialStreetEdge", - "TemporaryFreeEdge" - ], - "layout" : { - "symbol-placement" : "line", - "symbol-spacing" : 500, - "text-field" : "{name}", - "text-font" : [ - "KlokanTech Noto Sans Regular" - ], - "text-size" : { - "base" : 14.0, - "stops" : [ - [ - 14, - 12.0 - ], - [ - 20, - 14.0 - ] - ] - }, - "text-max-width" : 5, - "text-keep-upright" : true, - "text-rotation-alignment" : "map", - "visibility" : "none" - } - }, - { - "id" : "link", - "type" : "line", - "source" : "vectorSource", - "source-layer" : "edges", - "minzoom" : 13, - "maxzoom" : 23, - "paint" : { - "line-color" : "#22DD9E", - "line-width" : { - "base" : 1.3, - "stops" : [ - [ - 13, - 0.5 - ], - [ - 23, - 10.0 - ] - ] - } - }, - "filter" : [ - "in", - "class", - "StreetTransitStopLink", - "StreetTransitEntranceLink", - "BoardingLocationToStopLink", - "StreetVehicleRentalLink", - "StreetVehicleParkingLink" - ], - "layout" : { - "line-cap" : "round", - "visibility" : "none" - } - }, - { - "id" : "vertex", - "type" : "circle", - "source" : "vectorSource", - "source-layer" : "vertices", - "minzoom" : 15, - "maxzoom" : 23, - "paint" : { - "circle-stroke-color" : "#140d0e", - "circle-stroke-width" : { - "base" : 1.0, - "stops" : [ - [ - 15, - 0.2 - ], - [ - 23, - 3.0 - ] - ] - }, - "circle-radius" : { - "base" : 1.0, - "stops" : [ - [ - 15, - 1.0 - ], - [ - 23, - 7.0 - ] - ] - }, - "circle-color" : "#BC55F2" - }, - "layout" : { - "visibility" : "none" - } - }, - { - "id" : "parking-vertex", - "type" : "circle", - "source" : "vectorSource", - "source-layer" : "vertices", - "minzoom" : 13, - "maxzoom" : 23, - "paint" : { - "circle-stroke-color" : "#140d0e", - "circle-stroke-width" : { - "base" : 1.0, - "stops" : [ - [ - 15, - 0.2 - ], - [ - 23, - 3.0 - ] - ] - }, - "circle-radius" : { - "base" : 1.0, - "stops" : [ - [ - 13, - 1.4 - ], - [ - 23, - 10.0 - ] - ] - }, - "circle-color" : "#136b04" - }, - "filter" : [ - "in", - "class", - "VehicleParkingEntranceVertex" - ], - "layout" : { - "visibility" : "none" - } - }, - { - "id" : "area-stop", - "type" : "fill", - "source" : "vectorSource", - "source-layer" : "stops", - "minzoom" : 6, - "maxzoom" : 23, - "paint" : { - "fill-color" : "#22DD9E", - "fill-opacity" : 0.5, - "fill-outline-color" : "#140d0e" - } - }, - { - "id" : "group-stop", - "type" : "fill", - "source" : "vectorSource", - "source-layer" : "stops", - "minzoom" : 6, - "maxzoom" : 23, - "paint" : { - "fill-color" : "#22DD9E", - "fill-opacity" : 0.5, - "fill-outline-color" : "#140d0e" - } - }, - { - "id" : "regular-stop", - "type" : "circle", - "source" : "vectorSource", - "source-layer" : "stops", - "minzoom" : 10, - "maxzoom" : 23, - "paint" : { - "circle-stroke-color" : "#140d0e", - "circle-stroke-width" : { - "base" : 1.0, - "stops" : [ - [ - 11, - 0.5 - ], - [ - 23, - 5.0 - ] - ] - }, - "circle-radius" : { - "base" : 1.0, - "stops" : [ - [ - 11, - 0.5 - ], - [ - 23, - 10.0 - ] - ] - }, - "circle-color" : "#fcf9fa" - } - } - ], - "version" : 8, - "glyphs" : "https://cdn.jsdelivr.net/gh/klokantech/klokantech-gl-fonts@master/{fontstack}/{range}.pbf" -} \ No newline at end of file