void addPreActionListener(Class action, ActionListener listener) { if (action != null) { HashSet set = (HashSet) preActionListeners.get(action.getName()); if (set == null) { set = new HashSet(); } set.add(listener); preActionListeners.put(action.getName(), set); } } /** * Allows an ActionListener to be removed from receiving notifications of a * command being executed prior to the actual execution of the command. * * @param action * the Class of the command for which the listener will * notifications for. Class must extend * org.apache.jmeter.gui.action.Command. * @param listener * the ActionListener to receive the notifications */ public void removePreActionListener(Class action, ActionListener listener) { if (action != null) { HashSet set = (HashSet) preActionListeners.get(action.getName()); if (set != null) { set.remove(listener); preActionListeners.put(action.getName(), set); } } } /** * Allows an ActionListener to receive notification of a command being * executed after the command has executed. * * @param action * the Class of the command for which the listener will * notifications for. Class must extend * org.apache.jmeter.gui.action.Command. * @param listener */ public void addPostActionListener(Class action, ActionListener listener) { if (action != null) { HashSet set = (HashSet) postActionListeners.get(action.getName()); if (set == null) { set = new HashSet(); } set.add(listener); postActionListeners.put(action.getName(), set); } } /** * Allows an ActionListener to be removed from receiving notifications of a * command being executed after the command has executed. * * @param action * the Class of the command for which the listener will * notifications for. Class must extend * org.apache.jmeter.gui.action.Command. * @param listener */ public void removePostActionListener(Class action, ActionListener listener) { if (action != null) { HashSet set = (HashSet) postActionListeners.get(action.getName()); if (set != null) { set.remove(listener); postActionListeners.put(action.getName(), set); } } } protected void preActionPerformed(Class action, ActionEvent e) { if (action != null) { HashSet listenerSet = (HashSet) preActionListeners.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 postActionPerformed(Class action, ActionEvent e) { if (action != null) { HashSet listenerSet = (HashSet) 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); } } }
void addPreActionListener(Class action, ActionListener listener) { if (action != null) { HashSet set = (HashSet) preActionListeners.get(action.getName()); if (set == null) { set = new HashSet(); } set.add(listener); preActionListeners.put(action.getName(), set); } } /** * Allows an ActionListener to be removed from receiving notifications of a * command being executed prior to the actual execution of the command. * * @param action * the Class of the command for which the listener will * notifications for. Class must extend * org.apache.jmeter.report.gui.action.Command. * @param listener * the ActionListener to receive the notifications */ public void removePreActionListener(Class action, ActionListener listener) { if (action != null) { HashSet set = (HashSet) preActionListeners.get(action.getName()); if (set != null) { set.remove(listener); preActionListeners.put(action.getName(), set); } } } /** * Allows an ActionListener to receive notification of a command being * executed after the command has executed. * * @param action * the Class of the command for which the listener will * notifications for. Class must extend * org.apache.jmeter.report.gui.action.Command. * @param listener */ public void addPostActionListener(Class action, ActionListener listener) { if (action != null) { HashSet set = (HashSet) postActionListeners.get(action.getName()); if (set == null) { set = new HashSet(); } set.add(listener); postActionListeners.put(action.getName(), set); } } /** * Allows an ActionListener to be removed from receiving notifications of a * command being executed after the command has executed. * * @param action * the Class of the command for which the listener will * notifications for. Class must extend * org.apache.jmeter.report.gui.action.Command. * @param listener */ public void removePostActionListener(Class action, ActionListener listener) { if (action != null) { HashSet set = (HashSet) postActionListeners.get(action.getName()); if (set != null) { set.remove(listener); postActionListeners.put(action.getName(), set); } } } protected void preActionPerformed(Class action, ActionEvent e) { if (action != null) { HashSet listenerSet = (HashSet) preActionListeners.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 postActionPerformed(Class action, ActionEvent e) { if (action != null) { HashSet listenerSet = (HashSet) 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); } } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/action/ActionRouter.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/report/gui/action/ReportActionRouter.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
void addPreActionListener(Class action, ActionListener listener) {
1
void addPreActionListener(Class action, ActionListener listener) {
2
		if (action != null) {
2
		if (action != null) {
3
			HashSet set = (HashSet) preActionListeners.get(action.getName());
3
			HashSet set = (HashSet) preActionListeners.get(action.getName());
4
			if (set == null) {
4
			if (set == null) {
5
				set = new HashSet();
5
				set = new HashSet();
6
			}
6
			}
7
			set.add(listener);
7
			set.add(listener);
8
			preActionListeners.put(action.getName(), set);
8
			preActionListeners.put(action.getName(), set);
9
		}
9
		}
10
	}
10
	}
11
	/**
11
	/**
12
	 * Allows an ActionListener to be removed from receiving notifications of a
12
	 * Allows an ActionListener to be removed from receiving notifications of a
13
	 * command being executed prior to the actual execution of the command.
13
	 * command being executed prior to the actual execution of the command.
14
	 * 
14
	 * 
15
	 * @param action
15
	 * @param action
16
	 *            the Class of the command for which the listener will
16
	 *            the Class of the command for which the listener will
17
	 *            notifications for. Class must extend
17
	 *            notifications for. Class must extend
18
	 *            org.apache.jmeter.gui.action.Command.
18
	 *            org.apache.jmeter.report.gui.action.Command.
19
	 * @param listener
19
	 * @param listener
20
	 *            the ActionListener to receive the notifications
20
	 *            the ActionListener to receive the notifications
21
	 */
21
	 */
22
	public void removePreActionListener(Class action, ActionListener listener) {
22
	public void removePreActionListener(Class action, ActionListener listener) {
23
		if (action != null) {
23
		if (action != null) {
24
			HashSet set = (HashSet) preActionListeners.get(action.getName());
24
			HashSet set = (HashSet) preActionListeners.get(action.getName());
25
			if (set != null) {
25
			if (set != null) {
26
				set.remove(listener);
26
				set.remove(listener);
27
				preActionListeners.put(action.getName(), set);
27
				preActionListeners.put(action.getName(), set);
28
			}
28
			}
29
		}
29
		}
30
	}
30
	}
31
	/**
31
	/**
32
	 * Allows an ActionListener to receive notification of a command being
32
	 * Allows an ActionListener to receive notification of a command being
33
	 * executed after the command has executed.
33
	 * executed after the command has executed.
34
	 * 
34
	 * 
35
	 * @param action
35
	 * @param action
36
	 *            the Class of the command for which the listener will
36
	 *            the Class of the command for which the listener will
37
	 *            notifications for. Class must extend
37
	 *            notifications for. Class must extend
38
	 *            org.apache.jmeter.gui.action.Command.
38
	 *            org.apache.jmeter.report.gui.action.Command.
39
	 * @param listener
39
	 * @param listener
40
	 */
40
	 */
41
	public void addPostActionListener(Class action, ActionListener listener) {
41
	public void addPostActionListener(Class action, ActionListener listener) {
42
		if (action != null) {
42
		if (action != null) {
43
			HashSet set = (HashSet) postActionListeners.get(action.getName());
43
			HashSet set = (HashSet) postActionListeners.get(action.getName());
44
			if (set == null) {
44
			if (set == null) {
45
				set = new HashSet();
45
				set = new HashSet();
46
			}
46
			}
47
			set.add(listener);
47
			set.add(listener);
48
			postActionListeners.put(action.getName(), set);
48
			postActionListeners.put(action.getName(), set);
49
		}
49
		}
50
	}
50
	}
51
	/**
51
	/**
52
	 * Allows an ActionListener to be removed from receiving notifications of a
52
	 * Allows an ActionListener to be removed from receiving notifications of a
53
	 * command being executed after the command has executed.
53
	 * command being executed after the command has executed.
54
	 * 
54
	 * 
55
	 * @param action
55
	 * @param action
56
	 *            the Class of the command for which the listener will
56
	 *            the Class of the command for which the listener will
57
	 *            notifications for. Class must extend
57
	 *            notifications for. Class must extend
58
	 *            org.apache.jmeter.gui.action.Command.
58
	 *            org.apache.jmeter.report.gui.action.Command.
59
	 * @param listener
59
	 * @param listener
60
	 */
60
	 */
61
	public void removePostActionListener(Class action, ActionListener listener) {
61
	public void removePostActionListener(Class action, ActionListener listener) {
62
		if (action != null) {
62
		if (action != null) {
63
			HashSet set = (HashSet) postActionListeners.get(action.getName());
63
			HashSet set = (HashSet) postActionListeners.get(action.getName());
64
			if (set != null) {
64
			if (set != null) {
65
				set.remove(listener);
65
				set.remove(listener);
66
				postActionListeners.put(action.getName(), set);
66
				postActionListeners.put(action.getName(), set);
67
			}
67
			}
68
		}
68
		}
69
	}
69
	}
70
	protected void preActionPerformed(Class action, ActionEvent e) {
70
	protected void preActionPerformed(Class action, ActionEvent e) {
71
		if (action != null) {
71
		if (action != null) {
72
			HashSet listenerSet = (HashSet) preActionListeners.get(action.getName());
72
			HashSet listenerSet = (HashSet) preActionListeners.get(action.getName());
73
			if (listenerSet != null && listenerSet.size() > 0) {
73
			if (listenerSet != null && listenerSet.size() > 0) {
74
				Object[] listeners = listenerSet.toArray();
74
				Object[] listeners = listenerSet.toArray();
75
				for (int i = 0; i < listeners.length; i++) {
75
				for (int i = 0; i < listeners.length; i++) {
76
					((ActionListener) listeners[i]).actionPerformed(e);
76
					((ActionListener) listeners[i]).actionPerformed(e);
77
				}
77
				}
78
			}
78
			}
79
		}
79
		}
80
	}
80
	}
81
	protected void postActionPerformed(Class action, ActionEvent e) {
81
	protected void postActionPerformed(Class action, ActionEvent e) {
82
		if (action != null) {
82
		if (action != null) {
83
			HashSet listenerSet = (HashSet) postActionListeners.get(action.getName());
83
			HashSet listenerSet = (HashSet) postActionListeners.get(action.getName());
84
			if (listenerSet != null && listenerSet.size() > 0) {
84
			if (listenerSet != null && listenerSet.size() > 0) {
85
				Object[] listeners = listenerSet.toArray();
85
				Object[] listeners = listenerSet.toArray();
86
				for (int i = 0; i < listeners.length; i++) {
86
				for (int i = 0; i < listeners.length; i++) {
87
					((ActionListener) listeners[i]).actionPerformed(e);
87
					((ActionListener) listeners[i]).actionPerformed(e);
88
				}
88
				}
89
			}
89
			}
90
		}
90
		}
91
	
91
	
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0