2 // This software is now distributed according to
\r
3 // the Lesser Gnu Public License. Please see
\r
4 // http://www.gnu.org/copyleft/lesser.txt for
\r
6 // -- Happy Computing!
\r
8 package com.stevesoft.pat;
\r
13 * Matches any number of instances of sub Pattern this was the hardest method to
\r
14 * write. It implements '+', '*', '?', "{0,10}", "{5,}", "{5}", etc.
\r
16 * @see pat.Multi_stage2
\r
19 class Multi extends PatternSub
\r
23 public patInt minChars()
\r
25 return a.mul(p.countMinChars());
\r
28 public patInt maxChars()
\r
30 return b.mul(p.countMaxChars());
\r
37 public boolean matchFewest = false;
\r
41 * The fewest number of times the sub pattern can match.
\r
43 * The maximum number of times the sub pattern can match.
\r
49 public Multi(patInt a, patInt b, Pattern p) throws RegSyntax
\r
54 st2 = new Multi_stage2(a, b, p);
\r
59 public String toString()
\r
61 st2.matchFewest = matchFewest;
\r
62 return st2.toString();
\r
65 public int matchInternal(int pos, Pthings pt)
\r
69 st2 = new Multi_stage2(a, b, p);
\r
70 } catch (RegSyntax r__)
\r
73 st2.matchFewest = matchFewest;
\r
75 return st2.matchInternal(pos, pt);
\r
78 public Pattern clone1(Hashtable h)
\r
82 Multi m = new Multi(a, b, ((Pattern) p).clone(h));
\r
83 m.matchFewest = matchFewest;
\r
85 } catch (RegSyntax rs)
\r