private final int biggestMatch() { int erg = 0; for (int i=0; i<size(); i++) if (matches[i].length>erg) erg=matches[i].length; return erg; } public final boolean moreThan(float percent) {
public final void sort() { // bubblesort!!! Match tmp; int size = size(); int i, j; for (i=1; i<size; i++) for (j=0; j<(size-i); j++) if (matches[j].startA > matches[j+1].startA) { tmp = matches[j]; matches[j] = matches[j+1]; matches[j+1] = tmp; } }
public final int tokensMatched() { int erg = 0; for (int i=0; i<size(); i++) erg += matches[i].length; return erg; } private final int biggestMatch() {
public final int[] sort_permutation(int s) { // bubblesort!!! int size = size(); int[] perm = new int[size]; int i, j, tmp; // initialize permutation array for (i=0; i<size; i++) perm[i] = i; if (s==0) { // submission A for (i=1; i<size; i++) for (j=0; j<(size-i); j++) if (matches[perm[j]].startA > matches[perm[j+1]].startA) { tmp = perm[j]; perm[j] = perm[j+1]; perm[j+1] = tmp; } } else { // submission B for (i=1; i<size; i++) for (j=0; j<(size-i); j++) if (matches[perm[j]].startB > matches[perm[j+1]].startB) { tmp = perm[j]; perm[j] = perm[j+1]; perm[j+1] = tmp; } } return perm; }
public final String[] files(int j) { Token[] tokens = (j==0 ? subA : subB).struct.tokens; int i,h,starti,starth,count = 1; o1: for (i=1; i<size(); i++) { starti = (j==0 ? matches[i].startA : matches[i].startB); for (h=0; h<i; h++) { starth = (j==0 ? matches[h].startA : matches[h].startB); if (tokens[starti].file.equals(tokens[starth].file)) continue o1; } count++; } String[] res = new String[count]; res[0] = tokens[(j==0 ? matches[0].startA : matches[0].startB)].file; count = 1; o2: for (i=1; i<size(); i++) { starti = (j==0 ? matches[i].startA : matches[i].startB); for (h=0; h<i; h++) { starth = (j==0 ? matches[h].startA : matches[h].startB); if (tokens[starti].file.equals(tokens[starth].file)) continue o2; } res[count++] = tokens[starti].file; } /* sort by file name. (so that equally named files are displayed * approximately side by side.) */ Arrays.sort(res); return res; }
public final int diffType(String file, int line, int sub) { Structure struct = (sub==0 ? subA:subB).struct; int index = 0; for (; index < struct.size(); index++) if (struct.tokens[index].file.equals(file) && struct.tokens[index].getLine() == line) break; if (index == struct.size()) return 0; while (index < struct.size() && struct.tokens[index].getLine() == line && struct.tokens[index].file.equals(file)) { int j = 0; for (; j < size(); j++) if (matches[j].contains(index, sub)) break; if (j == size()) return 2; index++; } return 1; }
f.println("<TR><TH><TH>"+subA.name+" ("+percentA()+"%)<TH>"+ subB.name+" ("+percentB()+"%)<TH>" + msg.getString("AllMatches.Tokens")); for (int i=0; i<size(); i++) { match = matches[i];
TreeMap<MarkupText, Object> markupList = new TreeMap<MarkupText, Object>(comp); for (int x = 0; x < match.size(); x++) { Match onematch = match.matches[x];
String hilf; int h; for (int x = 0; x < match.size(); x++) { onematch = match.matches[x];
if (index < match.size()) { onematch = match.matches[perm[index]]; start = tokens[(j == 0 ? onematch.startA : onematch.startB)];