File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/BasicExtendedMetaData.java | File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/BasicExtendedMetaData.java | |||
Method name: List
|
Method name: List
|
|||
Number of AST nodes: 22 | Number of AST nodes: 22 | |||
1 | List<EClass> superTypes = eClass.getESuperTypes();↵ | 1 | List<EClass> superTypes = eClass.getESuperTypes();↵ | |
2 | List<EStructuralFeature> result = null;↵ | 2 | List<EStructuralFeature> result = null;↵ | |
3 | boolean changeable = false;↵ | 3 | boolean changeable = false;↵ | |
4 | for (int i = 0, size = superTypes.size(); i < size; ++i) ↵ | 4 | for (int i = 0, size = superTypes.size(); i < size; ++i) ↵ | |
5 | {↵ | 5 | {↵ | |
6 | EClass eSuperType = superTypes.get(i);↵ | 6 | EClass eSuperType = superTypes.get(i);↵ | |
7 | List<EStructuralFeature> allAttributes = getAllAttributes(eSuperType);↵ | 7 | List<EStructuralFeature> allElements = getAllElements(eSuperType);↵ | |
8 | if (!allAttributes.isEmpty())↵ | 8 | if (!allElements.isEmpty())↵ | |
9 | {↵ | 9 | {↵ | |
10 | if (result == null)↵ | 10 | if (result == null)↵ | |
11 | {↵ | 11 | {↵ | |
12 | result = allAttributes;↵ | 12 | result = allElements;↵ | |
13 | }↵ | 13 | }↵ | |
14 | else↵ | 14 | else↵ | |
15 | {↵ | 15 | {↵ | |
16 | if (!changeable)↵ | 16 | if (!changeable)↵ | |
17 | {↵ | 17 | {↵ | |
18 | changeable = true;↵ | 18 | changeable = true;↵ | |
19 | result = new UniqueEList<EStructuralFeature>(result);↵ | 19 | result = new UniqueEList<EStructuralFeature>(result);↵ | |
20 | }↵ | 20 | }↵ | |
21 | result.addAll(allAttributes);↵ | 21 | result.addAll(allElements);↵ | |
22 | }↵ | 22 | }↵ | |
23 | }↵ | 23 | }↵ | |
24 | }↵ | 24 | }↵ | |
25 | List<EStructuralFeature> attributes = getAttributes(eClass);↵ | 25 | List<EStructuralFeature> elements = getElements(eClass);↵ | |
26 | if (!attributes.isEmpty())↵ | 26 | if (!elements.isEmpty())↵ | |
27 | {↵ | 27 | {↵ | |
28 | if (result == null)↵ | 28 | if (result == null)↵ | |
29 | {↵ | 29 | {↵ | |
30 | return attributes;↵ | 30 | return elements;↵ | |
31 | }↵ | 31 | }↵ | |
32 | else↵ | 32 | else↵ | |
33 | {↵ | 33 | {↵ | |
34 | if (!changeable)↵ | 34 | if (!changeable)↵ | |
35 | {↵ | 35 | {↵ | |
36 | result = new UniqueEList<EStructuralFeature>(result);↵ | 36 | result = new UniqueEList<EStructuralFeature>(result);↵ | |
37 | }↵ | 37 | }↵ | |
38 | result.addAll(attributes);↵ | 38 | result.addAll(elements);↵ | |
39 | return result;↵ | 39 | return result;↵ | |
40 | }↵ | 40 | }↵ | |
41 | }↵ | 41 | }↵ | |
42 | else↵ | 42 | else↵ | |
43 | {↵ | 43 | {↵ | |
44 | return result == null ? Collections.<EStructuralFeature>emptyList() : result;↵ | 44 | return result == null ? Collections.<EStructuralFeature>emptyList() : result;↵ | |
45 | } | 45 |
| |
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.9 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 78 |
Number of mapped statements | 22 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 12.5 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | List<EClass> superTypes = eClass.getESuperTypes(); | 1 | List<EClass> superTypes = eClass.getESuperTypes(); | ||||||||||||||||
2 | List<EStructuralFeature> result = null; | 2 | List<EStructuralFeature> result = null; | ||||||||||||||||
3 | boolean changeable = false; | 3 | boolean changeable = false; | ||||||||||||||||
4 | for (int i = 0, size = superTypes.size(); i < size; ++i) | 4 | for (int i = 0, size = superTypes.size(); i < size; ++i) | ||||||||||||||||
5 | EClass eSuperType = superTypes.get(i); | 5 | EClass eSuperType = superTypes.get(i); | ||||||||||||||||
6 | List<EStructuralFeature> allAttributes = getAllAttributes(eSuperType); |
| 6 | List<EStructuralFeature> allElements = getAllElements(eSuperType); | |||||||||||||||
7 | if (!allAttributes.isEmpty()) |
| 7 | if (!allElements.isEmpty()) | |||||||||||||||
8 | if (result == null) | 8 | if (result == null) | ||||||||||||||||
9 | result = allAttributes; |
| 9 | result = allElements; | |||||||||||||||
else | else | ||||||||||||||||||
10 | if (!changeable) | 10 | if (!changeable) | ||||||||||||||||
11 | changeable = true; | 11 | changeable = true; | ||||||||||||||||
12 | result = new UniqueEList<EStructuralFeature>(result); | 12 | result = new UniqueEList<EStructuralFeature>(result); | ||||||||||||||||
13 | result.addAll(allAttributes); |
| 13 | result.addAll(allElements); | |||||||||||||||
14 | List<EStructuralFeature> attributes = getAttributes(eClass); |
| 14 | List<EStructuralFeature> elements = getElements(eClass); | |||||||||||||||
15 | if (!attributes.isEmpty()) |
| 15 | if (!elements.isEmpty()) | |||||||||||||||
16 | if (result == null) | 16 | if (result == null) | ||||||||||||||||
17 | return attributes; |
| 17 | return elements; | |||||||||||||||
else | else | ||||||||||||||||||
18 | if (!changeable) | 18 | if (!changeable) | ||||||||||||||||
19 | result = new UniqueEList<EStructuralFeature>(result); | 19 | result = new UniqueEList<EStructuralFeature>(result); | ||||||||||||||||
20 | result.addAll(attributes); |
| 20 | result.addAll(elements); | |||||||||||||||
21 | return result; | 21 | return result; | ||||||||||||||||
else | else | ||||||||||||||||||
22 | return result == null ? Collections.<EStructuralFeature>emptyList() : result; | 22 | return result == null ? Collections.<EStructuralFeature>emptyList() : result; |
Row | Violation |
---|---|
1 | Expression getAllAttributes(eSuperType) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression getAllElements(eSuperType) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression getAttributes(eClass) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression getElements(eClass) cannot be parameterized, because it has dependencies to/from statements that will be extracted |