" I represent a user of MFT. " Class { #name : 'MFTTrainee', #superclass : 'MFTObject', #instVars : [ 'currentRoutine', 'routines', 'logBook', 'workoutPrescriptions' ], #category : 'MyFitnessTracker-Core-Base', #package : 'MyFitnessTracker-Core', #tag : 'Base' } { #category : 'as yet unclassified' } MFTTrainee class >> newDefault [ ^ self new currentRoutine: MFTRoutine heavyDutyOneIdealRoutine; yourself ] { #category : 'accessing' } MFTTrainee >> addRoutine: aMFTRoutine [ routines addLast: aMFTRoutine ] { #category : 'accessing' } MFTTrainee >> addWorkoutPrescription: aMFTWorkoutPrescription [ workoutPrescriptions addLast: aMFTWorkoutPrescription ] { #category : 'initialization' } MFTTrainee >> canonicalName [ ^ 'trainee' ] { #category : 'accessing' } MFTTrainee >> currentRoutine [ ^ currentRoutine ] { #category : 'accessing' } MFTTrainee >> currentRoutine: aMFTRoutine [ currentRoutine := aMFTRoutine ] { #category : 'initialization' } MFTTrainee >> initialize [ super initialize. currentRoutine := MFTRoutine new. logBook := MFTWorkoutLogBook new. routines := OrderedCollection new. workoutPrescriptions := OrderedCollection new ] { #category : 'testing' } MFTTrainee >> isRecovered [ ^ logBook durationSinceLastWorkout ifNotNil: [ :duration | duration > 2 days ] ifNil: [ true ] ] { #category : 'accessing' } MFTTrainee >> logBook [ ^ logBook ] { #category : 'accessing' } MFTTrainee >> logBook: aMFTWorkoutLogBook [ logBook := aMFTWorkoutLogBook ] { #category : 'adding' } MFTTrainee >> logWorkout: aMFTWorkoutLog [ logBook logWorkout: aMFTWorkoutLog ] { #category : 'testing' } MFTTrainee >> nextWorkoutPrescription [ currentRoutine workouts ifEmpty: [ ^ nil ]. logBook workoutLogs ifEmpty: [ ^ currentRoutine workouts first ]. ^ currentRoutine workoutAfter: logBook workoutLogs last prescription ] { #category : 'accessing' } MFTTrainee >> routines [ ^ routines ] { #category : 'accessing' } MFTTrainee >> routines: aMFTRoutineCollection [ routines := aMFTRoutineCollection ] { #category : 'accessing' } MFTTrainee >> workoutPrescriptions [ ^ workoutPrescriptions ] { #category : 'accessing' } MFTTrainee >> workoutPrescriptions: aMFTWorkoutPrescriptionCollection [ workoutPrescriptions := aMFTWorkoutPrescriptionCollection asOrderedCollection ]