1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
package com.stevesoft.pat; |
9 |
|
|
10 |
|
import java.util.Hashtable; |
11 |
|
|
12 |
|
|
|
|
| 0% |
Uncovered Elements: 44 (44) |
Complexity: 14 |
Complexity Density: 0.58 |
|
13 |
|
class lookAhead extends Or |
14 |
|
{ |
15 |
|
boolean reverse; |
16 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
17 |
0 |
lookAhead(boolean b)... |
18 |
|
{ |
19 |
0 |
reverse = b; |
20 |
|
} |
21 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
22 |
0 |
public Pattern getNext()... |
23 |
|
{ |
24 |
0 |
return null; |
25 |
|
} |
26 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
27 |
0 |
public int nextMatch(int pos, Pthings pt)... |
28 |
|
{ |
29 |
0 |
Pattern p = super.getNext(); |
30 |
0 |
if (p != null) |
31 |
|
{ |
32 |
0 |
return p.matchInternal(pos, pt); |
33 |
|
} |
34 |
|
else |
35 |
|
{ |
36 |
0 |
return pos; |
37 |
|
} |
38 |
|
} |
39 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 4 |
Complexity Density: 0.57 |
|
40 |
0 |
public int matchInternal(int pos, Pthings pt)... |
41 |
|
{ |
42 |
0 |
if (super.matchInternal(pos, pt) >= 0) |
43 |
|
{ |
44 |
0 |
if (reverse) |
45 |
|
{ |
46 |
0 |
return -1; |
47 |
|
} |
48 |
|
else |
49 |
|
{ |
50 |
0 |
return nextMatch(pos, pt); |
51 |
|
} |
52 |
|
} |
53 |
|
else |
54 |
|
{ |
55 |
0 |
if (reverse) |
56 |
|
{ |
57 |
0 |
return nextMatch(pos, pt); |
58 |
|
} |
59 |
|
else |
60 |
|
{ |
61 |
0 |
return -1; |
62 |
|
} |
63 |
|
} |
64 |
|
} |
65 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
66 |
0 |
String leftForm()... |
67 |
|
{ |
68 |
0 |
if (reverse) |
69 |
|
{ |
70 |
0 |
return "(?!"; |
71 |
|
} |
72 |
|
else |
73 |
|
{ |
74 |
0 |
return "(?="; |
75 |
|
} |
76 |
|
} |
77 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
78 |
0 |
public patInt minChars()... |
79 |
|
{ |
80 |
0 |
return new patInt(0); |
81 |
|
} |
82 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
83 |
0 |
public patInt maxChars()... |
84 |
|
{ |
85 |
0 |
return new patInt(0); |
86 |
|
} |
87 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
88 |
0 |
Pattern clone1(Hashtable h)... |
89 |
|
{ |
90 |
0 |
lookAhead la = new lookAhead(reverse); |
91 |
0 |
h.put(this, la); |
92 |
0 |
h.put(la, la); |
93 |
0 |
for (int i = 0; i < v.size(); i++) |
94 |
|
{ |
95 |
0 |
la.v.addElement(((Pattern) v.elementAt(i)).clone(h)); |
96 |
|
} |
97 |
0 |
return la; |
98 |
|
} |
99 |
|
} |