else if (toType == String.class) { 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);
protected IConverter createConverter(Object fromType, Object toType) { if (fromType == String.class) { 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) { String value = fromObject == null ? null : fromObject.toString(); if (eAttribute.isMany()) { List<Object> result = new ArrayList<Object>(); if (value != null) { for (String element : value.split(" ")) { result.add(eFactory.createFromString(eDataType, element)); } } return result; } else { return eFactory.createFromString(eDataType, value);
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/EMFUpdateValueStrategy.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
else
1
protected IConverter createConverter(Object fromType, Object toType)
2
  {
2
 if (toType == String.class)
3
    if (fromType == String.class)
3
    {
4
    {
4
      if (fromType instanceof EAttribute)
5
      if (toType instanceof EAttribute)
5
      {
6
      {
6
        final EAttribute eAttribute = (EAttribute)fromType;
7
        final EAttribute eAttribute = (EAttribute)toType;
7
        final EDataType eDataType = eAttribute.getEAttributeType();
8
        final EDataType eDataType = eAttribute.getEAttributeType();
8
        final EFactory eFactory = eDataType.getEPackage().getEFactoryInstance();
9
        final EFactory eFactory = eDataType.getEPackage().getEFactoryInstance();
9
        return
10
        return
10
          new Converter(fromType, toType)
11
          new Converter(fromType, toType)
11
          {
12
          {
12
            public Object convert(Object fromObject)
13
            public Object convert(Object fromObject)
13
            {
14
            {
14
              return eFactory.convertToString(eDataType, fromObject
15
              String value = fromObject == null ? null : fromObject.toString();
16
              if (eAttribute.isMany())
17
              {
18
                List<Object> result = new ArrayList<Object>();
19
                if (value != null)
20
                {
21
                  for (String element : value.split(" "))
22
                  {
23
                    result.add(eFactory.createFromString(eDataType, element));
24
                  }
25
                }
26
                return result;
27
              }
28
              else
29
              {
15
);
30
                return eFactory.createFromString(eDataType, value);
16
            
31
              
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.0
Clones location
Number of node comparisons0