@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); }
@Override protected void updateListeners(Object oldOwner, Object newOwner) { Set<Object[]> lst = new HashSet<Object[]>(); if (newOwner != null) { // add the listeners to the newOwner lst.add(new Object[] {newOwner, null}); // and its stereotypes for (Object stereo : Model.getFacade().getStereotypes(newOwner)) { lst.add(new Object[] {stereo, null}); } // and its features for (Object feat : Model.getFacade().getFeatures(newOwner)) { lst.add(new Object[] {feat, null}); // and the stereotypes of its features for (Object stereo : Model.getFacade().getStereotypes(feat)) { lst.add(new Object[] {stereo, null}); } } // and its enumerationLiterals for (Object literal : Model.getFacade().getEnumerationLiterals( newOwner)) { lst.add(new Object[] {literal, null}); } } // And now add listeners to them all: updateElementListeners(lst); }
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/AbstractFigNode.java File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java
Method name: void updateListeners(Object, Object) Method name: void updateListeners(Object, Object)
Number of AST nodes: 3 Number of AST nodes: 2
1
@Override
1
@Override
2
    protected void updateListeners(Object oldOwner, Object newOwner) {
2
    protected void updateListeners(Object oldOwner, Object newOwner) {
3
        Set<Object[]> l = new HashSet<Object[]>();
3
        Set<Object[]> lst = new HashSet<Object[]>();
4
        if (newOwner != null) {
4
        if (newOwner != null) {
5
            // add the listeners to the newOwner
5
            // add the listeners to the newOwner
6
            l.add(new Object[] {newOwner, null});
6
            lst.add(new Object[] {newOwner, null});
7
            
7
            // and its stereotypes
8
            Collection c = Model.getFacade().getStereotypes(newOwner);
8
            for (Object stereo : Model.getFacade().getStereotypes(newOwner)) {
9
            Iterator i = c.iterator();
9
                lst.add(new Object[] {stereo, null});                
10
            while (i.hasNext()) {
10
            }
11
                Object st = i.next();
11
            // and its features
12
                l.add(new Object[] {st, "name"});
12
            for (Object feat : Model.getFacade().getFeatures(newOwner)) {
13
            }
13
                lst.add(new Object[] {feat, null});
14
        }
14
                // and the stereotypes of its features
15
        updateElementListeners(l);
15
                for (Object stereo : Model.getFacade().getStereotypes(feat)) {
16
    }
16
                    lst.add(new Object[] {stereo, null});
17
                }
18
            }
19
            // and its enumerationLiterals
20
            for (Object literal : Model.getFacade().getEnumerationLiterals(
21
                    newOwner)) {
22
                lst.add(new Object[] {literal, null});
23
            }
24
        }
25
        // And now add listeners to them all:
26
        updateElementListeners(lst);
27
28
    }
  1. {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.600
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    while (i.hasNext())
    6
    while (i.hasNext())
    8
    for (Object stereo : Model.getFacade().getStereotypes(feat))
    Differences
    Expression1Expression2Difference
    ststereoVARIABLE_NAME_MISMATCH
    cModel.getFacade().getStereotypes(feat)TYPE_COMPATIBLE_REPLACEMENT
    8
    for (Object stereo : Model.getFacade().getStereotypes(feat))
    7
    Object st = i.next();
    7
    Object st = i.next();
    Differences
    Expression1Expression2Difference
    ststereoVARIABLE_NAME_MISMATCH
                                                
    8
    l.add(new Object[] {st, "name"});
    8
    l.add(new Object[] {st, "name"});
    9
    lst.add(new Object[] {stereo, null});
    Differences
    Expression1Expression2Difference
    ststereoVARIABLE_NAME_MISMATCH
    "name"nullTYPE_COMPATIBLE_REPLACEMENT
    llstVARIABLE_NAME_MISMATCH
    9
    lst.add(new Object[] {stereo, null});
    Precondition Violations (0)
    Row Violation