File path: /jruby-1.4.0/src/org/jruby/runtime/builtin/InstanceVariableTable.java | File path: /jruby-1.4.0/src/org/jruby/runtime/builtin/InstanceVariableTable.java | |||
Method name: boolean packedContains(String)
|
Method name: Object packedFetch(String)
|
|||
Number of AST nodes: 7 | Number of AST nodes: 7 | |||
1 | Object[]table = packedVTable;↵ | 1 | Object[]table = packedVTable;↵ | |
2 | int hash = name.hashCode();↵ | 2 | int hash = name.hashCode();↵ | |
3 | for (int i = 0; i < vTableSize; i++) {↵ | 3 | for (int i = 0; i < vTableSize; i++) {↵ | |
4 | String n = (String)table[i];↵ | 4 | String n = (String)table[i];↵ | |
5 | if (n.hashCode() == hash && name.equals(n)) return true;↵ | 5 | if (n.hashCode() == hash && name.equals(n)) return table[i + MAX_PACKED];↵ | |
6 | }↵ | 6 | }↵ | |
7 | return false; | 7 | return null; | |
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.4 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 17 |
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) | 0.9 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||
---|---|---|---|---|---|---|---|---|
1 | Object[] table = packedVTable; | 1 | Object[] table = packedVTable; | |||||
2 | int hash = name.hashCode(); | 2 | int hash = name.hashCode(); | |||||
3 | for (int i = 0; i < vTableSize; i++) | 3 | for (int i = 0; i < vTableSize; i++) | |||||
4 | String n = (String)table[i]; | 4 | String n = (String)table[i]; | |||||
5 | if (n.hashCode() == hash && name.equals(n)) | 5 | if (n.hashCode() == hash && name.equals(n)) | |||||
|
| 6 | return table[i + MAX_PACKED]; | |||||
6 | return true; |
| | |||||
|
| 7 | return null; | |||||
7 | return false; |
| |
Row | Violation |
---|---|
1 | Unmatched statement return table[i + MAX_PACKED]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched return table[i + MAX_PACKED]; |
3 | Unmatched return true; |
4 | Unmatched return null; |
5 | Unmatched return false; |
6 | Clone fragment #1 returns variables , while Clone fragment #2 returns variables table, i |