@Override
protected void updateListeners(Object oldOwner, Object newOwner) {
super.updateListeners(oldOwner, newOwner);
if (newOwner != null) {
Collection c = Model.getFacade().getStereotypes(newOwner);
Iterator i = c.iterator();
while (i.hasNext()) {
Object st = i.next();
addElementListener(st, "name");
}
}
}
@Override
public void initialiseListener(Object modelElement) {
addElementListener(modelElement,
new String[] {"name", "classifier", "remove"});
Collection<Object> c = Model.getFacade().getClassifiers(modelElement);
for (Object classifier : c) {
addElementListener(classifier,
new String[] {"name", "remove"});
}
}
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/AbstractFigComponent.java
|
|
File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/notation/providers/NodeInstanceNotation.java
|
Method name: void updateListeners(Object, Object)
|
|
Method name: void initialiseListener(Object)
|
Number of AST nodes: 3
|
|
Number of AST nodes: 2
|
|
1 | @Override | | 1 | @Override |
2 | protected void updateListeners(Object oldOwner, Object newOwner) { | | 2 | public void initialiseListener(Object modelElement) { |
3 | super.updateListeners(oldOwner, newOwner); | | 3 | addElementListener(modelElement, |
4 | if (newOwner != null) { | | 4 | new String[] {"name", "classifier", "remove"}); |
5 | Collection c = Model.getFacade().getStereotypes(newOwner); | | 5 | Collection<Object> c = Model.getFacade().getClassifiers(modelElement); |
6 | Iterator i = c.iterator(); | | 6 | for (Object classifier : c) { |
7 | while (i.hasNext()) { | | 7 | addElementListener(classifier, |
8 | Object st = i.next(); | | 8 | new String[] {"name", "remove"}); |
9 | addElementListener(st, "name"); | | 9 | } |
10 | } | | 10 | } |
11 | } | | | |
12 | } | | | |
See real code fragment |
|
See real code fragment |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.0 |
Similarity Score | 0.500 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
5 | while (i.hasNext()) | | 3 | for (Object classifier : c) |
| | | 4 | addElementListener(classifier, new String[] {"name", "remove"}); |
6 | | | | |
7 | addElementListener(st, "name"); | | | |
Precondition Violations (3)
Row |
Violation |
1 | Type java.util.Collection of variable c does not match with type java.util.Collection<java.lang.Object> of variable c |
2 | Unmatched statement addElementListener(classifier,new String[]{"name","remove"}); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | 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 |