Skip to content

Feature/cleanup#25

Merged
MartinStenhagen merged 6 commits into
mainfrom
feature/cleanup
Jan 14, 2026
Merged

Feature/cleanup#25
MartinStenhagen merged 6 commits into
mainfrom
feature/cleanup

Conversation

@MartinStenhagen

@MartinStenhagen MartinStenhagen commented Jan 14, 2026

Copy link
Copy Markdown

Summary by CodeRabbit

  • New Features

    • Added ability to cancel an active journey.
  • Refactor

    • Removed unused code and simplified APIs by eliminating redundant getters, setters, and object constructors to improve maintainability.

✏️ Tip: You can customize this high-level summary in your review settings.

…elJourney() i traveler för att förhindra att programmet crashar om en spelare inte har råd med en resa.
…elJourney() i traveler för att förhindra att programmet crashar om en spelare inte har råd med en resa.
…rivate String managedMoneyAsInt(Traveler t), private List<Location> distinctLocationsById(List<Location> locations) som inte används längre i TravelGameController.
…nLink(Location fromLocation, Location toLocation, int distance) i LocationLink, dialogPane i TravelGame, konstruktorn public Transport(TransportType type, String costPerMove) i Transport, getTurnNumber() i Journey, setType i Location, getLocationLink() i TransportLink.
# Conflicts:
#	src/main/java/org/example/TravelGameController.java
@MartinStenhagen
MartinStenhagen merged commit 63290e3 into main Jan 14, 2026
1 of 2 checks passed
@coderabbitai

coderabbitai Bot commented Jan 14, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR removes several public accessors and constructors from domain entity classes (Journey, Location, LocationLink, Transport, TransportLink), deletes the EventResult record entirely, adds a cancelJourney method to Traveler, and removes an unused variable from TravelGame. The changes reduce the public API surface across multiple model classes.

Changes

Cohort / File(s) Summary
Domain Entity API Reduction
src/main/java/org/example/Journey.java, src/main/java/org/example/Location.java, src/main/java/org/example/LocationLink.java, src/main/java/org/example/Transport.java, src/main/java/org/example/TransportLink.java
Removed public getters/setters/constructors: getTurnNumber() from Journey, setType() from Location, two constructors from LocationLink, constructor from Transport, and getLocationLink() from TransportLink. Restricts external access to these entities' internals.
Service Class Removal
src/main/java/org/example/service/EventResult.java
Deleted entire EventResult record class, including its static factory methods penalty() and bonus(). Eliminates a service layer abstraction for event results.
Code Cleanup and Feature Addition
src/main/java/org/example/TravelGame.java, src/main/java/org/example/Traveler.java
Removed unused local variable dialogPane from TravelGame; added new public cancelJourney() method to Traveler that resets journey state.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • PR #22: Adds the org.example.service.EventResult record that this PR removes — direct inverse relationship on the same service class.
  • PR #11: Modifies the same domain classes (Journey, Location, LocationLink, Transport, TransportLink, Traveler) with overlapping changes to constructors and getters.
  • PR #21: Affects Transport-related API and signatures that depend on the constructor removed in this PR.

Poem

🐰 The API shrinks with careful care,
Getters and setters vanish in air,
EventResult bids its fond farewell,
While Traveler learns to break spells—
A cleaner path through the code we share!

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8927941 and f8172e1.

📒 Files selected for processing (8)
  • src/main/java/org/example/Journey.java
  • src/main/java/org/example/Location.java
  • src/main/java/org/example/LocationLink.java
  • src/main/java/org/example/Transport.java
  • src/main/java/org/example/TransportLink.java
  • src/main/java/org/example/TravelGame.java
  • src/main/java/org/example/Traveler.java
  • src/main/java/org/example/service/EventResult.java

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MartinStenhagen
MartinStenhagen deleted the feature/cleanup branch January 14, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant