-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from MERINGIT/Refactoring
for conditional polymorphism and move method
- Loading branch information
Showing
7 changed files
with
51 additions
and
84 deletions.
There are no files selected for viewing
4 changes: 3 additions & 1 deletion
4
src/main/java/com/example/slabiak/appointmentscheduler/model/AdjusterAfterEnd.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 7 additions & 2 deletions
9
src/main/java/com/example/slabiak/appointmentscheduler/model/AdjusterBeforeStart.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
package com.example.slabiak.appointmentscheduler.model; | ||
|
||
|
||
import java.time.LocalDateTime; | ||
|
||
class AdjusterBeforeStart implements TimePeriodAdjuster { | ||
|
||
|
||
@Override | ||
public TimePeriod adjust(TimePeriod original, TimePeroid breakPeriod) { | ||
public TimePeroid adjust(TimePeroid original, TimePeroid breakPeriod) { | ||
if (breakPeriod.getStart().isBefore(original.getStart())) { | ||
original.setStart(breakPeriod.getStart()); | ||
original.setStart((breakPeriod.getStart())); | ||
} | ||
return original; | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 0 additions & 37 deletions
37
src/main/java/com/example/slabiak/appointmentscheduler/model/TimePeriod.java
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
src/main/java/com/example/slabiak/appointmentscheduler/model/TimePeriodAdjuster.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package com.example.slabiak.appointmentscheduler.model; | ||
|
||
public interface TimePeriodAdjuster { | ||
TimePeriod adjust(TimePeriod original, TimePeroid breakPeriod); | ||
TimePeroid adjust(TimePeroid original, TimePeroid breakPeriod); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters