View raw

1 " 2 I represent an equipment that can be used for a MFTExercise. 3 " 4 Class { 5 #name : 'MFTEquipment', 6 #superclass : 'MFTObject', 7 #instVars : [ 8 'englishName' 9 ], 10 #category : 'MyFitnessTracker-Core-Base', 11 #package : 'MyFitnessTracker-Core', 12 #tag : 'Base' 13 } 14 15 { #category : 'freeweights' } 16 MFTEquipment class >> barbell [ 17 18 ^ self newWithEnglishName 19 ] 20 21 { #category : 'machines' } 22 MFTEquipment class >> cable [ 23 24 ^ self newWithEnglishName 25 ] 26 27 { #category : 'freeweights' } 28 MFTEquipment class >> dumbbell [ 29 30 ^ self newWithEnglishName 31 ] 32 33 { #category : 'freeweights' } 34 MFTEquipment class >> ezBar [ 35 36 ^ self new 37 englishName: 'EZ bar'; 38 yourself 39 ] 40 41 { #category : 'machines' } 42 MFTEquipment class >> legExtensionMachine [ 43 44 ^ self newWithEnglishName 45 ] 46 47 { #category : 'machines' } 48 MFTEquipment class >> legPressMachine [ 49 50 ^ self newWithEnglishName 51 ] 52 53 { #category : 'as yet unclassified' } 54 MFTEquipment class >> newWithEnglishName [ 55 "I return a MFTEquipment instance for which englishName is set to the calling method selector, as a space-separated string." 56 57 | equipmentNameFromSender | 58 equipmentNameFromSender := (thisContext sender selector 59 splitCamelCase collect: #asLowercase) 60 joinUsing: Character space. 61 ^ self new englishName: equipmentNameFromSender 62 ] 63 64 { #category : 'machines' } 65 MFTEquipment class >> pecDeck [ 66 67 ^ self newWithEnglishName 68 ] 69 70 { #category : 'machines' } 71 MFTEquipment class >> seatedLegCurlMachine [ 72 73 ^ self newWithEnglishName 74 ] 75 76 { #category : 'comparing' } 77 MFTEquipment >> = anObject [ 78 "Answer whether the receiver and anObject represent the same object." 79 80 self == anObject ifTrue: [ ^ true ]. 81 self class = anObject class ifFalse: [ ^ false ]. 82 ^ englishName = anObject canonicalName 83 ] 84 85 { #category : 'initialization' } 86 MFTEquipment >> canonicalName [ 87 88 ^ englishName 89 ] 90 91 { #category : 'accessing' } 92 MFTEquipment >> englishName [ 93 94 ^ englishName 95 ] 96 97 { #category : 'accessing' } 98 MFTEquipment >> englishName: aString [ 99 100 englishName := aString 101 ] 102 103 { #category : 'comparing' } 104 MFTEquipment >> hash [ 105 "Answer an integer value that is related to the identity of the receiver." 106 107 ^ englishName hash 108 ] 109