while (iter.hasNext()) {
boolean matchExists = matcher.contains(input, templatePattern);
if (startsWith) {
if (matchExists) {
combined.add(new Integer(matcher.getMatch().group(1)));
}
combined.add(iter.next());
} else {
combined.add(iter.next());
if (matchExists) {
combined.add(new Integer(matcher.getMatch().group(1)));
}
}
}
while (iter.hasNext()) {
boolean matchExists = matcher.contains(input, templatePattern);
if (startsWith) {
if (matchExists) {
combined.add(new Integer(matcher.getMatch().group(1)));
}
combined.add(iter.next());
} else {
combined.add(iter.next());
if (matchExists) {
combined.add(new Integer(matcher.getMatch().group(1)));
}
}
}
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/functions/RegexFunction.java
|
|
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/extractor/RegexExtractor.java
|
Method name: Object[] generateTemplate(String)
|
|
Method name: void initTemplate()
|
Number of AST nodes: 9
|
|
Number of AST nodes: 9
|
|
1 | while (iter.hasNext()) {↵ | | 1 | while (iter.hasNext()) {↵
|
2 | boolean matchExists = matcher.contains(input, templatePattern);↵ | | 2 | boolean matchExists = matcher.contains(input, templatePattern);↵
|
3 | if (startsWith) {↵ | | 3 | if (startsWith) {↵
|
4 | if (matchExists) {↵ | | 4 | if (matchExists) {↵
|
5 | combined.add(new Integer(matcher.getMatch().group(1)));↵ | | 5 | combined.add(new Integer(matcher.getMatch().group(1)));↵
|
6 | }↵ | | 6 | }↵
|
7 | combined.add(iter.next());↵ | | 7 | combined.add(iter.next());↵
|
8 | } else {↵ | | 8 | } else {↵
|
9 | combined.add(iter.next());↵ | | 9 | combined.add(iter.next());↵
|
10 | if (matchExists) {↵ | | 10 | if (matchExists) {↵
|
11 | combined.add(new Integer(matcher.getMatch().group(1)));↵ | | 11 | combined.add(new Integer(matcher.getMatch().group(1)));↵
|
12 | }↵ | | 12 | }↵
|
13 | }↵ | | 13 | }↵
|
14 | } | | 14 | }
|
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.3 |
Clones location | Clones are in different classes |
Number of node comparisons | 26 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 9 |
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) | 173.9 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
8 | while (iter.hasNext()) | | 17 | while (iter.hasNext()) |
9 | boolean matchExists = matcher.contains(input, templatePattern); | | 18 | boolean matchExists = matcher.contains(input, templatePattern); |
10 | | | 19 | |
11 | | | 20 | |
12 | combined.add(new Integer(matcher.getMatch().group(1))); | | 21 | combined.add(new Integer(matcher.getMatch().group(1))); |
13 | combined.add(iter.next()); | | 22 | combined.add(iter.next()); |
| | | | |
14 | combined.add(iter.next()); | | 23 | combined.add(iter.next()); |
15 | | | 24 | |
16 | combined.add(new Integer(matcher.getMatch().group(1))); | | 25 | combined.add(new Integer(matcher.getMatch().group(1))); |
Precondition Violations (0)
Row |
Violation |