File path: /ArgoUML-0.34-src/argouml/src/argouml-core-model-mdr/src/org/argouml/model/mdr/FacadeMDRImpl.java | File path: /ArgoUML-0.34-src/argouml/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java | |||
Method name: Collection getAssociatedClasses(Object)
|
Method name: Collection
|
|||
Number of AST nodes: 3 | Number of AST nodes: 2 | |||
1 | public Collection getAssociatedClasses(Object handle) { | 1 | public Collection<UmlAssociation> getAssociations(Object oclassifier) { | |
2 | try { | 2 | Collection<UmlAssociation> result = new ArrayList<UmlAssociation>(); | |
3 | Collection col = new ArrayList(); | 3 | try { | |
4 | if (handle instanceof Classifier) { | 4 | if (oclassifier instanceof Classifier) { | |
5 | Classifier classifier = (Classifier) handle; | 5 | for (Object end : Model.getFacade().getAssociationEnds( | |
6 | Collection ends = getAssociationEnds(classifier); | 6 | oclassifier)) { | |
7 | Iterator it = ends.iterator(); | 7 | result.add(((AssociationEnd) end).getAssociation()); | |
8 | Set associations = new HashSet(); | 8 | } | |
9 | while (it.hasNext()) { | 9 | } | |
10 | AssociationEnd ae = (AssociationEnd) it.next(); | 10 | } catch (InvalidObjectException e) { | |
11 | associations.add(ae.getAssociation()); | 11 | throw new InvalidElementException(e); | |
12 | } | 12 | } | |
13 | Collection otherEnds = new ArrayList(); | 13 | return result; | |
14 | it = associations.iterator(); | 14 | } | |
15 | while (it.hasNext()) { | |||
16 | otherEnds.addAll(((UmlAssociation) it.next()) | |||
17 | .getConnection()); | |||
18 | } | |||
19 | otherEnds.removeAll(ends); | |||
20 | it = otherEnds.iterator(); | |||
21 | while (it.hasNext()) { | |||
22 | col.add(((AssociationEnd) it.next()).getParticipant()); | |||
23 | } | |||
24 | return col; | |||
25 | } | |||
26 | } catch (InvalidObjectException e) { | |||
27 | throw new InvalidElementException(e); | |||
28 | } | |||
29 | return illegalArgumentCollection(handle); | |||
30 | } | |||
See real code fragment | See real code fragment |
Number of mapped statements | 3 |
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.500 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8 | while (it.hasNext()) |
| 4 | for (Object end : Model.getFacade().getAssociationEnds(oclassifier)) | ||||||||||
|
| 5 | result.add(((AssociationEnd)end).getAssociation()); | |||||||||||
9 | AssociationEnd ae = (AssociationEnd)it.next(); | | ||||||||||||
10 | associations.add(ae.getAssociation()); |
| |
Row | Violation |
---|---|
1 | Unmatched statement result.add(((AssociationEnd)end).getAssociation()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement associations.add(ae.getAssociation()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Clone fragment #1 returns variable ae with type org.omg.uml.foundation.core.AssociationEnd , while Clone fragment #2 returns variable end with type java.lang.Object |