File path: /jfreechart-1.0.10/src/org/jfree/data/DefaultKeyedValues.java | File path: /jfreechart-1.0.10/src/org/jfree/data/category/CategoryToPieDataset.java | |||
Method name: boolean equals(Object)
|
Method name: boolean equals(Object)
|
|||
Number of AST nodes: 21 | Number of AST nodes: 21 | |||
1 | if (obj == this) {↵ | 1 | if (obj == this) {↵ | |
2 | return true;↵ | 2 | return true;↵ | |
3 | }↵ | 3 | }↵ | |
4 | if (!(obj instanceof KeyedValues)) {↵ | 4 | if (!(obj instanceof PieDataset)) {↵ | |
5 | return false;↵ | 5 | return false;↵ | |
6 | }↵ | 6 | }↵ | |
7 | KeyedValues that = (KeyedValues) obj;↵ | 7 | PieDataset that = (PieDataset) obj;↵ | |
8 | int count = getItemCount();↵ | 8 | int count = getItemCount();↵ | |
9 | if (count != that.getItemCount()) {↵ | 9 | if (that.getItemCount() != count) {↵ | |
10 | return false;↵ | 10 | return false;↵ | |
11 | }↵ | 11 | }↵ | |
12 | for (int i = 0; i < count; i++) {↵ | 12 | for (int i = 0; i < count; i++) {↵ | |
13 | Comparable k1 = getKey(i);↵ | 13 | Comparable k1 = getKey(i);↵ | |
14 | Comparable k2 = that.getKey(i);↵ | 14 | Comparable k2 = that.getKey(i);↵ | |
15 | if (!k1.equals(k2)) {↵ | 15 | if (!k1.equals(k2)) {↵ | |
16 | return false;↵ | 16 | return false;↵ | |
17 | }↵ | 17 | }↵ | |
18 | Number v1 = getValue(i);↵ | 18 | Number v1 = getValue(i);↵ | |
19 | Number v2 = that.getValue(i);↵ | 19 | Number v2 = that.getValue(i);↵ | |
20 | if (v1 == null) {↵ | 20 | if (v1 == null) {↵ | |
21 | if (v2 != null) {↵ | 21 | if (v2 != null) {↵ | |
22 | return false;↵ | 22 | return false;↵ | |
23 | }↵ | 23 | }↵ | |
24 | }↵ | 24 | }↵ | |
25 | else {↵ | 25 | else {↵ | |
26 | if (!v1.equals(v2)) {↵ | 26 | if (!v1.equals(v2)) {↵ | |
27 | return false;↵ | 27 | return false;↵ | |
28 | }↵ | 28 | }↵ | |
29 | }↵ | 29 | }↵ | |
30 | }↵ | 30 | }↵ | |
31 | return true; | 31 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 1.2 |
Clones location | Clones are in different classes |
Number of node comparisons | 68 |
Number of mapped statements | 21 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 7.9 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | if (obj == this) | 1 | if (obj == this) | ||||||||||||||||||
2 | return true; | 2 | return true; | ||||||||||||||||||
3 | if (!(obj instanceof KeyedValues)) |
| 3 | if (!(obj instanceof PieDataset)) | |||||||||||||||||
4 | return false; | 4 | return false; | ||||||||||||||||||
5 | KeyedValues that = (KeyedValues)obj; |
| 5 | PieDataset that = (PieDataset)obj; | |||||||||||||||||
6 | int count = getItemCount(); | 6 | int count = getItemCount(); | ||||||||||||||||||
7 | if (count != that.getItemCount()) |
| 7 | if (that.getItemCount() != count) | |||||||||||||||||
8 | return false; | 8 | return false; | ||||||||||||||||||
9 | for (int i = 0; i < count; i++) | 9 | for (int i = 0; i < count; i++) | ||||||||||||||||||
10 | Comparable k1 = getKey(i); | 10 | Comparable k1 = getKey(i); | ||||||||||||||||||
11 | Comparable k2 = that.getKey(i); |
| 11 | Comparable k2 = that.getKey(i); | |||||||||||||||||
12 | if (!k1.equals(k2)) | 12 | if (!k1.equals(k2)) | ||||||||||||||||||
13 | return false; | 13 | return false; | ||||||||||||||||||
14 | Number v1 = getValue(i); | 14 | Number v1 = getValue(i); | ||||||||||||||||||
15 | Number v2 = that.getValue(i); |
| 15 | Number v2 = that.getValue(i); | |||||||||||||||||
16 | if (v1 == null) | 16 | if (v1 == null) | ||||||||||||||||||
17 | if (v2 != null) | 17 | if (v2 != null) | ||||||||||||||||||
18 | return false; | 18 | return false; | ||||||||||||||||||
else | else | ||||||||||||||||||||
19 | if (!v1.equals(v2)) | 19 | if (!v1.equals(v2)) | ||||||||||||||||||
20 | return false; | 20 | return false; | ||||||||||||||||||
21 | return true; | 21 | return true; |
Row | Violation |
---|---|
1 | Expression count cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression that.getItemCount() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression that.getItemCount() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression count cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | The refactoring of the clones is infeasible, because classes org.jfree.data.DefaultKeyedValues and org.jfree.data.category.CategoryToPieDataset do not have a common superclass |