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