File path: /ArgoUML-0.34-src/argouml-cpp/src/org/argouml/language/cpp/profile/DefaultTypeStrategyCpp.java | File path: /ArgoUML-0.34-src/argouml-cpp/src/org/argouml/language/cpp/reveng/XtorModeler.java | |||
Method name: Object getDefaultType(String)
|
Method name: Object getStereotype(Object, String)
|
|||
Number of AST nodes: 3 | Number of AST nodes: 5 | |||
1 | private Object getDefaultType(String typeName) { | 1 | /** | |
2 | for (Object model : profileModels) { | 2 | * Helper method that gets a stereotype for the given model | |
3 | Collection dataTypes = Model.getCoreHelper().getAllDataTypes(model); | 3 | * element with the given name. | |
4 | for (Object dataType : dataTypes) { | 4 | * | |
5 | if (typeName.equals(Model.getFacade().getName(dataType))) { | 5 | * TODO: this might be a performance bottleneck. If so, caching of | |
6 | return dataType; | 6 | * stereotypes for model elements by their stereotypes names could fix it. | |
7 | } | 7 | * | |
8 | } | 8 | * @param modelElement The model element for which to look for the | |
9 | } | 9 | * stereotype with the given name | |
10 | return null; | 10 | * @param stereotypeName The name of the stereotype. | |
11 | } | 11 | * @return the stereotype model element or null if not found. | |
12 | */ | |||
13 | private Object getStereotype(Object modelElement, String stereotypeName) { | |||
14 | Object stereotype = null; | |||
15 | Collection stereotypes = StereotypeUtility.getAvailableStereotypes( | |||
16 | modelElement); | |||
17 | for (Iterator it = stereotypes.iterator(); it.hasNext();) { | |||
18 | Object candidateStereotype = it.next(); | |||
19 | if (getFacade().getName(candidateStereotype).equals( | |||
20 | stereotypeName)) { | |||
21 | stereotype = candidateStereotype; | |||
22 | break; | |||
23 | } | |||
24 | } | |||
25 | return stereotype; | |||
26 | } | |||
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 | 2 |
Time elapsed for statement mapping (ms) | 0.0 |
Similarity Score | 0.833 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | for (Object dataType : dataTypes) |
| 3 | for (Iterator it = stereotypes.iterator(); it.hasNext(); ) | ||||||||||||||
|
| 4 | Object candidateStereotype = it.next(); | |||||||||||||||
4 | if (typeName.equals(Model.getFacade().getName(dataType))) |
| 5 | if (getFacade().getName(candidateStereotype).equals(stereotypeName)) | ||||||||||||||
5 | return dataType; |
| | |||||||||||||||
|
| 6 | stereotype = candidateStereotype; | |||||||||||||||
|
| 7 | break; |
Row | Violation |
---|---|
1 | Expression Model.getFacade().getName(dataType) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement return dataType; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched return dataType; |
4 | Unmatched statement stereotype=candidateStereotype; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched break; |