File path: /jEdit-4.2/src/bsh/Primitive.java | File path: /jEdit-4.2/src/bsh/Primitive.java | |||
Method name: Object doubleBinaryOperation(Double, Double, int)
|
Method name: Object floatBinaryOperation(Float, Float, int)
|
|||
Number of AST nodes: 36 | Number of AST nodes: 36 | |||
1 | switch(kind)↵ | 1 | switch(kind)↵ | |
2 | {↵ | 2 | {↵ | |
3 | // boolean↵ | 3 | // boolean↵ | |
4 | case LT:↵ | 4 | case LT:↵ | |
5 | case LTX:↵ | 5 | case LTX:↵ | |
6 | return new Boolean(lhs < rhs);↵ | 6 | return new Boolean(lhs < rhs);↵ | |
7 | case GT:↵ | 7 | case GT:↵ | |
8 | case GTX:↵ | 8 | case GTX:↵ | |
9 | return new Boolean(lhs > rhs);↵ | 9 | return new Boolean(lhs > rhs);↵ | |
10 | case EQ:↵ | 10 | case EQ:↵ | |
11 | return new Boolean(lhs == rhs);↵ | 11 | return new Boolean(lhs == rhs);↵ | |
12 | case LE:↵ | 12 | case LE:↵ | |
13 | case LEX:↵ | 13 | case LEX:↵ | |
14 | return new Boolean(lhs <= rhs);↵ | 14 | return new Boolean(lhs <= rhs);↵ | |
15 | case GE:↵ | 15 | case GE:↵ | |
16 | case GEX:↵ | 16 | case GEX:↵ | |
17 | return new Boolean(lhs >= rhs);↵ | 17 | return new Boolean(lhs >= rhs);↵ | |
18 | case NE:↵ | 18 | case NE:↵ | |
19 | return new Boolean(lhs != rhs);↵ | 19 | return new Boolean(lhs != rhs);↵ | |
20 | // arithmetic↵ | 20 | // arithmetic↵ | |
21 | case PLUS:↵ | 21 | case PLUS:↵ | |
22 | return new Double(lhs + rhs);↵ | 22 | return new Float(lhs + rhs);↵ | |
23 | case MINUS:↵ | 23 | case MINUS:↵ | |
24 | return new Double(lhs - rhs);↵ | 24 | return new Float(lhs - rhs);↵ | |
25 | case STAR:↵ | 25 | case STAR:↵ | |
26 | return new Double(lhs * rhs);↵ | 26 | return new Float(lhs * rhs);↵ | |
27 | case SLASH:↵ | 27 | case SLASH:↵ | |
28 | return new Double(lhs / rhs);↵ | 28 | return new Float(lhs / rhs);↵ | |
29 | case MOD:↵ | 29 | case MOD:↵ | |
30 | return new Double(lhs % rhs);↵ | 30 | return new Float(lhs % rhs);↵ | |
31 | // can't shift floating-point values↵ | 31 | // can't shift floats↵ | |
32 | case LSHIFT:↵ | 32 | case LSHIFT:↵ | |
33 | case LSHIFTX:↵ | 33 | case LSHIFTX:↵ | |
34 | case RSIGNEDSHIFT:↵ | 34 | case RSIGNEDSHIFT:↵ | |
35 | case RSIGNEDSHIFTX:↵ | 35 | case RSIGNEDSHIFTX:↵ | |
36 | case RUNSIGNEDSHIFT:↵ | 36 | case RUNSIGNEDSHIFT:↵ | |
37 | case RUNSIGNEDSHIFTX:↵ | 37 | case RUNSIGNEDSHIFTX:↵ | |
38 | throw new UtilEvalError("Can't shift doubles");↵ | 38 | throw new UtilEvalError("Can't shift floats ");↵ | |
39 | default:↵ | 39 | default:↵ | |
40 | throw new InterpreterError(↵ | 40 | throw new InterpreterError(↵ | |
41 | "Unimplemented binary double operator");↵ | 41 | "Unimplemented binary float operator");↵ | |
42 | } | 42 |
| |
See real code fragment | See real code fragment |
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 | 699 |
Number of mapped statements | 25 |
Number of unmapped statements in the first code fragment | 11 |
Number of unmapped statements in the second code fragment | 11 |
Time elapsed for statement mapping (ms) | 43.1 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | switch (kind) | 3 | switch (kind) | |||||||||||
4 | case LT: | 4 | case LT: | |||||||||||
5 | case LTX: | 5 | case LTX: | |||||||||||
|
| 6 | return new Boolean(lhs < rhs); | |||||||||||
6 | return new Boolean(lhs < rhs); |
| | |||||||||||
7 | case GT: | 7 | case GT: | |||||||||||
8 | case GTX: | 8 | case GTX: | |||||||||||
|
| 9 | return new Boolean(lhs > rhs); | |||||||||||
9 | return new Boolean(lhs > rhs); |
| | |||||||||||
10 | case EQ: | 10 | case EQ: | |||||||||||
|
| 11 | return new Boolean(lhs == rhs); | |||||||||||
11 | return new Boolean(lhs == rhs); |
| | |||||||||||
12 | case LE: | 12 | case LE: | |||||||||||
13 | case LEX: | 13 | case LEX: | |||||||||||
|
| 14 | return new Boolean(lhs <= rhs); | |||||||||||
14 | return new Boolean(lhs <= rhs); |
| | |||||||||||
15 | case GE: | 15 | case GE: | |||||||||||
16 | case GEX: | 16 | case GEX: | |||||||||||
|
| 17 | return new Boolean(lhs >= rhs); | |||||||||||
17 | return new Boolean(lhs >= rhs); |
| | |||||||||||
18 | case NE: | 18 | case NE: | |||||||||||
|
| 19 | return new Boolean(lhs != rhs); | |||||||||||
19 | return new Boolean(lhs != rhs); |
| | |||||||||||
20 | case PLUS: | 20 | case PLUS: | |||||||||||
|
| 21 | return new Float(lhs + rhs); | |||||||||||
21 | return new Double(lhs + rhs); |
| | |||||||||||
22 | case MINUS: | 22 | case MINUS: | |||||||||||
|
| 23 | return new Float(lhs - rhs); | |||||||||||
23 | return new Double(lhs - rhs); |
| | |||||||||||
24 | case STAR: | 24 | case STAR: | |||||||||||
|
| 25 | return new Float(lhs * rhs); | |||||||||||
25 | return new Double(lhs * rhs); |
| | |||||||||||
26 | case SLASH: | 26 | case SLASH: | |||||||||||
|
| 27 | return new Float(lhs / rhs); | |||||||||||
27 | return new Double(lhs / rhs); |
| | |||||||||||
28 | case MOD: | 28 | case MOD: | |||||||||||
|
| 29 | return new Float(lhs % rhs); | |||||||||||
29 | return new Double(lhs % rhs); |
| | |||||||||||
30 | case LSHIFT: | 30 | case LSHIFT: | |||||||||||
31 | case LSHIFTX: | 31 | case LSHIFTX: | |||||||||||
32 | case RSIGNEDSHIFT: | 32 | case RSIGNEDSHIFT: | |||||||||||
33 | case RSIGNEDSHIFTX: | 33 | case RSIGNEDSHIFTX: | |||||||||||
34 | case RUNSIGNEDSHIFT: | 34 | case RUNSIGNEDSHIFT: | |||||||||||
35 | case RUNSIGNEDSHIFTX: | 35 | case RUNSIGNEDSHIFTX: | |||||||||||
36 | throw new UtilEvalError("Can't shift doubles"); |
| 36 | throw new UtilEvalError("Can't shift floats "); | ||||||||||
37 | default: | 37 | default: | |||||||||||
38 | throw new InterpreterError("Unimplemented binary double operator"); |
| 38 | throw new InterpreterError("Unimplemented binary float operator"); |
Row | Violation |
---|---|
1 | Unmatched return new Boolean(lhs < rhs); |
2 | Unmatched return new Boolean(lhs < rhs); |
3 | Unmatched return new Boolean(lhs > rhs); |
4 | Unmatched return new Boolean(lhs > rhs); |
5 | Unmatched return new Boolean(lhs == rhs); |
6 | Unmatched return new Boolean(lhs == rhs); |
7 | Unmatched return new Boolean(lhs <= rhs); |
8 | Unmatched return new Boolean(lhs <= rhs); |
9 | Unmatched return new Boolean(lhs >= rhs); |
10 | Unmatched return new Boolean(lhs >= rhs); |
11 | Unmatched return new Boolean(lhs != rhs); |
12 | Unmatched return new Boolean(lhs != rhs); |
13 | Unmatched return new Float(lhs + rhs); |
14 | Unmatched return new Double(lhs + rhs); |
15 | Unmatched return new Float(lhs - rhs); |
16 | Unmatched return new Double(lhs - rhs); |
17 | Unmatched return new Float(lhs * rhs); |
18 | Unmatched return new Double(lhs * rhs); |
19 | Unmatched return new Float(lhs / rhs); |
20 | Unmatched return new Double(lhs / rhs); |
21 | Unmatched return new Float(lhs % rhs); |
22 | Unmatched return new Double(lhs % rhs); |