/** * Get the mandatory supplements from the property group and create a map that contains the daily * consumption rate for both the supplements and the meals for a given range. * * @param policy the feeding policy * @return Vector of ObjectScheduleElements */ private Vector createMealAndSupplementSchedule(FeedingPolicy policy) { Vector sched_els = new Vector(); if (policy != null) { RangeRuleParameterEntry[] mealRanges = policy.getMealPolicyRanges(); ObjectScheduleElement element; for (int i = 0; i < mealRanges.length; i++) { element = new ObjectScheduleElement( mealRanges[i].getRangeMin(), mealRanges[i].getRangeMax(), addMeals(new HashMap(), i, policy)); sched_els.addElement(element); } // for } // if return sched_els; } // createMealAndSupplementSchedule
private HashMap addMeals(HashMap map, int j, FeedingPolicy p) { RangeRuleParameterEntry[] meals; // bRanges, lRanges, dRanges; meals = p.getMealPolicyRanges(); if (meals == null) { return map; } // if KeyRuleParameterEntry[] keys = p.getRangeKeys(meals[j]); String nsn; for (int i = 0; i < keys.length; i++) { nsn = keys[i].getValue().toString(); if (nsn != null && nsn.length() > 0) { calculateConsumptionRate(map, nsn); map = addSupplementRate(map, nsn); } // if } // for return map; } // addMeals