1 Clazz.declarePackage ("com.stevesoft.pat");
\r
2 Clazz.load (["com.stevesoft.pat.Pattern"], "com.stevesoft.pat.Or", ["com.stevesoft.pat.patInt", "java.lang.StringBuffer", "java.util.Vector"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
6 Clazz.instantialize (this, arguments);
\r
7 }, com.stevesoft.pat, "Or", com.stevesoft.pat.Pattern);
\r
8 Clazz.makeConstructor (c$,
\r
10 Clazz.superConstructor (this, com.stevesoft.pat.Or, []);
\r
11 this.v = new java.util.Vector ();
\r
13 Clazz.defineMethod (c$, "leftForm",
\r
17 Clazz.defineMethod (c$, "rightForm",
\r
21 Clazz.defineMethod (c$, "sepForm",
\r
25 Clazz.defineMethod (c$, "addOr",
\r
28 this.v.addElement (p);
\r
31 }, "com.stevesoft.pat.Pattern");
\r
32 Clazz.defineMethod (c$, "toString",
\r
35 var sb = new StringBuffer ();
\r
36 sb.append (this.leftForm ());
\r
37 if (this.v.size () > 0) {
\r
38 sb.append ((this.v.elementAt (0)).toString ());
\r
39 }for (i = 1; i < this.v.size (); i++) {
\r
40 sb.append (this.sepForm ());
\r
41 sb.append ((this.v.elementAt (i)).toString ());
\r
43 sb.append (this.rightForm ());
\r
44 sb.append (this.nextString ());
\r
45 return sb.toString ();
\r
47 Clazz.defineMethod (c$, "matchInternal",
\r
48 function (pos, pt) {
\r
49 if (this.pv == null) {
\r
50 this.pv = new Array (this.v.size ());
\r
51 this.v.copyInto (this.pv);
\r
52 }for (var i = 0; i < this.v.size (); i++) {
\r
54 var r = p.matchInternal (pos, pt);
\r
59 }, "~N,com.stevesoft.pat.Pthings");
\r
60 Clazz.overrideMethod (c$, "minChars",
\r
62 if (this.v.size () == 0) {
\r
63 return new com.stevesoft.pat.patInt (0);
\r
64 }var m = (this.v.elementAt (0)).countMinChars ();
\r
65 for (var i = 1; i < this.v.size (); i++) {
\r
66 var p = this.v.elementAt (i);
\r
67 m.mineq (p.countMinChars ());
\r
71 Clazz.overrideMethod (c$, "maxChars",
\r
73 if (this.v.size () == 0) {
\r
74 return new com.stevesoft.pat.patInt (0);
\r
75 }var m = (this.v.elementAt (0)).countMaxChars ();
\r
76 for (var i = 1; i < this.v.size (); i++) {
\r
77 var p = this.v.elementAt (i);
\r
78 m.maxeq (p.countMaxChars ());
\r
82 Clazz.overrideMethod (c$, "clone1",
\r
84 var o = new com.stevesoft.pat.Or ();
\r
87 for (var i = 0; i < this.v.size (); i++) {
\r
88 o.v.addElement ((this.v.elementAt (i)).clone (h));
\r
91 }, "java.util.Hashtable");
\r