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: 28 (28) |
Complexity: 4 |
Complexity Density: 0,79 |
|
30 |
|
public class SingletonDomain implements Domain { |
31 |
|
|
32 |
|
private final int value; |
33 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
34 |
0
|
public SingletonDomain(int v) {... |
35 |
0
|
value = v; |
36 |
|
} |
37 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0,67 |
|
38 |
0
|
public int get(int i) {... |
39 |
0
|
if (i != 0) { |
40 |
0
|
throw new IllegalArgumentException(); |
41 |
|
} |
42 |
0
|
return value; |
43 |
|
} |
44 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
45 |
0
|
public int size() {... |
46 |
0
|
return 1; |
47 |
|
} |
48 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
49 |
0
|
public Iterator<Integer> iterator() {... |
50 |
0
|
return new Iterator<Integer>() { |
51 |
|
private int i = 0; |
52 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
53 |
0
|
public boolean hasNext() {... |
54 |
0
|
return i < 1; |
55 |
|
} |
56 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0,67 |
|
57 |
0
|
public Integer next() {... |
58 |
0
|
if (i == 1) |
59 |
0
|
throw new NoSuchElementException(); |
60 |
0
|
return value; |
61 |
|
} |
62 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
63 |
0
|
public void remove() {... |
64 |
0
|
throw new UnsupportedOperationException(); |
65 |
|
} |
66 |
|
}; |
67 |
|
} |
68 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0,67 |
|
69 |
0
|
public int pos(int value) {... |
70 |
0
|
if (value != this.value) { |
71 |
0
|
throw new IllegalArgumentException(); |
72 |
|
} |
73 |
0
|
return 0; |
74 |
|
} |
75 |
|
|
76 |
|
} |