@Override public void initialiseListener(Object modelElement) { addElementListener( modelElement, new String[] {"name", "visibility", "stereotype", "taggedValue"}); Collection stereotypes = Model.getFacade().getStereotypes(modelElement); Iterator iter = stereotypes.iterator(); while (iter.hasNext()) { Object o = iter.next(); addElementListener( o, new String[] {"name", "remove"}); } // We also show tagged values (the / for derived) for (Object uml : Model.getFacade().getTaggedValuesCollection(modelElement)) { addElementListener(uml); } }
@Override protected void updateListeners(Object oldOwner, Object newOwner) { super.updateListeners(oldOwner, newOwner); if (newOwner != null) { for (Object classifier : Model.getFacade().getClassifiers(newOwner)) { addElementListener(classifier, "name"); } } }
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/notation/providers/AssociationEndNameNotation.java File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/FigComponentInstance.java
Method name: void initialiseListener(Object) Method name: void updateListeners(Object, Object)
Number of AST nodes: 3 Number of AST nodes: 2
1
@Override
1
@Override
2
    public void initialiseListener(Object modelElement) {
2
    protected void updateListeners(Object oldOwner, Object newOwner) {
3
        addElementListener(
3
        super.updateListeners(oldOwner, newOwner);
4
                modelElement, 
4
        if (newOwner != null) {
5
                new String[] {"name", "visibility", "stereotype", "taggedValue"});
5
            for (Object classifier 
6
        Collection stereotypes =
6
                    : Model.getFacade().getClassifiers(newOwner)) {
7
                Model.getFacade().getStereotypes(modelElement);
7
                addElementListener(classifier, "name");
8
        Iterator iter = stereotypes.iterator();
8
            }
9
        while (iter.hasNext()) {
9
        }
10
            Object o = iter.next();
10
    }
11
            addElementListener(
12
                    o, 
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
    4
    while (iter.hasNext())
    4
    while (iter.hasNext())
    3
    for (Object classifier : Model.getFacade().getClassifiers(newOwner))
    Differences
    Expression1Expression2Difference
    oclassifierVARIABLE_NAME_MISMATCH
    stereotypesModel.getFacade().getClassifiers(newOwner)TYPE_COMPATIBLE_REPLACEMENT
    3
    for (Object classifier : Model.getFacade().getClassifiers(newOwner))
                                                                                      
    4
    addElementListener(classifier, "name");
    Preondition Violations
    Unmatched statement addElementListener(classifier,"name"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    addElementListener(classifier, "name");
    5
    Object o = iter.next();
    5
    Object o = iter.next();
    Differences
    Expression1Expression2Difference
    oclassifierVARIABLE_NAME_MISMATCH
                                                    
    6
    addElementListener(o, new String[] {"name", "remove"});
    6
    addElementListener(o, new String[] {"name", "remove"});
    Preondition Violations
    Unmatched statement addElementListener(o,new String[]{"name","remove"}); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                  
    Precondition Violations (2)
    Row Violation
    1Unmatched statement addElementListener(classifier,"name"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement addElementListener(o,new String[]{"name","remove"}); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted