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;
11 import java.util.Vector;
14 * The Bracket is a form of the Or class, implements the pattern element [ ].
16 class Bracket extends Or
47 public int matchInternal(int pos, Pthings pt)
49 if (pos >= pt.src.length())
53 int r = super.matchInternal(pos, pt);
54 if ((neg && r < 0) || (!neg && r >= 0))
56 return nextMatch(pos + 1, pt);
61 public patInt minChars()
66 public patInt maxChars()
71 public Or addOr(Pattern p)
79 public Pattern clone1(Hashtable h)
81 Bracket b = new Bracket(neg);
83 for (int i = 0; i < v.size(); i++)
85 b.v.addElement(((Pattern) v.elementAt(i)).clone1(h));