/** * Gets FigClassAssociationClass that is contained in this * FigAssociationClass. * * @return FigClassAssociationClass that is contained in this * FigAssociationClass. */ public FigClassAssociationClass getAssociationClass() { FigEdgeAssociationClass figEdgeLink = null; List edges = null; FigEdgePort figEdgePort = this.getEdgePort(); if (figEdgePort != null) { edges = figEdgePort.getFigEdges(); } if (edges != null) { for (Iterator it = edges.iterator(); it.hasNext() && figEdgeLink == null;) { Object o = it.next(); if (o instanceof FigEdgeAssociationClass) { figEdgeLink = (FigEdgeAssociationClass) o; } } } FigNode figClassBox = null; if (figEdgeLink != null) { figClassBox = figEdgeLink.getDestFigNode(); if (!(figClassBox instanceof FigClassAssociationClass)) { figClassBox = figEdgeLink.getSourceFigNode(); } } return (FigClassAssociationClass) figClassBox; }
protected Fig getRemoveDelegate() { // Look for the dashed edge for (Object fig : getFigEdges()) { if (fig instanceof FigEdgeAssociationClass) { // We have the dashed edge now find the opposite FigNode FigEdgeAssociationClass dashedEdge = (FigEdgeAssociationClass) fig; return dashedEdge.getRemoveDelegate(); } } return null; }
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociationClass.java File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/diagram/ui/FigClassAssociationClass.java
Method name: FigClassAssociationClass getAssociationClass() Method name: Fig getRemoveDelegate()
Number of AST nodes: 4 Number of AST nodes: 4
1
/**
1
protected Fig getRemoveDelegate() {
2
     * Gets FigClassAssociationClass that is contained in this
2
        // Look for the dashed edge
3
     * FigAssociationClass.
3
        for (Object fig : getFigEdges()) {
4
     *
4
            if (fig instanceof FigEdgeAssociationClass) {
5
     * @return FigClassAssociationClass that is contained in this
5
                // We have the dashed edge now find the opposite FigNode
6
     *         FigAssociationClass.
6
                FigEdgeAssociationClass dashedEdge =
7
     */
7
                    (FigEdgeAssociationClass) fig;
8
    public FigClassAssociationClass getAssociationClass() {
8
                return dashedEdge.getRemoveDelegate();
9
        FigEdgeAssociationClass figEdgeLink = null;
9
            }
10
        List edges = null;
10
        }
11
11
        return null;
12
        FigEdgePort figEdgePort = this.getEdgePort();
12
    }
13
        if (figEdgePort != null) {
14
            edges = figEdgePort.getFigEdges();
15
        }
16
17
        if (edges != null) {
18
            for (Iterator it = edges.iterator(); it.hasNext()
19
                    && figEdgeLink == null;) {
20
                Object o = it.next();
21
                if (o instanceof FigEdgeAssociationClass) {
22
                    figEdgeLink = (FigEdgeAssociationClass) o;
23
                }
24
            }
25
        }
26
27
        FigNode figClassBox = null;
28
        if (figEdgeLink != null) {
29
            figClassBox = figEdgeLink.getDestFigNode();
30
            if (!(figClassBox instanceof FigClassAssociationClass)) {
31
                figClassBox = figEdgeLink.getSourceFigNode();
32
            }
33
        }
34
        return (FigClassAssociationClass) figClassBox;
35
    }
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.0
    Similarity Score0.667
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    7
    for (Iterator it = edges.iterator(); it.hasNext() && figEdgeLink == null; )
    7
    for (Iterator it = edges.iterator(); it.hasNext() && figEdgeLink == null; )
    1
    for (Object fig : getFigEdges())
    Differences
    Expression1Expression2Difference
    ofigVARIABLE_NAME_MISMATCH
    java.util.Listjava.util.ListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.List of variable edges does not match with type java.util.List<org.tigris.gef.presentation.FigEdge> of variable getFigEdges()
    • Make classes java.util.List and java.util.List extend a common superclass
    1
    for (Object fig : getFigEdges())
    8
    Object o = it.next();
    8
    Object o = it.next();
    Differences
    Expression1Expression2Difference
    ofigVARIABLE_NAME_MISMATCH
                                                
    9
    if (o instanceof FigEdgeAssociationClass)
    9
    if (o instanceof FigEdgeAssociationClass)
    2
    if (fig instanceof FigEdgeAssociationClass)
    Differences
    Expression1Expression2Difference
    ofigVARIABLE_NAME_MISMATCH
    2
    if (fig instanceof FigEdgeAssociationClass)
    10
    figEdgeLink = (FigEdgeAssociationClass)o;
    10
    figEdgeLink = (FigEdgeAssociationClass)o;
    3
    FigEdgeAssociationClass dashedEdge = (FigEdgeAssociationClass)fig;
    Differences
    Expression1Expression2Difference
    figEdgeLinkdashedEdgeVARIABLE_NAME_MISMATCH
    ofigVARIABLE_NAME_MISMATCH
    figEdgeLinkdashedEdgeVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression figEdgeLink cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dashedEdge cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression figEdgeLink cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dashedEdge cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    FigEdgeAssociationClass dashedEdge = (FigEdgeAssociationClass)fig;
                                                                                      
    4
    return dashedEdge.getRemoveDelegate();
    Preondition Violations
    Unmatched statement return dashedEdge.getRemoveDelegate(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return dashedEdge.getRemoveDelegate();
    4
    return dashedEdge.getRemoveDelegate();
    Precondition Violations (7)
    Row Violation
    1Type java.util.List of variable edges does not match with type java.util.List<org.tigris.gef.presentation.FigEdge> of variable getFigEdges()
    2Expression figEdgeLink cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression dashedEdge cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression figEdgeLink cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression dashedEdge cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Unmatched statement return dashedEdge.getRemoveDelegate(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched return dashedEdge.getRemoveDelegate();