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: EStructuralFeature getLocalAttribute(EClass, String, String)
|
Method name: EStructuralFeature getLocalElement(EClass, String, String)
|
|||
Number of AST nodes: 34 | Number of AST nodes: 34 | |||
1 | EStructuralFeature result = null;↵ | 1 | EStructuralFeature result = null;↵ | |
2 | if (isFeatureKindSpecific())↵ | 2 | if (isFeatureKindSpecific())↵ | |
3 | {↵ | 3 | {↵ | |
4 | List<EStructuralFeature> allAttributes = getAllAttributes(eClass);↵ | 4 | List<EStructuralFeature> allElements = getAllElements(eClass);↵ | |
5 | for (int i = 0, size = allAttributes.size(); i < size; ++i)↵ | 5 | for (int i = 0, size = allElements.size(); i < size; ++i)↵ | |
6 | {↵ | 6 | {↵ | |
7 | EStructuralFeature eStructuralFeature = allAttributes.get(i);↵ | 7 | EStructuralFeature eStructuralFeature = allElements.get(i);↵ | |
8 | if (name.equals(getName(eStructuralFeature)))↵ | 8 | if (name.equals(getName(eStructuralFeature)))↵ | |
9 | {↵ | 9 | {↵ | |
10 | String featureNamespace = getNamespace(eStructuralFeature);↵ | 10 | String featureNamespace = getNamespace(eStructuralFeature);↵ | |
11 | if (namespace == null) ↵ | 11 | if (namespace == null) ↵ | |
12 | {↵ | 12 | {↵ | |
13 | if (featureNamespace == null)↵ | 13 | if (featureNamespace == null)↵ | |
14 | {↵ | 14 | {↵ | |
15 | return eStructuralFeature;↵ | 15 | return eStructuralFeature;↵ | |
16 | }↵ | 16 | }↵ | |
17 | else if (result == null)↵ | 17 | else if (result == null)↵ | |
18 | {↵ | 18 | {↵ | |
19 | result = eStructuralFeature;↵ | 19 | result = eStructuralFeature;↵ | |
20 | }↵ | 20 | }↵ | |
21 | }↵ | 21 | }↵ | |
22 | else if (namespace.equals(featureNamespace))↵ | 22 | else if (namespace.equals(featureNamespace))↵ | |
23 | {↵ | 23 | {↵ | |
24 | return eStructuralFeature;↵ | 24 | return eStructuralFeature;↵ | |
25 | }↵ | 25 | }↵ | |
26 | else if (featureNamespace == null && result == null)↵ | 26 | else if (featureNamespace == null && result == null)↵ | |
27 | {↵ | 27 | {↵ | |
28 | result = eStructuralFeature;↵ | 28 | result = eStructuralFeature;↵ | |
29 | }↵ | 29 | }↵ | |
30 | }↵ | 30 | }↵ | |
31 | }↵ | 31 | }↵ | |
32 | }↵ | 32 | }↵ | |
33 | else↵ | 33 | else↵ | |
34 | {↵ | 34 | {↵ | |
35 | for (int i = 0, size = eClass.getFeatureCount(); i < size; ++i)↵ | 35 | for (int i = 0, size = eClass.getFeatureCount(); i < size; ++i)↵ | |
36 | {↵ | 36 | {↵ | |
37 | EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(i);↵ | 37 | EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(i);↵ | |
38 | switch (getFeatureKind(eStructuralFeature))↵ | 38 | switch (getFeatureKind(eStructuralFeature))↵ | |
39 | {↵ | 39 | {↵ | |
40 | case UNSPECIFIED_FEATURE:↵ | 40 | case UNSPECIFIED_FEATURE:↵ | |
41 | case ATTRIBUTE_FEATURE:↵ | 41 | case ELEMENT_FEATURE:↵ | |
42 | {↵ | 42 | {↵ | |
43 | if (name.equals(getName(eStructuralFeature)))↵ | 43 | if (name.equals(getName(eStructuralFeature)))↵ | |
44 | {↵ | 44 | {↵ | |
45 | String featureNamespace = getNamespace(eStructuralFeature);↵ | 45 | String featureNamespace = getNamespace(eStructuralFeature);↵ | |
46 | if (namespace == null) ↵ | 46 | if (namespace == null) ↵ | |
47 | {↵ | 47 | {↵ | |
48 | if (featureNamespace == null)↵ | 48 | if (featureNamespace == null)↵ | |
49 | {↵ | 49 | {↵ | |
50 | return eStructuralFeature;↵ | 50 | return eStructuralFeature;↵ | |
51 | }↵ | 51 | }↵ | |
52 | else if (result == null)↵ | 52 | else if (result == null)↵ | |
53 | {↵ | 53 | {↵ | |
54 | result = eStructuralFeature;↵ | 54 | result = eStructuralFeature;↵ | |
55 | }↵ | 55 | }↵ | |
56 | }↵ | 56 | }↵ | |
57 | else if (namespace.equals(featureNamespace))↵ | 57 | else if (namespace.equals(featureNamespace))↵ | |
58 | {↵ | 58 | {↵ | |
59 | return eStructuralFeature;↵ | 59 | return eStructuralFeature;↵ | |
60 | }↵ | 60 | }↵ | |
61 | else if (featureNamespace == null && result == null)↵ | 61 | else if (featureNamespace == null && result == null)↵ | |
62 | {↵ | 62 | {↵ | |
63 | result = eStructuralFeature;↵ | 63 | result = eStructuralFeature;↵ | |
64 | }↵ | 64 | }↵ | |
65 | }↵ | 65 | }↵ | |
66 | break;↵ | 66 | break;↵ | |
67 | }↵ | 67 | }↵ | |
68 | }↵ | 68 | }↵ | |
69 | }↵ | 69 | }↵ | |
70 | }↵ | 70 | }↵ | |
71 | return isFeatureNamespaceMatchingLax() ? result : null; | 71 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 3.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 109 |
Number of mapped statements | 34 |
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) | 51.5 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | EStructuralFeature result = null; | 1 | EStructuralFeature result = null; | ||||||||||||||
2 | if (isFeatureKindSpecific()) | 2 | if (isFeatureKindSpecific()) | ||||||||||||||
3 | List<EStructuralFeature> allAttributes = getAllAttributes(eClass); |
| 3 | List<EStructuralFeature> allElements = getAllElements(eClass); | |||||||||||||
4 | for (int i = 0, size = allAttributes.size(); i < size; ++i) |
| 4 | for (int i = 0, size = allElements.size(); i < size; ++i) | |||||||||||||
5 | EStructuralFeature eStructuralFeature = allAttributes.get(i); |
| 5 | EStructuralFeature eStructuralFeature = allElements.get(i); | |||||||||||||
6 | if (name.equals(getName(eStructuralFeature))) | 6 | if (name.equals(getName(eStructuralFeature))) | ||||||||||||||
7 | String featureNamespace = getNamespace(eStructuralFeature); | 7 | String featureNamespace = getNamespace(eStructuralFeature); | ||||||||||||||
8 | if (namespace == null) | 8 | if (namespace == null) | ||||||||||||||
9 | if (featureNamespace == null) | 9 | if (featureNamespace == null) | ||||||||||||||
10 | return eStructuralFeature; | 10 | return eStructuralFeature; | ||||||||||||||
11 | else if (result == null) | 11 | else if (result == null) | ||||||||||||||
12 | result = eStructuralFeature; | 12 | result = eStructuralFeature; | ||||||||||||||
13 | else if (namespace.equals(featureNamespace)) | 13 | else if (namespace.equals(featureNamespace)) | ||||||||||||||
14 | return eStructuralFeature; | 14 | return eStructuralFeature; | ||||||||||||||
15 | else if (featureNamespace == null && result == null) | 15 | else if (featureNamespace == null && result == null) | ||||||||||||||
16 | result = eStructuralFeature; | 16 | result = eStructuralFeature; | ||||||||||||||
else | else | ||||||||||||||||
17 | for (int i = 0, size = eClass.getFeatureCount(); i < size; ++i) | 17 | for (int i = 0, size = eClass.getFeatureCount(); i < size; ++i) | ||||||||||||||
18 | EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(i); | 18 | EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(i); | ||||||||||||||
19 | switch (getFeatureKind(eStructuralFeature)) | 19 | switch (getFeatureKind(eStructuralFeature)) | ||||||||||||||
20 | case UNSPECIFIED_FEATURE: | 20 | case UNSPECIFIED_FEATURE: | ||||||||||||||
21 | case ATTRIBUTE_FEATURE: |
| 21 | case ELEMENT_FEATURE: | |||||||||||||
22 | if (name.equals(getName(eStructuralFeature))) | 22 | if (name.equals(getName(eStructuralFeature))) | ||||||||||||||
23 | String featureNamespace = getNamespace(eStructuralFeature); | 23 | String featureNamespace = getNamespace(eStructuralFeature); | ||||||||||||||
24 | if (namespace == null) | 24 | if (namespace == null) | ||||||||||||||
25 | if (featureNamespace == null) | 25 | if (featureNamespace == null) | ||||||||||||||
26 | return eStructuralFeature; | 26 | return eStructuralFeature; | ||||||||||||||
27 | else if (result == null) | 27 | else if (result == null) | ||||||||||||||
28 | result = eStructuralFeature; | 28 | result = eStructuralFeature; | ||||||||||||||
29 | else if (namespace.equals(featureNamespace)) | 29 | else if (namespace.equals(featureNamespace)) | ||||||||||||||
30 | return eStructuralFeature; | 30 | return eStructuralFeature; | ||||||||||||||
31 | else if (featureNamespace == null && result == null) | 31 | else if (featureNamespace == null && result == null) | ||||||||||||||
32 | result = eStructuralFeature; | 32 | result = eStructuralFeature; | ||||||||||||||
33 | break; | 33 | break; | ||||||||||||||
34 | return isFeatureNamespaceMatchingLax() ? result : null; | 34 | return isFeatureNamespaceMatchingLax() ? result : null; |
Row | Violation |
---|