1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.qedeq.base.io; |
17 |
|
|
18 |
|
import java.util.Iterator; |
19 |
|
import java.util.Set; |
20 |
|
import java.util.TreeSet; |
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
@author |
27 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (49) |
Complexity: 17 |
Complexity Density: 0.57 |
|
28 |
|
public final class VersionSet { |
29 |
|
|
30 |
|
|
31 |
|
private final Set set; |
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
@param |
39 |
|
@throws |
40 |
|
@throws |
41 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
42 |
14
|
public VersionSet(final String version) {... |
43 |
14
|
set = new TreeSet(); |
44 |
14
|
add(version); |
45 |
|
} |
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
50 |
100
|
public VersionSet() {... |
51 |
100
|
set = new TreeSet(); |
52 |
|
} |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
@param |
58 |
|
@return |
59 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.4 |
|
60 |
458
|
public boolean contains(final String version) {... |
61 |
458
|
Version v = null; |
62 |
458
|
try { |
63 |
458
|
v = new Version(version); |
64 |
|
} catch (RuntimeException e) { |
65 |
1
|
return false; |
66 |
|
} |
67 |
457
|
return set.contains(v); |
68 |
|
} |
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
@param |
74 |
|
@return |
75 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
76 |
13
|
public boolean contains(final Version version) {... |
77 |
13
|
return set.contains(version); |
78 |
|
} |
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
@param |
84 |
|
@throws |
85 |
|
@throws |
86 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
87 |
204
|
public void add(final String version) {... |
88 |
204
|
add(new Version(version)); |
89 |
|
} |
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
@param |
95 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
96 |
204
|
public void add(final Version version) {... |
97 |
204
|
set.add(version); |
98 |
|
} |
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
@param |
104 |
|
@return |
105 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
106 |
1
|
public boolean addAll(final VersionSet versions) {... |
107 |
1
|
return set.addAll(versions.set); |
108 |
|
} |
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
@return |
114 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
115 |
4
|
public boolean isEmpty() {... |
116 |
4
|
return set.isEmpty(); |
117 |
|
} |
118 |
|
|
119 |
|
|
120 |
|
|
121 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
122 |
1
|
public void clear() {... |
123 |
1
|
set.clear(); |
124 |
|
} |
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
|
130 |
|
@return |
131 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
132 |
1
|
public Iterator iterator() {... |
133 |
1
|
return set.iterator(); |
134 |
|
} |
135 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
136 |
4
|
public int hashCode() {... |
137 |
4
|
return set.hashCode(); |
138 |
|
} |
139 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
140 |
18
|
public boolean equals(final Object o) {... |
141 |
18
|
if (!(o instanceof VersionSet)) { |
142 |
3
|
return false; |
143 |
|
} |
144 |
15
|
return set.equals(((VersionSet) o).set); |
145 |
|
} |
146 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 3 |
Complexity Density: 0.27 |
|
147 |
5
|
public String toString() {... |
148 |
5
|
final StringBuffer buffer = new StringBuffer(30); |
149 |
5
|
buffer.append("{"); |
150 |
5
|
Iterator e = set.iterator(); |
151 |
5
|
boolean notFirst = false; |
152 |
10
|
while (e.hasNext()) { |
153 |
5
|
if (notFirst) { |
154 |
1
|
buffer.append(", "); |
155 |
|
} else { |
156 |
4
|
notFirst = true; |
157 |
|
} |
158 |
5
|
buffer.append(String.valueOf(e.next())); |
159 |
|
} |
160 |
5
|
buffer.append("}"); |
161 |
5
|
return buffer.toString(); |
162 |
|
} |
163 |
|
|
164 |
|
} |