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;
12 /** This class matches a single character. */
13 class oneChar extends Pattern
19 public oneChar(char ci)
23 cu = CaseMgr.toUpperCase(c);
24 cl = CaseMgr.toLowerCase(c);
25 ct = CaseMgr.toTitleCase(c);
41 mask = c & altc & altc2;
44 public int matchInternal(int pos, Pthings pt)
48 if (pos < pt.src.length()
50 && ((p = pt.src.charAt(pos)) == c || (pt.ignoreCase && (p == altc || p == altc2))))
52 ret = nextMatch(pos + 1, pt);
57 public String toString()
59 return protect("" + c, PROTECT_THESE, ESC) + nextString();
62 public patInt minChars()
67 public patInt maxChars()
72 Pattern clone1(Hashtable h)
74 return new oneChar(c);