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;
13 * The Bracket is a form of the Or class, implements the pattern element [ ].
15 class Bracket extends Or
46 public int matchInternal(int pos, Pthings pt)
48 if (pos >= pt.src.length())
52 int r = super.matchInternal(pos, pt);
53 if ((neg && r < 0) || (!neg && r >= 0))
55 return nextMatch(pos + 1, pt);
60 public patInt minChars()
65 public patInt maxChars()
70 public Or addOr(Pattern p)
78 public Pattern clone1(Hashtable h)
80 Bracket b = new Bracket(neg);
82 for (int i = 0; i < v.size(); i++)
84 b.v.addElement(((Pattern) v.elementAt(i)).clone1(h));