if (view == null) { view = new View<K, V>(); } if (view.map == null) { view.map = new DelegatingMap(); } return view.map;
if (view == null) { view = new View<URI, URI>(); } if (view.map == null) { view.map = new URIMapImpl(); } return view.map;
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/ecore/resource/impl/URIMappingRegistryImpl.java
Method name: Map map() Method name: Map map()
Number of AST nodes: 5 Number of AST nodes: 5
1
if (view == null)
1
if (view == null)
2
    {
2
    {
3
      view = new View<K, V>();
3
      view = new View<URI, URI>();
4
    }
4
    }
5
    if (view.map == null)
5
    if (view.map == null)
6
    {
6
    {
7
      view.map = new DelegatingMap();
7
      view.map = new URIMapImpl();
8
    }
8
    }
9
    return view.map;
9
    return view.map;
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 in different classes having the same super class
Number of node comparisons14
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (view == null)
    1
    if (view == null)
    1
    if (view == null)
    Differences
    Expression1Expression2Difference
    org.eclipse.emf.common.util.BasicEMap.Vieworg.eclipse.emf.common.util.BasicEMap.ViewVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.common.util.BasicEMap.View<K,V> of variable view does not match with type org.eclipse.emf.common.util.BasicEMap.View<org.eclipse.emf.common.util.URI,org.eclipse.emf.common.util.URI> of variable view
    • Make classes org.eclipse.emf.common.util.BasicEMap.View and org.eclipse.emf.common.util.BasicEMap.View extend a common superclass
    1
    if (view == null)
                                                            
    2
    view = new View<URI, URI>();
    Preondition Violations
    Unmatched statement view=new View<URI,URI>(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2
    view = new View<URI, URI>();
    2
    view = new View<K, V>();
    2
    view = new View<K, V>();
    Preondition Violations
    Unmatched statement view=new View<K,V>(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                    
    3
    if (view.map == null)
    3
    if (view.map == null)
    3
    if (view.map == null)
    Differences
    Expression1Expression2Difference
    org.eclipse.emf.common.util.BasicEMap.Vieworg.eclipse.emf.common.util.BasicEMap.ViewVARIABLE_TYPE_MISMATCH
    java.util.Mapjava.util.MapVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.common.util.BasicEMap.View<K,V> of variable view does not match with type org.eclipse.emf.common.util.BasicEMap.View<org.eclipse.emf.common.util.URI,org.eclipse.emf.common.util.URI> of variable view
    • Make classes org.eclipse.emf.common.util.BasicEMap.View and org.eclipse.emf.common.util.BasicEMap.View extend a common superclass
    Type java.util.Map<K,V> of variable view.map does not match with type java.util.Map<org.eclipse.emf.common.util.URI,org.eclipse.emf.common.util.URI> of variable view.map
    • Make classes java.util.Map and java.util.Map extend a common superclass
    3
    if (view.map == null)
                                                              
    4
    view.map = new URIMapImpl();
    4
    view.map = new DelegatingMap();
                                                                    
                                          
    5
    return view.map;
    Preondition Violations
    Unmatched return view.map;
    5
    return view.map;
    5
    return view.map;
    5
    return view.map;
    Preondition Violations
    Unmatched return view.map;
                                          
    Precondition Violations (7)
    Row Violation
    1Type org.eclipse.emf.common.util.BasicEMap.View<K,V> of variable view does not match with type org.eclipse.emf.common.util.BasicEMap.View<org.eclipse.emf.common.util.URI,org.eclipse.emf.common.util.URI> of variable view
    2Unmatched statement view=new View<URI,URI>(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement view=new View<K,V>(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Type org.eclipse.emf.common.util.BasicEMap.View<K,V> of variable view does not match with type org.eclipse.emf.common.util.BasicEMap.View<org.eclipse.emf.common.util.URI,org.eclipse.emf.common.util.URI> of variable view
    5Type java.util.Map<K,V> of variable view.map does not match with type java.util.Map<org.eclipse.emf.common.util.URI,org.eclipse.emf.common.util.URI> of variable view.map
    6Unmatched return view.map;
    7Unmatched return view.map;