-
Notifications
You must be signed in to change notification settings - Fork 7
Refactor ThermalGrid.handleFeedIn #1555
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
base: dev
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR refactors the ThermalGrid.handleFeedIn
method by extracting complex conditional logic into separate, reusable components using the Strategy pattern.
- Introduced
ThermalDemandConditions
to encapsulate thermal demand state evaluation - Created
FeedInStrategy
pattern with concrete strategies for different heating scenarios - Replaced inline conditional logic with structured strategy selection
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
ThermalStrategyPatterns.scala | Defines FeedInStrategy interface and three concrete strategy implementations |
ThermalGrid.scala | Refactors handleFeedIn method to use strategy pattern and demand conditions |
ThermalDemandConditions.scala | Encapsulates thermal demand state evaluation logic |
CHANGELOG.md | Documents the refactoring changes |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/main/scala/edu/ie3/simona/model/thermal/ThermalDemandConditions.scala
Outdated
Show resolved
Hide resolved
src/main/scala/edu/ie3/simona/model/thermal/ThermalDemandConditions.scala
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
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.
I have some small remarks.
src/main/scala/edu/ie3/simona/model/thermal/ThermalDemandConditions.scala
Outdated
Show resolved
Hide resolved
src/main/scala/edu/ie3/simona/model/thermal/ThermalDemandConditions.scala
Outdated
Show resolved
Hide resolved
private case class ThermalDemandConditions( | ||
shouldContinueHouseHeating: Boolean, | ||
houseDemand: Boolean, | ||
heatStorageDemand: Boolean, | ||
housePossible: Boolean, | ||
heatStoragePossible: Boolean, | ||
houseHeatedLastState: Boolean, | ||
) |
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.
Maybe you could add some scaladoc here.
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.
No, it's private case class and I guess this should be quite clear as it is. Isn't it?
No description provided.