Entry tab[] = table; int hash = key; int index = (hash & 0x7FFFFFFF) % tab.length; for(Entry e = tab[index]; e != null; e = e.next) { if (e.hash == hash) { return e; } } return null;
Entry tab[] = table; int hash = key; int index = (hash & 0x7FFFFFFF) % tab.length; for (Entry e = tab[index]; e != null; e = e.next) { if (e.hash == hash) { return e.value; } } return null;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/util/collections/IntHashMap.java File path: /jruby-1.4.0/src/org/jruby/util/collections/IntHashMap.java
Method name: Entry getEntry(int) Method name: Object get(int)
Number of AST nodes: 7 Number of AST nodes: 7
1
Entry tab[] = table;
1
Entry tab[] = table;
2
        int hash = key;
2
        int hash = key;
3
        int index = (hash & 0x7FFFFFFF) % tab.length;
3
        int index = (hash & 0x7FFFFFFF) % tab.length;
4
        for(Entry e = tab[index]; e != null; e = e.next) {
4
        for (Entry e = tab[index]; e != null; e = e.next) {
5
            if (e.hash == hash) {
5
            if (e.hash == hash) {
6
                return e;
6
                return e.value;
7
            }
7
            }
8
        }
8
        }
9
        return null;
9
        return null;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.4
Clones locationClones are declared in the same class
Number of node comparisons21
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Entry tab[] = table;
    1
    Entry tab[] = table;
    2
    int hash = key;
    2
    int hash = key;
    3
    int index = (hash & 0x7FFFFFFF) % tab.length;
    3
    int index = (hash & 0x7FFFFFFF) % tab.length;
    4
    for (Entry e = tab[index]; e != null; e = e.next)
    4
    for (Entry e = tab[index]; e != null; e = e.next)
    5
    if (e.hash == hash)
    5
    if (e.hash == hash)
                                        
    6
    return e.value;
    Preondition Violations
    Unmatched statement return e.value; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return e.value;
    6
    return e.value;
    6
    return e;
    6
    return e;
    Preondition Violations
    Unmatched statement return e; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return e;
                            
    7
    return null;
    7
    return null;
    Precondition Violations (4)
    Row Violation
    1Unmatched statement return e.value; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched return e.value;
    3Unmatched statement return e; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return e;