File path: /ArgoUML-0.34-src/argouml-cpp/src/org/argouml/language/cpp/reveng/ModelerImpl.java | File path: /ArgoUML-0.34-src/argouml-java/src/org/argouml/language/java/reveng/Modeller.java | |||
Method name: Object findClass(String, Object)
|
Method name: Object getClass(Object, String)
|
|||
Number of AST nodes: 4 | Number of AST nodes: 4 | |||
1 | /** | 1 | /** | |
2 | * Find a class within the given namespace that has the given identifier. | 2 | * Find a class in a package. If it does not exist, a new class is | |
3 | * | 3 | * created. | |
4 | * @param identifier the class identifier | 4 | * | |
5 | * @param ns namespace to look in | 5 | * @param mPackage Look in this package. | |
6 | * @return the class if found, null otherwise | 6 | * @param name The name of the class. | |
7 | */ | 7 | * @return The class found or created. | |
8 | private static Object findClass(String identifier, Object ns) { | 8 | */ | |
9 | Collection classes = getCoreHelper().getAllClasses(ns); | 9 | private Object getClass(Object mPackage, String name) { | |
10 | Iterator it = classes.iterator(); | 10 | Object mClass = null; | |
11 | while (it.hasNext()) { | 11 | for (Object c : Model.getCoreHelper().getAllClasses(mPackage)) { | |
12 | Object candidateClass = it.next(); | 12 | if (name.equals(Model.getFacade().getName(c))) { | |
13 | if (Model.getFacade().getName(candidateClass).equals(identifier)) { | 13 | mClass = c; | |
14 | return candidateClass; | 14 | break; | |
15 | } | 15 | } | |
16 | } | 16 | } | |
17 | return null; | 17 | if (mClass == null) { | |
18 | } | 18 | mClass = Model.getCoreFactory().buildClass(name, mPackage); | |
19 | newElements.add(mClass); | |||
20 | } | |||
21 | return mClass; | |||
22 | } | |||
See real code fragment | See real code fragment |
Number of mapped statements | 4 |
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 | 1.000 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | while (it.hasNext()) |
| 2 | for (Object c : Model.getCoreHelper().getAllClasses(mPackage)) | ||||||||||||||
4 | Object candidateClass = it.next(); |
| | |||||||||||||||
5 | if (Model.getFacade().getName(candidateClass).equals(identifier)) |
| 3 | if (name.equals(Model.getFacade().getName(c))) | ||||||||||||||
|
| 4 | mClass = c; | |||||||||||||||
|
| 5 | break; | |||||||||||||||
6 | return candidateClass; |
| |
Row | Violation |
---|---|
1 | Expression Model.getFacade().getName(c) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement mClass=c; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched break; |
4 | Unmatched statement return candidateClass; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched return candidateClass; |