Decouple workout and set group DSL.

Commit
a39f07cbd60d9ca2a0c951c4099adeaebd7b2e18
Author
Marius Peter <dev@marius-peter.com>
Author date
Committer
Marius Peter <dev@marius-peter.com>
Committer date
Changed files
src/MyFitnessTracker-Core-Tests/MFTWorkoutPrescriptionTest.class.st
index 34fcf3f4..d76d3e78 100644..100644
@@ -107,7 +107,7 @@
107 107 | workout set group groups |
108 108 workout := MFTWorkoutPrescription new.
109 109 set := self newSetPrescription.
110 Removed: group := MFTStraightSetGroupPrescription withSet: set.
110 Added: group := MFTStraightSetGroupPrescription with: set.
111 111 groups := OrderedCollection with: group.
112 112
113 113 workout setGroups: groups.
src/MyFitnessTracker-Core/MFTPreExhaustSupersetGroupPrescription.class.st
index 4db584f3..3ac684f0 100644..100644
@@ -9,6 +9,16 @@
9 9 #tag : 'Prescription'
10 10 }
11 11
12 Added: { #category : 'instance creation' }
13 Added: MFTPreExhaustSupersetGroupPrescription class >> with: firstSet with: secondSet [
14 Added:
15 Added: ^ self new
16 Added: sets: (OrderedCollection withAll: {
17 Added: firstSet.
18 Added: secondSet });
19 Added: yourself
20 Added: ]
21 Added:
12 22 { #category : 'initialization' }
13 23 MFTPreExhaustSupersetGroupPrescription >> canonicalName [
14 24
src/MyFitnessTracker-Core/MFTStraightSetGroupPrescription.class.st
index f0f0082e..5f761e87 100644..100644
@@ -10,7 +10,7 @@
10 10 }
11 11
12 12 { #category : 'as yet unclassified' }
13 Removed: MFTStraightSetGroupPrescription class >> withSet: aMFTSetPrescription [
13 Added: MFTStraightSetGroupPrescription class >> with: aMFTSetPrescription [
14 14
15 15 ^ self new
16 16 sets: (OrderedCollection with: aMFTSetPrescription);
@@ -28,8 +28,5 @@
28 28 MFTStraightSetGroupPrescription >> validate [
29 29
30 30 sets size = 1 ifFalse: [
31 Removed: self error: 'Straight group must have exactly 1 set.' ].
32 Removed: (sets allSatisfy: [ :each | each isKindOf: MFTSetPrescription ])
33 Removed: ifFalse: [
34 Removed: self error: 'All sets are not MFTSetPrescription subclasses.' ]
31 Added: self error: 'Straight group must have exactly 1 set.' ]
35 32 ]
src/MyFitnessTracker-Core/MFTSupersetGroupPrescription.class.st
index f3f8c52f..9d15f141 100644..100644
@@ -9,6 +9,16 @@
9 9 #tag : 'Prescription'
10 10 }
11 11
12 Added: { #category : 'instance creation' }
13 Added: MFTSupersetGroupPrescription class >> with: firstSet with: secondSet [
14 Added:
15 Added: ^ self new
16 Added: sets: (OrderedCollection withAll: {
17 Added: firstSet.
18 Added: secondSet });
19 Added: yourself
20 Added: ]
21 Added:
12 22 { #category : 'initialization' }
13 23 MFTSupersetGroupPrescription >> canonicalName [
14 24
src/MyFitnessTracker-Core/MFTWorkoutPrescription.class.st
index b3c85589..0afc75ae 100644..100644
@@ -18,22 +18,22 @@
18 18
19 19 ^ self new
20 20 title: 'Day 1';
21 Removed: prescribePreExhaustSuperset: {
22 Removed: (MFTSetPrescription
23 Removed: exercise: MFTExercise dumbbellFly
24 Removed: alternativeExercises: {
25 Removed: MFTExercise cableCross.
26 Removed: MFTExercise pecDeck }).
27 Removed: (MFTSetPrescription exercise: MFTExercise inclinePress) };
28 Removed: prescribeStraightSet:
29 Removed: (MFTSetPrescription exercise: MFTExercise lateralRaise);
30 Removed: prescribeStraightSet:
31 Removed: (MFTSetPrescription exercise: MFTExercise rearDeltFly);
32 Removed: prescribeSuperset: {
33 Removed: (MFTSetPrescription
34 Removed: exercise: MFTExercise lyingFrenchPress
35 Removed: alternativeExercises: { MFTExercise tricepPressdown }).
36 Removed: (MFTSetPrescription exercise: MFTExercise dip) }
21 Added: prescribe: (MFTPreExhaustSupersetGroupPrescription
22 Added: with: (MFTSetPrescription
23 Added: exercise: MFTExercise dumbbellFly
24 Added: alternativeExercises: {
25 Added: MFTExercise cableCross.
26 Added: MFTExercise pecDeck })
27 Added: with: (MFTSetPrescription exercise: MFTExercise inclinePress));
28 Added: prescribe: (MFTStraightSetGroupPrescription with:
29 Added: (MFTSetPrescription exercise: MFTExercise lateralRaise));
30 Added: prescribe: (MFTStraightSetGroupPrescription with:
31 Added: (MFTSetPrescription exercise: MFTExercise rearDeltFly));
32 Added: prescribe: (MFTSupersetGroupPrescription
33 Added: with: (MFTSetPrescription
34 Added: exercise: MFTExercise lyingFrenchPress
35 Added: alternativeExercises: { MFTExercise tricepPressdown })
36 Added: with: (MFTSetPrescription exercise: MFTExercise dip))
37 37 ]
38 38
39 39 { #category : 'as yet unclassified' }
@@ -41,18 +41,19 @@
41 41
42 42 ^ self new
43 43 title: 'Day 2';
44 Removed: prescribeSuperset: {
45 Removed: (MFTSetPrescription exercise: MFTExercise latPullover).
46 Removed: (MFTSetPrescription exercise:
47 Removed: MFTExercise closeGripPalmsUpPulldown) };
48 Removed: prescribeStraightSet:
49 Removed: (MFTSetPrescription exercise: MFTExercise bentOverBarbellRows);
50 Removed: prescribeStraightSet:
51 Removed: (MFTSetPrescription exercise: MFTExercise shrug);
52 Removed: prescribeStraightSet:
53 Removed: (MFTSetPrescription exercise: MFTExercise hyperextension);
54 Removed: prescribeStraightSet:
55 Removed: (MFTSetPrescription exercise: MFTExercise bicepCurl)
44 Added: prescribe: (MFTSupersetGroupPrescription
45 Added: with: (MFTSetPrescription exercise: MFTExercise latPullover)
46 Added: with:
47 Added: (MFTSetPrescription exercise:
48 Added: MFTExercise closeGripPalmsUpPulldown));
49 Added: prescribe: (MFTStraightSetGroupPrescription with:
50 Added: (MFTSetPrescription exercise: MFTExercise bentOverBarbellRows));
51 Added: prescribe: (MFTStraightSetGroupPrescription with:
52 Added: (MFTSetPrescription exercise: MFTExercise shrug));
53 Added: prescribe: (MFTStraightSetGroupPrescription with:
54 Added: (MFTSetPrescription exercise: MFTExercise hyperextension));
55 Added: prescribe: (MFTStraightSetGroupPrescription with:
56 Added: (MFTSetPrescription exercise: MFTExercise bicepCurl))
56 57 ]
57 58
58 59 { #category : 'as yet unclassified' }
@@ -60,19 +61,31 @@
60 61
61 62 ^ self new
62 63 title: 'Day 3';
63 Removed: prescribeSuperset: {
64 Removed: (MFTSetPrescription exercise: MFTExercise legExtension).
65 Removed: (MFTSetPrescription
66 Removed: exercise: MFTExercise barbellSquat
67 Removed: alternativeExercises: { MFTExercise legPress }) };
68 Removed: prescribeStraightSet:
69 Removed: (MFTSetPrescription exercise: MFTExercise seatedLegCurl);
70 Removed: prescribeStraightSet:
71 Removed: (MFTSetPrescription exercise: MFTExercise calfRaise);
72 Removed: prescribeStraightSet:
73 Removed: (MFTSetPrescription exercise: MFTExercise sitUp)
64 Added: prescribe: (MFTSupersetGroupPrescription
65 Added: with: (MFTSetPrescription exercise: MFTExercise legExtension)
66 Added: with: (MFTSetPrescription
67 Added: exercise: MFTExercise barbellSquat
68 Added: alternativeExercises: { MFTExercise legPress }));
69 Added: prescribe: (MFTStraightSetGroupPrescription with:
70 Added: (MFTSetPrescription exercise: MFTExercise seatedLegCurl));
71 Added: prescribe: (MFTStraightSetGroupPrescription with:
72 Added: (MFTSetPrescription exercise: MFTExercise calfRaise));
73 Added: prescribe: (MFTStraightSetGroupPrescription with:
74 Added: (MFTSetPrescription exercise: MFTExercise sitUp))
74 75 ]
75 76
77 Added: { #category : 'as yet unclassified' }
78 Added: MFTWorkoutPrescription class >> heavyDutyTwoDay1 [
79 Added:
80 Added: ^ self new
81 Added: title: 'Day 1';
82 Added: prescribe: (MFTStraightSetGroupPrescription with:
83 Added: (MFTSetPrescription exercise: MFTExercise barbellSquat));
84 Added: prescribe: (MFTStraightSetGroupPrescription with:
85 Added: (MFTSetPrescription exercise:
86 Added: MFTExercise closeGripPalmsUpPulldown))
87 Added: ]
88 Added:
76 89 { #category : 'initialization' }
77 90 MFTWorkoutPrescription >> canonicalName [
78 91
@@ -87,25 +100,9 @@
87 100 ]
88 101
89 102 { #category : 'as yet unclassified' }
90 Removed: MFTWorkoutPrescription >> prescribePreExhaustSuperset: aMFTSetPrescriptionCollection [
103 Added: MFTWorkoutPrescription >> prescribe: aMFTSetGroupPrescription [
91 104
92 Removed: setGroups addLast: (MFTPreExhaustSupersetGroupPrescription withSets:
93 Removed: aMFTSetPrescriptionCollection)
94 Removed: ]
95 Removed:
96 Removed: { #category : 'as yet unclassified' }
97 Removed: MFTWorkoutPrescription >> prescribeStraightSet: aMFTSetPrescription [
98 Removed:
99 Removed: setGroups addLast:
100 Removed: (MFTStraightSetGroupPrescription withSet: aMFTSetPrescription)
101 Removed: ]
102 Removed:
103 Removed: { #category : 'as yet unclassified' }
104 Removed: MFTWorkoutPrescription >> prescribeSuperset: aMFTSetPrescriptionCollection [
105 Removed:
106 Removed: setGroups addLast:
107 Removed: (MFTSupersetGroupPrescription withSets:
108 Removed: aMFTSetPrescriptionCollection)
105 Added: setGroups addLast: aMFTSetGroupPrescription
109 106 ]
110 107
111 108 { #category : 'initialization' }