protected void postActionPerformed(Class<? extends Command> action, ActionEvent e) {
if (action != null) {
HashSet<ActionListener> listenerSet = postActionListeners.get(action.getName());
if (listenerSet != null && listenerSet.size() > 0) {
Object[] listeners = listenerSet.toArray();
for (int i = 0; i < listeners.length; i++) {
((ActionListener) listeners[i]).actionPerformed(e);
}
}
}
}
protected void preActionPerformed(Class<? extends Command> action, ActionEvent e) {
if (action != null) {
Set<ActionListener> listenerSet = preActionListeners.get(action.getName());
if (listenerSet != null && listenerSet.size() > 0) {
ActionListener[] listeners = listenerSet.toArray(new ActionListener[listenerSet.size()]);
for (ActionListener listener : listeners) {
listener.actionPerformed(e);
}
}
}
}
Clone fragments detected by clone detection tool
File path: /apache-jmeter-2.11/src/reports/org/apache/jmeter/report/gui/action/ReportActionRouter.java
|
|
File path: /apache-jmeter-2.11/src/core/org/apache/jmeter/gui/action/ActionRouter.java
|
Method name: void postActionPerformed(Class extends Command>, ActionEvent)
|
|
Method name: void preActionPerformed(Class extends Command>, ActionEvent)
|
Number of AST nodes: 2
|
|
Number of AST nodes: 2
|
|
1 | protected void postActionPerformed(Class<? extends Command> action, ActionEvent e) {
| | 1 | protected void preActionPerformed(Class<? extends Command> action, ActionEvent e) {
|
2 | if (action != null) {
| | 2 | if (action != null) {
|
3 | HashSet<ActionListener> listenerSet = postActionListeners.get(action.getName());
| | 3 | Set<ActionListener> listenerSet = preActionListeners.get(action.getName());
|
4 | if (listenerSet != null && listenerSet.size() > 0) {
| | 4 | if (listenerSet != null && listenerSet.size() > 0) {
|
5 | Object[] listeners = listenerSet.toArray();
| | 5 | ActionListener[] listeners = listenerSet.toArray(new ActionListener[listenerSet.size()]);
|
6 | for (int i = 0; i < listeners.length; i++) {
| | 6 | for (ActionListener listener : listeners) {
|
7 | ((ActionListener) listeners[i]).actionPerformed(e);
| | 7 | listener.actionPerformed(e);
|
8 | }
| | 8 | }
|
9 | }
| | 9 | }
|
10 | }
| | 10 | }
|
11 | } | | 11 | } |
See real code fragment |
|
See real code fragment |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 2 |
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.600 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
5 | for (int i = 0; i < listeners.length; i++) | | 5 | for (ActionListener listener : listeners) |
6 | ((ActionListener)listeners[i]).actionPerformed(e); | | 6 | listener.actionPerformed(e); |
Precondition Violations (4)
Row |
Violation |
1 | Type java.lang.Object[] of variable listeners does not match with type java.awt.event.ActionListener[] of variable listeners |
2 | Type java.lang.Object[] of variable listeners does not match with type java.awt.event.ActionListener[] of variable listeners |
3 | Expression ((ActionListener)listeners[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression listener cannot be parameterized, because it has dependencies to/from statements that will be extracted |