Exemplo n.º 1
0
  private void performMatching() {
    QueryDataSet sks = null, pok = null;
    Int2 run = new Int2();
    String lastcpar = "";
    total.clear();

    for (int row = 0; row < model.getRowCount(); row++)
      if (model.isRowSelected(row)) {
        MatchableCollection mc = (MatchableCollection) model.getValueAt(row, 0);
        String mkey = mc.getRow(0).getMasterKey();
        String cpar = mkey.substring(0, mkey.indexOf('$'));
        if (!cpar.equals(lastcpar)) {
          if (sks != null && raTransaction.saveChangesInTransaction(new QueryDataSet[] {sks, pok}))
            total = total.add(run);
          run.clear();
          sks = dM.getDataModule().getSkstavke();
          Skstavke.getDataModule()
              .setFilter(
                  Aus.getKnjigCond()
                      .and(Aus.getFreeYearCond())
                      .and(Condition.equal("CPAR", Aus.getNumber(lastcpar = cpar))));
          sks.open();
          pok = Pokriveni.getDataModule().getFilteredDataSet("1=0");
          pok.open();
        }
        PotentialMatch pm = new PotentialMatch();
        for (int i = 0; i < mc.getRowCount(); i++) pm.addStavka(mc.getRow(i));
        for (int i = 0; i < mc.getMatch().getRowCount(); i++) pm.addStavka(mc.getMatch().getRow(i));
        run = run.add(pm.realize(sks, pok));
      }
    if (sks != null && R2Handler.saveChangesInTransaction(new QueryDataSet[] {sks, pok}))
      total = total.add(run);
    dM.getDataModule().getSynchronizer().markAsDirty("pokriveni");
  }
Exemplo n.º 2
0
 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();
 }
Exemplo n.º 3
0
 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();
 }