if (obj == this) {
return true;
}
if (!(obj instanceof Directory)) {
return false;
}
Directory d = (Directory) obj;
return this.directory.equals(d.directory);
if (obj == this) {
return true;
}
if (obj == null || !obj.getClass().equals(getClass())) {
return false;
}
TemplateElement t = (TemplateElement) obj;
return
(name == null ? t.name == null : name.equals(t.name))
&& optional == t.optional
&& implicit == t.implicit;
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/ssh/Directory.java
|
|
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/MacroDef.java
|
Method name: boolean equals(Object)
|
|
Method name: boolean equals(Object)
|
Number of AST nodes: 6
|
|
Number of AST nodes: 6
|
|
1 | if (obj == this) {↵ | | 1 | if (obj == this) {↵
|
2 | return true;↵ | | 2 | return true;↵
|
3 | }↵ | | 3 | ↵
|
|
| | | 4 | }↵
|
4 | if (!(obj instanceof Directory)) {↵ | | 5 | if (obj == null || !obj.getClass().equals(getClass())) {↵
|
5 | return false;↵ | | 6 | return false;↵
|
6 | }↵ | | 7 | }↵
|
|
7 | Directory d = (Directory) obj;↵ | | 8 | TemplateElement t = (TemplateElement) obj;↵
|
|
8 | return this.directory.equals(d.directory)↵ | | 9 | return↵
|
| | | 10 | (name == null ? t.name == null : name.equals(t.name))↵
|
| | | 11 | && optional == t.optional↵
|
9 | ; | | 12 | && implicit == t.implicit;
|
See real code fragment |
|
See real code fragment |
Summary
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) | 0.3 |
Clones location | Clones are in different classes |
Number of node comparisons | 7 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 2 |
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) | 0.2 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | if (obj == this) | | 1 | if (obj == this) |
2 | | | 2 | |
Precondition Violations (2)
Row |
Violation |
1 | Conditional return true; |
2 | Conditional return true; |