@Override public void initialiseListener(Object modelElement) { super.initialiseListener(modelElement); Collection classifiers = Model.getFacade().getBases(modelElement); for (Object c : classifiers) { addElementListener(c, "name"); } }
@Override public void initialiseListener(Object modelElement) { /* Listen to the modelelement itself: */ addElementListener(modelElement, new String[] {"name", "visibility", "stereotype", "taggedValue"}); Collection stereotypes = Model.getFacade().getStereotypes(modelElement); Iterator iter = stereotypes.iterator(); while (iter.hasNext()) { Object oneStereoType = iter.next(); addElementListener( oneStereoType, new String[] {"name", "remove"}); } // We also show tagged values (the / for derived) for (Object uml : Model.getFacade().getTaggedValuesCollection(modelElement)) { addElementListener(uml); } }
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/notation/providers/ClassifierRoleNotation.java File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/notation/providers/AssociationNameNotation.java
Method name: void initialiseListener(Object) Method name: void initialiseListener(Object)
Number of AST nodes: 2 Number of AST nodes: 3
1
@Override
1
@Override
2
    public void initialiseListener(Object modelElement) {
2
    public void initialiseListener(Object modelElement) {
3
        super.initialiseListener(modelElement);
3
        /* Listen to the modelelement itself: */
4
        Collection classifiers = Model.getFacade().getBases(modelElement);
4
        addElementListener(modelElement, 
5
        for (Object c : classifiers) {
5
                new String[] {"name", "visibility", "stereotype", "taggedValue"});
6
            addElementListener(c, "name");
6
        Collection stereotypes =
7
        }
7
            Model.getFacade().getStereotypes(modelElement);
8
    }
8
        Iterator iter = stereotypes.iterator();
9
        while (iter.hasNext()) {
10
            Object oneStereoType = iter.next();
11
            addElementListener(
12
                    oneStereoType, 
13
                    new String[] {"name", "remove"});
14
        }
15
        // We also show tagged values (the / for derived)
16
        for (Object uml : Model.getFacade().getTaggedValuesCollection(modelElement)) {
17
            addElementListener(uml);
18
        }
19
    }
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    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.500
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    3
    for (Object c : classifiers)
    3
    for (Object c : classifiers)
    4
    while (iter.hasNext())
    Differences
    Expression1Expression2Difference
    coneStereoTypeVARIABLE_NAME_MISMATCH
    4
    while (iter.hasNext())
    4
    addElementListener(c, "name");
    4
    addElementListener(c, "name");
    Preondition Violations
    Unmatched statement addElementListener(c,"name"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                    
                                                                            
    5
    Object oneStereoType = iter.next();
    Differences
    Expression1Expression2Difference
    coneStereoTypeVARIABLE_NAME_MISMATCH
    5
    Object oneStereoType = iter.next();
                                                                                                                                          
    6
    addElementListener(oneStereoType, new String[] {"name", "remove"});
    Preondition Violations
    Unmatched statement addElementListener(oneStereoType,new String[]{"name","remove"}); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    addElementListener(oneStereoType, new String[] {"name", "remove"});
    Precondition Violations (2)
    Row Violation
    1Unmatched statement addElementListener(c,"name"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement addElementListener(oneStereoType,new String[]{"name","remove"}); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted