JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / com / stevesoft / pat / oneChar.js
1 Clazz.declarePackage ("com.stevesoft.pat");\r
2 Clazz.load (["com.stevesoft.pat.Pattern"], "com.stevesoft.pat.oneChar", ["com.stevesoft.pat.CaseMgr", "$.patInt"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.c = '\0';\r
5 this.altc = '\0';\r
6 this.altc2 = '\0';\r
7 this.mask = 0;\r
8 Clazz.instantialize (this, arguments);\r
9 }, com.stevesoft.pat, "oneChar", com.stevesoft.pat.Pattern);\r
10 Clazz.makeConstructor (c$, \r
11 function (ci) {\r
12 Clazz.superConstructor (this, com.stevesoft.pat.oneChar, []);\r
13 this.c = ci;\r
14 var cu;\r
15 var cl;\r
16 var ct;\r
17 cu = com.stevesoft.pat.CaseMgr.toUpperCaseC (this.c);\r
18 cl = com.stevesoft.pat.CaseMgr.toLowerCaseC (this.c);\r
19 ct = com.stevesoft.pat.CaseMgr.toTitleCaseC (this.c);\r
20 if (this.c == cu) {\r
21 this.altc = cl;\r
22 this.altc2 = ct;\r
23 } else if (this.c == cl) {\r
24 this.altc = cu;\r
25 this.altc2 = ct;\r
26 } else {\r
27 this.altc = cl;\r
28 this.altc2 = cu;\r
29 }this.mask = this.c.charCodeAt (0) & this.altc.charCodeAt (0) & this.altc2.charCodeAt (0);\r
30 }, "~S");\r
31 Clazz.overrideMethod (c$, "matchInternal", \r
32 function (pos, pt) {\r
33 var p;\r
34 var ret = -1;\r
35 if (pos < pt.src.length () && !this.Masked (pos, pt) && ((p = pt.src.charAt (pos)) == this.c || (pt.ignoreCase && (p == this.altc || p == this.altc2)))) {\r
36 ret = this.nextMatch (pos + 1, pt);\r
37 }return ret;\r
38 }, "~N,com.stevesoft.pat.Pthings");\r
39 Clazz.overrideMethod (c$, "toString", \r
40 function () {\r
41 return com.stevesoft.pat.Pattern.protect ("" + this.c, "[]{}(),$,-\"^.", '\\') + this.nextString ();\r
42 });\r
43 Clazz.overrideMethod (c$, "minChars", \r
44 function () {\r
45 return  new com.stevesoft.pat.patInt (1);\r
46 });\r
47 Clazz.overrideMethod (c$, "maxChars", \r
48 function () {\r
49 return  new com.stevesoft.pat.patInt (1);\r
50 });\r
51 Clazz.overrideMethod (c$, "clone1", \r
52 function (h) {\r
53 return  new com.stevesoft.pat.oneChar (this.c);\r
54 }, "java.util.Hashtable");\r
55 });\r