watch2.stop();
Thread.sleep(50);
long difference = watch.getTiming() - watch2.getTiming();
if (Math.abs(difference) < 40) {
fail("Stopwatch wasnt stopped.");
}
watch2.start();
Thread.sleep(50);
long difference = watch.getTiming() - watch2.getTiming();
if (Math.abs(difference) < 40) {
fail("Stopwatch wasnt restarted correctly.");
}
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/test/java/org/columba/core/util/StopWatchTest.java
|
|
File path: /columba-1.4-src/core/src/test/java/org/columba/core/util/StopWatchTest.java
|
Method name: void testStop()
|
|
Method name: void testStart()
|
Number of AST nodes: 5
|
|
Number of AST nodes: 5
|
|
1 | watch2.stop();↵ | | 1 | watch2.start();↵
|
|
2 | Thread.sleep(50);↵ | | 2 | Thread.sleep(50);↵
|
|
3 | long difference = watch.getTiming() - watch2.getTiming();↵ | | 3 | long difference = watch.getTiming() - watch2.getTiming();↵
|
|
4 | if (Math.abs(difference) < 40) {↵ | | 4 | if (Math.abs(difference) < 40) {↵
|
5 | fail("Stopwatch wasnt stopped.");↵ | | 5 | fail("Stopwatch wasnt restarted correctly.");↵
|
6 | } | | 6 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 13 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 4 |
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.7 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
3 | watch2.stop(); | | | |
| | | 5 | watch2.start(); |
4 | Thread.sleep(50); | | 6 | Thread.sleep(50); |
5 | long difference = watch.getTiming() - watch2.getTiming(); | | 7 | long difference = watch.getTiming() - watch2.getTiming(); |
6 | if (Math.abs(difference) < 40) | | 8 | if (Math.abs(difference) < 40) |
7 | fail("Stopwatch wasnt stopped."); | | 9 | fail("Stopwatch wasnt restarted correctly."); |
Precondition Violations (0)
Row |
Violation |