while (e.hasMoreElements()) {
Extension extension = (Extension) e.nextElement();
IColumbaService service = getServiceInstance(extension);
service.startService();
}
while (e.hasMoreElements()) {
Extension extension = (Extension) e.nextElement();
// retrieving the instance for the first time
// creates an instance in ExtensionHandler subclass
//
// instance reference is kept in hashmap automatically
IColumbaService service = getServiceInstance(extension);
service.initService();
}
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/scripting/service/ServiceManager.java
|
|
File path: /columba-1.4-src/core/src/main/java/org/columba/core/scripting/service/ServiceManager.java
|
Method name: void startServices()
|
|
Method name: void initServices()
|
Number of AST nodes: 4
|
|
Number of AST nodes: 4
|
|
1 | while (e.hasMoreElements()) {↵ | | 1 | while (e.hasMoreElements()) {↵
|
2 | Extension extension = (Extension) e.nextElement();↵ | | 2 | Extension extension = (Extension) e.nextElement();↵
|
|
| | | 3 | // retrieving the instance for the first time↵
|
| | | 4 | // creates an instance in ExtensionHandler subclass↵
|
| | | 5 | // ↵
|
| | | 6 | // instance reference is kept in hashmap automatically↵
|
3 | IColumbaService service = getServiceInstance(extension);↵ | | 7 | IColumbaService service = getServiceInstance(extension);↵
|
4 | service.startService();↵ | | 8 | service.initService();↵
|
|
5 | } | | 9 | }
|
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.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 16 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.8 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
2 | while (e.hasMoreElements()) | | 2 | while (e.hasMoreElements()) |
3 | Extension extension = (Extension)e.nextElement(); | | 3 | Extension extension = (Extension)e.nextElement(); |
4 | IColumbaService service = getServiceInstance(extension); | | 4 | IColumbaService service = getServiceInstance(extension); |
| | | 5 | |
5 | | | | |
Precondition Violations (2)
Row |
Violation |
1 | Unmatched statement service.initService(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement service.startService(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |