JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / bin / com / stevesoft / pat / RBuffer.js
1 Clazz.declarePackage ("com.stevesoft.pat");\r
2 Clazz.load (null, "com.stevesoft.pat.RBuffer", ["java.lang.StringBuffer"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.done = false;\r
5 this.sb = null;\r
6 this.pos = 0;\r
7 this.epos = 0;\r
8 this.next = null;\r
9 Clazz.instantialize (this, arguments);\r
10 }, com.stevesoft.pat, "RBuffer");\r
11 Clazz.makeConstructor (c$, \r
12 function () {\r
13 });\r
14 Clazz.makeConstructor (c$, \r
15 function (sb) {\r
16 this.sb = sb;\r
17 }, "StringBuffer");\r
18 Clazz.overrideMethod (c$, "toString", \r
19 function () {\r
20 return "sb=" + this.sb.toString ().$replace ('\n', ' ') + " pos=" + this.pos + " epos=" + this.epos + " sb.length()=" + this.sb.length () + "\n" + this.sp (this.pos + 3) + "^" + this.sp (this.epos - this.pos - 1) + "^";\r
21 });\r
22 Clazz.defineMethod (c$, "sp", \r
23 function (n) {\r
24 if (n <= 0) {\r
25 return "";\r
26 }var sb =  new StringBuffer (n);\r
27 for (var i = 0; i < n; i++) {\r
28 sb.append (' ');\r
29 }\r
30 return sb.toString ();\r
31 }, "~N");\r
32 });\r