Class CalorieConversionUtilities


  • @RequiresApi(api=26)
    public class CalorieConversionUtilities
    extends java.lang.Object
    Calorie conversion utilities, to calculate and convert our calorie related stuff.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int getBasalMetabolicRate​(User user)
      Mifflin-St Jeor Equation: https://en.wikipedia.org/wiki/Basal_metabolic_rate For men: BMR = 10xWeight + 6.25xHeight - 5xAge + 5 For women: BMR = 10xWeight + 6.25xHeight - 5xAge - 161
      static int getCalories​(User user, java.lang.String sportType, java.time.ZonedDateTime startDate, java.time.ZonedDateTime endDate)
      1 MET = 1 kcal/kg x h = 4.184 kJ/kg x h = 1.162 W/kg https://en.wikipedia.org/wiki/Metabolic_equivalent_of_task CALORIES: (Time(in minutes) x MET x Body Weight) / 200
      static int getCaloriesWithHeartRate​(User user, int avgHeartRate, java.time.ZonedDateTime startDate, java.time.ZonedDateTime endDate)
      Calorie calculation with Heart rate VO2MAX is more accurate, uses generic form if user has not set resting heart rate.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CalorieConversionUtilities

        public CalorieConversionUtilities()
    • Method Detail

      • getBasalMetabolicRate

        public static int getBasalMetabolicRate​(@NonNull
                                                User user)
        Mifflin-St Jeor Equation: https://en.wikipedia.org/wiki/Basal_metabolic_rate For men: BMR = 10xWeight + 6.25xHeight - 5xAge + 5 For women: BMR = 10xWeight + 6.25xHeight - 5xAge - 161
        Parameters:
        user -
        Returns:
        BMR as int
      • getCalories

        public static int getCalories​(@NonNull
                                      User user,
                                      java.lang.String sportType,
                                      java.time.ZonedDateTime startDate,
                                      java.time.ZonedDateTime endDate)
        1 MET = 1 kcal/kg x h = 4.184 kJ/kg x h = 1.162 W/kg https://en.wikipedia.org/wiki/Metabolic_equivalent_of_task CALORIES: (Time(in minutes) x MET x Body Weight) / 200
        Parameters:
        user - User data
        sportType - Sport Data
        startDate - StartDate to calculate duration
        endDate - EndDate to calculate duration
        Returns:
        Estimated calories burned as integer value
      • getCaloriesWithHeartRate

        public static int getCaloriesWithHeartRate​(@NonNull
                                                   User user,
                                                   int avgHeartRate,
                                                   java.time.ZonedDateTime startDate,
                                                   java.time.ZonedDateTime endDate)
        Calorie calculation with Heart rate VO2MAX is more accurate, uses generic form if user has not set resting heart rate. VO2MAX equations: https://www.researchgate.net/publication/7777759_Prediction_of_energy_expenditure_from_heart_rate_monitoring_during_submaximal_exercise
        Parameters:
        user - Current user (for gender, weight and age)
        avgHeartRate - User set value for average heart rate in the exercise
        startDate - Start date to calculate time duration
        endDate - End date to calculate time duration
        Returns:
        Estimated calories burned as integer value