JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / com / stevesoft / pat / StringBufferLike.js
1 Clazz.declarePackage ("com.stevesoft.pat");\r
2 Clazz.load (["com.stevesoft.pat.BasicStringBufferLike"], "com.stevesoft.pat.StringBufferLike", ["com.stevesoft.pat.CaseMgr"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.sbl = null;\r
5 this.mode = 'E';\r
6 this.altMode = ' ';\r
7 Clazz.instantialize (this, arguments);\r
8 }, com.stevesoft.pat, "StringBufferLike", null, com.stevesoft.pat.BasicStringBufferLike);\r
9 Clazz.makeConstructor (c$, \r
10 function (sbl) {\r
11 this.sbl = sbl;\r
12 }, "com.stevesoft.pat.BasicStringBufferLike");\r
13 Clazz.defineMethod (c$, "toStringLike", \r
14 function () {\r
15 return this.sbl.toStringLike ();\r
16 });\r
17 Clazz.defineMethod (c$, "toString", \r
18 function () {\r
19 return this.sbl.toString ();\r
20 });\r
21 Clazz.defineMethod (c$, "appendC", \r
22 function (c) {\r
23 switch (this.mode) {\r
24 case 'u':\r
25 this.mode = this.altMode;\r
26 this.altMode = ' ';\r
27 case 'U':\r
28 this.sbl.appendC (com.stevesoft.pat.CaseMgr.toUpperCaseC (c));\r
29 break;\r
30 case 'l':\r
31 this.mode = this.altMode;\r
32 this.altMode = ' ';\r
33 case 'L':\r
34 this.sbl.appendC (com.stevesoft.pat.CaseMgr.toLowerCaseC (c));\r
35 break;\r
36 case 'Q':\r
37 if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) {\r
38 ;} else {\r
39 this.sbl.appendC ('\\');\r
40 }default:\r
41 this.sbl.appendC (c);\r
42 break;\r
43 }\r
44 }, "~S");\r
45 Clazz.overrideMethod (c$, "append", \r
46 function (s) {\r
47 for (var i = 0; i < s.length; i++) {\r
48 this.appendC (s.charAt (i));\r
49 }\r
50 }, "~S");\r
51 Clazz.defineMethod (c$, "setMode", \r
52 function (c) {\r
53 if (c == 'u' || c == 'l') {\r
54 if (this.altMode == ' ') {\r
55 this.altMode = this.mode;\r
56 }}this.mode = c;\r
57 }, "~S");\r
58 Clazz.defineMethod (c$, "unwrap", \r
59 function () {\r
60 return this.sbl.unwrap ();\r
61 });\r
62 });\r