File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/EContentsEList.java | File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/EContentsEList.java | |||
Method name: boolean hasNext()
|
Method name: boolean hasPrevious()
|
|||
Number of AST nodes: 35 | Number of AST nodes: 34 | |||
1 | EStructuralFeature feature = eStructuralFeatures[featureCursor++];↵ | 1 | EStructuralFeature feature = eStructuralFeatures[--featureCursor];↵ | |
2 | if (isIncluded(feature) && (!useIsSet() || eObject.eIsSet(feature)))↵ | 2 | if (isIncluded(feature) && (!useIsSet() || eObject.eIsSet(feature)))↵ | |
3 | {↵ | 3 | {↵ | |
4 | Object value = eObject.eGet(feature, resolve());↵ | 4 | Object value = eObject.eGet(feature, resolve());↵ | |
5 | isHandlingFeatureMap = FeatureMapUtil.isFeatureMap(feature);↵ | 5 | isHandlingFeatureMap = FeatureMapUtil.isFeatureMap(feature);↵ | |
6 | if (isHandlingFeatureMap || feature.isMany())↵ | 6 | if (isHandlingFeatureMap || feature.isMany())↵ | |
7 | {↵ | 7 | {↵ | |
8 | if (resolve())↵ | 8 | if (resolve())↵ | |
9 | {↵ | 9 | {↵ | |
10 | @SuppressWarnings("unchecked") List<E> newValueList = (List<E>)value;↵ | 10 | @SuppressWarnings("unchecked") List<E> newValueList = (List<E>)value;↵ | |
11 | valueList = newValueList;↵ | 11 | valueList = newValueList;↵ | |
12 | }↵ | 12 | }↵ | |
13 | else↵ | 13 | else↵ | |
14 | {↵ | 14 | {↵ | |
15 | @SuppressWarnings("unchecked") InternalEList<E> newValueList = (InternalEList<E>)value;↵ | 15 | @SuppressWarnings("unchecked") InternalEList<E> newValueList = (InternalEList<E>)value;↵ | |
16 | valueList = valueInternalEList = newValueList;↵ | 16 | valueList = valueInternalEList = newValueList;↵ | |
17 | }↵ | 17 | }↵ | |
18 | if (valueList instanceof RandomAccess)↵ | 18 | if (valueList instanceof RandomAccess)↵ | |
19 | {↵ | 19 | {↵ | |
20 | values = null;↵ | |||
21 | valueListSize = valueList.size();↵ | 20 | valueListSize = valueList.size();↵ | |
22 | valueListIndex = 0;↵ | 21 | valueListIndex = valueListSize;↵ | |
23 | }↵ | 22 | }↵ | |
24 | else↵ | 23 | else↵ | |
25 | {↵ | 24 | {↵ | |
26 | values = ↵ | 25 | values = ↵ | |
27 | valueInternalEList == null ? ↵ | 26 | valueInternalEList == null ? ↵ | |
28 | valueList.listIterator() : ↵ | 27 | valueList.listIterator(valueList.size()) : ↵ | |
29 | valueInternalEList.basicListIterator();↵ | 28 | valueInternalEList.basicListIterator(valueList.size());↵ | |
30 | }↵ | 29 | }↵ | |
31 | if (values == null ? scanNext() : scanNext(values))↵ | 30 | if (values == null ? scanPrevious() : scanPrevious(values))↵ | |
32 | {↵ | 31 | {↵ | |
33 | Object result = ↵ | 32 | Object result =↵ | |
34 | ↵ | |||
35 | values == null ? ↵ | 33 | values == null ? ↵ | |
36 | valueInternalEList == null ? ↵ | 34 | valueInternalEList == null ? ↵ | |
37 | valueList.get(valueListIndex++) : ↵ | 35 | valueList.get(--valueListIndex) : ↵ | |
38 | valueInternalEList.basicGet(valueListIndex++) : ↵ | 36 | valueInternalEList.basicGet(--valueListIndex) : ↵ | |
39 | values.next();↵ | 37 | values.previous();↵ | |
40 | if (isHandlingFeatureMap)↵ | 38 | if (isHandlingFeatureMap)↵ | |
41 | {↵ | 39 | {↵ | |
42 | FeatureMap.Entry entry = (FeatureMap.Entry)result; ↵ | 40 | FeatureMap.Entry entry = (FeatureMap.Entry)result; ↵ | |
43 | preparedFeature = entry.getEStructuralFeature();↵ | 41 | preparedFeature = entry.getEStructuralFeature();↵ | |
44 | @SuppressWarnings("unchecked") E newPreparedResult = (E)entry.getValue();↵ | 42 | @SuppressWarnings("unchecked") E newPreparedResult = (E)entry.getValue();↵ | |
45 | preparedResult = newPreparedResult;↵ | 43 | preparedResult = newPreparedResult;↵ | |
46 | }↵ | 44 | }↵ | |
47 | else↵ | 45 | else↵ | |
48 | {↵ | 46 | {↵ | |
49 | @SuppressWarnings("unchecked") E newPreparedResult = (E)result;↵ | 47 | @SuppressWarnings("unchecked") E newPreparedResult = (E)result;↵ | |
50 | preparedResult = newPreparedResult;↵ | 48 | preparedResult = newPreparedResult;↵ | |
51 | preparedFeature = feature;↵ | 49 | preparedFeature = feature;↵ | |
52 | }↵ | 50 | }↵ | |
53 | prepared = 3;↵ | 51 | prepared = -3;↵ | |
54 | return true;↵ | 52 | return true;↵ | |
55 | }↵ | 53 | }↵ | |
56 | }↵ | 54 | }↵ | |
57 | else if (value != null)↵ | 55 | else if (value != null)↵ | |
58 | {↵ | 56 | {↵ | |
59 | valueList = null;↵ | 57 | valueList = null;↵ | |
60 | values = null;↵ | 58 | values = null;↵ | |
61 | @SuppressWarnings("unchecked") E newPreparedResult = (E)value;↵ | 59 | @SuppressWarnings("unchecked") E newPreparedResult = (E)value;↵ | |
62 | preparedResult = newPreparedResult;↵ | 60 | preparedResult = newPreparedResult;↵ | |
63 | preparedFeature = feature;↵ | 61 | preparedFeature = feature;↵ | |
64 | prepared = 2;↵ | 62 | prepared = -2;↵ | |
65 | return true;↵ | 63 | return true;↵ | |
66 | }↵ | 64 | }↵ | |
67 | } | 65 |
| |
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) | 1.6 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 222 |
Number of mapped statements | 34 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 19.2 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
14 | EStructuralFeature feature = eStructuralFeatures[featureCursor++]; | 14 | EStructuralFeature feature = eStructuralFeatures[--featureCursor]; | ||||||||||||||||||
15 | if (isIncluded(feature) && (!useIsSet() || eObject.eIsSet(feature))) | 15 | if (isIncluded(feature) && (!useIsSet() || eObject.eIsSet(feature))) | ||||||||||||||||||
16 | Object value = eObject.eGet(feature, resolve()); | 16 | Object value = eObject.eGet(feature, resolve()); | ||||||||||||||||||
17 | isHandlingFeatureMap = FeatureMapUtil.isFeatureMap(feature); | 17 | isHandlingFeatureMap = FeatureMapUtil.isFeatureMap(feature); | ||||||||||||||||||
18 | if (isHandlingFeatureMap || feature.isMany()) | 18 | if (isHandlingFeatureMap || feature.isMany()) | ||||||||||||||||||
19 | if (resolve()) | 19 | if (resolve()) | ||||||||||||||||||
20 | @SuppressWarnings("unchecked") List<E> newValueList = (List<E>)value; | 20 | @SuppressWarnings("unchecked") List<E> newValueList = (List<E>)value; | ||||||||||||||||||
21 | valueList = newValueList; | 21 | valueList = newValueList; | ||||||||||||||||||
else | else | ||||||||||||||||||||
22 | @SuppressWarnings("unchecked") InternalEList<E> newValueList = (InternalEList<E>)value; | 22 | @SuppressWarnings("unchecked") InternalEList<E> newValueList = (InternalEList<E>)value; | ||||||||||||||||||
23 | valueList = valueInternalEList = newValueList; | 23 | valueList = valueInternalEList = newValueList; | ||||||||||||||||||
24 | if (valueList instanceof RandomAccess) | 24 | if (valueList instanceof RandomAccess) | ||||||||||||||||||
25 | values = null; |
| | ||||||||||||||||||
26 | valueListSize = valueList.size(); | 25 | valueListSize = valueList.size(); | ||||||||||||||||||
27 | valueListIndex = 0; |
| 26 | valueListIndex = valueListSize; | |||||||||||||||||
else | else | ||||||||||||||||||||
28 | values = valueInternalEList == null ? valueList.listIterator() : valueInternalEList.basicListIterator(); |
| 27 | values = valueInternalEList == null ? valueList.listIterator(valueList.size()) : valueInternalEList.basicListIterator(valueList.size()); | |||||||||||||||||
29 | if (values == null ? scanNext() : scanNext(values)) |
| 28 | if (values == null ? scanPrevious() : scanPrevious(values)) | |||||||||||||||||
30 | Object result = values == null ? valueInternalEList == null ? valueList.get(valueListIndex++) : valueInternalEList.basicGet(valueListIndex++) : values.next(); |
| 29 | Object result = values == null ? valueInternalEList == null ? valueList.get(--valueListIndex) : valueInternalEList.basicGet(--valueListIndex) : values.previous(); | |||||||||||||||||
31 | if (isHandlingFeatureMap) | 30 | if (isHandlingFeatureMap) | ||||||||||||||||||
32 | FeatureMap.Entry entry = (FeatureMap.Entry)result; | 31 | FeatureMap.Entry entry = (FeatureMap.Entry)result; | ||||||||||||||||||
33 | preparedFeature = entry.getEStructuralFeature(); | 32 | preparedFeature = entry.getEStructuralFeature(); | ||||||||||||||||||
34 | @SuppressWarnings("unchecked") E newPreparedResult = (E)entry.getValue(); | 33 | @SuppressWarnings("unchecked") E newPreparedResult = (E)entry.getValue(); | ||||||||||||||||||
35 | preparedResult = newPreparedResult; | 34 | preparedResult = newPreparedResult; | ||||||||||||||||||
else | else | ||||||||||||||||||||
36 | @SuppressWarnings("unchecked") E newPreparedResult = (E)result; | 35 | @SuppressWarnings("unchecked") E newPreparedResult = (E)result; | ||||||||||||||||||
37 | preparedResult = newPreparedResult; | 36 | preparedResult = newPreparedResult; | ||||||||||||||||||
38 | preparedFeature = feature; | 37 | preparedFeature = feature; | ||||||||||||||||||
39 | prepared = 3; |
| 38 | prepared = -3; | |||||||||||||||||
40 | return true; |
| 39 | return true; | |||||||||||||||||
41 | else if (value != null) | 40 | else if (value != null) | ||||||||||||||||||
42 | valueList = null; | 41 | valueList = null; | ||||||||||||||||||
43 | values = null; | 42 | values = null; | ||||||||||||||||||
44 | @SuppressWarnings("unchecked") E newPreparedResult = (E)value; | 43 | @SuppressWarnings("unchecked") E newPreparedResult = (E)value; | ||||||||||||||||||
45 | preparedResult = newPreparedResult; | 44 | preparedResult = newPreparedResult; | ||||||||||||||||||
46 | preparedFeature = feature; | 45 | preparedFeature = feature; | ||||||||||||||||||
47 | prepared = 2; |
| 46 | prepared = -2; | |||||||||||||||||
48 | return true; |
| 47 | return true; |
Row | Violation |
---|---|
1 | Unmatched statement values=null; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Expression valueListSize cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression valueList.listIterator() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression valueList.listIterator(valueList.size()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression valueInternalEList.basicListIterator() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression valueInternalEList.basicListIterator(valueList.size()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression scanNext(values) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression scanPrevious(values) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Expression values.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
10 | Expression values.previous() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Conditional return true; |
12 | Conditional return true; |
13 | Conditional return true; |
14 | Conditional return true; |