public final float roundedPercent() { float percent = percent(); return ((int)(percent * 10)) / (float)10; } public final float percent() {
private void registerMatch(AllMatches match, int[] dist, SortedVector<AllMatches> avgmatches, SortedVector<AllMatches> maxmatches, SortedVector<AllMatches> minmatches, int a, int b) { float avgpercent = match.percent(); float maxpercent = match.percentMaxAB(); float minpercent = match.percentMinAB(); if ((avgmatches.size() < options.store_matches || avgpercent > avgmatches.lastElement().percent()) && avgpercent > 0) { avgmatches.insert(match); if (avgmatches.size() > options.store_matches) avgmatches.removeElementAt(options.store_matches); if (maxmatches != null && (maxmatches.size() < options.store_matches || maxpercent > maxmatches.lastElement().percent()) && maxpercent > 0) { maxmatches.insert(match); maxmatches.removeElementAt(options.store_matches); if (minmatches != null && (minmatches.size() < options.store_matches || minpercent > minmatches.lastElement().percent()) && minpercent > 0) { minmatches.insert(match);
public float getPercent(AllMatches matches) { return matches.percent(); } }, "<H4>" + msg.getString("Report.MatchesAvg"), csvfile);
public final boolean moreThan(float percent) { return (percent() > percent); } public final float roundedPercent() {
public float getPercent(AllMatches matches) { return matches.percent(); } }
private void expCompare() throws jplag.ExitException { int size = validSubmissions(); int[] similarity = new int[(size * size - size) / 2]; int anzSub = submissions.size(); int i, j, count = 0; Submission s1, s2; AllMatches match; long msec = System.currentTimeMillis(); for (i = 0; i < (anzSub - 1); i++) { s1 = submissions.elementAt(i); if (s1.struct == null) continue; for (j = (i + 1); j < anzSub; j++) { s2 = submissions.elementAt(j); if (s2.struct == null) continue; match = this.gSTiling.compare(s1, s2); similarity[count++] = (int) match.percent(); } } long time = System.currentTimeMillis() - msec; // output System.out.print(options.root_dir + " "); System.out.print(options.min_token_match + " "); System.out.print(options.filtername + " "); System.out.print((time) + " "); for (i = 0; i < similarity.length; i++) System.out.print(similarity[i] + " "); System.out.println(); }
private void writeTextResult(File dir, SortedVector<AllMatches> matches) { Iterator<AllMatches> iter = matches.iterator(); print("Writing special 'matches.txt' file\n", null); try { File f = new File(dir, "matches.txt"); PrintWriter writer = new PrintWriter(new FileWriter(f)); while (iter.hasNext()) { AllMatches match = iter.next(); String file1, file2, tmp; file1 = match.subA.name; file2 = match.subB.name; if (file1.compareTo(file2) > 0) { tmp = file2; file2 = file1; file1 = tmp; } writer.println(file1 + "\t" + file2 + "\t" + match.percent()); } writer.close(); } catch (IOException e) { print("IOException while writing file\n", null); } } }
System.out.println("Comparing " + s1.name + "-" + s2.name + ": " + match.percent());
anz++; float percent = match.percent(); if ((matches.size() < options.compare || matches.size() == 0 || match.moreThan(matches.lastElement().percent())) && match.moreThan(0)) { matches.insert(match); match = iter.next(); if (once) { f.println("<TR><TD BGCOLOR=" + this.report.color(match.percent(), 128, 192, 128, 192, 255, 255) + ">" + s1.name + "<TD WIDTH=\"10\">->"); once = false; f.println(" <TD BGCOLOR=" + this.report.color(match.percent(), 128, 192, 128, 192, 255, 255) + " ALIGN=center><A HREF=\"match" + matchIndex + ".html\">" + match.subName(other) + "</A><BR><FONT COLOR=\"" + this.report.color(match.percent(), 0, 255, 0, 0, 0, 0) + "\"><B>(" + match.roundedPercent() + "%)</B></FONT>"); this.report.writeMatch(root, matchIndex++, match);