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;
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 true; } } return false;
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: Object get(int) Method name: boolean containsKey(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.value;
6
                return true;
7
            }
7
            }
8
        }
8
        }
9
        return null;
9
        return false;
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 statements5
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    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 true;
    Preondition Violations
    Unmatched return true;
    6
    return true;
    6
    return e.value;
    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;
                                        
                                    
    7
    return false;
    Preondition Violations
    Unmatched return false;
    7
    return false;
    7
    return null;
    7
    return null;
    Preondition Violations
    Unmatched return null;
                                  
    Precondition Violations (6)
    Row Violation
    1Unmatched return true;
    2Unmatched statement return e.value; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched return e.value;
    4Unmatched return false;
    5Unmatched return null;
    6Clone fragment #1 returns variables e , while Clone fragment #2 returns variables