1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.extension.rating; |
21 |
|
|
22 |
|
import org.apache.commons.lang3.builder.HashCodeBuilder; |
23 |
|
import org.xwiki.extension.repository.rating.RatableExtensionRepository; |
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
@version |
29 |
|
@since |
30 |
|
|
|
|
| 51.9% |
Uncovered Elements: 13 (27) |
Complexity: 8 |
Complexity Density: 0.47 |
|
31 |
|
public class DefaultExtensionRating implements ExtensionRating |
32 |
|
{ |
33 |
|
|
34 |
|
@see |
35 |
|
|
36 |
|
private int totalVotes; |
37 |
|
|
38 |
|
|
39 |
|
@see |
40 |
|
|
41 |
|
private float averageVote; |
42 |
|
|
43 |
|
|
44 |
|
@see |
45 |
|
|
46 |
|
private RatableExtensionRepository repository; |
47 |
|
|
48 |
|
|
49 |
|
@param |
50 |
|
@param |
51 |
|
@param |
52 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
53 |
67 |
public DefaultExtensionRating(int totalVotes, float averageVote, RatableExtensionRepository repository)... |
54 |
|
{ |
55 |
67 |
this.totalVotes = totalVotes; |
56 |
67 |
this.averageVote = averageVote; |
57 |
67 |
this.repository = repository; |
58 |
|
} |
59 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
60 |
60 |
@Override... |
61 |
|
public int getTotalVotes() |
62 |
|
{ |
63 |
60 |
return this.totalVotes; |
64 |
|
} |
65 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
66 |
30 |
@Override... |
67 |
|
public float getAverageVote() |
68 |
|
{ |
69 |
30 |
return this.averageVote; |
70 |
|
} |
71 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
72 |
0 |
@Override... |
73 |
|
public RatableExtensionRepository getRepository() |
74 |
|
{ |
75 |
0 |
return this.repository; |
76 |
|
} |
77 |
|
|
78 |
|
|
79 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
80 |
0 |
@Override... |
81 |
|
public boolean equals(Object obj) |
82 |
|
{ |
83 |
0 |
if (obj == this) { |
84 |
0 |
return true; |
85 |
|
} |
86 |
|
|
87 |
0 |
if (obj instanceof ExtensionRating) { |
88 |
0 |
ExtensionRating rating = (ExtensionRating) obj; |
89 |
0 |
return this.totalVotes == rating.getTotalVotes() && this.averageVote == rating.getAverageVote() |
90 |
|
&& this.repository == rating.getRepository(); |
91 |
|
} else { |
92 |
0 |
return false; |
93 |
|
} |
94 |
|
} |
95 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
96 |
30 |
@Override... |
97 |
|
public int hashCode() |
98 |
|
{ |
99 |
30 |
HashCodeBuilder builder = new HashCodeBuilder(); |
100 |
|
|
101 |
30 |
builder.append(this.totalVotes); |
102 |
30 |
builder.append(this.averageVote); |
103 |
30 |
builder.append(this.repository); |
104 |
|
|
105 |
30 |
return builder.toHashCode(); |
106 |
|
} |
107 |
|
} |