code: public List<List<String>> getFilteredPolicy(String sec, String ptype, int fieldIndex, String... fieldValues) {
          List<List<String>> res = new ArrayList<>();
  
          for (List<String> rule : model.get(sec).get(ptype).policy) {
              boolean matched = true;
              for (int i = 0; i < fieldValues.length; i ++) {
                  String fieldValue = fieldValues[i];
                  if (!fieldValue.equals("") && !rule.get(fieldIndex + i).equals(fieldValue)) {
                      matched = false;
                      break;
                  }
              }
  
              if (matched) {
                  res.add(rule);
              }
          }
  
          return res;
      }
docs: getFilteredPolicy gets rules based on field filters from a policy.
  
  @param sec the section, "p" or "g".
  @param ptype the policy type, "p", "p2", .. or "g", "g2", ..
  @param fieldIndex the policy rule's start index to be matched.
  @param fieldValues the field values to be matched, value ""
  means not to match this field.
  @return the filtered policy rules of section sec and policy type ptype.