View raw

1 " 2 I represent an exercise set prescribed for a workout. 3 " 4 Class { 5 #name : 'MFTSetPrescription', 6 #superclass : 'MFTObject', 7 #instVars : [ 8 'exercise', 9 'alternativeExercises', 10 'repScheme' 11 ], 12 #category : 'MyFitnessTracker-Core-Prescription', 13 #package : 'MyFitnessTracker-Core', 14 #tag : 'Prescription' 15 } 16 17 { #category : 'as yet unclassified' } 18 MFTSetPrescription class >> exercise: aMFTExercise [ 19 20 ^ self new 21 exercise: aMFTExercise; 22 yourself 23 ] 24 25 { #category : 'as yet unclassified' } 26 MFTSetPrescription class >> exercise: aMFTExercise alternativeExercises: aMFTExerciseCollection [ 27 28 ^ self new 29 exercise: aMFTExercise; 30 alternativeExercises: aMFTExerciseCollection; 31 yourself 32 ] 33 34 { #category : 'as yet unclassified' } 35 MFTSetPrescription class >> exercise: aMFTExercise repScheme: aMFTRepScheme [ 36 37 ^ self new 38 exercise: aMFTExercise; 39 repScheme: aMFTRepScheme; 40 yourself 41 ] 42 43 { #category : 'comparing' } 44 MFTSetPrescription >> = anObject [ 45 46 self == anObject ifTrue: [ ^ true ]. 47 self class = anObject class ifFalse: [ ^ false ]. 48 ^ repScheme = anObject repScheme and: [ exercise = anObject exercise ] 49 ] 50 51 { #category : 'accessing' } 52 MFTSetPrescription >> alternativeExercises [ 53 54 ^ alternativeExercises 55 ] 56 57 { #category : 'accessing' } 58 MFTSetPrescription >> alternativeExercises: aMFTExerciseCollection [ 59 60 alternativeExercises := aMFTExerciseCollection 61 ] 62 63 { #category : 'initialization' } 64 MFTSetPrescription >> canonicalName [ 65 66 ^ repScheme canonicalName , ' reps ' , exercise canonicalName 67 ] 68 69 { #category : 'accessing' } 70 MFTSetPrescription >> exercise [ 71 72 ^ exercise 73 ] 74 75 { #category : 'as yet unclassified' } 76 MFTSetPrescription >> exercise: aMFTExercise [ 77 78 exercise := aMFTExercise 79 ] 80 81 { #category : 'comparing' } 82 MFTSetPrescription >> hash [ 83 "Answer an integer value that is related to the identity of the receiver." 84 85 ^ repScheme hash bitXor: exercise hash 86 ] 87 88 { #category : 'as yet unclassified' } 89 MFTSetPrescription >> initialize [ 90 91 super initialize. 92 repScheme := MFTRepScheme from: 6 to: 10. 93 alternativeExercises := OrderedCollection new 94 ] 95 96 { #category : 'as yet unclassified' } 97 MFTSetPrescription >> repScheme [ 98 99 ^ repScheme 100 ] 101 102 { #category : 'as yet unclassified' } 103 MFTSetPrescription >> repScheme: aMFTRepScheme [ 104 105 repScheme := aMFTRepScheme 106 ] 107