private void setCell(Cell thisCell,Cell left, Cell above, Cell leftAbove, boolean substitution) {
        int a=left.getTotal()+1;
        int b=above.getTotal()+1;
        int c=leftAbove.getTotal();

        c+=substitution ? 1 : 0;

        if (a<=b && a<=c) {
            thisCell.setTo(left);
            thisCell.addDeletion();
        }
        else if (b<=a && b<=c) {
            thisCell.setTo(above);
            thisCell.addInsertion();
        }
        else {
            thisCell.setTo(leftAbove);
            if (substitution)
                thisCell.addSubstitution();
        }
    /*
        if(i > 1 and j > 1 and str1[i] = str2[j-1] and str1[i-1] = str2[j]) then
               d[i, j] := minimum(
                                d[i, j],
                                d[i-2, j-2] + cost   // transposition
                             )
                             */
    }
The cell containg the last calculated edit distance
searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/reference/OptimalStringAlignmentDistance.java