1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.qedeq.kernel.se.dto.module; |
17 |
|
|
18 |
|
import java.util.ArrayList; |
19 |
|
import java.util.List; |
20 |
|
|
21 |
|
import org.qedeq.base.utility.EqualsUtility; |
22 |
|
import org.qedeq.kernel.se.base.module.LinkList; |
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
@author |
29 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (51) |
Complexity: 16 |
Complexity Density: 0.62 |
|
30 |
|
public class LinkListVo implements LinkList { |
31 |
|
|
32 |
|
|
33 |
|
private final List list; |
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
38 |
43
|
public LinkListVo() {... |
39 |
43
|
this.list = new ArrayList(); |
40 |
|
|
41 |
|
} |
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
@param |
47 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
48 |
34
|
public final void add(final String id) {... |
49 |
34
|
list.add(id); |
50 |
|
} |
51 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
52 |
687
|
public final int size() {... |
53 |
687
|
return list.size(); |
54 |
|
} |
55 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
56 |
720
|
public final String get(final int index) {... |
57 |
720
|
return (String) list.get(index); |
58 |
|
} |
59 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 5 |
Complexity Density: 0.56 |
|
60 |
78
|
public boolean equals(final Object obj) {... |
61 |
78
|
if (!(obj instanceof LinkListVo)) { |
62 |
7
|
return false; |
63 |
|
} |
64 |
71
|
final LinkListVo otherList = (LinkListVo) obj; |
65 |
71
|
if (size() != otherList.size()) { |
66 |
11
|
return false; |
67 |
|
} |
68 |
178
|
for (int i = 0; i < size(); i++) { |
69 |
122
|
if (!EqualsUtility.equals(get(i), otherList.get(i))) { |
70 |
4
|
return false; |
71 |
|
} |
72 |
|
} |
73 |
56
|
return true; |
74 |
|
} |
75 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
76 |
72
|
public int hashCode() {... |
77 |
72
|
int hash = 0; |
78 |
202
|
for (int i = 0; i < size(); i++) { |
79 |
130
|
hash = hash ^ (i + 1); |
80 |
130
|
if (get(i) != null) { |
81 |
128
|
hash = hash ^ get(i).hashCode(); |
82 |
|
} |
83 |
|
} |
84 |
72
|
return hash; |
85 |
|
} |
86 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 4 |
Complexity Density: 0.57 |
|
87 |
52
|
public String toString() {... |
88 |
52
|
final StringBuffer buffer = new StringBuffer("List of links:\n"); |
89 |
161
|
for (int i = 0; i < size(); i++) { |
90 |
109
|
if (i != 0) { |
91 |
60
|
buffer.append("\n"); |
92 |
|
} |
93 |
109
|
buffer.append((i + 1) + ":\n"); |
94 |
109
|
buffer.append(get(i) != null ? get(i) : null); |
95 |
|
} |
96 |
52
|
return buffer.toString(); |
97 |
|
} |
98 |
|
|
99 |
|
} |