public Program(Options options) throws jplag.ExitException { this.options = options; this.options.initializeSecondStep(this); if (this.options.language == null) throw new ExitException("Language not initialized!", ExitException.BAD_LANGUAGE_ERROR); msg = new Messages(this.options.getCountryTag()); if (this.options.getCountryTag().equals("de")) { dateFormat = new SimpleDateFormat("dd.MM.yyyy"); dateTimeFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss 'GMT'"); } else { dateFormat = new SimpleDateFormat("yyyy-MM-dd"); dateTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss 'GMT'"); } dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); dateTimeFormat.setTimeZone(TimeZone.getTimeZone("GMT")); report = new Report(this, get_language()); }
public void write(File f, int[] dist, SortedVector<AllMatches> avgmatches, SortedVector<AllMatches> maxmatches, SortedVector<AllMatches> minmatches, Cluster clustering, Options options) throws jplag.ExitException { root = f; this.dist = dist; this.avgmatches = avgmatches; this.maxmatches = maxmatches; this.minmatches = minmatches; this.options = options; System.gc(); writeIndex((clustering != null)); if (this.program.use_clustering()) writeClusters(clustering); copyFixedFiles(f); writeMatches(avgmatches); if (maxmatches != null) writeMatches(maxmatches); if (minmatches != null) writeMatches(minmatches); }
private void writeMatches(SortedVector<AllMatches> matches) throws jplag.ExitException { Enumeration<AllMatches> enum1 = matches.elements(); for (int i = 0; enum1.hasMoreElements(); i++) { AllMatches match = enum1.nextElement(); if (!matchesIndexMap.containsKey(match)) continue; // match has already been written if (this.program.use_externalSearch()) { ThemeGenerator.loadStructure(match.subA); ThemeGenerator.loadStructure(match.subB); } writeMatch(root, getMatchIndex(match), match); matchesIndexMap.remove(match); // "mark" as already written options.setProgress((i + 1) * 100 / matches.size()); if (this.program.use_externalSearch()) { match.subA.struct = null; match.subB.struct = null; } } }
int bytes = 0; bytes = writeFrames(i, match); bytes += writeLink(i, match); bytes += writeTop(i, match); bytes += writeDist(i, match); bytes += writeIndexedSubmission(i, match, 0); bytes += writeIndexedSubmission(i, match, 1); } else if (this.language.supportsColumns()) { bytes += writeImprovedSubmission(i, match, 0); bytes += writeImprovedSubmission(i, match, 1); } else { bytes += writeNormalSubmission(i, match, 0); bytes += writeNormalSubmission(i, match, 1); bytes += writeSubmissionDiff(i, match, 0); bytes += writeSubmissionDiff(i, match, 1);
private int writeIndex(boolean includeClusterLink) throws jplag.ExitException { HTMLFile f = openHTMLFile(root, "index.html"); writeIndexBegin(f, msg.getString("Report.Search_Results")); writeDistribution(f); writeLinksToMatches(f, avgmatches, new MatchesHelper() { public float getPercent(AllMatches matches) { return matches.percent(); writeMatchesCSV(root, csvfile, avgmatches, new MatchesHelper() { public float getPercent(AllMatches matches) { writeLinksToMatches(f, minmatches, new MatchesHelper() { public float getPercent(AllMatches matches) { return matches.percentMinAB(); writeMatchesCSV(root, csvfile, avgmatches, new MatchesHelper() { public float getPercent(AllMatches matches) { writeLinksToMatches(f, maxmatches, new MatchesHelper() { public float getPercent(AllMatches matches) { return matches.percentMaxAB(); writeMatchesCSV(root, csvfile, avgmatches, new MatchesHelper() { public float getPercent(AllMatches matches) {
private void specialCompare() throws jplag.ExitException { File root = new File(options.result_dir); HTMLFile f = this.report.openHTMLFile(root, "index.html"); this.report.copyFixedFiles(root); this.report.writeIndexBegin(f, "Special Search Results"); // start HTML f.println("<P><A NAME=\"matches\"><H4>Matches:</H4><P>"); 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); this.report.writeIndexEnd(f); f.close();
private int writeDist(int i, AllMatches match) throws jplag.ExitException { HTMLFile f = openHTMLFile(root, "match" + i + "-dist.html"); writeHTMLHeader(f, msg.getString("Report.Token_Distribution")); f.println("<BODY>"); match.distributionReport(f, msg); f.println("</BODY>\n</HTML>"); f.close(); return f.bytesWritten(); }
private int writeTop(int i, AllMatches match) throws jplag.ExitException { HTMLFile f = openHTMLFile(root, "match" + i + "-top.html"); writeHTMLHeaderWithScript(f, "Top"); f.println("<BODY BGCOLOR=\"#ffffff\">"); if (this.program.use_externalSearch()) { f.println("<A HREF=\"match" + i + "-dist.html\" TARGET=\"_top\">" + msg.getString("Report.Distribution") + "</A><P>"); } match.HTMLreport(f, i, this.program); f.println("</BODY>\n</HTML>\n"); f.close(); return f.bytesWritten(); }
private int writeClusters(Cluster clustering) throws jplag.ExitException { int bytes = 0; HTMLFile f = openHTMLFile(root, "cluster.html"); writeHTMLHeader(f, msg.getString("Report.Clustering_Results")); String clustertype = msg.getString("Report.Type") + ": " + program.clusters.getType(); f.println("<BODY>\n<H2>" + msg.getString("Report.Clustering_Results") + " (" + clustertype + ")</H2>"); new String[] { threshold + "" }); f.println("<H3><A HREF=\"cluster" + threshold + ".html\">" + clustertitle + "</A></H3>"); HTMLFile f2 = openHTMLFile(root, "cluster" + threshold + ".html"); writeHTMLHeader(f2, clustertitle); f2.println("<BODY>\n<H2>" + clustertitle + " (" + clustertype + ")</H2>"); String text = program.clusters.printClusters(clustering, threshold, f2); new String[] { threshold + "" }); f.println("<H3><A HREF=\"cluster" + (int) threshold + ".html\">" + clustertitle + "</A></H3>"); HTMLFile f2 = openHTMLFile(root, "cluster" + (int) threshold + ".html"); writeHTMLHeader(f2, clustertitle); f2.println("<BODY>\n<H2>" + clustertitle + " (" + clustertype + ")</H2>"); String text = program.clusters.printClusters(clustering, (int) threshold, f2); f.close(); bytes += copySubmissions(); return f.bytesWritten() + bytes;
if (!header) { // only print header when necessary! header = true; f.print("<TR><TD BGCOLOR=" + color(helper.getPercent(match), 128, 192, 128, 192, 255, 255) + ">" + name + "</TD><TD><nobr>-></nobr>"); f.print("</TD><TD BGCOLOR=" + color(percent, 128, 192, 128, 192, 255, 255) + " ALIGN=center><A HREF=\"match" + getMatchIndex(output) + ".html\">" + output.subName(other) + "</A><BR><FONT COLOR=\"" + color(percent, 0, 255, 0, 0, 0, 0) + "\">(" + (((int) (percent * 10)) / (float) 10) + "%)</FONT>");
private void writeResults(int[] dist, SortedVector<AllMatches> avgmatches, SortedVector<AllMatches> maxmatches, SortedVector<AllMatches> minmatches, Cluster clustering) throws jplag.ExitException { options.setState(Options.GENERATING_RESULT_FILES); options.setProgress(0); if (options.original_dir == null) print("Writing results to: " + options.result_dir + "\n", null); File f = new File(options.result_dir); if (!f.exists()) if (!f.mkdirs()) { throw new jplag.ExitException("Cannot create directory!"); } if (!f.isDirectory()) { throw new jplag.ExitException(options.result_dir + " is not a directory!"); } if (!f.canWrite()) { throw new jplag.ExitException("Cannot write directory: " + options.result_dir); } this.report.write(f, dist, avgmatches, maxmatches, minmatches, clustering, options); if (options.externalSearch) writeTextResult(f, avgmatches); }
writer.write(getMatchIndex(output) + ";"); writer.write(output.subName(other) + ";"); writer.write( (((int) (percent * 10)) / (float) 10) + ";");
private void writeDistribution(HTMLFile f) { // Die Verteilung: int max = 0; for (int i = 0; i < 10; i++) if (dist[i] > max) max = dist[i]; f.println("<H4>" + this.msg.getString("Report.Distribution") + ":</H4>\n<CENTER>"); f.println("<TABLE CELLPADDING=1 CELLSPACING=1>"); for (int i = 9; i >= 0; i--) { f.print("<TR BGCOLOR=" + color(i * 10 + 10, 128, 192, 128, 192, 255, 255) + "><TD ALIGN=center>" + (i * 10) + "% - " + (i * 10 + 10) + "%" + "</TD><TD ALIGN=right>" + dist[i] + "</TD><TD>"); for (int j = (dist[i] * bar_length / max); j > 0; j--) f.print("#"); if (dist[i] * bar_length / max == 0) { if (dist[i] == 0) f.print("."); else f.print("#"); } f.println("</TD></TR>"); } f.println("</TABLE></CENTER>\n<P>\n<HR>"); }
public int makeDendrograms(File root, Cluster clustering) throws jplag.ExitException { HTMLFile f = this.program.report.openHTMLFile(root, "dendro.html"); f.println("<!DOCTYPE HTML PUBLIC \"-//DTD HTML 3.2//EN\">"); f.println("<HTML>\n<HEAD>\n<TITLE>"
private int copySubmissions() throws jplag.ExitException { int bytes = 0; for (Iterator<Submission> i = program.clusters.neededSubmissions.iterator(); i.hasNext();) { Submission sub = i.next(); int index = this.program.clusters.submissions.indexOf(sub); HTMLFile f = openHTMLFile(root, "submission" + index + ".html"); writeHTMLHeader(f, sub.name); f.println("<BODY BGCOLOR=\"#ffffff\">"); String[] files = sub.files; String text[][] = sub.readFiles(files); for (int j = 0; j < files.length; j++) { f.println("<HR>\n<H3><CENTER>" + files[j] + "</CENTER></H3><HR>"); if (this.language.isPreformated()) f.println("<PRE>"); for (int k = 0; k < text[j].length; k++) { f.print(text[j][k]); if (!this.language.isPreformated()) f.println("<BR>"); else f.println(); } if (language.isPreformated()) f.println("</PRE>"); } f.println("</BODY>\n</HTML>"); f.close(); bytes += f.bytesWritten(); } return bytes; }
HTMLFile f = openHTMLFile(root, "match" + i + "-" + j + ".html"); writeHTMLHeaderWithScript(f, (j == 0 ? match.subA : match.subB).name); f.println("<BODY BGCOLOR=\"#ffffff\"" + (j == 1 ? " style=\"margin-left:25\">" : ">"));
HTMLFile f = openHTMLFile(root, "match" + i + "-" + j + ".html"); writeHTMLHeader(f, (j == 0 ? match.subA : match.subB).name); f.println("<BODY>");
HTMLFile f = openHTMLFile(root, "match" + i + "-" + j + ".html"); writeHTMLHeaderWithScript(f, (j == 0 ? match.subA : match.subB).name); f.println("<BODY BGCOLOR=\"#ffffff\"" + (j == 1 ? " style=\"margin-left:25\">" : ">"));
private int writeFrames(int i, AllMatches match) throws jplag.ExitException { HTMLFile f = openHTMLFile(root, "match" + i + ".html"); writeHTMLHeader(f, TagParser.parse(msg.getString("Report.Matches_for_X1_AND_X2"), new String[] { match.subName(0), match.subName(1) })); f.println("<FRAMESET ROWS=\"130,*\">\n <FRAMESET COLS=\"30%,70%\">"); f.println(" <FRAME SRC=\"match" + i + "-link.html\" NAME=\"link\" " + "FRAMEBORDER=0>"); f.println(" <FRAME SRC=\"match" + i + "-top.html\" NAME=\"top\" " + "FRAMEBORDER=0>"); f.println(" </FRAMESET>"); f.println(" <FRAMESET COLS=\"50%,50%\">"); f.println(" <FRAME SRC=\"match" + i + "-0.html\" NAME=\"0\">"); f.println(" <FRAME SRC=\"match" + i + "-1.html\" NAME=\"1\">"); f.println(" </FRAMESET>\n</FRAMESET>\n</HTML>"); f.close(); return f.bytesWritten(); }
HTMLFile f = openHTMLFile(root, "match" + i + "-" + j + ".html"); writeHTMLHeaderWithScript(f, (j == 0 ? match.subA : match.subB).name); f.println("<BODY BGCOLOR=\"#ffffff\">");