1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
package com.stevesoft.pat; |
9 |
|
|
10 |
|
import java.util.Hashtable; |
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
|
|
| 0% |
Uncovered Elements: 40 (40) |
Complexity: 16 |
Complexity Density: 0.76 |
|
16 |
|
class Group extends Pattern |
17 |
|
{ |
18 |
|
char op, cl; |
19 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
20 |
0 |
Group(char opi, char cli)... |
21 |
|
{ |
22 |
0 |
op = opi; |
23 |
0 |
cl = cli; |
24 |
|
} |
25 |
|
|
|
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 12 |
Complexity Density: 0.75 |
|
26 |
0 |
public int matchInternal(int pos, Pthings pt)... |
27 |
|
{ |
28 |
0 |
int i, count = 1; |
29 |
0 |
if (pos < pt.src.length()) |
30 |
|
{ |
31 |
0 |
if (!Masked(pos, pt) && pt.src.charAt(pos) != op) |
32 |
|
{ |
33 |
0 |
return -1; |
34 |
|
} |
35 |
|
} |
36 |
0 |
for (i = pos + 1; i < pt.src.length(); i++) |
37 |
|
{ |
38 |
0 |
char c = pt.src.charAt(i); |
39 |
0 |
boolean b = !Masked(i, pt); |
40 |
0 |
if (b && c == ESC) |
41 |
|
{ |
42 |
0 |
i++; |
43 |
|
} |
44 |
|
else |
45 |
|
{ |
46 |
0 |
if (b && c == cl) |
47 |
|
{ |
48 |
0 |
count--; |
49 |
|
} |
50 |
0 |
if (count == 0) |
51 |
|
{ |
52 |
0 |
return nextMatch(i + 1, pt); |
53 |
|
} |
54 |
0 |
if (b && c == op) |
55 |
|
{ |
56 |
0 |
count++; |
57 |
|
} |
58 |
|
} |
59 |
|
} |
60 |
0 |
return -1; |
61 |
|
} |
62 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
63 |
0 |
public String toString()... |
64 |
|
{ |
65 |
0 |
return "(?@" + op + cl + ")" + nextString(); |
66 |
|
} |
67 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
68 |
0 |
public patInt minChars()... |
69 |
|
{ |
70 |
0 |
return new patInt(2); |
71 |
|
} |
72 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
73 |
0 |
Pattern clone1(Hashtable h)... |
74 |
|
{ |
75 |
0 |
return new Group(op, cl); |
76 |
|
} |
77 |
|
}; |