JAL-1807 test
[jalviewjs.git] / bin / com / stevesoft / pat / lookAhead.js
1 Clazz.declarePackage ("com.stevesoft.pat");
2 Clazz.load (["com.stevesoft.pat.Or"], "com.stevesoft.pat.lookAhead", ["com.stevesoft.pat.patInt"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.reverse = false;
5 Clazz.instantialize (this, arguments);
6 }, com.stevesoft.pat, "lookAhead", com.stevesoft.pat.Or);
7 Clazz.makeConstructor (c$, 
8 function (b) {
9 Clazz.superConstructor (this, com.stevesoft.pat.lookAhead, []);
10 this.reverse = b;
11 }, "~B");
12 Clazz.defineMethod (c$, "getNext", 
13 function () {
14 return null;
15 });
16 Clazz.overrideMethod (c$, "nextMatch", 
17 function (pos, pt) {
18 var p = Clazz.superCall (this, com.stevesoft.pat.lookAhead, "getNext", []);
19 if (p != null) {
20 return p.matchInternal (pos, pt);
21 } else {
22 return pos;
23 }}, "~N,com.stevesoft.pat.Pthings");
24 Clazz.defineMethod (c$, "matchInternal", 
25 function (pos, pt) {
26 if (Clazz.superCall (this, com.stevesoft.pat.lookAhead, "matchInternal", [pos, pt]) >= 0) {
27 if (this.reverse) {
28 return -1;
29 } else {
30 return this.nextMatch (pos, pt);
31 }} else {
32 if (this.reverse) {
33 return this.nextMatch (pos, pt);
34 } else {
35 return -1;
36 }}}, "~N,com.stevesoft.pat.Pthings");
37 Clazz.overrideMethod (c$, "leftForm", 
38 function () {
39 if (this.reverse) {
40 return "(?!";
41 } else {
42 return "(?=";
43 }});
44 Clazz.overrideMethod (c$, "minChars", 
45 function () {
46 return  new com.stevesoft.pat.patInt (0);
47 });
48 Clazz.overrideMethod (c$, "maxChars", 
49 function () {
50 return  new com.stevesoft.pat.patInt (0);
51 });
52 Clazz.overrideMethod (c$, "clone1", 
53 function (h) {
54 var la =  new com.stevesoft.pat.lookAhead (this.reverse);
55 h.put (this, la);
56 h.put (la, la);
57 for (var i = 0; i < this.v.size (); i++) {
58 la.v.addElement ((this.v.elementAt (i)).clone (h));
59 }
60 return la;
61 }, "java.util.Hashtable");
62 });