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
9 import java.util.Hashtable;
\r
11 /** This class matches a single character. */
\r
12 class oneChar extends Pattern {
\r
15 public oneChar(char ci) {
\r
18 cu = CaseMgr.toUpperCase(c);
\r
19 cl = CaseMgr.toLowerCase(c);
\r
20 ct = CaseMgr.toTitleCase(c);
\r
24 } else if(c == cl) {
\r
31 mask = c & altc & altc2;
\r
33 public int matchInternal(int pos,Pthings pt) {
\r
36 if (pos < pt.src.length() && !Masked(pos,pt)
\r
37 && ((p=pt.src.charAt(pos))==c ||
\r
38 (pt.ignoreCase&& (p==altc||p==altc2) ) ))
\r
39 ret = nextMatch(pos+1,pt);
\r
42 public String toString() {
\r
43 return protect(""+c,PROTECT_THESE,ESC)+nextString();
\r
45 public patInt minChars() { return new patInt(1); }
\r
46 public patInt maxChars() { return new patInt(1); }
\r
47 Pattern clone1(Hashtable h) { return new oneChar(c); }
\r