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 buildImport(Object, Object)
|
|||
Number of AST nodes: 4 | Number of AST nodes: 3 | |||
1 | /** | 1 | private Object buildImport(Object element, Object srcFile) { | |
2 | * Find a class within the given namespace that has the given identifier. | 2 | // TODO: add <<javaImport>> stereotype to Java profile - thn | |
3 | * | 3 | Collection dependencies = Model.getCoreHelper().getDependencies( | |
4 | * @param identifier the class identifier | 4 | element, srcFile); | |
5 | * @param ns namespace to look in | 5 | for (Object dep : dependencies) { | |
6 | * @return the class if found, null otherwise | 6 | for (Object stereotype : Model.getFacade().getStereotypes(dep)) { | |
7 | */ | 7 | if ("javaImport".equals( | |
8 | private static Object findClass(String identifier, Object ns) { | 8 | Model.getFacade().getName(stereotype))) { | |
9 | Collection classes = getCoreHelper().getAllClasses(ns); | 9 | return dep; | |
10 | Iterator it = classes.iterator(); | 10 | } | |
11 | while (it.hasNext()) { | 11 | } | |
12 | Object candidateClass = it.next(); | 12 | } | |
13 | if (Model.getFacade().getName(candidateClass).equals(identifier)) { | 13 | ||
14 | return candidateClass; | 14 | // Didn't find it. Let's create one. | |
15 | } | 15 | Object pkgImport = Model.getCoreFactory().buildDependency(srcFile, | |
16 | } | 16 | element); | |
17 | return null; | 17 | if (Model.getFacade().getUmlVersion().charAt(0) == '1') { | |
18 | } | 18 | // TODO: support for stereotypes in eUML | |
19 | Model.getCoreHelper().addStereotype(pkgImport, | |||
20 | getUML1Stereotype("javaImport")); | |||
21 | ProjectManager.getManager().updateRoots(); | |||
22 | } | |||
23 | String newName = makeDependencyName(srcFile, element); | |||
24 | Model.getCoreHelper().setName(pkgImport, newName); | |||
25 | newElements.add(pkgImport); | |||
26 | return pkgImport; | |||
27 | } | |||
See real code fragment | See real code fragment |
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.0 |
Similarity Score | 1.000 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | while (it.hasNext()) |
| 3 | for (Object stereotype : Model.getFacade().getStereotypes(dep)) | ||||||||||||||
4 | Object candidateClass = it.next(); |
| | |||||||||||||||
5 | if (Model.getFacade().getName(candidateClass).equals(identifier)) |
| 4 | if ("javaImport".equals(Model.getFacade().getName(stereotype))) | ||||||||||||||
6 | return candidateClass; |
| 5 | return dep; |
Row | Violation |
---|---|
1 | Expression candidateClass cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression candidateClass cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression Model.getFacade().getName(stereotype) cannot be parameterized, because it has dependencies to/from statements that will be extracted |