protected void addOtherModelEventListeners(Object newTarget) { super.addOtherModelEventListeners(newTarget); /* Make a copy of the modelelements: */ others = new ArrayList(Model.getFacade().getConnections(newTarget)); Iterator i = others.iterator(); while (i.hasNext()) { Object end = i.next(); Model.getPump().addModelEventListener(this, end, "name"); } }
@Override protected void addOtherModelEventListeners(Object newTarget) { super.addOtherModelEventListeners(newTarget); Collection connections = Model.getFacade().getConnections(newTarget); Collection types = new ArrayList(); for (Object conn : connections) { types.add(Model.getFacade().getType(conn)); } for (Object classifierRole : types) { others.addAll(Model.getFacade().getBases(classifierRole)); } for (Object classifier : others) { Model.getPump().addModelEventListener(this, classifier, "feature"); } }
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLAssociationConnectionListModel.java File path: /ArgoUML-0.34-src/argouml/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLAssociationRoleBaseComboBoxModel.java
Method name: void addOtherModelEventListeners(Object) Method name: void addOtherModelEventListeners(Object)
Number of AST nodes: 3 Number of AST nodes: 2
1
protected void addOtherModelEventListeners(Object newTarget) {
1
@Override
2
        super.addOtherModelEventListeners(newTarget);
2
    protected void addOtherModelEventListeners(Object newTarget) {
3
        /* Make a copy of the modelelements: */
3
        super.addOtherModelEventListeners(newTarget);
4
        others = new ArrayList(Model.getFacade().getConnections(newTarget));
4
        Collection connections = Model.getFacade().getConnections(newTarget);
5
        Iterator i = others.iterator();
5
        Collection types = new ArrayList();
6
        while (i.hasNext()) {
6
        for (Object conn : connections) {
7
            Object end = i.next();
7
            types.add(Model.getFacade().getType(conn));
8
            Model.getPump().addModelEventListener(this, end, "name");
8
        }
9
        }
9
        for (Object classifierRole : types) {
10
    }
10
            others.addAll(Model.getFacade().getBases(classifierRole));
11
        }
12
        for (Object classifier : others) {
13
            Model.getPump().addModelEventListener(this, 
14
                    classifier, "feature");
15
        }
16
    }
  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
    4
    while (i.hasNext())
    4
    while (i.hasNext())
    8
    for (Object classifier : others)
    Differences
    Expression1Expression2Difference
    endclassifierVARIABLE_NAME_MISMATCH
    8
    for (Object classifier : others)
    5
    Object end = i.next();
    5
    Object end = i.next();
    Differences
    Expression1Expression2Difference
    endclassifierVARIABLE_NAME_MISMATCH
                                                  
    6
    Model.getPump().addModelEventListener(this, end, "name");
    6
    Model.getPump().addModelEventListener(this, end, "name");
    9
    Model.getPump().addModelEventListener(this, classifier, "feature");
    Differences
    Expression1Expression2Difference
    endclassifierVARIABLE_NAME_MISMATCH
    "name""feature"LITERAL_VALUE_MISMATCH
    9
    Model.getPump().addModelEventListener(this, classifier, "feature");
    Precondition Violations (0)
    Row Violation