1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
package com.stevesoft.pat; |
9 |
|
|
10 |
|
import java.util.Hashtable; |
11 |
|
|
12 |
|
|
|
|
| 0% |
Uncovered Elements: 35 (35) |
Complexity: 14 |
Complexity Density: 0.61 |
|
13 |
|
class oneChar extends Pattern |
14 |
|
{ |
15 |
|
char c, altc, altc2; |
16 |
|
|
17 |
|
int mask; |
18 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 3 |
Complexity Density: 0.21 |
|
19 |
0 |
public oneChar(char ci)... |
20 |
|
{ |
21 |
0 |
c = ci; |
22 |
0 |
char cu, cl, ct; |
23 |
0 |
cu = CaseMgr.toUpperCase(c); |
24 |
0 |
cl = CaseMgr.toLowerCase(c); |
25 |
0 |
ct = CaseMgr.toTitleCase(c); |
26 |
0 |
if (c == cu) |
27 |
|
{ |
28 |
0 |
altc = cl; |
29 |
0 |
altc2 = ct; |
30 |
|
} |
31 |
0 |
else if (c == cl) |
32 |
|
{ |
33 |
0 |
altc = cu; |
34 |
0 |
altc2 = ct; |
35 |
|
} |
36 |
|
else |
37 |
|
{ |
38 |
0 |
altc = cl; |
39 |
0 |
altc2 = cu; |
40 |
|
} |
41 |
0 |
mask = c & altc & altc2; |
42 |
|
} |
43 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 7 |
Complexity Density: 1.4 |
|
44 |
0 |
public int matchInternal(int pos, Pthings pt)... |
45 |
|
{ |
46 |
0 |
char p; |
47 |
0 |
int ret = -1; |
48 |
0 |
if (pos < pt.src.length() && !Masked(pos, pt) |
49 |
|
&& ((p = pt.src.charAt(pos)) == c |
50 |
|
|| (pt.ignoreCase && (p == altc || p == altc2)))) |
51 |
|
{ |
52 |
0 |
ret = nextMatch(pos + 1, pt); |
53 |
|
} |
54 |
0 |
return ret; |
55 |
|
} |
56 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
57 |
0 |
public String toString()... |
58 |
|
{ |
59 |
0 |
return protect("" + c, PROTECT_THESE, ESC) + nextString(); |
60 |
|
} |
61 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
62 |
0 |
public patInt minChars()... |
63 |
|
{ |
64 |
0 |
return new patInt(1); |
65 |
|
} |
66 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
67 |
0 |
public patInt maxChars()... |
68 |
|
{ |
69 |
0 |
return new patInt(1); |
70 |
|
} |
71 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
72 |
0 |
Pattern clone1(Hashtable h)... |
73 |
|
{ |
74 |
0 |
return new oneChar(c); |
75 |
|
} |
76 |
|
}; |