if (defaultSaveOptions == null || defaultSaveOptions.isEmpty()) { doSave(writer, options); } else if (options == null) { doSave(writer, defaultSaveOptions); } else { Map<Object, Object> mergedOptions = new HashMap<Object, Object>(defaultSaveOptions); mergedOptions.putAll(options); doSave(writer, mergedOptions); } setModified(false);
if (defaultLoadOptions == null || defaultLoadOptions.isEmpty()) { doLoad(inputSource, options); } else if (options == null) { doLoad(inputSource, defaultLoadOptions); } else { Map<Object, Object> mergedOptions = new HashMap<Object, Object>(defaultLoadOptions); mergedOptions.putAll(options); doLoad(inputSource, mergedOptions); }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/XMLResourceImpl.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/XMLResourceImpl.java
Method name: void save(Writer, Map) Method name: void load(InputSource, Map)
Number of AST nodes: 8 Number of AST nodes: 7
1
if (defaultSaveOptions == null || defaultSaveOptions.isEmpty())
1
if (defaultLoadOptions == null || defaultLoadOptions.isEmpty())
2
    {
2
    
3
    {
3
      doSave(writer, options);
4
          doLoad(inputSource, options);
4
    }
5
     
6
   }
5
    else if (options == null)
7
        else if (options == null)
6
    {
8
    
7
      doSave(writer
9
    {
8
, defaultSaveOptions);
10
          doLoad(inputSource, defaultLoadOptions);
9
    }
11
    
12
    }
10
    else
13
        else
11
    {
14
    
15
    {
12
      Map<Object, Object> mergedOptions = new HashMap<Object, Object>(defaultSaveOptions);
16
          Map<Object, Object> mergedOptions = new HashMap<Object, Object>(defaultLoadOptions);
13
      mergedOptions.putAll(options);
17
          mergedOptions.putAll(options);
14
      doSave(writer
18
  
15
, mergedOptions);
19
          doLoad(inputSource, mergedOptions);
16
    }
20
    
17
    setModified(false);
21
    }
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 comparisons40
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)1.8
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (defaultSaveOptions == null || defaultSaveOptions.isEmpty())
    1
    if (defaultSaveOptions == null || defaultSaveOptions.isEmpty())
    9
    if (defaultLoadOptions == null || defaultLoadOptions.isEmpty())
    Differences
    Expression1Expression2Difference
    defaultSaveOptionsdefaultLoadOptionsVARIABLE_NAME_MISMATCH
    defaultSaveOptionsdefaultLoadOptionsVARIABLE_NAME_MISMATCH
    9
    if (defaultLoadOptions == null || defaultLoadOptions.isEmpty())
    2
    doSave(writer, options);
                                                        
                                                                    
    10
    doLoad(inputSource, options);
    3
    else if (options == null)
    3
    else if (options == null)
    11
    else if (options == null)
    Differences
    Expression1Expression2Difference
    java.util.Map<,>java.util.Map<,>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Map<,> of variable options does not match with type java.util.Map<,> of variable options
    • Make classes java.util.Map<,> and java.util.Map<,> extend a common superclass
    11
    else if (options == null)
    4
    doSave(writer, defaultSaveOptions);
                                                                              
                                                                                          
    12
    doLoad(inputSource, defaultLoadOptions);
    else
    else
    5
    Map<Object, Object> mergedOptions = new HashMap<Object, Object>(defaultSaveOptions);
    5
    Map<Object, Object> mergedOptions = new HashMap<Object, Object>(defaultSaveOptions);
    13
    Map<Object, Object> mergedOptions = new HashMap<Object, Object>(defaultLoadOptions);
    Differences
    Expression1Expression2Difference
    defaultSaveOptionsdefaultLoadOptionsVARIABLE_NAME_MISMATCH
    13
    Map<Object, Object> mergedOptions = new HashMap<Object, Object>(defaultLoadOptions);
    6
    mergedOptions.putAll(options);
    6
    mergedOptions.putAll(options);
    14
    mergedOptions.putAll(options);
    Differences
    Expression1Expression2Difference
    java.util.Map<,>java.util.Map<,>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Map<,> of variable options does not match with type java.util.Map<,> of variable options
    • Make classes java.util.Map<,> and java.util.Map<,> extend a common superclass
    14
    mergedOptions.putAll(options);
    7
    doSave(writer, mergedOptions);
                                                                    
                                                                                
    15
    doLoad(inputSource, mergedOptions);
    8
    setModified(false);
                                                
    Precondition Violations (2)
    Row Violation
    1Type java.util.Map<,> of variable options does not match with type java.util.Map<,> of variable options
    2Type java.util.Map<,> of variable options does not match with type java.util.Map<,> of variable options