Skip to content

Commit d62b8f8

Browse files
authored
Merge pull request #6 from ncryptedV1/dev
Dev to main
2 parents de82653 + 0f34416 commit d62b8f8

32 files changed

+1843
-9
lines changed

README.md

Lines changed: 1119 additions & 6 deletions
Large diffs are not rendered by default.

docs/res/cov.png

330 KB
Loading

src/main/java/de/cunc/autochef/domain/aggregate/MealPlan.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@ public class MealPlan {
1818
private LocalDate end;
1919

2020
public MealPlan(List<Meal> meals, LocalDate start, LocalDate end) {
21-
int days = start.until(end).getDays();
21+
this.start = start;
22+
this.end = end;
23+
24+
int days = getDays();
2225
if (meals.size() != days) {
2326
throw new IllegalArgumentException(
2427
"Mahlzeiten-Plan spannt " + days + " Tage, es wurden allerdings nur " + meals.size()
2528
+ " Mahlzeiten übergeben");
2629
}
2730

2831
this.meals = meals;
29-
this.start = start;
30-
this.end = end;
3132
}
3233

3334
public List<Meal> getMeals() {

uml/aggregate.iuml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@startuml
2+
3+
left to right direction
4+
5+
'class MealPlan {
6+
' - meals: List<Meal>
7+
' - start: LocalDate
8+
' - end: LocalDate
9+
' + getMeals(): List<Meal>
10+
' + getStart(): LocalDate
11+
' + getEnd(): LocalDate
12+
' + getDays(): int
13+
' + getGroceryList(): GroceryList
14+
'}
15+
16+
class Meal {
17+
- recipe: Recipe
18+
- adjustedNumberOfPeople: int
19+
+ Meal(recipe: Recipe, adjustedNumberOfPeople: int)
20+
+ getRecipe(): Recipe
21+
+ setRecipe(recipe: Recipe): void
22+
+ getAdjustedNumberOfPeople(): int
23+
+ getGroceryList(): GroceryList
24+
}
25+
26+
'class GroceryList {
27+
' - items: List<GroceryItem>
28+
' + addItem(GroceryItem entry): void
29+
' + getItems(): List<GroceryItem>
30+
'}
31+
'
32+
'MealPlan <- GroceryList
33+
'MealPlan <- Meal
34+
'Meal <- GroceryList
35+
36+
@enduml

uml/cohesion.iuml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@startuml
2+
class Recipe {
3+
- name: String
4+
- groceryList: GroceryList
5+
- recipeSteps: List<RecipeStep>
6+
+ Recipe(name: String, groceryList: GroceryList, recipeSteps: List<RecipeStep>)
7+
+ Recipe(name: String, groceryList: GroceryList, recipeSteps: RecipeStep...)
8+
+ getName(): String
9+
+ getRecipeSteps(): List<RecipeStep>
10+
+ getGroceryList(): GroceryList
11+
+ getId(): String
12+
+ toString(): String
13+
+ equals(Object o): boolean
14+
+ hashCode(): int
15+
}
16+
17+
class GroceryList {
18+
// fields and methods
19+
}
20+
21+
class RecipeStep {
22+
// fields and methods
23+
}
24+
25+
Recipe "1" --> "1" GroceryList
26+
Recipe "0..*" --> "1" RecipeStep
27+
@enduml

uml/coupling-neg-better.iuml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
@startuml
2+
3+
left to right direction
4+
5+
class ChefkochRecipeFetcher {
6+
+getRecipe(url: String): Recipe
7+
-extractRecipeName(content: String): String
8+
-extractIngredients(content: String): GroceryList
9+
-extractRecipeSteps(content: String): List<RecipeStep>
10+
}
11+
12+
interface WebsiteFetcher {
13+
+getWebsiteBody(urlString: String): String
14+
}
15+
16+
class BufferedWebsiteFetcher {
17+
+getWebsiteBody(urlString: String): String
18+
}
19+
20+
class Recipe {
21+
// fields and methods
22+
}
23+
24+
class GroceryList {
25+
// fields and methods
26+
}
27+
28+
class RecipeStep {
29+
// fields and methods
30+
}
31+
32+
WebsiteFetcher <-- ChefkochRecipeFetcher
33+
WebsiteFetcher <|.. BufferedWebsiteFetcher
34+
Recipe <-- ChefkochRecipeFetcher
35+
GroceryList <-- ChefkochRecipeFetcher
36+
RecipeStep <-- ChefkochRecipeFetcher
37+
38+
@enduml

uml/coupling-neg.iuml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@startuml
2+
3+
left to right direction
4+
5+
class ChefkochRecipeFetcher {
6+
+getRecipe(url: String): Recipe
7+
-extractRecipeName(content: String): String
8+
-extractIngredients(content: String): GroceryList
9+
-extractRecipeSteps(content: String): List<RecipeStep>
10+
}
11+
12+
class WebsiteFetcher {
13+
+getWebsiteBody(urlString: String): String
14+
}
15+
16+
class Recipe {
17+
// fields and methods
18+
}
19+
20+
class GroceryList {
21+
// fields and methods
22+
}
23+
24+
class RecipeStep {
25+
// fields and methods
26+
}
27+
28+
WebsiteFetcher <-- ChefkochRecipeFetcher
29+
Recipe <-- ChefkochRecipeFetcher
30+
GroceryList <-- ChefkochRecipeFetcher
31+
RecipeStep <-- ChefkochRecipeFetcher
32+
33+
@enduml

uml/coupling-pos-1.iuml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
@startuml
2+
3+
interface InputReader {
4+
+readLine(): String
5+
}
6+
7+
interface OutputService {
8+
+info(msg: String): void
9+
+warning(msg: String): void
10+
+severe(msg: String): void
11+
+rawOut(msg: Object): void
12+
+rawErr(msg: Object): void
13+
}
14+
15+
interface InputParser {
16+
+getInteger(lowerBound: Integer, upperBound: Integer, question: String): Integer
17+
+getDate(after: LocalDate, before: LocalDate, question: String): LocalDate
18+
+getString(validator: Function<String, String>, question: String): String
19+
}
20+
21+
class DialogInputParser {
22+
-inputReader: InputReader
23+
-outputService: OutputService
24+
+DialogInputParser(inputReader: InputReader, outputService: OutputService)
25+
+getInputWithType(transformFunction: Function<String, T>, question: String): T
26+
}
27+
28+
InputParser <|.. DialogInputParser
29+
DialogInputParser --> InputReader
30+
DialogInputParser --> OutputService
31+
32+
@enduml

uml/coupling-pos-2.iuml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@startuml
2+
3+
class Recipe {
4+
// fields and methods
5+
}
6+
7+
class RecipeFileRepository {
8+
-recipesFolder: File
9+
+RecipeFileRepository(recipesFolder: File)
10+
+saveRecipe(recipe: Recipe): void
11+
+deleteRecipe(recipe: Recipe): boolean
12+
+getRecipes(): List<Recipe>
13+
+getRecipe(id: String): Recipe
14+
}
15+
16+
interface RecipeRepository {
17+
+saveRecipe(recipe: Recipe): void
18+
+deleteRecipe(recipe: Recipe): boolean
19+
+getRecipes(): List<Recipe>
20+
+getRecipe(id: String): Recipe
21+
}
22+
23+
RecipeFileRepository ..|> RecipeRepository
24+
RecipeRepository -> Recipe
25+
26+
@enduml

uml/dependency-inversion-neg.iuml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@startuml
2+
3+
left to right direction
4+
5+
package "Infrastructure" {
6+
class WebsiteFetcher {
7+
+ getWebsiteBody(urlString: String)
8+
}
9+
10+
package "Application" {
11+
class ChefkochRecipeFetcher {
12+
+ getRecipe(url: String)
13+
- extractRecipeName(content: String)
14+
- extractIngredients(content: String)
15+
- extractRecipeSteps(content: String)
16+
}
17+
18+
package "Domain" {
19+
}
20+
}
21+
}
22+
23+
ChefkochRecipeFetcher -> WebsiteFetcher
24+
25+
@enduml

0 commit comments

Comments
 (0)