public void removeModelEventListener() { Collection bases = Model.getFacade().getBases(getTarget()); Iterator it = bases.iterator(); while (it.hasNext()) { Object base = it.next(); Model.getPump().removeModelEventListener( this, base, "feature"); } // make sure we know it when a classifier is added as a base Model.getPump().removeModelEventListener( this, getTarget(), "base"); }
@Override protected void removeOtherModelEventListeners(Object oldTarget) { super.removeOtherModelEventListeners(oldTarget); for (Object classifier : others) { Model.getPump().removeModelEventListener(this, classifier, "feature"); } others.clear(); }
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLClassifierRoleAvailableFeaturesListModel.java File path: /ArgoUML-0.34-src/argouml/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLAssociationRoleBaseComboBoxModel.java
Method name: void removeModelEventListener() Method name: void removeOtherModelEventListeners(Object)
Number of AST nodes: 3 Number of AST nodes: 2
1
public void removeModelEventListener() {
1
@Override
2
        Collection bases = Model.getFacade().getBases(getTarget());
2
    protected void removeOtherModelEventListeners(Object oldTarget) {
3
        Iterator it = bases.iterator();
3
        super.removeOtherModelEventListeners(oldTarget);
4
        while (it.hasNext()) {
4
        for (Object classifier : others) {
5
            Object base =  it.next();
5
            Model.getPump().removeModelEventListener(this, 
6
            Model.getPump().removeModelEventListener(
6
                    classifier, "feature");
7
                this,
7
        }
8
                base,
8
        others.clear();
9
                "feature");
9
    }
10
        }
11
        
12
        // make sure we know it when a classifier is added as a base
13
        Model.getPump().removeModelEventListener(
14
            this,
15
            getTarget(),
16
            "base");
17
    }
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Similarity Score1.000
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    while (it.hasNext())
    3
    while (it.hasNext())
    2
    for (Object classifier : others)
    Differences
    Expression1Expression2Difference
    baseclassifierVARIABLE_NAME_MISMATCH
    basesothersVARIABLE_NAME_MISMATCH
    2
    for (Object classifier : others)
    4
    Object base = it.next();
    4
    Object base = it.next();
    Differences
    Expression1Expression2Difference
    baseclassifierVARIABLE_NAME_MISMATCH
                                                      
    5
    Model.getPump().removeModelEventListener(this, base, "feature");
    5
    Model.getPump().removeModelEventListener(this, base, "feature");
    3
    Model.getPump().removeModelEventListener(this, classifier, "feature");
    Differences
    Expression1Expression2Difference
    baseclassifierVARIABLE_NAME_MISMATCH
    3
    Model.getPump().removeModelEventListener(this, classifier, "feature");
    Precondition Violations (0)
    Row Violation