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: IConverter createConverter(Object, Object)
|
Method name: IConverter createConverter(Object, Object)
|
|||
Number of AST nodes: 6 | Number of AST nodes: 5 | |||
1 | if (toType == String.class)↵ | 1 | if (toType ↵ | |
2 | {↵ | |||
3 | if (fromType instanceof EAttribute)↵ | 2 | instanceof EAttribute)↵ | |
4 | {↵ | 3 | {↵ | |
5 | final EAttribute eAttribute = (EAttribute)fromType;↵ | 4 | final EAttribute eAttribute = (EAttribute)toType;↵ | |
6 | final EDataType eDataType = eAttribute.getEAttributeType();↵ | 5 | final EDataType eDataType = eAttribute.getEAttributeType();↵ | |
7 | final EFactory eFactory = eDataType.getEPackage().getEFactoryInstance();↵ | 6 | final EFactory eFactory = eDataType.getEPackage().getEFactoryInstance();↵ | |
8 | return↵ | 7 | return↵ | |
9 | new Converter(fromType, toType)↵ | 8 | new Converter(fromType, toType)↵ | |
10 | {↵ | 9 | {↵ | |
11 | public Object convert(Object fromObject)↵ | 10 | public Object convert(Object fromObject)↵ | |
12 | {↵ | 11 | {↵ | |
13 | return eFactory.convertToString(eDataType, fromObject);↵ | 12 | String value = fromObject == null ? null : fromObject.toString();↵ | |
13 | if (eAttribute.isMany())↵ | |||
14 | {↵ | |||
15 | List<Object> result = new ArrayList<Object>();↵ | |||
16 | if (value != null)↵ | |||
17 | {↵ | |||
18 | for (String element : value.split(" "))↵ | |||
19 | {↵ | |||
20 | result.add(eFactory.createFromString(eDataType, element));↵ | |||
21 | }↵ | |||
22 | }↵ | |||
23 | return result;↵ | |||
24 | }↵ | |||
25 | else↵ | |||
26 | {↵ | |||
27 | return eFactory.createFromString(eDataType, value);↵ | |||
28 | }↵ | |||
14 | }↵ | 29 | }↵ | |
15 | };↵ | 30 | };↵ | |
16 | }↵ | 31 |
| |
17 | } | |||
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.4 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 26 |
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 4.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8 | if (fromType instanceof EAttribute) |
| 2 | if (toType instanceof EAttribute) | ||||||||||
9 | final EAttribute eAttribute = (EAttribute)fromType; |
| 3 | final EAttribute eAttribute = (EAttribute)toType; | ||||||||||
10 | final EDataType eDataType = eAttribute.getEAttributeType(); | 4 | final EDataType eDataType = eAttribute.getEAttributeType(); | |||||||||||
11 | final EFactory eFactory = eDataType.getEPackage().getEFactoryInstance(); | 5 | final EFactory eFactory = eDataType.getEPackage().getEFactoryInstance(); | |||||||||||
| 6 | return new Converter(fromType, toType) {...}; | ||||||||||||
12 | return new Converter(fromType, toType) {...}; | |
Row | Violation |
---|---|
1 | Clone fragment #1 returns variables eDataType, eFactory , while Clone fragment #2 returns variables eAttribute, eDataType, eFactory |