File path: /ArgoUML-0.34-src/argouml/src/argouml-core-model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsHelperMDRImpl.java | File path: /ArgoUML-0.34-src/argouml/src/argouml-core-model-mdr/src/org/argouml/model/mdr/FacadeMDRImpl.java | |||
Method name: boolean hasStereotype(Object, String)
|
Method name: boolean isStereotype(Object, String)
|
|||
Number of AST nodes: 3 | Number of AST nodes: 4 | |||
1 | public boolean hasStereotype(Object handle, String name) { | 1 | public boolean isStereotype(Object handle, String stereotypeName) { | |
2 | if (name == null || !(handle instanceof ModelElement)) { | 2 | try { | |
3 | throw new IllegalArgumentException(); | 3 | if (handle instanceof ModelElement) { | |
4 | } | 4 | Collection stereotypes = | |
5 | try { | 5 | ((ModelElement) handle).getStereotype(); | |
6 | ModelElement element = (ModelElement) handle; | 6 | Iterator it = stereotypes.iterator(); | |
7 | for (Stereotype stereotype : element.getStereotype()) { | 7 | Stereotype stereotype; | |
8 | if (name.equals(stereotype.getName())) { | 8 | while (it.hasNext()) { | |
9 | return true; | 9 | stereotype = (Stereotype) it.next(); | |
10 | } | 10 | if (stereotypeName.equals(stereotype.getName())) { | |
11 | } | 11 | return true; | |
12 | } catch (InvalidObjectException e) { | 12 | } | |
13 | throw new InvalidElementException(e); | 13 | } | |
14 | } | 14 | return false; | |
15 | return false; | 15 | } | |
16 | } | 16 | return illegalArgumentBoolean(handle); | |
17 | } catch (InvalidObjectException e) { | |||
18 | throw new InvalidElementException(e); | |||
19 | } | |||
20 | } | |||
See real code fragment | See real code fragment |
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 0 |
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 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5 | for (Stereotype stereotype : element.getStereotype()) |
| 6 | while (it.hasNext()) | |||||||||||
|
| 7 | stereotype = (Stereotype)it.next(); | ||||||||||||
6 | if (name.equals(stereotype.getName())) |
| 8 | if (stereotypeName.equals(stereotype.getName())) | |||||||||||
7 | return true; | 9 | return true; |
Row | Violation |
---|---|
1 | Type java.util.Collection<org.omg.uml.foundation.core.Stereotype> of variable element.getStereotype() does not match with type java.util.Collection of variable stereotypes |
2 | Unmatched statement stereotype=(Stereotype)it.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |