1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
package org.sat4j.reader.csp; |
26 |
|
|
27 |
|
import java.util.Iterator; |
28 |
|
import java.util.NoSuchElementException; |
29 |
|
|
|
|
| 0% |
Uncovered Elements: 27 (27) |
Complexity: 4 |
Complexity Density: 0,85 |
|
30 |
|
public class EnumeratedDomain implements Domain { |
31 |
|
|
32 |
|
private final int[] values; |
33 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
34 |
0
|
public EnumeratedDomain(int[] values) {... |
35 |
0
|
this.values = values; |
36 |
|
} |
37 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
38 |
0
|
public int get(int i) {... |
39 |
0
|
return values[i]; |
40 |
|
} |
41 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
42 |
0
|
public int size() {... |
43 |
0
|
return values.length; |
44 |
|
} |
45 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
46 |
0
|
public Iterator<Integer> iterator() {... |
47 |
0
|
return new Iterator<Integer>() { |
48 |
|
private int i = 0; |
49 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
50 |
0
|
public boolean hasNext() {... |
51 |
0
|
return i < values.length; |
52 |
|
} |
53 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0,67 |
|
54 |
0
|
public Integer next() {... |
55 |
0
|
if (i == values.length) |
56 |
0
|
throw new NoSuchElementException(); |
57 |
0
|
return values[i++]; |
58 |
|
} |
59 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
60 |
0
|
public void remove() {... |
61 |
0
|
throw new UnsupportedOperationException(); |
62 |
|
} |
63 |
|
}; |
64 |
|
} |
65 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 3 |
Complexity Density: 0,75 |
|
66 |
0
|
public int pos(int value) {... |
67 |
0
|
for (int i = 0; i < values.length; i++) |
68 |
0
|
if (values[i] == value) |
69 |
0
|
return i; |
70 |
0
|
return -1; |
71 |
|
} |
72 |
|
} |