public void deleteCollection(Collection col) { Iterator it = col.iterator(); while (it.hasNext()) { modelImpl.getUmlFactory().delete(it.next()); } }
/** * @param elem * the associationrole */ public void deleteAssociationRole(Object elem) { AssociationRole role = (AssociationRole) elem; for (Message message : role.getMessage()) { modelImpl.getUmlFactory().delete(message);
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlHelperMDRImpl.java File path: /ArgoUML-0.34-src/argouml/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CollaborationsFactoryMDRImpl.java
Method name: void deleteCollection(Collection) Method name: void deleteAssociationRole(Object)
Number of AST nodes: 2 Number of AST nodes: 2
1
public void deleteCollection(Collection col) {
1
/**
2
        Iterator it = col.iterator();
2
     * @param elem
3
        while (it.hasNext()) {
3
     *            the associationrole
4
            modelImpl.getUmlFactory().delete(it.next());
4
     */
5
        }
5
    public void deleteAssociationRole(Object elem) {
6
    }
6
        AssociationRole role = (AssociationRole) elem;
7
        for (Message message : role.getMessage()) {
8
            modelImpl.getUmlFactory().delete(message);
9
        
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.0
    Similarity Score0.750
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    while (it.hasNext())
    2
    while (it.hasNext())
    2
    for (Message message : role.getMessage())
    Differences
    Expression1Expression2Difference
    java.util.Collectionjava.util.CollectionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Collection of variable col does not match with type java.util.Collection<org.omg.uml.behavioralelements.collaborations.Message> of variable role.getMessage()
    • Make classes java.util.Collection and java.util.Collection extend a common superclass
    2
    for (Message message : role.getMessage())
                                                                                              
    3
    modelImpl.getUmlFactory().delete(message);
    Preondition Violations
    Unmatched statement modelImpl.getUmlFactory().delete(message); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    modelImpl.getUmlFactory().delete(message);
    3
    modelImpl.getUmlFactory().delete(it.next());
                                                                                                  
    Precondition Violations (3)
    Row Violation
    1Type java.util.Collection of variable col does not match with type java.util.Collection<org.omg.uml.behavioralelements.collaborations.Message> of variable role.getMessage()
    2Unmatched statement modelImpl.getUmlFactory().delete(message); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Clone fragment #1 returns variables , while Clone fragment #2 returns variables message