Beispiel #1
0
  /**
   * @param rdvList
   * @return RecDailyValue Contains all of the totaled values for the group of people the user has
   *     set
   */
  public static RecDailyValues getTotalRDVOf(List<RecDailyValues> rdvList) {

    RecDailyValues total = new RecDailyValues();

    for (int i = 0; i < rdvList.size(); i++) {
      // create a temporary RDV object
      RecDailyValues temp = rdvList.get(i);

      // set all of the properties based on the current and the sum of the
      total.setCalories(total.getCalories() + temp.getCalories());
      total.setProtein((total.getProtein() + temp.getProtein()));
      total.setFat((total.getFat() + temp.getFat()));
      total.setCarbohydrate((total.getCarbohydrate() + temp.getCarbohydrate()));
      total.setFiber((total.getFiber() + temp.getFiber()));
      total.setSugar((total.getSugar() + temp.getSugar()));
      total.setCalcium((total.getCalcium() + temp.getCalcium()));
      total.setIron((total.getIron() + temp.getIron()));
      total.setMagnesium((total.getMagnesium() + temp.getMagnesium()));
      total.setPotassium((total.getPotassium() + temp.getPotassium()));
      total.setSodium((total.getSodium() + temp.getSodium()));
      total.setZinc((total.getZinc() + temp.getZinc()));
      total.setVitC((total.getVitC() + temp.getVitC()));
      total.setVitB6((total.getVitB6() + temp.getVitB6()));
      total.setVitB12((total.getVitB12() + temp.getVitB12()));
      total.setVitA((total.getVitA() + temp.getVitA()));
      total.setVitE((total.getVitE() + temp.getVitE()));
      total.setVitD((total.getVitD() + temp.getVitD()));
      total.setVitK((total.getVitK() + temp.getVitK()));
      total.setFatSat((total.getFatSat() + temp.getFatSat()));
      total.setFatPoly((total.getFatPoly() + temp.getFatPoly()));
      total.setCholesterol((total.getCholesterol() + temp.getCholesterol()));
    }

    return total;
  }