JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / com / stevesoft / pat / BackMatch.js
1 Clazz.declarePackage ("com.stevesoft.pat");\r
2 Clazz.load (["com.stevesoft.pat.Pattern"], "com.stevesoft.pat.BackMatch", null, function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.id = 0;\r
5 Clazz.instantialize (this, arguments);\r
6 }, com.stevesoft.pat, "BackMatch", com.stevesoft.pat.Pattern);\r
7 Clazz.makeConstructor (c$, \r
8 function (id) {\r
9 Clazz.superConstructor (this, com.stevesoft.pat.BackMatch, []);\r
10 this.id = id;\r
11 }, "~N");\r
12 Clazz.overrideMethod (c$, "toString", \r
13 function () {\r
14 return "\\" + (this.id) + this.nextString ();\r
15 });\r
16 Clazz.overrideMethod (c$, "matchInternal", \r
17 function (pos, p) {\r
18 var i1 = p.marks[this.id];\r
19 var i2 = p.marks[this.id + p.nMarks];\r
20 var imax = i2 - i1;\r
21 if (i1 < 0 || imax < 0 || pos + imax > p.src.length ()) {\r
22 return -1;\r
23 }var ns = p.src.length () - pos;\r
24 if (imax < ns) {\r
25 ns = imax;\r
26 }for (var i = 0; i < ns; i++) {\r
27 if (p.src.charAt (i + i1) != p.src.charAt (pos + i)) {\r
28 return -1;\r
29 }}\r
30 return this.nextMatch (pos + imax, p);\r
31 }, "~N,com.stevesoft.pat.Pthings");\r
32 Clazz.overrideMethod (c$, "clone1", \r
33 function (h) {\r
34 return  new com.stevesoft.pat.BackMatch (this.id);\r
35 }, "java.util.Hashtable");\r
36 });\r