| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
package com.stevesoft.pat; |
| 9 |
|
|
| 10 |
|
import java.util.Hashtable; |
| 11 |
|
import java.util.Vector; |
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| |
|
| 0% |
Uncovered Elements: 40 (40) |
Complexity: 16 |
Complexity Density: 0.7 |
|
| 16 |
|
class Bracket extends Or |
| 17 |
|
{ |
| 18 |
|
boolean neg; |
| 19 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 20 |
0 |
Bracket(boolean n)... |
| 21 |
|
{ |
| 22 |
0 |
neg = n; |
| 23 |
|
} |
| 24 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 25 |
0 |
String leftForm()... |
| 26 |
|
{ |
| 27 |
0 |
if (neg) |
| 28 |
|
{ |
| 29 |
0 |
return "[^"; |
| 30 |
|
} |
| 31 |
|
else |
| 32 |
|
{ |
| 33 |
0 |
return "["; |
| 34 |
|
} |
| 35 |
|
} |
| 36 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 37 |
0 |
String rightForm()... |
| 38 |
|
{ |
| 39 |
0 |
return "]"; |
| 40 |
|
} |
| 41 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 42 |
0 |
String sepForm()... |
| 43 |
|
{ |
| 44 |
0 |
return ""; |
| 45 |
|
} |
| 46 |
|
|
| |
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 6 |
Complexity Density: 1 |
|
| 47 |
0 |
public int matchInternal(int pos, Pthings pt)... |
| 48 |
|
{ |
| 49 |
0 |
if (pos >= pt.src.length()) |
| 50 |
|
{ |
| 51 |
0 |
return -1; |
| 52 |
|
} |
| 53 |
0 |
int r = super.matchInternal(pos, pt); |
| 54 |
0 |
if ((neg && r < 0) || (!neg && r >= 0)) |
| 55 |
|
{ |
| 56 |
0 |
return nextMatch(pos + 1, pt); |
| 57 |
|
} |
| 58 |
0 |
return -1; |
| 59 |
|
} |
| 60 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 61 |
0 |
public patInt minChars()... |
| 62 |
|
{ |
| 63 |
0 |
return new patInt(1); |
| 64 |
|
} |
| 65 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 66 |
0 |
public patInt maxChars()... |
| 67 |
|
{ |
| 68 |
0 |
return new patInt(1); |
| 69 |
|
} |
| 70 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 71 |
0 |
public Or addOr(Pattern p)... |
| 72 |
|
{ |
| 73 |
0 |
pv = null; |
| 74 |
0 |
v.addElement(p); |
| 75 |
0 |
p.setParent(null); |
| 76 |
0 |
return this; |
| 77 |
|
} |
| 78 |
|
|
| |
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 79 |
0 |
public Pattern clone1(Hashtable h)... |
| 80 |
|
{ |
| 81 |
0 |
Bracket b = new Bracket(neg); |
| 82 |
0 |
b.v = new Vector(); |
| 83 |
0 |
for (int i = 0; i < v.size(); i++) |
| 84 |
|
{ |
| 85 |
0 |
b.v.addElement(((Pattern) v.elementAt(i)).clone1(h)); |
| 86 |
|
} |
| 87 |
0 |
return b; |
| 88 |
|
} |
| 89 |
|
}; |