-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make ScheduledTransitLeg, FlexibleTransitLeg fully immutable #6386
Make ScheduledTransitLeg, FlexibleTransitLeg fully immutable #6386
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #6386 +/- ##
=============================================
+ Coverage 69.72% 69.86% +0.14%
- Complexity 18016 18156 +140
=============================================
Files 2057 2072 +15
Lines 76967 77324 +357
Branches 7844 7851 +7
=============================================
+ Hits 53666 54026 +360
+ Misses 20550 20543 -7
- Partials 2751 2755 +4 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great work. Making these model classes fully immutable makes stuff so much simpler to reason about.
application/src/ext-test/java/org/opentripplanner/ext/flex/FlexibleTransitLegBuilderTest.java
Outdated
Show resolved
Hide resolved
application/src/ext-test/java/org/opentripplanner/ext/flex/FlexibleTransitLegBuilderTest.java
Outdated
Show resolved
Hide resolved
application/src/ext/java/org/opentripplanner/ext/realtimeresolver/RealtimeResolver.java
Outdated
Show resolved
Hide resolved
...cation/src/ext/java/org/opentripplanner/ext/stopconsolidation/model/ConsolidatedStopLeg.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/opentripplanner/model/plan/ScheduledTransitLeg.java
Show resolved
Hide resolved
application/src/main/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilder.java
Outdated
Show resolved
Hide resolved
…xibleTransitLegBuilderTest.java Co-authored-by: Henrik Abrahamsson <[email protected]>
21ab826
to
5bf1072
Compare
I've moved the computation of |
ac5925b
to
bafdc90
Compare
bafdc90
to
9f6b523
Compare
application/src/main/java/org/opentripplanner/model/plan/AlertsAware.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/opentripplanner/model/plan/FareProductAware.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Henrik Abrahamsson <[email protected]>
application/src/main/java/org/opentripplanner/framework/geometry/GeometryUtils.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/opentripplanner/model/plan/LegUtils.java
Outdated
Show resolved
Hide resolved
.../org/opentripplanner/routing/algorithm/filterchain/filters/transit/DecorateTransitAlert.java
Outdated
Show resolved
Hide resolved
application/src/ext-test/java/org/opentripplanner/ext/flex/FlexibleTransitLegBuilderTest.java
Outdated
Show resolved
Hide resolved
application/src/test/java/org/opentripplanner/_support/time/DateTimes.java
Outdated
Show resolved
Hide resolved
aebb441
to
b2ac81f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for fixing the "small things" it makes the code easier to read.
Summary
Right now the ScheduledTransitLeg is mostly immutable apart from a few fields
distanceMeters
due to testingalerts
because they are added laterfareProducts
they are also added laterBecause Aracadis has a few sandbox features that manipulate the legs over the years I had to fix many bugs because of the leg is half immutable and half mutable. I would like to fix all of them at once and therefore I'm making the ScheduledTransitLeg and FlexibleTransitLeg immutable and all fields must now be set via a builder.
There is also the special sandbox leg
ConsolidatedStopLeg
which also required some special handling but it is now also fully immutable and has a builder.Unit tests
Lots of tests added and some re-written.
Documentation
Javadoc.