View raw

1 " 2 I am a rep range used when prescribing workout sets. 3 " 4 Class { 5 #name : 'MFTRepScheme', 6 #superclass : 'MFTObject', 7 #instVars : [ 8 'minReps', 9 'maxReps' 10 ], 11 #category : 'MyFitnessTracker-Core-Prescription', 12 #package : 'MyFitnessTracker-Core', 13 #tag : 'Prescription' 14 } 15 16 { #category : 'instance creation' } 17 MFTRepScheme class >> from: min to: max [ 18 19 ^ self new 20 minReps: min; 21 maxReps: max; 22 yourself 23 ] 24 25 { #category : 'comparing' } 26 MFTRepScheme >> = anObject [ 27 "Answer whether the receiver and anObject represent the same object." 28 29 self == anObject ifTrue: [ ^ true ]. 30 self class = anObject class ifFalse: [ ^ false ]. 31 ^ minReps = anObject minReps and: [ maxReps = anObject maxReps ] 32 ] 33 34 { #category : 'initialization' } 35 MFTRepScheme >> canonicalName [ 36 37 ^ minReps asString , '–' , maxReps asString 38 ] 39 40 { #category : 'comparing' } 41 MFTRepScheme >> hash [ 42 "Answer an integer value that is related to the identity of the receiver." 43 44 ^ minReps hash bitXor: maxReps hash 45 ] 46 47 { #category : 'testing' } 48 MFTRepScheme >> includes: repsAchieved [ 49 50 ^ repsAchieved between: minReps and: maxReps 51 ] 52 53 { #category : 'accessing' } 54 MFTRepScheme >> maxReps [ 55 56 ^ maxReps 57 ] 58 59 { #category : 'accessing' } 60 MFTRepScheme >> maxReps: anInteger [ 61 62 maxReps := anInteger 63 ] 64 65 { #category : 'accessing' } 66 MFTRepScheme >> minReps [ 67 68 ^ minReps 69 ] 70 71 { #category : 'accessing' } 72 MFTRepScheme >> minReps: anInteger [ 73 74 minReps := anInteger 75 ] 76 77 { #category : 'testing' } 78 MFTRepScheme >> progressionFor: repsAchieved [ 79 80 repsAchieved > maxReps ifTrue: [ ^ #increaseLoad ]. 81 repsAchieved < minReps ifTrue: [ ^ #decreaseLoad ]. 82 ^ #keepLoad 83 ] 84