protected Schedule getWaterPolicySchedule(FeedingPolicy fp) { Vector sched_els = new Vector(0); if (fp != null) { RangeRuleParameterEntry[] waterRanges = fp.getWaterPolicyRanges(); ObjectScheduleElement element; long start, end; // e.g., min = 0 then start is C + 0 or C - Day of the operation // e.g., min = 1 then start is C + 1 or 2nd day of the operation if (waterRanges.length > 0) { start = parentPlugin .getTimeUtils() .addNDays(logOPlan.getStartTime(), waterRanges[0].getRangeMin()); for (int i = 0; i < waterRanges.length; i++) { end = parentPlugin .getTimeUtils() .addNDays( start, (waterRanges[i].getRangeMax() - waterRanges[i].getRangeMin() + 1)); KeyRuleParameterEntry[] keys = fp.getRangeKeys(waterRanges[i]); element = new ObjectScheduleElement( start, end, addWater(new HashMap(), BOTTLED_WATER, new Double(keys[0].getValue()))); sched_els.addElement(element); start = end; } } } // else feeding policy is null return empty schedule return parentPlugin.getScheduleUtils().newObjectSchedule(sched_els.elements()); }
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