File path: /jruby-1.4.0/src/org/jruby/RubyFixnum.java | File path: /jruby-1.4.0/src/org/jruby/RubyFixnum.java | |||
Method name: IRubyObject subtractFixnum(ThreadContext, RubyFixnum)
|
Method name: IRubyObject addFixnum(ThreadContext, RubyFixnum)
|
|||
Number of AST nodes: 5 | Number of AST nodes: 5 | |||
1 | long otherValue = other.value;↵ | 1 | long otherValue = other.value;↵ | |
2 | long result = value - otherValue;↵ | 2 | long result = value + otherValue;↵ | |
3 | if (subtractionOverflowed(value, otherValue, result)) {↵ | 3 | if (additionOverflowed(value, otherValue, result)) {↵ | |
4 | return subtractAsBignum(context, other);↵ | 4 | return addAsBignum(context, other);↵ | |
5 | }↵ | 5 | }↵ | |
6 | return newFixnum(context.getRuntime(), result); | 6 |
| |
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.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 13 |
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) | 1.5 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | long otherValue = other.value; | 1 | long otherValue = other.value; | |||||||||||||
|
| 2 | long result = value + otherValue; | |||||||||||||
2 | long result = value - otherValue; |
| | |||||||||||||
3 | if (subtractionOverflowed(value, otherValue, result)) |
| 3 | if (additionOverflowed(value, otherValue, result)) | ||||||||||||
4 | return subtractAsBignum(context, other); |
| 4 | return addAsBignum(context, other); | ||||||||||||
5 | return newFixnum(context.getRuntime(), result); | 5 | return newFixnum(context.getRuntime(), result); |
Row | Violation |
---|---|
1 | Unmatched statement long result=value + otherValue; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement long result=value - otherValue; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Expression subtractionOverflowed(value,otherValue,result) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression additionOverflowed(value,otherValue,result) cannot be parameterized, because it has dependencies to/from statements that will be extracted |