@Override public void initialiseListener(Object modelElement) { addElementListener(modelElement, new String[] {"entry", "remove", "stereotype"} ); Object entry = Model.getFacade().getEntry(modelElement); if (entry != null) { addElementListener(entry, "script"); } Collection c = Model.getFacade().getStereotypes(modelElement); Iterator i = c.iterator(); while (i.hasNext()) { Object st = i.next(); addElementListener(st, "name"); } }
@Override public void initialiseListener(Object modelElement) { addElementListener(modelElement); Object cis = Model.getFacade().getType(modelElement); if (Model.getFacade().isAClassifierInState(cis)) { addElementListener(cis, new String[] {"remove", "inState"}); Collection<Object> c = Model.getFacade().getInStates(cis); for (Object state : c) { addElementListener(state, new String[] {"remove", "name"}); } } }
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/notation/providers/ActionStateNotation.java File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/notation/providers/ObjectFlowStateStateNotation.java
Method name: void initialiseListener(Object) Method name: void initialiseListener(Object)
Number of AST nodes: 3 Number of AST nodes: 2
1
@Override
1
@Override
2
    public void initialiseListener(Object modelElement) {
2
    public void initialiseListener(Object modelElement) {
3
        addElementListener(modelElement, 
3
        addElementListener(modelElement);
4
                new String[] {"entry", "remove", "stereotype"} );
4
        Object cis = Model.getFacade().getType(modelElement);
5
        Object entry = Model.getFacade().getEntry(modelElement);
5
        if (Model.getFacade().isAClassifierInState(cis)) {
6
        if (entry != null) {
6
            addElementListener(cis,
7
            addElementListener(entry, "script");
7
                    new String[] {"remove", "inState"});
8
        }
8
            Collection<Object> c = Model.getFacade().getInStates(cis);
9
        Collection c = Model.getFacade().getStereotypes(modelElement);
9
            for (Object state : c) {
10
        Iterator i = c.iterator();
10
                addElementListener(state,
11
        while (i.hasNext()) {
11
                        new String[] {"remove", "name"});
12
            Object st = i.next();
12
            }
13
            addElementListener(st, "name");
13
        }
14
        }
14
    }
15
    }
  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 Score0.500
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    7
    while (i.hasNext())
    7
    while (i.hasNext())
    6
    for (Object state : c)
    Differences
    Expression1Expression2Difference
    ststateVARIABLE_NAME_MISMATCH
    6
    for (Object state : c)
                                                                                                                          
    7
    addElementListener(state, new String[] {"remove", "name"});
    Preondition Violations
    Unmatched statement addElementListener(state,new String[]{"remove","name"}); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    addElementListener(state, new String[] {"remove", "name"});
    8
    Object st = i.next();
    8
    Object st = i.next();
    Differences
    Expression1Expression2Difference
    ststateVARIABLE_NAME_MISMATCH
                                                
    9
    addElementListener(st, "name");
    9
    addElementListener(st, "name");
    Preondition Violations
    Unmatched statement addElementListener(st,"name"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                      
    Precondition Violations (2)
    Row Violation
    1Unmatched statement addElementListener(state,new String[]{"remove","name"}); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement addElementListener(st,"name"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted