File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/cognitive/critics/CrComponentInstanceWithoutClassifier.java | File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/cognitive/critics/CrObjectWithoutClassifier.java | |||
Method name: ListSet computeOffenders(UMLDeploymentDiagram)
|
Method name: ListSet computeOffenders(UMLDeploymentDiagram)
|
|||
Number of AST nodes: 15 | Number of AST nodes: 14 | |||
1 | /** | 1 | /** | |
2 | * If there are component-instances that have no enclosing FigMNodeInstance | 2 | * If there are objects that are not inside a component or a | |
3 | * the returned ListSet is not null. Then in the ListSet | 3 | * component-instance the returned vector-set is not null. Then in | |
4 | * are the UMLDeploymentDiagram and all FigComponentInstances with no | 4 | * the vector-set are the UMLDeploymentDiagram and all FigObjects | |
5 | * enclosing FigMNodeInstance | 5 | * with no enclosing FigComponent or FigComponentInstance | |
6 | * | 6 | * | |
7 | * @param deploymentDiagram the diagram to check | 7 | * @param dd the diagram to check | |
8 | * @return the set of offenders | 8 | * @return the set of offenders | |
9 | */ | 9 | */ | |
10 | public ListSet computeOffenders(UMLDeploymentDiagram deploymentDiagram) { | 10 | public ListSet computeOffenders(UMLDeploymentDiagram dd) { | |
11 | 11 | Collection figs = dd.getLayer().getContents(); | ||
12 | Collection figs = deploymentDiagram.getLayer().getContents(); | 12 | ListSet offs = null; | |
13 | ListSet offs = null; | 13 | for (Object obj : figs) { | |
14 | Iterator figIter = figs.iterator(); | 14 | if (!(obj instanceof FigObject)) { | |
15 | while (figIter.hasNext()) { | 15 | continue; | |
16 | Object obj = figIter.next(); | 16 | } | |
17 | if (!(obj instanceof FigComponentInstance)) { | 17 | FigObject fo = (FigObject) obj; | |
18 | continue; | 18 | if (fo != null) { | |
19 | } | 19 | Object mobj = fo.getOwner(); | |
20 | FigComponentInstance figComponentInstance = | 20 | if (mobj != null) { | |
21 | (FigComponentInstance) obj; | 21 | Collection col = Model.getFacade().getClassifiers(mobj); | |
22 | if (figComponentInstance != null) { | 22 | if (col.size() > 0) { | |
23 | Object coi = | 23 | continue; | |
24 | figComponentInstance.getOwner(); | 24 | } | |
25 | if (coi != null) { | 25 | } | |
26 | Collection col = Model.getFacade().getClassifiers(coi); | 26 | if (offs == null) { | |
27 | if (col.size() > 0) { | 27 | offs = new ListSet(); | |
28 | continue; | 28 | offs.add(dd); | |
29 | } | 29 | } | |
30 | } | 30 | offs.add(fo); | |
31 | if (offs == null) { | 31 | } | |
32 | offs = new ListSet(); | 32 | } | |
33 | offs.add(deploymentDiagram); | 33 | return offs; | |
34 | } | 34 | } | |
35 | offs.add(figComponentInstance); | |||
36 | } | |||
37 | } | |||
38 | ||||
39 | return offs; | |||
40 | } | |||
See real code fragment | See real code fragment |
Number of mapped statements | 16 |
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) | 0.0 |
Similarity Score | 0.846 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4 | while (figIter.hasNext()) | 3 | for (Object obj : figs) | |||||||||||||||||||||
5 | Object obj = figIter.next(); | | ||||||||||||||||||||||
6 | if (!(obj instanceof FigComponentInstance)) |
| 4 | if (!(obj instanceof FigObject)) | ||||||||||||||||||||
7 | continue; | 5 | continue; | |||||||||||||||||||||
8 | FigComponentInstance figComponentInstance = (FigComponentInstance)obj; |
| 6 | FigObject fo = (FigObject)obj; | ||||||||||||||||||||
9 | if (figComponentInstance != null) |
| 7 | if (fo != null) | ||||||||||||||||||||
10 | Object coi = figComponentInstance.getOwner(); |
| 8 | Object mobj = fo.getOwner(); | ||||||||||||||||||||
11 | if (coi != null) |
| 9 | if (mobj != null) | ||||||||||||||||||||
12 | Collection col = Model.getFacade().getClassifiers(coi); |
| 10 | Collection col = Model.getFacade().getClassifiers(mobj); | ||||||||||||||||||||
13 | if (col.size() > 0) | 11 | if (col.size() > 0) | |||||||||||||||||||||
14 | continue; | 12 | continue; | |||||||||||||||||||||
15 | if (offs == null) | 13 | if (offs == null) | |||||||||||||||||||||
16 | offs = new ListSet(); | 14 | offs = new ListSet(); | |||||||||||||||||||||
17 | offs.add(deploymentDiagram); |
| 15 | offs.add(dd); | ||||||||||||||||||||
18 | offs.add(figComponentInstance); |
| 16 | offs.add(fo); |
Row | Violation |
---|---|
1 | Expression obj instanceof FigObject cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression (FigObject)obj cannot be parameterized, because it has dependencies to/from statements that will be extracted |