AgeGroup GetAgeGroupFrom(AgePhase agePhase) { switch (agePhase) { case AgePhase.Child: return(AgeGroup.Child); case AgePhase.Teen0: case AgePhase.Teen1: return(AgeGroup.Teen); case AgePhase.Young0: case AgePhase.Young1: case AgePhase.Young2: return(AgeGroup.Young); case AgePhase.Adult0: case AgePhase.Adult1: case AgePhase.Adult2: case AgePhase.Adult3: return(AgeGroup.Adult); case AgePhase.Senior0: case AgePhase.Senior1: case AgePhase.Senior2: case AgePhase.Senior3: return(AgeGroup.Senior); default: return(AgeGroup.Adult); } }
public float GetAverageSpeed(AgePhase agePhase, Gender gender) { var ageRange = GetAgeRangeFrom(GetAgeGroupFrom(agePhase)); return(_data[new AgeRangeAndGender(ageRange, gender)]); }