/** * When a ToDoItem is deselected in the UiToDoList window, * unhighlight the "offending" design material's. */ public void deselect() { for (Object dm : getOffenders()) { if (dm instanceof Highlightable) { ((Highlightable) dm).setHighlight(false); } } }
@Override public void select() { Project p = ProjectManager.getManager().getCurrentProject(); for (Object dm : getOffenders()) { if (dm instanceof Highlightable) { ((Highlightable) dm).setHighlight(true); } else if (p != null) { Iterator iterFigs = p.findFigsForMember(dm).iterator(); while (iterFigs.hasNext()) { Object f = iterFigs.next(); if (f instanceof Highlightable) { ((Highlightable) f).setHighlight(true); } } } } }
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/cognitive/ToDoItem.java File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/cognitive/UMLToDoItem.java
Method name: void deselect() Method name: void select()
Number of AST nodes: 3 Number of AST nodes: 4
1
/**
1
@Override
2
     * When a ToDoItem is deselected in the UiToDoList window,
2
    public void select() {
3
     * unhighlight the "offending" design material's.
3
        Project p = ProjectManager.getManager().getCurrentProject();
4
     */
4
        for (Object dm : getOffenders()) {
5
    public void deselect() {
5
            if (dm instanceof Highlightable) {
6
        for (Object dm : getOffenders()) {
6
                ((Highlightable) dm).setHighlight(true);
7
	    if (dm instanceof Highlightable) {
7
	    } else if (p != null) {
8
	        ((Highlightable) dm).setHighlight(false);
8
                Iterator iterFigs = p.findFigsForMember(dm).iterator();
9
	    }
9
                while (iterFigs.hasNext()) {
10
	}
10
                    Object f = iterFigs.next();
11
    }
11
                    if (f instanceof Highlightable) {
12
                        ((Highlightable) f).setHighlight(true);
13
		    }
14
                }
15
            }
16
        }
17
    }
  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 fragment0
    Time elapsed for statement mapping (ms)0.0
    Similarity Score1.000
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    for (Object dm : getOffenders())
    1
    for (Object dm : getOffenders())
    7
    while (iterFigs.hasNext())
    Differences
    Expression1Expression2Difference
    dmfVARIABLE_NAME_MISMATCH
    org.argouml.cognitive.ListSetjava.util.CollectionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.argouml.cognitive.ListSet of variable getOffenders() does not match with type java.util.Collection<org.tigris.gef.presentation.Fig> of variable p.findFigsForMember(dm)
    • Make classes org.argouml.cognitive.ListSet and java.util.Collection extend a common superclass
    7
    while (iterFigs.hasNext())
                                                            
    8
    Object f = iterFigs.next();
    Differences
    Expression1Expression2Difference
    dmfVARIABLE_NAME_MISMATCH
    8
    Object f = iterFigs.next();
    2
    if (dm instanceof Highlightable)
    2
    if (dm instanceof Highlightable)
    9
    if (f instanceof Highlightable)
    Differences
    Expression1Expression2Difference
    dmfVARIABLE_NAME_MISMATCH
    9
    if (f instanceof Highlightable)
    3
    ((Highlightable)dm).setHighlight(false);
    3
    ((Highlightable)dm).setHighlight(false);
    10
    ((Highlightable)f).setHighlight(true);
    Differences
    Expression1Expression2Difference
    falsetrueLITERAL_VALUE_MISMATCH
    dmfVARIABLE_NAME_MISMATCH
    10
    ((Highlightable)f).setHighlight(true);
    Precondition Violations (1)
    Row Violation
    1Type org.argouml.cognitive.ListSet of variable getOffenders() does not match with type java.util.Collection<org.tigris.gef.presentation.Fig> of variable p.findFigsForMember(dm)