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