if (BasicEMap.this.size > 0 && object instanceof Map.Entry) { BasicEMap.this.ensureEntryDataExists(); @SuppressWarnings("unchecked") Map.Entry<K, V> otherEntry = (Map.Entry<K, V>)object; Object key = otherEntry.getKey(); int hash = key == null ? 0 : key.hashCode(); int index = BasicEMap.this.indexOf(hash); BasicEList<Entry<K, V>> eList = entryData[index]; if (eList != null) { @SuppressWarnings("unchecked") Entry<K, V> [] entries = (Entry<K, V> [])eList.data; int size = eList.size; for (int j = 0; j < size; ++j) { Entry<K, V> entry = entries[j]; if (entry.getHash() == hash && entry.equals(otherEntry)) { return true; } } } } return false;
if (BasicEMap.this.size > 0 && object instanceof Map.Entry) { BasicEMap.this.ensureEntryDataExists(); @SuppressWarnings("unchecked") Map.Entry<K, V> otherEntry = (Map.Entry<K, V>)object; Object key = otherEntry.getKey(); int hash = key == null ? 0 : key.hashCode(); int index = BasicEMap.this.indexOf(hash); BasicEList<Entry<K, V>> eList = entryData[index]; if (eList != null) { @SuppressWarnings("unchecked") Entry<K, V> [] entries = (Entry<K, V> [])eList.data; int size = eList.size; for (int j = 0; j < size; ++j) { Entry<K, V> entry = entries[j]; if (entry.getHash() == hash && entry.equals(otherEntry)) { // BasicEMap.this.removeEntry(index, j); remove(otherEntry); return true; } } } } return false;
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/common/util/BasicEMap.java File path: /emf-2.4.1/src/org/eclipse/emf/common/util/BasicEMap.java
Method name: boolean contains(Object) Method name: boolean remove(Object)
Number of AST nodes: 15 Number of AST nodes: 16
1
if (BasicEMap.this.size > 0 && object instanceof Map.Entry)
1
if (BasicEMap.this.size > 0 && object instanceof Map.Entry)
2
          {
2
          {
3
            BasicEMap.this.ensureEntryDataExists();
3
            BasicEMap.this.ensureEntryDataExists();
4
            @SuppressWarnings("unchecked") Map.Entry<K, V> otherEntry = (Map.Entry<K, V>)object;
4
            @SuppressWarnings("unchecked") Map.Entry<K, V> otherEntry = (Map.Entry<K, V>)object;
5
            Object key = otherEntry.getKey();
5
            Object key = otherEntry.getKey();
6
  
7
            int hash = key == null ? 0 : key.hashCode();
6
            int hash = key == null ? 0 : key.hashCode();
8
            int index = BasicEMap.this.indexOf(hash);
7
            int index = BasicEMap.this.indexOf(hash);
9
            BasicEList<Entry<K, V>> eList = entryData[index];
8
            BasicEList<Entry<K, V>> eList = entryData[index];
10
            if (eList != null)
9
            if (eList != null)
11
            {
10
            {
12
              @SuppressWarnings("unchecked") Entry<K, V> [] entries = (Entry<K, V> [])eList.data;
11
              @SuppressWarnings("unchecked") Entry<K, V> [] entries = (Entry<K, V> [])eList.data;
13
              int size = eList.size;
12
              int size = eList.size;
14
              for (int j = 0; j < size; ++j)
13
              for (int j = 0; j < size; ++j)
15
              {
14
              {
16
                Entry<K, V> entry = entries[j];
15
                Entry<K, V> entry = entries[j];
17
                if (entry.getHash() == hash && entry.equals(otherEntry))
16
                if (entry.getHash() == hash && entry.equals(otherEntry)) 
18
                {
17
                {
18
                  // BasicEMap.this.removeEntry(index, j);
19
                  remove(otherEntry);
19
                  return true;
20
                  return true;
20
                }
21
                }
21
              }
22
              }
22
            }
23
            }
23
          }
24
          }
24
          return false;
25
          return false;
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.4
Clones locationClones are declared in the same class
Number of node comparisons1