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