File path: /jEdit-4.2/src/bsh/BSHUnaryExpression.java | File path: /jEdit-4.2/src/bsh/Primitive.java | |||
Method name: Object primitiveWrapperUnaryOperation(Object, int)
|
Method name: Primitive unaryOperation(Primitive, int)
|
|||
Number of AST nodes: 17 | Number of AST nodes: 17 | |||
1 | if ( operand instanceof Integer )↵ | 1 | if(operand instanceof Integer)↵ | |
2 | {↵ | 2 | {↵ | |
3 | int result = Primitive.intUnaryOperation((Integer)operand, kind);↵ | 3 | int result = intUnaryOperation((Integer)operand, kind);↵ | |
4 | // ++ and -- must be cast back the original type↵ | 4 | // ++ and -- must be cast back the original type↵ | |
5 | if(kind == INCR || kind == DECR)↵ | 5 | if(kind == INCR || kind == DECR)↵ | |
6 | {↵ | 6 | {↵ | |
7 | if(operandType == Byte.TYPE)↵ | 7 | if(operandType == Byte.TYPE)↵ | |
8 | return new Byte((byte)result);↵ | 8 | return new Primitive((byte)result);↵ | |
9 | if(operandType == Short.TYPE)↵ | 9 | if(operandType == Short.TYPE)↵ | |
10 | return new Short((short)result);↵ | 10 | return new Primitive((short)result);↵ | |
11 | if(operandType == Character.TYPE)↵ | 11 | if(operandType == Character.TYPE)↵ | |
12 | return new Character((char)result);↵ | 12 | return new Primitive((char)result);↵ | |
13 | }↵ | 13 | }↵ | |
14 | return new Integer(result);↵ | 14 | return new Primitive(result);↵ | |
15 | }↵ | 15 | }↵ | |
16 | else if(operand instanceof Long)↵ | 16 | else if(operand instanceof Long)↵ | |
17 | return new Long(Primitive.longUnaryOperation((Long)operand, kind));↵ | 17 | return new Primitive(longUnaryOperation((Long)operand, kind));↵ | |
18 | else if(operand instanceof Float)↵ | 18 | else if(operand instanceof Float)↵ | |
19 | return new Float(Primitive.floatUnaryOperation((Float)operand, kind));↵ | 19 | return new Primitive(floatUnaryOperation((Float)operand, kind));↵ | |
20 | else if(operand instanceof Double)↵ | 20 | else if(operand instanceof Double)↵ | |
21 | return new Double(Primitive.doubleUnaryOperation((Double)operand, kind));↵ | 21 | return new Primitive(doubleUnaryOperation((Double)operand, kind));↵ | |
22 | else↵ | 22 | else↵ | |
23 | throw new InterpreterError(↵ | 23 | throw new InterpreterError(↵ | |
24 | "An error occurred. Please call technical support."); | 24 | "An error occurred. Please call technical support."); | |
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) | 2.2 |
Clones location | Clones are in different classes |
Number of node comparisons | 73 |
Number of mapped statements | 10 |
Number of unmapped statements in the first code fragment | 7 |
Number of unmapped statements in the second code fragment | 7 |
Time elapsed for statement mapping (ms) | 4.9 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5 | else if (operand instanceof Integer) | 9 | else if (operand instanceof Integer) | |||||||||||||
6 | int result = Primitive.intUnaryOperation((Integer)operand, kind); |
| 10 | int result = intUnaryOperation((Integer)operand, kind); | ||||||||||||
7 | if (kind == INCR || kind == DECR) | 11 | if (kind == INCR || kind == DECR) | |||||||||||||
8 | if (operandType == Byte.TYPE) | 12 | if (operandType == Byte.TYPE) | |||||||||||||
9 | return new Byte((byte)result); | | ||||||||||||||
| 13 | return new Primitive((byte)result); | ||||||||||||||
10 | if (operandType == Short.TYPE) | 14 | if (operandType == Short.TYPE) | |||||||||||||
11 | return new Short((short)result); | | ||||||||||||||
| 15 | return new Primitive((short)result); | ||||||||||||||
12 | if (operandType == Character.TYPE) | 16 | if (operandType == Character.TYPE) | |||||||||||||
13 | return new Character((char)result); | | ||||||||||||||
| 17 | return new Primitive((char)result); | ||||||||||||||
14 | return new Integer(result); | | ||||||||||||||
| 18 | return new Primitive(result); | ||||||||||||||
15 | else if (operand instanceof Long) | 19 | else if (operand instanceof Long) | |||||||||||||
16 | return new Long(Primitive.longUnaryOperation((Long)operand, kind)); |
| | |||||||||||||
|
| 20 | return new Primitive(longUnaryOperation((Long)operand, kind)); | |||||||||||||
17 | else if (operand instanceof Float) | 21 | else if (operand instanceof Float) | |||||||||||||
18 | return new Float(Primitive.floatUnaryOperation((Float)operand, kind)); |
| | |||||||||||||
|
| 22 | return new Primitive(floatUnaryOperation((Float)operand, kind)); | |||||||||||||
19 | else if (operand instanceof Double) | 23 | else if (operand instanceof Double) | |||||||||||||
20 | return new Double(Primitive.doubleUnaryOperation((Double)operand, kind)); |
| | |||||||||||||
|
| 24 | return new Primitive(doubleUnaryOperation((Double)operand, kind)); | |||||||||||||
else | else | |||||||||||||||
21 | throw new InterpreterError("An error occurred. Please call technical support."); | 25 | throw new InterpreterError("An error occurred. Please call technical support."); |
Row | Violation |
---|---|
1 | Expression Primitive.intUnaryOperation((Integer)operand,kind) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression intUnaryOperation((Integer)operand,kind) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement return new Long(Primitive.longUnaryOperation((Long)operand,kind)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
4 | Unmatched return new Long(Primitive.longUnaryOperation((Long)operand,kind)); |
5 | Unmatched statement return new Primitive(longUnaryOperation((Long)operand,kind)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
6 | Unmatched return new Primitive(longUnaryOperation((Long)operand,kind)); |
7 | Unmatched statement return new Float(Primitive.floatUnaryOperation((Float)operand,kind)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
8 | Unmatched return new Float(Primitive.floatUnaryOperation((Float)operand,kind)); |
9 | Unmatched statement return new Primitive(floatUnaryOperation((Float)operand,kind)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
10 | Unmatched return new Primitive(floatUnaryOperation((Float)operand,kind)); |
11 | Unmatched statement return new Double(Primitive.doubleUnaryOperation((Double)operand,kind)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
12 | Unmatched return new Double(Primitive.doubleUnaryOperation((Double)operand,kind)); |
13 | Unmatched statement return new Primitive(doubleUnaryOperation((Double)operand,kind)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
14 | Unmatched return new Primitive(doubleUnaryOperation((Double)operand,kind)); |