File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/cognitive/critics/CrObjectWithoutComponent.java | File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/cognitive/critics/CrInterfaceWithoutComponent.java | |||
Method name: ListSet computeOffenders(UMLDeploymentDiagram)
|
Method name: ListSet computeOffenders(UMLDeploymentDiagram)
|
|||
Number of AST nodes: 10 | Number of AST nodes: 11 | |||
1 | /** | 1 | /** | |
2 | * If there are objects that are not inside a component or a | 2 | * If there are interfaces that are not inside a component | |
3 | * component-instance the returned vector-set is not null. Then in | 3 | * the returned ListSet is not null. Then in the ListSet | |
4 | * the vector-set are the UMLDeploymentDiagram and all FigObjects | 4 | * are the UMLDeploymentDiagram and all FigInterfaces with no | |
5 | * with no enclosing FigComponent or FigComponentInstance | 5 | * enclosing FigComponent | |
6 | * | 6 | * | |
7 | * @param dd 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 dd) { | 10 | public ListSet computeOffenders(UMLDeploymentDiagram dd) { | |
11 | Collection figs = dd.getLayer().getContents(); | 11 | Collection figs = dd.getLayer().getContents(); | |
12 | ListSet offs = null; | 12 | ListSet offs = null; | |
13 | for (Object obj : figs) { | 13 | Iterator figIter = figs.iterator(); | |
14 | if (!(obj instanceof FigObject)) { | 14 | while (figIter.hasNext()) { | |
15 | continue; | 15 | Object obj = figIter.next(); | |
16 | } | 16 | if (!(obj instanceof FigInterface)) { | |
17 | FigObject fo = (FigObject) obj; | 17 | continue; | |
18 | Fig enclosing = fo.getEnclosingFig(); | 18 | } | |
19 | if (enclosing == null | 19 | FigInterface fi = (FigInterface) obj; | |
20 | || (!(Model.getFacade().isAComponent(enclosing.getOwner()) | 20 | Fig enclosing = fi.getEnclosingFig(); | |
21 | || Model.getFacade().isAComponentInstance( | 21 | if (enclosing == null || (!(Model.getFacade() | |
22 | enclosing.getOwner())))) { | 22 | .isAComponent(enclosing.getOwner())))) { | |
23 | if (offs == null) { | 23 | if (offs == null) { | |
24 | offs = new ListSet(); | 24 | offs = new ListSet(); | |
25 | offs.add(dd); | 25 | offs.add(dd); | |
26 | } | 26 | } | |
27 | offs.add(fo); | 27 | offs.add(fi); | |
28 | } | 28 | } | |
29 | } | 29 | } | |
30 | return offs; | 30 | return offs; | |
31 | } | 31 | } | |
See real code fragment | See real code fragment |
Number of mapped statements | 12 |
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.786 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | for (Object obj : figs) | 4 | while (figIter.hasNext()) | |||||||||||||||||||||
| 5 | Object obj = figIter.next(); | ||||||||||||||||||||||
4 | if (!(obj instanceof FigObject)) |
| 6 | if (!(obj instanceof FigInterface)) | ||||||||||||||||||||
5 | continue; | 7 | continue; | |||||||||||||||||||||
6 | FigObject fo = (FigObject)obj; |
| 8 | FigInterface fi = (FigInterface)obj; | ||||||||||||||||||||
7 | Fig enclosing = fo.getEnclosingFig(); |
| 9 | Fig enclosing = fi.getEnclosingFig(); | ||||||||||||||||||||
8 | if (enclosing == null || (!(Model.getFacade().isAComponent(enclosing.getOwner()) || Model.getFacade().isAComponentInstance(enclosing.getOwner())))) |
| 10 | if (enclosing == null || (!(Model.getFacade().isAComponent(enclosing.getOwner())))) | ||||||||||||||||||||
9 | if (offs == null) | 11 | if (offs == null) | |||||||||||||||||||||
10 | offs = new ListSet(); | 12 | offs = new ListSet(); | |||||||||||||||||||||
11 | offs.add(dd); | 13 | offs.add(dd); | |||||||||||||||||||||
12 | offs.add(fo); |
| 14 | offs.add(fi); |
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 |
3 | Expression Model.getFacade().isAComponent(enclosing.getOwner()) || Model.getFacade().isAComponentInstance(enclosing.getOwner()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression Model.getFacade().isAComponent(enclosing.getOwner()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |