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