if (collection.size() == 0) { return false; } boolean isFeatureMap = FeatureMapUtil.isFeatureMap(feature); @SuppressWarnings("unchecked") Collection<Entry> entryCollection = isFeatureMap ? (Collection<Entry>)collection : new BasicEList<Entry>(collection.size());
if (collection.size() == 0) { return false; } boolean isFeatureMap = FeatureMapUtil.isFeatureMap(feature); @SuppressWarnings("unchecked") Collection<Entry> entryCollection = isFeatureMap ? (Collection<Entry>)collection : new BasicEList<Entry>(collection.size());
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/BasicFeatureMap.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/BasicFeatureMap.java
Method name: boolean addAll(EStructuralFeature, Collection) Method name: boolean addAll(EStructuralFeature, int, Collection)
Number of AST nodes: 4 Number of AST nodes: 4
1
if (collection.size() == 0)
1
if (collection.size() == 0)
2
    {
2
    {
3
      return false;
3
      return false;
4
    }
4
    }
5
    boolean isFeatureMap = FeatureMapUtil.isFeatureMap(feature);
5
    boolean isFeatureMap = FeatureMapUtil.isFeatureMap(feature);
6
    @SuppressWarnings("unchecked") Collection<Entry> entryCollection = 
6
    @SuppressWarnings("unchecked") Collection<Entry> entryCollection = 
7
      isFeatureMap ? 
7
      isFeatureMap ? 
8
        (Collection<Entry>)collection : 
8
        (Collection<Entry>)collection :
9
        new BasicEList<Entry>(collection.size());
9
        new BasicEList<Entry>(collection.size());
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.2
Clones locationClones are declared in the same class
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (collection.size() == 0)
    1
    if (collection.size() == 0)
    1
    if (collection.size() == 0)
    Differences
    Expression1Expression2Difference
    java.util.Collection<>java.util.Collection<>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Collection<> of variable collection does not match with type java.util.Collection<> of variable collection
    • Make classes java.util.Collection<> and java.util.Collection<> extend a common superclass
    1
    if (collection.size() == 0)
    2
    return false;
    2
    return false;
    3
    boolean isFeatureMap = FeatureMapUtil.isFeatureMap(feature);
    3
    boolean isFeatureMap = FeatureMapUtil.isFeatureMap(feature);
    4
    @SuppressWarnings("unchecked") Collection<Entry> entryCollection = isFeatureMap ? (Collection<Entry>)collection : new BasicEList<Entry>(collection.size());
    4
    @SuppressWarnings("unchecked") Collection<Entry> entryCollection = isFeatureMap ? (Collection<Entry>)collection : new BasicEList<Entry>(collection.size());
    4
    @SuppressWarnings("unchecked") Collection<Entry> entryCollection = isFeatureMap ? (Collection<Entry>)collection : new BasicEList<Entry>(collection.size());
    Differences
    Expression1Expression2Difference
    java.util.Collection<>java.util.Collection<>VARIABLE_TYPE_MISMATCH
    java.util.Collection<>java.util.Collection<>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Collection<> of variable collection does not match with type java.util.Collection<> of variable collection
    • Make classes java.util.Collection<> and java.util.Collection<> extend a common superclass
    Type java.util.Collection<> of variable collection does not match with type java.util.Collection<> of variable collection
    • Make classes java.util.Collection<> and java.util.Collection<> extend a common superclass
    4
    @SuppressWarnings("unchecked") Collection<Entry> entryCollection = isFeatureMap ? (Collection<Entry>)collection : new BasicEList<Entry>(collection.size());
    Precondition Violations (4)
    Row Violation
    1Type java.util.Collection<> of variable collection does not match with type java.util.Collection<> of variable collection
    2Type java.util.Collection<> of variable collection does not match with type java.util.Collection<> of variable collection
    3Type java.util.Collection<> of variable collection does not match with type java.util.Collection<> of variable collection
    4Clone fragment #1 returns variables entryCollection, isFeatureMap , while Clone fragment #2 returns variables entryCollection, isFeatureMap