JAL-1807 includes ?j2sdebug flag and DebugJS._(msg)
[jalviewjs.git] / bin / javajs / util / SB.js
1 Clazz.declarePackage ("javajs.util");
2 c$ = Clazz.decorateAsClass (function () {
3 this.sb = null;
4 this.s = null;
5 Clazz.instantialize (this, arguments);
6 }, javajs.util, "SB");
7 Clazz.makeConstructor (c$, 
8 function () {
9 {
10 this.s = "";
11 }});
12 c$.newN = Clazz.defineMethod (c$, "newN", 
13 function (n) {
14 {
15 return new javajs.util.SB();
16 }}, "~N");
17 c$.newS = Clazz.defineMethod (c$, "newS", 
18 function (s) {
19 {
20 var sb = new javajs.util.SB();
21 sb.s = s;
22 return sb;
23 }}, "~S");
24 Clazz.defineMethod (c$, "append", 
25 function (s) {
26 {
27 this.s += s
28 }return this;
29 }, "~S");
30 Clazz.defineMethod (c$, "appendC", 
31 function (c) {
32 {
33 this.s += c;
34 }return this;
35 }, "~S");
36 Clazz.defineMethod (c$, "appendI", 
37 function (i) {
38 {
39 this.s += i
40 }return this;
41 }, "~N");
42 Clazz.defineMethod (c$, "appendB", 
43 function (b) {
44 {
45 this.s += b
46 }return this;
47 }, "~B");
48 Clazz.defineMethod (c$, "appendF", 
49 function (f) {
50 {
51 var sf = "" + f;
52 if (sf.indexOf(".") < 0 && sf.indexOf("e") < 0)
53 sf += ".0" ;
54 this.s += sf;
55 }return this;
56 }, "~N");
57 Clazz.defineMethod (c$, "appendD", 
58 function (d) {
59 {
60 var sf = "" + d;
61 if (sf.indexOf(".") < 0 && sf.indexOf("e") < 0)
62 sf += ".0" ;
63 this.s += sf;
64 }return this;
65 }, "~N");
66 Clazz.defineMethod (c$, "appendSB", 
67 function (buf) {
68 {
69 this.s += buf.s;
70 }return this;
71 }, "javajs.util.SB");
72 Clazz.defineMethod (c$, "appendO", 
73 function (data) {
74 if (data != null) {
75 {
76 this.s += data.toString();
77 }}return this;
78 }, "~O");
79 Clazz.defineMethod (c$, "appendCB", 
80 function (cb, off, len) {
81 {
82 for (var i = len,j=off; --i >= 0;)
83 this.s += cb[j++];
84 }}, "~A,~N,~N");
85 Clazz.overrideMethod (c$, "toString", 
86 function () {
87 {
88 return this.s;
89 }});
90 Clazz.defineMethod (c$, "length", 
91 function () {
92 {
93 return this.s.length;
94 }});
95 Clazz.defineMethod (c$, "indexOf", 
96 function (s) {
97 {
98 return this.s.indexOf(s);
99 }}, "~S");
100 Clazz.defineMethod (c$, "charAt", 
101 function (i) {
102 {
103 return this.s.charAt(i);
104 }}, "~N");
105 Clazz.defineMethod (c$, "charCodeAt", 
106 function (i) {
107 {
108 return this.s.charCodeAt(i);
109 }}, "~N");
110 Clazz.defineMethod (c$, "setLength", 
111 function (n) {
112 {
113 this.s = this.s.substring(0, n);
114 }}, "~N");
115 Clazz.defineMethod (c$, "lastIndexOf", 
116 function (s) {
117 {
118 return this.s.lastIndexOf(s);
119 }}, "~S");
120 Clazz.defineMethod (c$, "indexOf2", 
121 function (s, i) {
122 {
123 return this.s.indexOf(s, i);
124 }}, "~S,~N");
125 Clazz.defineMethod (c$, "substring", 
126 function (i) {
127 {
128 return this.s.substring(i);
129 }}, "~N");
130 Clazz.defineMethod (c$, "substring2", 
131 function (i, j) {
132 {
133 return this.s.substring(i, j);
134 }}, "~N,~N");
135 Clazz.defineMethod (c$, "toBytes", 
136 function (off, len) {
137 if (len < 0) len = this.length () - off;
138 var b =  Clazz.newByteArray (len, 0);
139 for (var i = off + len, j = i - off; --i >= off; ) b[--j] = (this.charAt (i)).charCodeAt (0);
140
141 return b;
142 }, "~N,~N");
143 Clazz.defineMethod (c$, "replace", 
144 function (start, end, str) {
145 {
146 this.s = this.s.substring(0, start) + str + this.s.substring(end);
147 }}, "~N,~N,~S");
148 Clazz.defineMethod (c$, "insert", 
149 function (offset, str) {
150 this.replace (offset, offset, str);
151 }, "~N,~S");