@Override public void removeFromDiagram() { /* Remove all items in the group, * otherwise the model event listeners remain: * TODO: Why does a FigGroup not do this? */ for (Object f : getFigs()) { ((Fig) f).removeFromDiagram(); } super.removeFromDiagram(); Model.getPump() .removeModelEventListener(this, getOwner(), "stereotype"); }
protected void removeFromDiagramImpl() { Object o = getOwner(); if (o != null) { removeElementListener(o); } if (notationProviderName != null) { notationProviderName.cleanListener(); } /* TODO: MVW: Why is this not done in GEF? */ Iterator it = getPathItemFigs().iterator(); while (it.hasNext()) { Fig fig = (Fig) it.next(); fig.removeFromDiagram(); } super.removeFromDiagram(); damage(); }
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesGroup.java File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
Method name: void removeFromDiagram() Method name: void removeFromDiagramImpl()
Number of AST nodes: 2 Number of AST nodes: 3
1
@Override
1
protected void removeFromDiagramImpl() {
2
    public void removeFromDiagram() {
2
        Object o = getOwner();
3
        /* Remove all items in the group, 
3
        if (o != null) {
4
         * otherwise the model event listeners remain: 
4
            removeElementListener(o);
5
         * TODO: Why does a FigGroup not do this? */
5
        }
6
        for (Object f : getFigs()) {
6
        if (notationProviderName != null) {
7
            ((Fig) f).removeFromDiagram();
7
            notationProviderName.cleanListener();
8
        }
8
        }
9
        super.removeFromDiagram();
9
10
        Model.getPump()
10
        /* TODO: MVW: Why is this not done in GEF? */
11
                .removeModelEventListener(this, getOwner(), "stereotype");
11
        Iterator it = getPathItemFigs().iterator();
12
    }
12
        while (it.hasNext()) {
13
            Fig fig = (Fig) it.next();
14
            fig.removeFromDiagram();
15
        }
16
17
        super.removeFromDiagram();
18
        damage();
19
    }
  1. {Non-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 Score0.667
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    for (Object f : getFigs())
    1
    for (Object f : getFigs())
    7
    while (it.hasNext())
    Differences
    Expression1Expression2Difference
    java.util.Listjava.util.VectorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.List<org.tigris.gef.presentation.Fig> of variable getFigs() does not match with type java.util.Vector of variable getPathItemFigs()
    • Make classes java.util.List and java.util.Vector extend a common superclass
    7
    while (it.hasNext())
                                                        
    8
    Fig fig = (Fig)it.next();
    2
    ((Fig)f).removeFromDiagram();
    2
    ((Fig)f).removeFromDiagram();
    9
    fig.removeFromDiagram();
    Differences
    Expression1Expression2Difference
    ((Fig)f)figTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ((Fig)f) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9
    fig.removeFromDiagram();
    Precondition Violations (2)
    Row Violation
    1Type java.util.List<org.tigris.gef.presentation.Fig> of variable getFigs() does not match with type java.util.Vector of variable getPathItemFigs()
    2Expression ((Fig)f) cannot be parameterized, because it has dependencies to/from statements that will be extracted