JAL-1807 test
[jalviewjs.git] / bin / com / stevesoft / pat / SkipBMH.js
index 9ea4116..ac81e43 100644 (file)
-Clazz.declarePackage ("com.stevesoft.pat");\r
-Clazz.load (["com.stevesoft.pat.Skip"], "com.stevesoft.pat.SkipBMH", ["com.stevesoft.pat.CaseMgr", "com.stevesoft.pat.wrap.StringWrap"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.MAX_CHAR = 64;\r
-this.skip = null;\r
-this.sm1 = 0;\r
-this.jump_ahead = 0;\r
-this.uc = '\0';\r
-this.lc = '\0';\r
-this.tc = '\0';\r
-this.x = '\0';\r
-Clazz.instantialize (this, arguments);\r
-}, com.stevesoft.pat, "SkipBMH", com.stevesoft.pat.Skip);\r
-Clazz.prepareFields (c$, function () {\r
-this.skip =  Clazz.newCharArray (64, '\0');\r
-});\r
-Clazz.defineMethod (c$, "exact", \r
-function (c) {\r
-return (this.ign && this.anyc (c)) || c == this.x;\r
-}, "~S");\r
-Clazz.defineMethod (c$, "anyc", \r
-function (c) {\r
-return c == this.uc || c == this.lc || c == this.tc;\r
-}, "~S");\r
-Clazz.makeConstructor (c$, \r
-function (pt, ign) {\r
-this.construct (pt, ign, 0);\r
-}, "~S,~B");\r
-Clazz.makeConstructor (c$, \r
-function (pt) {\r
-this.construct (pt, false, 0);\r
-}, "~S");\r
-Clazz.makeConstructor (c$, \r
-function (pt, ign, offset) {\r
-Clazz.superConstructor (this, com.stevesoft.pat.SkipBMH, [pt, ign, offset]);\r
-for (var k = 0; k < 64; k++) {\r
-this.skip[k] = String.fromCharCode (this.src.length);\r
-}\r
-this.sm1 = this.src.length - 1;\r
-this.x = this.src.charAt (this.sm1);\r
-this.uc = com.stevesoft.pat.CaseMgr.toUpperCaseC (this.x);\r
-this.lc = com.stevesoft.pat.CaseMgr.toLowerCaseC (this.x);\r
-this.tc = com.stevesoft.pat.CaseMgr.toTitleCaseC (this.x);\r
-for (var k = 0; k < this.src.length - 1; k++) {\r
-var x_ = this.src.charAt (k);\r
-if (ign) {\r
-var uc_ = com.stevesoft.pat.CaseMgr.toUpperCaseC (x_);\r
-var lc_ = com.stevesoft.pat.CaseMgr.toLowerCaseC (x_);\r
-var tc_ = com.stevesoft.pat.CaseMgr.toTitleCaseC (x_);\r
-this.skip[uc_.charCodeAt (0) & (63)] = String.fromCharCode (this.src.length - k - 1);\r
-this.skip[lc_.charCodeAt (0) & (63)] = String.fromCharCode (this.src.length - k - 1);\r
-this.skip[tc_.charCodeAt (0) & (63)] = String.fromCharCode (this.src.length - k - 1);\r
-} else {\r
-this.skip[x_.charCodeAt (0) & (63)] = String.fromCharCode (this.src.length - k - 1);\r
-}}\r
-this.jump_ahead = this.src.length - 1;\r
-for (var k = 0; k < this.src.length - 1; k++) {\r
-var y = this.src.charAt (this.sm1 - k - 1);\r
-if (this.exact (y)) {\r
-this.jump_ahead = k;\r
-break;\r
-}}\r
-}, "~S,~B,~N");\r
-Clazz.defineMethod (c$, "searchRegion", \r
-function (s, start, end) {\r
-return this.find (s, start, end);\r
-}, "~S,~N,~N");\r
-Clazz.defineMethod (c$, "searchFrom", \r
-function (s, start) {\r
-return this.find (s, start, s.length);\r
-}, "~S,~N");\r
-Clazz.defineMethod (c$, "search", \r
-function (s) {\r
-return this.find (s, 0, s.length);\r
-}, "~S");\r
-Clazz.defineMethod (c$, "find", \r
-function (s, start, end) {\r
-start += this.$offset + this.sm1;\r
-var vend = com.stevesoft.pat.Skip.min (s.length - 1, end + this.sm1 + this.$offset);\r
-var k;\r
-var vend1 = vend - this.jump_ahead;\r
-if (this.ign) {\r
-for (k = start; k <= vend1; k += (this.skip[s.charCodeAt (k) & (63)]).charCodeAt (0)) {\r
-if (this.anyc (s.charAt (k))) {\r
-if (com.stevesoft.pat.CaseMgr.regionMatches2 (this.src, this.ign, 0, s, k - this.sm1, this.sm1)) {\r
-return k - this.sm1 - this.$offset;\r
-}k += this.jump_ahead;\r
-}}\r
-for (; k <= vend; k += (this.skip[s.charCodeAt (k) & (63)]).charCodeAt (0)) {\r
-if (this.anyc (s.charAt (k))) {\r
-if (com.stevesoft.pat.CaseMgr.regionMatches2 (this.src, this.ign, 0, s, k - this.sm1, this.sm1)) {\r
-return k - this.sm1 - this.$offset;\r
-}k += this.jump_ahead;\r
-if (k > vend) {\r
-return -1;\r
-}}}\r
-} else {\r
-for (k = start; k <= vend1; k += (this.skip[s.charCodeAt (k) & (63)]).charCodeAt (0)) {\r
-if (this.x == s.charAt (k)) {\r
-if (com.stevesoft.pat.CaseMgr.regionMatches2 (this.src, false, 0, s, k - this.sm1, this.sm1)) {\r
-return k - this.sm1 - this.$offset;\r
-}k += this.jump_ahead;\r
-}}\r
-for (; k <= vend; k += (this.skip[s.charCodeAt (k) & (63)]).charCodeAt (0)) {\r
-if (this.x == s.charAt (k)) {\r
-if (com.stevesoft.pat.CaseMgr.regionMatches2 (this.src, false, 0, s, k - this.sm1, this.sm1)) {\r
-return k - this.sm1 - this.$offset;\r
-}k += this.jump_ahead;\r
-if (k > vend) {\r
-return -1;\r
-}}}\r
-}return -1;\r
-}, "~S,~N,~N");\r
-Clazz.defineMethod (c$, "find", \r
-function (s, start, end) {\r
-if (Clazz.instanceOf (s, com.stevesoft.pat.wrap.StringWrap)) {\r
-return this.find (s.toString (), start, end);\r
-}start += this.$offset + this.sm1;\r
-var vend = com.stevesoft.pat.Skip.min (s.length () - 1, end + this.sm1 + this.$offset);\r
-var k;\r
-var vend1 = vend - this.jump_ahead;\r
-if (this.ign) {\r
-for (k = start; k <= vend1; k += (this.skip[s.charCodeAt (k) & (63)]).charCodeAt (0)) {\r
-if (this.anyc (s.charAt (k))) {\r
-if (com.stevesoft.pat.CaseMgr.regionMatches (this.src, this.ign, 0, s, k - this.sm1, this.sm1)) {\r
-return k - this.sm1 - this.$offset;\r
-}k += this.jump_ahead;\r
-}}\r
-for (; k <= vend; k += (this.skip[s.charCodeAt (k) & (63)]).charCodeAt (0)) {\r
-if (this.anyc (s.charAt (k))) {\r
-if (com.stevesoft.pat.CaseMgr.regionMatches (this.src, this.ign, 0, s, k - this.sm1, this.sm1)) {\r
-return k - this.sm1 - this.$offset;\r
-}k += this.jump_ahead;\r
-if (k > vend) {\r
-return -1;\r
-}}}\r
-} else {\r
-for (k = start; k <= vend1; k += (this.skip[s.charCodeAt (k) & (63)]).charCodeAt (0)) {\r
-if (this.x == s.charAt (k)) {\r
-if (com.stevesoft.pat.CaseMgr.regionMatches (this.src, false, 0, s, k - this.sm1, this.sm1)) {\r
-return k - this.sm1 - this.$offset;\r
-}k += this.jump_ahead;\r
-}}\r
-for (; k <= vend; k += (this.skip[s.charCodeAt (k) & (63)]).charCodeAt (0)) {\r
-if (this.x == s.charAt (k)) {\r
-if (com.stevesoft.pat.CaseMgr.regionMatches (this.src, false, 0, s, k - this.sm1, this.sm1)) {\r
-return k - this.sm1 - this.$offset;\r
-}k += this.jump_ahead;\r
-if (k > vend) {\r
-return -1;\r
-}}}\r
-}return -1;\r
-}, "com.stevesoft.pat.StringLike,~N,~N");\r
-});\r
+Clazz.declarePackage ("com.stevesoft.pat");
+Clazz.load (["com.stevesoft.pat.Skip"], "com.stevesoft.pat.SkipBMH", ["com.stevesoft.pat.CaseMgr", "com.stevesoft.pat.wrap.StringWrap"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.MAX_CHAR = 64;
+this.skip = null;
+this.sm1 = 0;
+this.jump_ahead = 0;
+this.uc = '\0';
+this.lc = '\0';
+this.tc = '\0';
+this.x = '\0';
+Clazz.instantialize (this, arguments);
+}, com.stevesoft.pat, "SkipBMH", com.stevesoft.pat.Skip);
+Clazz.prepareFields (c$, function () {
+this.skip =  Clazz.newCharArray (64, '\0');
+});
+Clazz.defineMethod (c$, "exact", 
+function (c) {
+return (this.ign && this.anyc (c)) || c == this.x;
+}, "~S");
+Clazz.defineMethod (c$, "anyc", 
+function (c) {
+return c == this.uc || c == this.lc || c == this.tc;
+}, "~S");
+Clazz.makeConstructor (c$, 
+function (pt, ign) {
+this.construct (pt, ign, 0);
+}, "~S,~B");
+Clazz.makeConstructor (c$, 
+function (pt) {
+this.construct (pt, false, 0);
+}, "~S");
+Clazz.makeConstructor (c$, 
+function (pt, ign, offset) {
+Clazz.superConstructor (this, com.stevesoft.pat.SkipBMH, [pt, ign, offset]);
+for (var k = 0; k < 64; k++) {
+this.skip[k] = String.fromCharCode (this.src.length);
+}
+this.sm1 = this.src.length - 1;
+this.x = this.src.charAt (this.sm1);
+this.uc = com.stevesoft.pat.CaseMgr.toUpperCaseC (this.x);
+this.lc = com.stevesoft.pat.CaseMgr.toLowerCaseC (this.x);
+this.tc = com.stevesoft.pat.CaseMgr.toTitleCaseC (this.x);
+for (var k = 0; k < this.src.length - 1; k++) {
+var x_ = this.src.charAt (k);
+if (ign) {
+var uc_ = com.stevesoft.pat.CaseMgr.toUpperCaseC (x_);
+var lc_ = com.stevesoft.pat.CaseMgr.toLowerCaseC (x_);
+var tc_ = com.stevesoft.pat.CaseMgr.toTitleCaseC (x_);
+this.skip[uc_.charCodeAt (0) & (63)] = String.fromCharCode (this.src.length - k - 1);
+this.skip[lc_.charCodeAt (0) & (63)] = String.fromCharCode (this.src.length - k - 1);
+this.skip[tc_.charCodeAt (0) & (63)] = String.fromCharCode (this.src.length - k - 1);
+} else {
+this.skip[x_.charCodeAt (0) & (63)] = String.fromCharCode (this.src.length - k - 1);
+}}
+this.jump_ahead = this.src.length - 1;
+for (var k = 0; k < this.src.length - 1; k++) {
+var y = this.src.charAt (this.sm1 - k - 1);
+if (this.exact (y)) {
+this.jump_ahead = k;
+break;
+}}
+}, "~S,~B,~N");
+Clazz.defineMethod (c$, "searchRegion", 
+function (s, start, end) {
+return this.find (s, start, end);
+}, "~S,~N,~N");
+Clazz.defineMethod (c$, "searchFrom", 
+function (s, start) {
+return this.find (s, start, s.length);
+}, "~S,~N");
+Clazz.defineMethod (c$, "search", 
+function (s) {
+return this.find (s, 0, s.length);
+}, "~S");
+Clazz.defineMethod (c$, "find", 
+function (s, start, end) {
+start += this.$offset + this.sm1;
+var vend = com.stevesoft.pat.Skip.min (s.length - 1, end + this.sm1 + this.$offset);
+var k;
+var vend1 = vend - this.jump_ahead;
+if (this.ign) {
+for (k = start; k <= vend1; k += (this.skip[s.charCodeAt (k) & (63)]).charCodeAt (0)) {
+if (this.anyc (s.charAt (k))) {
+if (com.stevesoft.pat.CaseMgr.regionMatches2 (this.src, this.ign, 0, s, k - this.sm1, this.sm1)) {
+return k - this.sm1 - this.$offset;
+}k += this.jump_ahead;
+}}
+for (; k <= vend; k += (this.skip[s.charCodeAt (k) & (63)]).charCodeAt (0)) {
+if (this.anyc (s.charAt (k))) {
+if (com.stevesoft.pat.CaseMgr.regionMatches2 (this.src, this.ign, 0, s, k - this.sm1, this.sm1)) {
+return k - this.sm1 - this.$offset;
+}k += this.jump_ahead;
+if (k > vend) {
+return -1;
+}}}
+} else {
+for (k = start; k <= vend1; k += (this.skip[s.charCodeAt (k) & (63)]).charCodeAt (0)) {
+if (this.x == s.charAt (k)) {
+if (com.stevesoft.pat.CaseMgr.regionMatches2 (this.src, false, 0, s, k - this.sm1, this.sm1)) {
+return k - this.sm1 - this.$offset;
+}k += this.jump_ahead;
+}}
+for (; k <= vend; k += (this.skip[s.charCodeAt (k) & (63)]).charCodeAt (0)) {
+if (this.x == s.charAt (k)) {
+if (com.stevesoft.pat.CaseMgr.regionMatches2 (this.src, false, 0, s, k - this.sm1, this.sm1)) {
+return k - this.sm1 - this.$offset;
+}k += this.jump_ahead;
+if (k > vend) {
+return -1;
+}}}
+}return -1;
+}, "~S,~N,~N");
+Clazz.defineMethod (c$, "find", 
+function (s, start, end) {
+if (Clazz.instanceOf (s, com.stevesoft.pat.wrap.StringWrap)) {
+return this.find (s.toString (), start, end);
+}start += this.$offset + this.sm1;
+var vend = com.stevesoft.pat.Skip.min (s.length () - 1, end + this.sm1 + this.$offset);
+var k;
+var vend1 = vend - this.jump_ahead;
+if (this.ign) {
+for (k = start; k <= vend1; k += (this.skip[s.charCodeAt (k) & (63)]).charCodeAt (0)) {
+if (this.anyc (s.charAt (k))) {
+if (com.stevesoft.pat.CaseMgr.regionMatches (this.src, this.ign, 0, s, k - this.sm1, this.sm1)) {
+return k - this.sm1 - this.$offset;
+}k += this.jump_ahead;
+}}
+for (; k <= vend; k += (this.skip[s.charCodeAt (k) & (63)]).charCodeAt (0)) {
+if (this.anyc (s.charAt (k))) {
+if (com.stevesoft.pat.CaseMgr.regionMatches (this.src, this.ign, 0, s, k - this.sm1, this.sm1)) {
+return k - this.sm1 - this.$offset;
+}k += this.jump_ahead;
+if (k > vend) {
+return -1;
+}}}
+} else {
+for (k = start; k <= vend1; k += (this.skip[s.charCodeAt (k) & (63)]).charCodeAt (0)) {
+if (this.x == s.charAt (k)) {
+if (com.stevesoft.pat.CaseMgr.regionMatches (this.src, false, 0, s, k - this.sm1, this.sm1)) {
+return k - this.sm1 - this.$offset;
+}k += this.jump_ahead;
+}}
+for (; k <= vend; k += (this.skip[s.charCodeAt (k) & (63)]).charCodeAt (0)) {
+if (this.x == s.charAt (k)) {
+if (com.stevesoft.pat.CaseMgr.regionMatches (this.src, false, 0, s, k - this.sm1, this.sm1)) {
+return k - this.sm1 - this.$offset;
+}k += this.jump_ahead;
+if (k > vend) {
+return -1;
+}}}
+}return -1;
+}, "com.stevesoft.pat.StringLike,~N,~N");
+});