public Collection getAllPossibleNamespaces( Object modelElement, Object model) { if (!(model instanceof Element) || !(modelElement instanceof Element)) { throw new IllegalArgumentException( "modelElement and model must be instances of Element"); } Collection result = new ArrayList(); if (isValidNamespace(modelElement, model)) { result.add((Namespace) model); } final ModelManagementHelperEUMLImpl helper = modelImpl.getModelManagementHelper(); for (Object o : helper.getAllModelElementsOfKind(model, Namespace.class)) { if (isValidNamespace(modelElement, o)) { result.add((Namespace) o); } } return result; }
public Collection getAllPossibleImports(Object pack) { // TODO: Fully implement this! Object container = pack; Object cc = modelImpl.getFacade().getModelElementContainer(pack); while (cc != null) { container = cc; cc = modelImpl.getFacade().getModelElementContainer(cc); } Collection mes = getAllModelElementsOfKind(container, modelImpl.getMetaTypes().getModelElement()); Collection vmes = new ArrayList(); Iterator i = mes.iterator(); while (i.hasNext()) { Object me = i.next(); if (modelImpl.getCoreHelper().isValidNamespace(me, pack)) { vmes.add(me); } } return vmes; }
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml/src/argouml-core-model-euml/src/org/argouml/model/euml/CoreHelperEUMLImpl.java File path: /ArgoUML-0.34-src/argouml/src/argouml-core-model-mdr/src/org/argouml/model/mdr/ModelManagementHelperMDRImpl.java
Method name: Collection getAllPossibleNamespaces(Object, Object) Method name: Collection getAllPossibleImports(Object)
Number of AST nodes: 3 Number of AST nodes: 4
1
public Collection getAllPossibleNamespaces(
1
public Collection getAllPossibleImports(Object pack) {
2
            Object modelElement, 
2
        // TODO: Fully implement this!
3
            Object model) {
3
        
4
        if (!(model instanceof Element) || !(modelElement instanceof Element)) {
4
        Object container = pack;
5
            throw new IllegalArgumentException(
5
        Object cc = modelImpl.getFacade().getModelElementContainer(pack);
6
                    "modelElement and model must be instances of Element");
6
        while (cc != null) {
7
        }
7
            container = cc;
8
        Collection result = new ArrayList();
8
            cc = modelImpl.getFacade().getModelElementContainer(cc);
9
        if (isValidNamespace(modelElement, model)) {
9
        }
10
            result.add((Namespace) model);
10
11
        }
11
        Collection mes = getAllModelElementsOfKind(container, 
12
        final ModelManagementHelperEUMLImpl helper =
12
                modelImpl.getMetaTypes().getModelElement());
13
            modelImpl.getModelManagementHelper();
13
        
14
        for (Object o 
14
        Collection vmes = new ArrayList();
15
                : helper.getAllModelElementsOfKind(model, Namespace.class)) {
15
        Iterator i = mes.iterator();
16
            if (isValidNamespace(modelElement, o)) {
16
        while (i.hasNext()) {
17
                result.add((Namespace) o);
17
            Object me = i.next();
18
            }
18
            if (modelImpl.getCoreHelper().isValidNamespace(me, pack)) {
19
        }
19
                vmes.add(me);
20
        return result;
20
            }
21
    }
21
        }
22
        
23
        return vmes;
24
    }
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.0
    Similarity Score0.375
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    7
    for (Object o : helper.getAllModelElementsOfKind(model, Namespace.class))
    7
    for (Object o : helper.getAllModelElementsOfKind(model, Namespace.class))
    9
    while (i.hasNext())
    Differences
    Expression1Expression2Difference
    omeVARIABLE_NAME_MISMATCH
    helper.getAllModelElementsOfKind(model,Namespace.class)mesTYPE_COMPATIBLE_REPLACEMENT
    9
    while (i.hasNext())
                                                  
    10
    Object me = i.next();
    Differences
    Expression1Expression2Difference
    omeVARIABLE_NAME_MISMATCH
    10
    Object me = i.next();
    8
    if (isValidNamespace(modelElement, o))
    8
    if (isValidNamespace(modelElement, o))
    11
    if (modelImpl.getCoreHelper().isValidNamespace(me, pack))
    Differences
    Expression1Expression2Difference
    modelElementmeVARIABLE_NAME_MISMATCH
    opackVARIABLE_NAME_MISMATCH
    modelImpl.getCoreHelper()MISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression o cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression isValidNamespace(modelElement,o) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11
    if (modelImpl.getCoreHelper().isValidNamespace(me, pack))
    9
    result.add((Namespace)o);
    9
    result.add((Namespace)o);
    Preondition Violations
    Unmatched statement result.add((Namespace)o); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                            
                                      
    12
    vmes.add(me);
    Preondition Violations
    Unmatched statement vmes.add(me); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    12
    vmes.add(me);
    Precondition Violations (4)
    Row Violation
    1Expression o cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression isValidNamespace(modelElement,o) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement result.add((Namespace)o); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement vmes.add(me); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted