public double getMatchFactor(MatchableCollection other) { if (rows.size() > 1 && other.rows.size() > 1) return getMultiMatch(other); if (rows.size() > 1) return other.getMatchFactor(this); String brdok = getRow(0).getBrojDok(); double sim = 0; for (int i = 0; i < other.getRowCount(); i++) sim += Aus.heuristicCompare(brdok, other.getRow(i).getBrojDok(), raOptimisticMatch.getIgnore()); if (sim == 0) sim = 0.01; return sim / other.getRowCount(); }
private double getMultiMatch(MatchableCollection other) { if (rows.size() > other.rows.size()) return other.getMultiMatch(this); double sim = 0; for (int j = 0; j < other.getRowCount(); j++) { String brdok = other.getRow(j).getBrojDok(); double best = 0, now; for (int i = 0; i < getRowCount(); i++) if ((now = Aus.heuristicCompare(brdok, getRow(i).getBrojDok())) > best) best = now; sim += best; } if (sim == 0) sim = 0.01; return sim / other.getRowCount(); }