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