1 Clazz.declarePackage ("jalview.io");
2 Clazz.load (null, "jalview.io.AlignmentProperties", ["java.lang.StringBuffer"], function () {
3 c$ = Clazz.decorateAsClass (function () {
5 Clazz.instantialize (this, arguments);
6 }, jalview.io, "AlignmentProperties");
7 Clazz.makeConstructor (c$,
9 this.alignment = alignment;
10 }, "jalview.datamodel.AlignmentI");
11 Clazz.defineMethod (c$, "writeProperties",
13 var nl = html ? "<br>" : System.getProperty ("line.separator");
17 for (var i = 0; i < this.alignment.getHeight (); i++) {
18 var size = 1 + this.alignment.getSequenceAt (i).getEnd () - this.alignment.getSequenceAt (i).getStart ();
25 avg = avg / this.alignment.getHeight ();
27 sb.append ("Sequences: " + this.alignment.getHeight ());
29 sb.append ("Minimum Sequence Length: " + min);
31 sb.append ("Maximum Sequence Length: " + max);
33 sb.append ("Average Length: " + Clazz.floatToInt (avg));
34 if ((this.alignment).alignmentProperties != null) {
38 sb.append ("<table border=\"1\">");
39 }var props = (this.alignment).alignmentProperties;
40 var en = props.keys ();
41 while (en.hasMoreElements ()) {
42 var key = en.nextElement ().toString ();
43 var vals = props.get (key).toString ();
45 var val = new StringBuffer ();
49 npos = vals.indexOf ("\n", pos);
51 val.append (vals.substring (pos));
53 val.append (vals.substring (pos, npos));
57 sb.append ("<tr><td>" + key + "</td><td>" + val + "</td></tr>");
59 sb.append (nl + key + "\t" + vals);
62 sb.append ("</table>");
63 }}}, "StringBuffer,~B");
64 Clazz.defineMethod (c$, "formatAsString",
66 return this.formatReport (false);
68 Clazz.defineMethod (c$, "formatReport",
70 var sb = new StringBuffer ();
71 this.writeProperties (sb, html);
74 Clazz.defineMethod (c$, "formatAsHtml",
76 return this.formatReport (true);