private HashMap addSupplementRate(HashMap m, String n) {
   Asset item = parentPlugin.getPrototype(n);
   if (item != null) {
     RationPG rpg = (RationPG) item.searchForPropertyGroup(RationPG.class);
     HashMap supplements = rpg.getMandatorySupplement();
     //	System.JTEST.out.println (" the supplements list is "  + supplements);
     for (Iterator i = supplements.keySet().iterator(); i.hasNext(); ) {
       String nsn = (String) i.next();
       m = calculateSupplementRate(m, nsn, ((BigDecimal) supplements.get(nsn)).doubleValue());
     } // for
   } // if
   return m;
 } // addSupplementRate
  public Rate getRate(Asset asset, List params) {

    double quantity = 0; // people
    // CDW
    if (params.size() < 1) {
      return null;
    } // if
    Object obj = params.get(0);
    if (obj instanceof Double) {
      quantity = ((Double) obj).doubleValue();
    } else {
      if (obj != null) {
        if (logger.isDebugEnabled()) {
          logger.debug("Bad param - expected quantity got " + obj);
        }
      } // if
      return null;
    } // if
    OrgActivity act = null;
    obj = params.get(1);
    if (obj instanceof OrgActivity) {
      act = (OrgActivity) obj;
    } else {
      if (obj != null) {
        if (logger.isDebugEnabled()) {
          logger.debug("Bad param - expected OrgActivity got " + obj);
        }
      } // if
      return null;
    } // if

    KeyRuleParameterEntry[] keys = getActionPolicy(act.getActivityType(), act.getOpTempo());
    if ((keys != null) && (keys.length == 0)) {
      return null;
    } // if

    Rate result = null;
    String identifier = parentPlugin.getAssetUtils().getAssetIdentifier(asset);

    PackagePG ppg = (PackagePG) asset.searchForPropertyGroup(PackagePG.class);
    if (ppg == null) {
      if (logger.isErrorEnabled()) {
        logger.error("No PackagePG on " + identifier);
      }
    }
    // String type = null;
    double resource_count = 0;

    if (keys != null) {
      for (int j = 0; j < keys.length; j++) {
        if ((keys[j].getKey().equalsIgnoreCase("Breakfast")
                && (keys[j].getValue().equals(identifier)))
            || (keys[j].getKey().equalsIgnoreCase("Lunch")
                && (keys[j].getValue().equals(identifier)))
            || (keys[j].getKey().equalsIgnoreCase("Dinner")
                && (keys[j].getValue().equals(identifier)))) {
          resource_count += 1.0;
        }
      }
    } else {
      // keys from getActionPolicy was null

      // Optempo does not over rule
      if (params.size() < 3) {
        if (logger.isErrorEnabled()) {
          logger.error("Class I ose array in getRate() is missing element " + 2 + " (meal)");
        }
      } else {
        if (params.get(2) != null) {
          if (logger.isDebugEnabled()) {
            logger.debug(" meal params is " + params.get(2) + " resource is " + identifier);
          }
          if (((HashMap) params.get(2)).containsKey(identifier)) {
            // Meals
            resource_count += ((Double) ((HashMap) params.get(2)).get(identifier)).doubleValue();
            if (logger.isDebugEnabled()) {
              logger.debug(identifier + " rate is " + resource_count);
            }
          } // if
          // DEBUG
          else {
            if (logger.isDebugEnabled()) {
              logger.debug("No meal rates for " + identifier);
            }
          }
        } // if non null params(2)

        // Enhancements policy
        if (params.size() >= 4 && params.get(3) != null) {
          if (((HashMap) params.get(3)).containsKey(identifier)) {
            // Meals
            resource_count += ((Double) ((HashMap) params.get(3)).get(identifier)).doubleValue();
            if (logger.isDebugEnabled()) {
              logger.debug(
                  " enhance params is "
                      + ((Double) ((HashMap) params.get(3)).get(identifier)).doubleValue());
            }
          }
        }
      } // if have at least thru params(3)
    } // end of case for null keys

    // Water
    if (params.size() < 5) {
      if (logger.isErrorEnabled()) {
        logger.error("Class I ose array in getRate() is missing element " + 5 + " water");
      }
    } else {
      if (params.get(4) != null) {
        if (((HashMap) params.get(4)).containsKey(identifier)) {
          // water  public static HashMap cachedDBValues = new HashMap();

          resource_count += ((Double) ((HashMap) params.get(4)).get(identifier)).doubleValue();
          if (logger.isDebugEnabled()) {
            logger.debug(
                " water params is "
                    + ((Double) ((HashMap) params.get(4)).get(identifier)).doubleValue());
          }
        } // if
      } // if
    } // if

    if (resource_count > 0) {
      double total = Math.ceil(resource_count * (1.0 / ppg.getCountPerPack()) * quantity);
      result = CountRate.newEachesPerDay(total);
      RationPG rpg = (RationPG) asset.searchForPropertyGroup(RationPG.class);
      if (logger.isDebugEnabled()) {
        logger.debug(
            "\n THE rate is "
                + CountRate.newEachesPerDay(total)
                + " for asset "
                + identifier
                + " the ration type is "
                + rpg.getRationType());
      }
      if (logger.isDebugEnabled()) {
        logger.debug(
            " Unit of Issue  is "
                + ppg.getUnitOfIssue()
                + " count per pack"
                + ppg.getCountPerPack());
      }
    } // if
    return result;
  } // getRate