File path: /ArgoUML-0.34-src/argouml-sql/src/org/argouml/language/sql/Utils.java | File path: /ArgoUML-0.34-src/argouml-cpp/src/org/argouml/language/cpp/profile/BaseProfile.java | |||
Method name: Object getAttributeForName(Object, String)
|
Method name: Object getStereotype(Object, String)
|
|||
Number of AST nodes: 5 | Number of AST nodes: 3 | |||
1 | /** | 1 | private Object getStereotype(Object aModel, String stereotypeName) { | |
2 | * Search the attribute named <code>attributeName</code> in the given | 2 | Collection stereotypes = getExtensionMechanismsHelper().getStereotypes( | |
3 | * relation. If there exist more than one attribute the first one is | 3 | aModel); | |
4 | * returned. | 4 | for (Object stereotype : stereotypes) { | |
5 | * | 5 | if (stereotypeName.equals(getFacade().getName(stereotype))) { | |
6 | * @param relation | 6 | return stereotype; | |
7 | * The relation in which to search the attribute. | 7 | } | |
8 | * @param attributeName | 8 | } | |
9 | * The name of the attribute to search. | 9 | return null; | |
10 | * @return The attribute if found, <code>null</code> else. | 10 | } | |
11 | */ | |||
12 | public static Object getAttributeForName(Object relation, | |||
13 | String attributeName) { | |||
14 | Object attribute = null; | |||
15 | ||||
16 | Collection attributes = Model.getFacade().getAttributes(relation); | |||
17 | for (Iterator it = attributes.iterator(); it.hasNext();) { | |||
18 | Object attr = it.next(); | |||
19 | if (Model.getFacade().getName(attr).equals(attributeName)) { | |||
20 | attribute = attr; | |||
21 | break; | |||
22 | } | |||
23 | } | |||
24 | ||||
25 | return attribute; | |||
26 | } | |||
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 | 0.833 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | for (Iterator it = attributes.iterator(); it.hasNext(); ) |
| 2 | for (Object stereotype : stereotypes) | ||||||||||||||
4 | Object attr = it.next(); |
| | |||||||||||||||
5 | if (Model.getFacade().getName(attr).equals(attributeName)) |
| 3 | if (stereotypeName.equals(getFacade().getName(stereotype))) | ||||||||||||||
|
| 4 | return stereotype; | |||||||||||||||
6 | attribute = attr; |
| | |||||||||||||||
7 | break; |
| |
Row | Violation |
---|---|
1 | Expression getFacade().getName(stereotype) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement return stereotype; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched return stereotype; |
4 | Unmatched statement attribute=attr; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched break; |