File path: /ArgoUML-0.34-src/argouml/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLLinkAssociationComboBoxModel.java | File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/diagram/collaboration/CollabDiagramGraphModel.java | |||
Method name: void buildModelList()
|
Method name: List getInEdges(Object)
|
|||
Number of AST nodes: 4 | Number of AST nodes: 2 | |||
1 | /** | 1 | public List getInEdges(Object port) { | |
2 | * To simplify implementation, we list all associations | 2 | ||
3 | * found with any of the Classifiers | 3 | if (Model.getFacade().isAClassifierRole(port)) { | |
4 | * represented by the linked Instances. <p> | 4 | Object cr = port; | |
5 | * | 5 | Collection ends = Model.getFacade().getAssociationEnds(cr); | |
6 | * TODO: Make a foolproof algorithm that only allows selecting associations | 6 | if (ends == null) { | |
7 | * that create a correct model. Also take into account n-ary associations | 7 | return Collections.EMPTY_LIST; | |
8 | * and associationclasses. This algo best goes in the model subsystem, e.g. | 8 | } | |
9 | * in a method getAllPossibleAssociationsForALink(). | 9 | List result = new ArrayList(); | |
10 | * | 10 | for (Object end : ends) { | |
11 | * @see org.argouml.uml.ui.UMLComboBoxModel#buildModelList() | 11 | result.add(Model.getFacade().getAssociation(end)); | |
12 | */ | 12 | } | |
13 | protected void buildModelList() { | 13 | } | |
14 | Collection linkEnds; | 14 | return Collections.EMPTY_LIST; | |
15 | Collection associations = new HashSet(); | 15 | } | |
16 | Object t = getTarget(); | |||
17 | if (Model.getFacade().isALink(t)) { | |||
18 | linkEnds = Model.getFacade().getConnections(t); | |||
19 | Iterator ile = linkEnds.iterator(); | |||
20 | while (ile.hasNext()) { | |||
21 | Object instance = Model.getFacade().getInstance(ile.next()); | |||
22 | Collection c = Model.getFacade().getClassifiers(instance); | |||
23 | Iterator ic = c.iterator(); | |||
24 | while (ic.hasNext()) { | |||
25 | Object classifier = ic.next(); | |||
26 | Collection ae = | |||
27 | Model.getFacade().getAssociationEnds(classifier); | |||
28 | Iterator iae = ae.iterator(); | |||
29 | while (iae.hasNext()) { | |||
30 | Object associationEnd = iae.next(); | |||
31 | Object association = | |||
32 | Model.getFacade().getAssociation(associationEnd); | |||
33 | associations.add(association); | |||
34 | } | |||
35 | } | |||
36 | } | |||
37 | } | |||
38 | setElements(associations); | |||
39 | } | |||
See real code fragment | See real code fragment |
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.0 |
Similarity Score | 1.000 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
15 | while (iae.hasNext()) |
| 7 | for (Object end : ends) | ||||||||||
|
| 8 | result.add(Model.getFacade().getAssociation(end)); | |||||||||||
16 | Object associationEnd = iae.next(); |
| | |||||||||||
17 | Object association = Model.getFacade().getAssociation(associationEnd); |
| | |||||||||||
18 | associations.add(association); | |
Row | Violation |
---|---|
1 | Unmatched statement result.add(Model.getFacade().getAssociation(end)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement Object association=Model.getFacade().getAssociation(associationEnd); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |