if (toType instanceof EAttribute) { final EAttribute eAttribute = (EAttribute)toType; final EDataType eDataType = eAttribute.getEAttributeType(); final EFactory eFactory = eDataType.getEPackage().getEFactoryInstance(); return new Converter(fromType, toType) { public Object convert(Object fromObject) { return eFactory.createFromString(eDataType, (String)fromObject); } }; }
if (fromType instanceof EAttribute) { final EAttribute eAttribute = (EAttribute)fromType; final EDataType eDataType = eAttribute.getEAttributeType(); final EFactory eFactory = eDataType.getEPackage().getEFactoryInstance(); return new Converter(fromType, toType) { public Object convert(Object fromObject) { return eFactory.convertToString(eDataType, fromObject); } }; }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/databinding/EMFUpdateListStrategy.java File path: /emf-2.4.1/src/org/eclipse/emf/databinding/EMFUpdateListStrategy.java
Method name: IConverter createConverter(Object, Object) Method name: IConverter createConverter(Object, Object)
Number of AST nodes: 5 Number of AST nodes: 5
1
if (toType instanceof EAttribute)
1
if (fromType instanceof EAttribute)
2
      {
2
      {
3
        final EAttribute eAttribute = (EAttribute)toType;
3
        final EAttribute eAttribute = (EAttribute)fromType;
4
        final EDataType eDataType = eAttribute.getEAttributeType();
4
        final EDataType eDataType = eAttribute.getEAttributeType();
5
        final EFactory eFactory = eDataType.getEPackage().getEFactoryInstance();
5
        final EFactory eFactory = eDataType.getEPackage().getEFactoryInstance();
6
        return
6
        return
7
          new Converter(fromType, toType)
7
          new Converter(fromType, toType)
8
          {
8
          {
9
            public Object convert(Object fromObject)
9
            public Object convert(Object fromObject)
10
            {
10
            {
11
              return eFactory.createFromString(eDataType, (String)fromObject);
11
              return eFactory.convertToString(eDataType, fromObject);
12
            }
12
            }
13
          };
13
          };
14
      }
14
      }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.4
Clones locationClones are in the same method
Number of node comparisons26
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)5.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    if (toType instanceof EAttribute)
    2
    if (toType instanceof EAttribute)
    8
    if (fromType instanceof EAttribute)
    Differences
    Expression1Expression2Difference
    toTypefromTypeVARIABLE_NAME_MISMATCH
    8
    if (fromType instanceof EAttribute)
    3
    final EAttribute eAttribute = (EAttribute)toType;
    3
    final EAttribute eAttribute = (EAttribute)toType;
    9
    final EAttribute eAttribute = (EAttribute)fromType;
    Differences
    Expression1Expression2Difference
    toTypefromTypeVARIABLE_NAME_MISMATCH
    9
    final EAttribute eAttribute = (EAttribute)fromType;
    4
    final EDataType eDataType = eAttribute.getEAttributeType();
    10
    final EDataType eDataType = eAttribute.getEAttributeType();
    5
    final EFactory eFactory = eDataType.getEPackage().getEFactoryInstance();
    11
    final EFactory eFactory = eDataType.getEPackage().getEFactoryInstance();
    6
    return new Converter(fromType, toType) {...};
    6
    return new Converter(fromType, toType) {...};
    Preondition Violations
    Unmatched statement return new Converter(fromType,toType){ public Object convert( Object fromObject){ return eFactory.createFromString(eDataType,(String)fromObject); } } ; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement return new Converter(fromType,toType){ public Object convert( Object fromObject){ return eFactory.createFromString(eDataType,(String)fromObject); } } ; cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    Unmatched return new Converter(fromType,toType){ public Object convert( Object fromObject){ return eFactory.createFromString(eDataType,(String)fromObject); } } ;
                                                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                          
    12
    return new Converter(fromType, toType) {...};
    Preondition Violations
    Unmatched statement return new Converter(fromType,toType){ public Object convert( Object fromObject){ return eFactory.convertToString(eDataType,fromObject); } } ; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement return new Converter(fromType,toType){ public Object convert( Object fromObject){ return eFactory.convertToString(eDataType,fromObject); } } ; cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    Unmatched return new Converter(fromType,toType){ public Object convert( Object fromObject){ return eFactory.convertToString(eDataType,fromObject); } } ;
    12
    return new Converter(fromType, toType) {...};
    Precondition Violations (6)
    Row Violation
    1Unmatched statement return new Converter(fromType,toType){ public Object convert( Object fromObject){ return eFactory.createFromString(eDataType,(String)fromObject); } } ; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement return new Converter(fromType,toType){ public Object convert( Object fromObject){ return eFactory.createFromString(eDataType,(String)fromObject); } } ; cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    3Unmatched return new Converter(fromType,toType){ public Object convert( Object fromObject){ return eFactory.createFromString(eDataType,(String)fromObject); } } ;
    4Unmatched statement return new Converter(fromType,toType){ public Object convert( Object fromObject){ return eFactory.convertToString(eDataType,fromObject); } } ; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement return new Converter(fromType,toType){ public Object convert( Object fromObject){ return eFactory.convertToString(eDataType,fromObject); } } ; cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    6Unmatched return new Converter(fromType,toType){ public Object convert( Object fromObject){ return eFactory.convertToString(eDataType,fromObject); } } ;