File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigObjectFlowState.java | File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java | |||
Method name: void updateListeners(Object, Object)
|
Method name: void updateListeners(Object, Object)
|
|||
Number of AST nodes: 2 | 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 | ||
4 | 4 | Set<Object[]> listeners = new HashSet<Object[]>(); | ||
5 | if (newOwner != null) { | 5 | if (newOwner != null) { | |
6 | /* Don't listen to all property names | 6 | listeners.add(new Object[] {newOwner, null}); | |
7 | * We only need to listen to its "type", and "remove". */ | 7 | // register for tagDefinitions: | |
8 | l.add(new Object[] {newOwner, new String[] {"type", "remove"}}); | 8 | for (Object td : Model.getFacade().getTagDefinitions(newOwner)) { | |
9 | // register for events from the type | 9 | listeners.add(new Object[] {td, | |
10 | Object type = Model.getFacade().getType(newOwner); | 10 | new String[] {"name", "tagType", "multiplicity"}}); | |
11 | if (Model.getFacade().isAClassifier(type)) { | 11 | } | |
12 | if (Model.getFacade().isAClassifierInState(type)) { | 12 | /* TODO: constraints, ... */ | |
13 | Object classifier = Model.getFacade().getType(type); | 13 | } | |
14 | l.add(new Object[] {classifier, "name"}); | 14 | updateElementListeners(listeners); | |
15 | l.add(new Object[] {type, "inState"}); | 15 | } | |
16 | Collection states = Model.getFacade().getInStates(type); | |||
17 | Iterator i = states.iterator(); | |||
18 | while (i.hasNext()) { | |||
19 | l.add(new Object[] {i.next(), "name"}); | |||
20 | } | |||
21 | } else { | |||
22 | l.add(new Object[] {type, "name"}); | |||
23 | } | |||
24 | } | |||
25 | } | |||
26 | ||||
27 | updateElementListeners(l); | |||
28 | } | |||
See real code fragment | See real code fragment |
Number of mapped statements | 2 |
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 | 1.000 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
12 | while (i.hasNext()) |
| 4 | for (Object td : Model.getFacade().getTagDefinitions(newOwner)) | ||||||||||
|
| 5 | listeners.add(new Object[] {td, new String[] {"name", "tagType", "multiplicity"}}); | |||||||||||
13 | l.add(new Object[] {i.next(), "name"}); | |
Row | Violation |
---|---|
1 | 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 |
2 | Clone fragment #1 returns variables , while Clone fragment #2 returns variables td |