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