@Override protected void updateListeners(Object oldOwner, Object newOwner) { Set<Object[]> listeners = new HashSet<Object[]>(); if (newOwner != null) { listeners.add(new Object[] {newOwner, null}); // register for tagDefinitions: for (Object td : Model.getFacade().getTagDefinitions(newOwner)) { listeners.add(new Object[] {td, new String[] {"name", "tagType", "multiplicity"}}); } /* TODO: constraints, ... */ } updateElementListeners(listeners); }
@Override protected void updateListeners(Object oldOwner, Object newOwner) { Set<Object[]> l = new HashSet<Object[]>(); if (newOwner != null) { // add the listeners to the newOwner l.add(new Object[] {newOwner, null}); Collection c = Model.getFacade().getStereotypes(newOwner); Iterator i = c.iterator(); while (i.hasNext()) { Object st = i.next(); l.add(new Object[] {st, "name"}); } } updateElementListeners(l); }
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/AbstractFigNode.java
Method name: void updateListeners(Object, Object) Method name: void updateListeners(Object, Object)
Number of AST nodes: 2 Number of AST nodes: 3
1
@Override
1
@Override
2
    protected void updateListeners(Object oldOwner, Object newOwner) {
2
    protected void updateListeners(Object oldOwner, Object newOwner) {
3
        
3
        Set<Object[]> l = new HashSet<Object[]>();
4
        Set<Object[]> listeners = new HashSet<Object[]>();
4
        if (newOwner != null) {
5
        if (newOwner != null) {
5
            // add the listeners to the newOwner
6
            listeners.add(new Object[] {newOwner, null});
6
            l.add(new Object[] {newOwner, null});
7
            // register for tagDefinitions:
7
            
8
            for (Object td : Model.getFacade().getTagDefinitions(newOwner)) {
8
            Collection c = Model.getFacade().getStereotypes(newOwner);
9
                listeners.add(new Object[] {td,
9
            Iterator i = c.iterator();
10
                    new String[] {"name", "tagType", "multiplicity"}});
10
            while (i.hasNext()) {
11
            }
11
                Object st = i.next();
12
            /* TODO: constraints, ... */
12
                l.add(new Object[] {st, "name"});
13
        }
13
            }
14
        updateElementListeners(listeners);
14
        }
15
    }
15
        updateElementListeners(l);
16
    }
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    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 Score1.000
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    4
    for (Object td : Model.getFacade().getTagDefinitions(newOwner))
    4
    for (Object td : Model.getFacade().getTagDefinitions(newOwner))
    6
    while (i.hasNext())
    Differences
    Expression1Expression2Difference
    tdstVARIABLE_NAME_MISMATCH
    Model.getFacade().getTagDefinitions(newOwner)cTYPE_COMPATIBLE_REPLACEMENT
    6
    while (i.hasNext())
    5
    listeners.add(new Object[] {td, new String[] {"name", "tagType", "multiplicity"}});
    5
    listeners.add(new Object[] {td, new String[] {"name", "tagType", "multiplicity"}});
    Preondition Violations
    Unmatched statement listeners.add(new Object[]{td,new String[]{"name","tagType","multiplicity"}}); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                      
                                                
    7
    Object st = i.next();
    Differences
    Expression1Expression2Difference
    tdstVARIABLE_NAME_MISMATCH
    7
    Object st = i.next();
                                                                        
    8
    l.add(new Object[] {st, "name"});
    Preondition Violations
    Unmatched statement l.add(new Object[]{st,"name"}); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    l.add(new Object[] {st, "name"});
    Precondition Violations (2)
    Row Violation
    1Unmatched statement listeners.add(new Object[]{td,new String[]{"name","tagType","multiplicity"}}); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement l.add(new Object[]{st,"name"}); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted