-
Notifications
You must be signed in to change notification settings - Fork 3
Direction splitter > stops in same direction #11
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
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
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.
Code Review
This pull request introduces a new mechanism to identify if two lists of stops share items in the same order, which is then used in the direction splitting logic. The core logic in countItemsGoingIntoSameOrder has some critical performance issues due to inefficient list manipulation, and could be improved for readability. The new tests are good but contain some debug statements and code duplication that should be addressed. I've provided suggestions to refactor the new function for performance and to clean up the tests.
This comment was marked as outdated.
This comment was marked as outdated.
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.
Code Review
This pull request introduces new collection extension functions, hasItemsGoingIntoSameOrder and countItemsGoingIntoSameOrder, to identify sequences of items that appear in the same order across two collections. This new logic is then integrated into MDirectionSplitter to improve direction detection. The implementation is functionally sound and the accompanying tests provide good coverage. My review includes suggestions to enhance the readability and structure of the new functions, and to clean up the test code.
|
/gemini review |
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.
Code Review
This pull request introduces a new way to match trip directions by looking for common sequences of stops. The core logic is in the new countItemsGoingIntoSameOrder function.
My review found a critical issue in this new function where its result can be non-deterministic due to iterating over an unordered Set. I've provided a corrected implementation. I also have a suggestion to reduce code duplication in the new tests.
Overall, the approach is a good addition to the direction splitting logic, but the implementation needs to be corrected to ensure reliable behavior.
|
/gemini review |
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.
Code Review
This pull request introduces a new mechanism for matching trip directions by finding common sequences of stops. The implementation adds new extension functions to CollectionsExt.kt along with corresponding tests. The new logic is then integrated into MDirectionSplitter.kt. The changes are logical and well-tested. I've provided a few suggestions to improve code encapsulation, performance, and test maintainability.
A simple most reliable way to match direction between trips is too look for stops in the same direction (stop1->stop2->...->stopN) in both trips.