-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor/#368 : Nutritionist 도메인의 공통된 분석 메서드들 추상화
- Loading branch information
1 parent
ea28395
commit 5a84797
Showing
7 changed files
with
80 additions
and
35 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
BE/exceed/src/main/java/com/gaebaljip/exceed/application/domain/nutritionist/Analyzable.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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
public interface Analyzable { | ||
boolean analyze(); | ||
} |
15 changes: 15 additions & 0 deletions
15
BE/exceed/src/main/java/com/gaebaljip/exceed/application/domain/nutritionist/Analyzer.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
import com.gaebaljip.exceed.application.domain.meal.DailyMeal; | ||
import com.gaebaljip.exceed.application.domain.member.Member; | ||
|
||
public abstract class Analyzer implements Analyzable { | ||
|
||
protected DailyMeal dailyMeal; | ||
protected Member member; | ||
|
||
public Analyzer(DailyMeal dailyMeal, Member member) { | ||
this.dailyMeal = dailyMeal; | ||
this.member = member; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...d/src/main/java/com/gaebaljip/exceed/application/domain/nutritionist/CalorieAnalyzer.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
import com.gaebaljip.exceed.application.domain.meal.DailyMeal; | ||
import com.gaebaljip.exceed.application.domain.member.Member; | ||
|
||
public class CalorieAnalyzer extends Analyzer { | ||
public CalorieAnalyzer(DailyMeal dailyMeal, Member member) { | ||
super(dailyMeal, member); | ||
} | ||
|
||
@Override | ||
public boolean analyze() { | ||
return member.measureTargetCalorie() - dailyMeal.calculateCurrentCalorie() <= 0; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
.../main/java/com/gaebaljip/exceed/application/domain/nutritionist/CarbohydrateAnalyzer.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
import com.gaebaljip.exceed.application.domain.meal.DailyMeal; | ||
import com.gaebaljip.exceed.application.domain.member.Member; | ||
|
||
public class CarbohydrateAnalyzer extends Analyzer { | ||
public CarbohydrateAnalyzer(DailyMeal dailyMeal, Member member) { | ||
super(dailyMeal, member); | ||
} | ||
|
||
@Override | ||
public boolean analyze() { | ||
return member.measureTargetCarbohydrate() - dailyMeal.calculateCurrentCarbohydrate() <= 0; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...xceed/src/main/java/com/gaebaljip/exceed/application/domain/nutritionist/FatAnalyzer.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
import com.gaebaljip.exceed.application.domain.meal.DailyMeal; | ||
import com.gaebaljip.exceed.application.domain.member.Member; | ||
|
||
public class FatAnalyzer extends Analyzer { | ||
public FatAnalyzer(DailyMeal dailyMeal, Member member) { | ||
super(dailyMeal, member); | ||
} | ||
|
||
@Override | ||
public boolean analyze() { | ||
return member.measureTargetFat() - dailyMeal.calculateCurrentFat() <= 0; | ||
} | ||
} |
35 changes: 0 additions & 35 deletions
35
...ceed/src/main/java/com/gaebaljip/exceed/application/domain/nutritionist/Nutritionist.java
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
...d/src/main/java/com/gaebaljip/exceed/application/domain/nutritionist/ProteinAnalyzer.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
import com.gaebaljip.exceed.application.domain.meal.DailyMeal; | ||
import com.gaebaljip.exceed.application.domain.member.Member; | ||
|
||
public class ProteinAnalyzer extends Analyzer { | ||
public ProteinAnalyzer(DailyMeal dailyMeal, Member member) { | ||
super(dailyMeal, member); | ||
} | ||
|
||
@Override | ||
public boolean analyze() { | ||
return member.measureTargetProtein() - dailyMeal.calculateCurrentProtein() <= 0; | ||
} | ||
} |