1 Clazz.declarePackage ("com.stevesoft.pat");
2 Clazz.load (["com.stevesoft.pat.PatternSub"], "com.stevesoft.pat.FastMulti", ["com.stevesoft.pat.RegSyntaxError", "$.patInt"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.fewestMatches = null;
5 this.mostMatches = null;
6 this.matchFewest = false;
8 Clazz.instantialize (this, arguments);
9 }, com.stevesoft.pat, "FastMulti", com.stevesoft.pat.PatternSub);
10 Clazz.overrideMethod (c$, "minChars",
12 return this.sub.countMinChars ().mul (this.fewestMatches);
14 Clazz.overrideMethod (c$, "maxChars",
16 return this.sub.countMaxChars ().mul (this.mostMatches);
18 Clazz.makeConstructor (c$,
20 Clazz.superConstructor (this, com.stevesoft.pat.FastMulti, []);
22 com.stevesoft.pat.RegSyntaxError.endItAll ("Null length pattern followed by *, +, or other Multi.");
23 }this.fewestMatches = a;
26 this.step = p.countMinChars ().intValue ();
27 this.sub.setParent (null);
28 }, "com.stevesoft.pat.patInt,com.stevesoft.pat.patInt,com.stevesoft.pat.Pattern");
29 Clazz.defineMethod (c$, "toString",
31 return this.sub.toString () + "{" + this.fewestMatches + "," + this.mostMatches + "}" + (this.matchFewest ? "?" : "") + "(?# <= fast multi)" + this.nextString ();
33 Clazz.defineMethod (c$, "matchInternal",
37 var endstr = pt.src.length () - this.step;
38 var matches = new com.stevesoft.pat.patInt (0);
39 if (this.matchFewest) {
40 if (this.fewestMatches.lessEq (matches)) {
41 var ii = this.nextMatch (i, pt);
44 }}while (i >= 0 && i <= endstr) {
45 i = this.sub.matchInternal (i, pt);
48 if (this.fewestMatches.lessEq (matches)) {
49 var ii = this.nextMatch (i, pt);
52 }}if (matches.equals (this.mostMatches)) {
57 while (this.fewestMatches.intValue () > nMatches) {
58 i = this.sub.matchInternal (i, pt);
65 if (this.mostMatches.finite ()) {
66 while (nMatches < this.mostMatches.intValue ()) {
67 i = this.sub.matchInternal (i, pt);
76 i = this.sub.matchInternal (i, pt);
84 var r = this.nextMatch (m, pt);
89 if (nMatches < this.fewestMatches.intValue ()) {
93 }, "~N,com.stevesoft.pat.Pthings");
94 Clazz.overrideMethod (c$, "clone1",
97 var fm = new com.stevesoft.pat.FastMulti (this.fewestMatches, this.mostMatches, this.sub.clone (h));
98 fm.matchFewest = this.matchFewest;
101 if (Clazz.exceptionOf (rs, com.stevesoft.pat.RegSyntax)) {
107 }, "java.util.Hashtable");