X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=bin%2Fjavajs%2Futil%2FSB.js;h=b597d0f58b999a7029acad985ab6af9a5951c33a;hp=daa1518a6bcf88d4ba1d50488e476665deab496f;hb=7301a2415adab88038b291fc54caeeb3a5a47a44;hpb=6154cb57a6eac3bb1344b8342495f5bb701ee921 diff --git a/bin/javajs/util/SB.js b/bin/javajs/util/SB.js index daa1518..b597d0f 100644 --- a/bin/javajs/util/SB.js +++ b/bin/javajs/util/SB.js @@ -1,151 +1,151 @@ -Clazz.declarePackage ("javajs.util"); -c$ = Clazz.decorateAsClass (function () { -this.sb = null; -this.s = null; -Clazz.instantialize (this, arguments); -}, javajs.util, "SB"); -Clazz.makeConstructor (c$, -function () { -{ -this.s = ""; -}}); -c$.newN = Clazz.defineMethod (c$, "newN", -function (n) { -{ -return new javajs.util.SB(); -}}, "~N"); -c$.newS = Clazz.defineMethod (c$, "newS", -function (s) { -{ -var sb = new javajs.util.SB(); -sb.s = s; -return sb; -}}, "~S"); -Clazz.defineMethod (c$, "append", -function (s) { -{ -this.s += s -}return this; -}, "~S"); -Clazz.defineMethod (c$, "appendC", -function (c) { -{ -this.s += c; -}return this; -}, "~S"); -Clazz.defineMethod (c$, "appendI", -function (i) { -{ -this.s += i -}return this; -}, "~N"); -Clazz.defineMethod (c$, "appendB", -function (b) { -{ -this.s += b -}return this; -}, "~B"); -Clazz.defineMethod (c$, "appendF", -function (f) { -{ -var sf = "" + f; -if (sf.indexOf(".") < 0 && sf.indexOf("e") < 0) -sf += ".0" ; -this.s += sf; -}return this; -}, "~N"); -Clazz.defineMethod (c$, "appendD", -function (d) { -{ -var sf = "" + d; -if (sf.indexOf(".") < 0 && sf.indexOf("e") < 0) -sf += ".0" ; -this.s += sf; -}return this; -}, "~N"); -Clazz.defineMethod (c$, "appendSB", -function (buf) { -{ -this.s += buf.s; -}return this; -}, "javajs.util.SB"); -Clazz.defineMethod (c$, "appendO", -function (data) { -if (data != null) { -{ -this.s += data.toString(); -}}return this; -}, "~O"); -Clazz.defineMethod (c$, "appendCB", -function (cb, off, len) { -{ -for (var i = len,j=off; --i >= 0;) -this.s += cb[j++]; -}}, "~A,~N,~N"); -Clazz.overrideMethod (c$, "toString", -function () { -{ -return this.s; -}}); -Clazz.defineMethod (c$, "length", -function () { -{ -return this.s.length; -}}); -Clazz.defineMethod (c$, "indexOf", -function (s) { -{ -return this.s.indexOf(s); -}}, "~S"); -Clazz.defineMethod (c$, "charAt", -function (i) { -{ -return this.s.charAt(i); -}}, "~N"); -Clazz.defineMethod (c$, "charCodeAt", -function (i) { -{ -return this.s.charCodeAt(i); -}}, "~N"); -Clazz.defineMethod (c$, "setLength", -function (n) { -{ -this.s = this.s.substring(0, n); -}}, "~N"); -Clazz.defineMethod (c$, "lastIndexOf", -function (s) { -{ -return this.s.lastIndexOf(s); -}}, "~S"); -Clazz.defineMethod (c$, "indexOf2", -function (s, i) { -{ -return this.s.indexOf(s, i); -}}, "~S,~N"); -Clazz.defineMethod (c$, "substring", -function (i) { -{ -return this.s.substring(i); -}}, "~N"); -Clazz.defineMethod (c$, "substring2", -function (i, j) { -{ -return this.s.substring(i, j); -}}, "~N,~N"); -Clazz.defineMethod (c$, "toBytes", -function (off, len) { -if (len < 0) len = this.length () - off; -var b = Clazz.newByteArray (len, 0); -for (var i = off + len, j = i - off; --i >= off; ) b[--j] = (this.charAt (i)).charCodeAt (0); - -return b; -}, "~N,~N"); -Clazz.defineMethod (c$, "replace", -function (start, end, str) { -{ -this.s = this.s.substring(0, start) + str + this.s.substring(end); -}}, "~N,~N,~S"); -Clazz.defineMethod (c$, "insert", -function (offset, str) { -this.replace (offset, offset, str); -}, "~N,~S"); +Clazz.declarePackage ("javajs.util"); +c$ = Clazz.decorateAsClass (function () { +this.sb = null; +this.s = null; +Clazz.instantialize (this, arguments); +}, javajs.util, "SB"); +Clazz.makeConstructor (c$, +function () { +{ +this.s = ""; +}}); +c$.newN = Clazz.defineMethod (c$, "newN", +function (n) { +{ +return new javajs.util.SB(); +}}, "~N"); +c$.newS = Clazz.defineMethod (c$, "newS", +function (s) { +{ +var sb = new javajs.util.SB(); +sb.s = s; +return sb; +}}, "~S"); +Clazz.defineMethod (c$, "append", +function (s) { +{ +this.s += s +}return this; +}, "~S"); +Clazz.defineMethod (c$, "appendC", +function (c) { +{ +this.s += c; +}return this; +}, "~S"); +Clazz.defineMethod (c$, "appendI", +function (i) { +{ +this.s += i +}return this; +}, "~N"); +Clazz.defineMethod (c$, "appendB", +function (b) { +{ +this.s += b +}return this; +}, "~B"); +Clazz.defineMethod (c$, "appendF", +function (f) { +{ +var sf = "" + f; +if (sf.indexOf(".") < 0 && sf.indexOf("e") < 0) +sf += ".0" ; +this.s += sf; +}return this; +}, "~N"); +Clazz.defineMethod (c$, "appendD", +function (d) { +{ +var sf = "" + d; +if (sf.indexOf(".") < 0 && sf.indexOf("e") < 0) +sf += ".0" ; +this.s += sf; +}return this; +}, "~N"); +Clazz.defineMethod (c$, "appendSB", +function (buf) { +{ +this.s += buf.s; +}return this; +}, "javajs.util.SB"); +Clazz.defineMethod (c$, "appendO", +function (data) { +if (data != null) { +{ +this.s += data.toString(); +}}return this; +}, "~O"); +Clazz.defineMethod (c$, "appendCB", +function (cb, off, len) { +{ +for (var i = len,j=off; --i >= 0;) +this.s += cb[j++]; +}}, "~A,~N,~N"); +Clazz.overrideMethod (c$, "toString", +function () { +{ +return this.s; +}}); +Clazz.defineMethod (c$, "length", +function () { +{ +return this.s.length; +}}); +Clazz.defineMethod (c$, "indexOf", +function (s) { +{ +return this.s.indexOf(s); +}}, "~S"); +Clazz.defineMethod (c$, "charAt", +function (i) { +{ +return this.s.charAt(i); +}}, "~N"); +Clazz.defineMethod (c$, "charCodeAt", +function (i) { +{ +return this.s.charCodeAt(i); +}}, "~N"); +Clazz.defineMethod (c$, "setLength", +function (n) { +{ +this.s = this.s.substring(0, n); +}}, "~N"); +Clazz.defineMethod (c$, "lastIndexOf", +function (s) { +{ +return this.s.lastIndexOf(s); +}}, "~S"); +Clazz.defineMethod (c$, "indexOf2", +function (s, i) { +{ +return this.s.indexOf(s, i); +}}, "~S,~N"); +Clazz.defineMethod (c$, "substring", +function (i) { +{ +return this.s.substring(i); +}}, "~N"); +Clazz.defineMethod (c$, "substring2", +function (i, j) { +{ +return this.s.substring(i, j); +}}, "~N,~N"); +Clazz.defineMethod (c$, "toBytes", +function (off, len) { +if (len < 0) len = this.length () - off; +var b = Clazz.newByteArray (len, 0); +for (var i = off + len, j = i - off; --i >= off; ) b[--j] = (this.charAt (i)).charCodeAt (0); + +return b; +}, "~N,~N"); +Clazz.defineMethod (c$, "replace", +function (start, end, str) { +{ +this.s = this.s.substring(0, start) + str + this.s.substring(end); +}}, "~N,~N,~S"); +Clazz.defineMethod (c$, "insert", +function (offset, str) { +this.replace (offset, offset, str); +}, "~N,~S");