File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/notation/providers/NotationUtilityProviders.java | File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/notation/providers/ObjectFlowStateStateNotation.java | |||
Method name: void addListenersForEvent(NotationProvider, Object)
|
Method name: void initialiseListener(Object)
|
|||
Number of AST nodes: 3 | Number of AST nodes: 2 | |||
1 | private static void addListenersForEvent(NotationProvider np, | 1 | @Override | |
2 | Object event) { | 2 | public void initialiseListener(Object modelElement) { | |
3 | if (event != null) { | 3 | addElementListener(modelElement); | |
4 | if (Model.getFacade().isAEvent(event)) { | 4 | Object cis = Model.getFacade().getType(modelElement); | |
5 | np.addElementListener(event, | 5 | if (Model.getFacade().isAClassifierInState(cis)) { | |
6 | new String[] { | 6 | addElementListener(cis, | |
7 | "parameter", "name"}); | 7 | new String[] {"remove", "inState"}); | |
8 | } | 8 | Collection<Object> c = Model.getFacade().getInStates(cis); | |
9 | if (Model.getFacade().isATimeEvent(event)) { | 9 | for (Object state : c) { | |
10 | np.addElementListener(event, new String[] {"when"}); | 10 | addElementListener(state, | |
11 | } | 11 | new String[] {"remove", "name"}); | |
12 | if (Model.getFacade().isAChangeEvent(event)) { | 12 | } | |
13 | np.addElementListener(event, | 13 | } | |
14 | new String[] {"changeExpression"}); | 14 | } | |
15 | } | |||
16 | /* And the parameter names and values: */ | |||
17 | Collection prms = Model.getFacade().getParameters(event); | |||
18 | Iterator i = prms.iterator(); | |||
19 | while (i.hasNext()) { | |||
20 | Object parameter = i.next(); | |||
21 | np.addElementListener(parameter, | |||
22 | new String[] {"defaultValue", "name", "type", "kind"}); | |||
23 | } | |||
24 | } | |||
25 | } | |||
See real code fragment | See real code fragment |
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.750 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
10 | while (i.hasNext()) |
| 6 | for (Object state : c) | |||||||||||||||||||
11 | Object parameter = i.next(); |
| | ||||||||||||||||||||
12 | np.addElementListener(parameter, new String[] {"defaultValue", "name", "type", "kind"}); |
| 7 | addElementListener(state, new String[] {"remove", "name"}); |
Row | Violation |
---|---|
1 | Type java.util.Collection of variable prms does not match with type java.util.Collection<java.lang.Object> of variable c |
2 | Expression addElementListener(state,new String[]{"remove","name"}) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression np.addElementListener(parameter,new String[]{"defaultValue","name","type","kind"}) is a void method call, and thus it cannot be parameterized |
4 | Expression addElementListener(state,new String[]{"remove","name"}) is a void method call, and thus it cannot be parameterized |