JAL-1807 test
[jalviewjs.git] / bin / com / stevesoft / pat / Or.js
1 Clazz.declarePackage ("com.stevesoft.pat");
2 Clazz.load (["com.stevesoft.pat.Pattern"], "com.stevesoft.pat.Or", ["com.stevesoft.pat.patInt", "java.lang.StringBuffer", "java.util.Vector"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.v = null;
5 this.pv = null;
6 Clazz.instantialize (this, arguments);
7 }, com.stevesoft.pat, "Or", com.stevesoft.pat.Pattern);
8 Clazz.makeConstructor (c$, 
9 function () {
10 Clazz.superConstructor (this, com.stevesoft.pat.Or, []);
11 this.v =  new java.util.Vector ();
12 });
13 Clazz.defineMethod (c$, "leftForm", 
14 function () {
15 return "(?:";
16 });
17 Clazz.defineMethod (c$, "rightForm", 
18 function () {
19 return ")";
20 });
21 Clazz.defineMethod (c$, "sepForm", 
22 function () {
23 return "|";
24 });
25 Clazz.defineMethod (c$, "addOr", 
26 function (p) {
27 this.pv = null;
28 this.v.addElement (p);
29 p.setParent (this);
30 return this;
31 }, "com.stevesoft.pat.Pattern");
32 Clazz.defineMethod (c$, "toString", 
33 function () {
34 var i;
35 var sb =  new StringBuffer ();
36 sb.append (this.leftForm ());
37 if (this.v.size () > 0) {
38 sb.append ((this.v.elementAt (0)).toString ());
39 }for (i = 1; i < this.v.size (); i++) {
40 sb.append (this.sepForm ());
41 sb.append ((this.v.elementAt (i)).toString ());
42 }
43 sb.append (this.rightForm ());
44 sb.append (this.nextString ());
45 return sb.toString ();
46 });
47 Clazz.defineMethod (c$, "matchInternal", 
48 function (pos, pt) {
49 if (this.pv == null) {
50 this.pv =  new Array (this.v.size ());
51 this.v.copyInto (this.pv);
52 }for (var i = 0; i < this.v.size (); i++) {
53 var p = this.pv[i];
54 var r = p.matchInternal (pos, pt);
55 if (r >= 0) {
56 return r;
57 }}
58 return -1;
59 }, "~N,com.stevesoft.pat.Pthings");
60 Clazz.overrideMethod (c$, "minChars", 
61 function () {
62 if (this.v.size () == 0) {
63 return  new com.stevesoft.pat.patInt (0);
64 }var m = (this.v.elementAt (0)).countMinChars ();
65 for (var i = 1; i < this.v.size (); i++) {
66 var p = this.v.elementAt (i);
67 m.mineq (p.countMinChars ());
68 }
69 return m;
70 });
71 Clazz.overrideMethod (c$, "maxChars", 
72 function () {
73 if (this.v.size () == 0) {
74 return  new com.stevesoft.pat.patInt (0);
75 }var m = (this.v.elementAt (0)).countMaxChars ();
76 for (var i = 1; i < this.v.size (); i++) {
77 var p = this.v.elementAt (i);
78 m.maxeq (p.countMaxChars ());
79 }
80 return m;
81 });
82 Clazz.overrideMethod (c$, "clone1", 
83 function (h) {
84 var o =  new com.stevesoft.pat.Or ();
85 h.put (this, o);
86 h.put (o, o);
87 for (var i = 0; i < this.v.size (); i++) {
88 o.v.addElement ((this.v.elementAt (i)).clone (h));
89 }
90 return o;
91 }, "java.util.Hashtable");
92 });