@Override
public void initialiseListener(Object modelElement) {
addElementListener(modelElement,
new String[] {"name", "classifier"});
// Add the following once we show stereotypes:
// Collection c = Model.getFacade().getStereotypes(newOwner);
// Iterator i = c.iterator();
// while (i.hasNext()) {
// Object st = i.next();
// addElementListener(st, "name");
// }
Collection c = Model.getFacade().getClassifiers(modelElement);
Iterator i = c.iterator();
while (i.hasNext()) {
Object st = i.next();
addElementListener(st, "name");
}
}
@Override
protected void updateListeners(Object oldOwner, Object newOwner) {
super.updateListeners(oldOwner, newOwner);
if (newOwner != null) {
for (Object classifier
: Model.getFacade().getClassifiers(newOwner)) {
addElementListener(classifier, "name");
}
}
}
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/notation/providers/ObjectNotation.java
|
|
File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/FigComponentInstance.java
|
Method name: void initialiseListener(Object)
|
|
Method name: void updateListeners(Object, Object)
|
Number of AST nodes: 3
|
|
Number of AST nodes: 2
|
|
1 | @Override | | 1 | @Override |
2 | public void initialiseListener(Object modelElement) { | | 2 | protected void updateListeners(Object oldOwner, Object newOwner) { |
3 | addElementListener(modelElement, | | 3 | super.updateListeners(oldOwner, newOwner); |
4 | new String[] {"name", "classifier"}); | | 4 | if (newOwner != null) { |
5 | | | 5 | for (Object classifier |
6 | // Add the following once we show stereotypes: | | 6 | : Model.getFacade().getClassifiers(newOwner)) { |
7 | // Collection c = Model.getFacade().getStereotypes(newOwner); | | 7 | addElementListener(classifier, "name"); |
8 | // Iterator i = c.iterator(); | | 8 | } |
9 | // while (i.hasNext()) { | | 9 | } |
10 | // Object st = i.next(); | | 10 | } |
11 | // addElementListener(st, "name"); | | | |
12 | // } | | | |
13 | | | | |
14 | Collection c = Model.getFacade().getClassifiers(modelElement); | | | |
15 | Iterator i = c.iterator(); | | | |
16 | while (i.hasNext()) { | | | |
17 | Object st = i.next(); | | | |
18 | addElementListener(st, "name"); | | | |
19 | } | | | |
20 | } | | | |
See real code fragment |
|
See real code fragment |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.0 |
Similarity Score | 0.500 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
4 | while (i.hasNext()) | | 3 | for (Object classifier : Model.getFacade().getClassifiers(newOwner)) |
5 | | | | |
6 | addElementListener(st, "name"); | | 4 | addElementListener(classifier, "name"); |
Precondition Violations (0)
Row |
Violation |