private boolean validate(final List<UFLD> exFlds, List<UFLD> acFlds) { if (exFlds == null) { return true; } final Iterator<UFLD> iter = exFlds.iterator(); while (iter.hasNext()) { final UFLD fld = iter.next(); if (fld.size() == 1) { final String val = getField(fld); if (isFunc(val, VALUE_PREFIX_SIZ)) { if (Integer.parseInt(getArg(val)) != Util.size(acFlds)) { return false; } iter.remove(); break; } } } final int exFldsSize = Util.size(exFlds); int acFldsSize = Util.size(acFlds); if (exFldsSize == 0) { return true; } else if (acFldsSize == 0) { if (VALUE_EMPTY.equals(getField(exFlds))) { acFlds = new ArrayList<UFLD>(1); acFlds.add(newFld()); acFldsSize = 1; } else { return false; } } if (acFldsSize < exFldsSize) { return false; } for (final UFLD exFld : exFlds) { boolean found = false; for (final UFLD acFld : acFlds) { if (validate(exFld, acFld)) { found = true; break; } } if (!found) { return false; } } return true; }
private boolean validate(final UFLD exFld, UFLD acFld) { final int exFldSize = UFLD.size(exFld); int acFldSize = UFLD.size(acFld); if (exFldSize == 0) { return true; } else if (acFldSize == 0) { if (VALUE_EMPTY.equals(getField(exFld))) { acFld = newFld(); acFldSize = 1; } else { return false; } } if (acFldSize < exFldSize) { return false; } for (int i = 1; i <= exFldSize; i++) { if (!validate(exFld.get(i), acFld.get(i))) { return false; } } return true; }
private final UFLD newFld() { final UFLD fld = new UFLD(null); fld.set(1, newCmp()); return fld; }