switch(kind)
{
case PLUS:
return operand;
case MINUS:
return -operand;
default:
throw new InterpreterError("bad float unaryOperation");
}
switch(kind)
{
case PLUS:
return operand;
case MINUS:
return -operand;
default:
throw new InterpreterError("bad double unaryOperation");
}
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/bsh/Primitive.java
|
|
File path: /jEdit-4.2/src/bsh/Primitive.java
|
Method name: float floatUnaryOperation(Float, int)
|
|
Method name: double doubleUnaryOperation(Double, int)
|
Number of AST nodes: 7
|
|
Number of AST nodes: 7
|
|
1 | switch(kind)↵ | | 1 | switch(kind)↵
|
2 | {↵ | | 2 | {↵
|
3 | case PLUS:↵ | | 3 | case PLUS:↵
|
4 | return operand;↵ | | 4 | return operand;↵
|
5 | case MINUS:↵ | | 5 | case MINUS:↵
|
6 | return -operand;↵ | | 6 | return -operand;↵
|
7 | default:↵ | | 7 | default:↵
|
8 | throw new InterpreterError("bad float unaryOperation");↵ | | 8 | throw new InterpreterError("bad double unaryOperation");↵
|
9 | } | | 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 | 26 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 1.0 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
2 | switch (kind) | | 2 | switch (kind) |
3 | | | 3 | |
| | | 4 | |
4 | | | | |
5 | | | 5 | |
| | | 6 | |
6 | | | | |
7 | | | 7 | |
8 | throw new InterpreterError("bad float unaryOperation"); | | 8 | throw new InterpreterError("bad double unaryOperation"); |
Precondition Violations (4)
Row |
Violation |
1 | Unmatched return operand; |
2 | Unmatched return operand; |
3 | Unmatched return -operand; |
4 | Unmatched return -operand; |