File path: /ArgoUML-0.34-src/argouml/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java | File path: /ArgoUML-0.34-src/argouml/src/argouml-core-model-mdr/src/org/argouml/model/mdr/ModelManagementHelperMDRImpl.java | |||
Method name: List
|
Method name: Collection getAllBehavioralFeatures(Object)
|
|||
Number of AST nodes: 3 | Number of AST nodes: 4 | |||
1 | public List<BehavioralFeature> getBehavioralFeatures(Object clazz) { | 1 | public Collection getAllBehavioralFeatures(Object ns) { | |
2 | if (clazz instanceof Classifier) { | 2 | // Get Classifiers in Namespace | |
3 | List<BehavioralFeature> ret = new ArrayList<BehavioralFeature>(); | 3 | ArrayList features = new ArrayList(); | |
4 | try { | 4 | try { | |
5 | for (Object o : modelImpl.getFacade().getFeatures(clazz)) { | 5 | Collection classifiers = getAllModelElementsOfKind(ns, | |
6 | if (o instanceof BehavioralFeature) { | 6 | modelImpl.getMetaTypes().getClassifier()); | |
7 | ret.add((BehavioralFeature) o); | 7 | Iterator i = classifiers.iterator(); | |
8 | } | 8 | // Get Features owned by those Classifiers | |
9 | } | 9 | while (i.hasNext()) { | |
10 | } catch (InvalidObjectException e) { | 10 | features.addAll(modelImpl.getFacade().getFeatures(i.next())); | |
11 | throw new InvalidElementException(e); | 11 | } | |
12 | } | 12 | } catch (InvalidObjectException e) { | |
13 | return ret; | 13 | throw new InvalidElementException(e); | |
14 | } else { | 14 | } | |
15 | throw new IllegalArgumentException("Argument is not a classifier"); | 15 | // Select those Features which are BehavioralFeatures | |
16 | } | 16 | ArrayList behavioralfeatures = new ArrayList(); | |
17 | } | 17 | Iterator ii = features.iterator(); | |
18 | while (ii.hasNext()) { | |||
19 | Object f = ii.next(); | |||
20 | if (f instanceof BehavioralFeature) { | |||
21 | behavioralfeatures.add(f); | |||
22 | } | |||
23 | } | |||
24 | return behavioralfeatures; | |||
25 | } | |||
See real code fragment | See real code fragment |
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) | 0.0 |
Similarity Score | 0.600 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4 | for (Object o : modelImpl.getFacade().getFeatures(clazz)) |
| 9 | while (ii.hasNext()) | |||||||||||||
|
| 10 | Object f = ii.next(); | ||||||||||||||
5 | if (o instanceof BehavioralFeature) |
| 11 | if (f instanceof BehavioralFeature) | |||||||||||||
6 | ret.add((BehavioralFeature)o); |
| | ||||||||||||||
|
| 12 | behavioralfeatures.add(f); |
Row | Violation |
---|---|
1 | Unmatched statement ret.add((BehavioralFeature)o); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement behavioralfeatures.add(f); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |