public void doActionNow(ActionEvent e) { performAction(e); } public Set getAction(String actionName) { Set set = new HashSet(); Set commandObjects = (Set) commands.get(actionName); Iterator iter = commandObjects.iterator(); while (iter.hasNext()) { try { set.add(iter.next()); } catch (Exception err) { log.error("", err); } } return set; } public Command getAction(String actionName, Class actionClass) { Set commandObjects = (Set) commands.get(actionName); Iterator iter = commandObjects.iterator(); while (iter.hasNext()) { try { Command com = (Command) iter.next(); if (com.getClass().equals(actionClass)) { return com; } } catch (Exception err) { log.error("", err); } } return null; } public Command getAction(String actionName, String className) { Set commandObjects = (Set) commands.get(actionName); Iterator iter = commandObjects.iterator(); while (iter.hasNext()) { try { Command com = (Command) iter.next(); if (com.getClass().getName().equals(className)) { return com; } } catch (Exception err) { log.error("", err); } } return null; } /** * Allows an ActionListener to receive notification 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 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);
public void doActionNow(ActionEvent e) { performAction(e); } public Set getAction(String actionName) { Set set = new HashSet(); Set commandObjects = (Set) commands.get(actionName); Iterator iter = commandObjects.iterator(); while (iter.hasNext()) { try { set.add(iter.next()); } catch (Exception err) { log.error("", err); } } return set; } public Command getAction(String actionName, Class actionClass) { Set commandObjects = (Set) commands.get(actionName); Iterator iter = commandObjects.iterator(); while (iter.hasNext()) { try { Command com = (Command) iter.next(); if (com.getClass().equals(actionClass)) { return com; } } catch (Exception err) { log.error("", err); } } return null; } public Command getAction(String actionName, String className) { Set commandObjects = (Set) commands.get(actionName); Iterator iter = commandObjects.iterator(); while (iter.hasNext()) { try { Command com = (Command) iter.next(); if (com.getClass().getName().equals(className)) { return com; } } catch (Exception err) { log.error("", err); } } return null; } /** * Allows an ActionListener to receive notification 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 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
public void doActionNow(ActionEvent e) {
1
public void doActionNow(ActionEvent e) {
2
		performAction(e);
2
		performAction(e);
3
	}
3
	}
4
	public Set getAction(String actionName) {
4
	public Set getAction(String actionName) {
5
		Set set = new HashSet();
5
		Set set = new HashSet();
6
		Set commandObjects = (Set) commands.get(actionName);
6
		Set commandObjects = (Set) commands.get(actionName);
7
		Iterator iter = commandObjects.iterator();
7
		Iterator iter = commandObjects.iterator();
8
		while (iter.hasNext()) {
8
		while (iter.hasNext()) {
9
			try {
9
			try {
10
				set.add(iter.next());
10
				set.add(iter.next());
11
			} catch (Exception err) {
11
			} catch (Exception err) {
12
				log.error("", err);
12
				log.error("", err);
13
			}
13
			}
14
		}
14
		}
15
		return set;
15
		return set;
16
	}
16
	}
17
	public Command getAction(String actionName, Class actionClass) {
17
	public Command getAction(String actionName, Class actionClass) {
18
		Set commandObjects = (Set) commands.get(actionName);
18
		Set commandObjects = (Set) commands.get(actionName);
19
		Iterator iter = commandObjects.iterator();
19
		Iterator iter = commandObjects.iterator();
20
		while (iter.hasNext()) {
20
		while (iter.hasNext()) {
21
			try {
21
			try {
22
				Command com = (Command) iter.next();
22
				Command com = (Command) iter.next();
23
				if (com.getClass().equals(actionClass)) {
23
				if (com.getClass().equals(actionClass)) {
24
					return com;
24
					return com;
25
				}
25
				}
26
			} catch (Exception err) {
26
			} catch (Exception err) {
27
				log.error("", err);
27
				log.error("", err);
28
			}
28
			}
29
		}
29
		}
30
		return null;
30
		return null;
31
	}
31
	}
32
	public Command getAction(String actionName, String className) {
32
	public Command getAction(String actionName, String className) {
33
		Set commandObjects = (Set) commands.get(actionName);
33
		Set commandObjects = (Set) commands.get(actionName);
34
		Iterator iter = commandObjects.iterator();
34
		Iterator iter = commandObjects.iterator();
35
		while (iter.hasNext()) {
35
		while (iter.hasNext()) {
36
			try {
36
			try {
37
				Command com = (Command) iter.next();
37
				Command com = (Command) iter.next();
38
				if (com.getClass().getName().equals(className)) {
38
				if (com.getClass().getName().equals(className)) {
39
					return com;
39
					return com;
40
				}
40
				}
41
			} catch (Exception err) {
41
			} catch (Exception err) {
42
				log.error("", err);
42
				log.error("", err);
43
			}
43
			}
44
		}
44
		}
45
		return null;
45
		return null;
46
	}
46
	}
47
	/**
47
	/**
48
	 * Allows an ActionListener to receive notification of a command being
48
	 * Allows an ActionListener to receive notification of a command being
49
	 * executed prior to the actual execution of the command.
49
	 * executed prior to the actual execution of the command.
50
	 * 
50
	 * 
51
	 * @param action
51
	 * @param action
52
	 *            the Class of the command for which the listener will
52
	 *            the Class of the command for which the listener will
53
	 *            notifications for. Class must extend
53
	 *            notifications for. Class must extend
54
	 *            org.apache.jmeter.gui.action.Command.
54
	 *            org.apache.jmeter.report.gui.action.Command.
55
	 * @param listener
55
	 * @param listener
56
	 *            the ActionListener to receive the notifications
56
	 *            the ActionListener to receive the notifications
57
	 */
57
	 */
58
	public void addPreActionListener(Class action, ActionListener listener) {
58
	public void addPreActionListener(Class action, ActionListener listener) {
59
		if (action != null) {
59
		if (action != null) {
60
			HashSet set = (HashSet) preActionListeners.get(action.getName());
60
			HashSet set = (HashSet) preActionListeners.get(action.getName());
61
			if (set == null) {
61
			if (set == null) {
62
				set = new HashSet();
62
				set = new HashSet();
63
			}
63
			}
64
			set.add(listener);
64
			set.add(listener);
65
			preActionListeners.put(action.getName(), set);
65
			preActionListeners.put(action.getName(), set);
66
		}
66
		}
67
	}
67
	}
68
	/**
68
	/**
69
	 * Allows an ActionListener to be removed from receiving notifications of a
69
	 * Allows an ActionListener to be removed from receiving notifications of a
70
	 * command being executed prior to the actual execution of the command.
70
	 * command being executed prior to the actual execution of the command.
71
	 * 
71
	 * 
72
	 * @param action
72
	 * @param action
73
	 *            the Class of the command for which the listener will
73
	 *            the Class of the command for which the listener will
74
	 *            notifications for. Class must extend
74
	 *            notifications for. Class must extend
75
	 *            org.apache.jmeter.gui.action.Command.
75
	 *            org.apache.jmeter.report.gui.action.Command.
76
	 * @param listener
76
	 * @param listener
77
	 *            the ActionListener to receive the notifications
77
	 *            the ActionListener to receive the notifications
78
	 */
78
	 */
79
	public void removePreActionListener(Class action, ActionListener listener) {
79
	public void removePreActionListener(Class action, ActionListener listener) {
80
		if (action != null) {
80
		if (action != null) {
81
			HashSet set = (HashSet) preActionListeners.get(action.getName());
81
			HashSet set = (HashSet) preActionListeners.get(action.getName());
82
			if (set != null) {
82
			if (set != null) {
83
				set.remove(listener);
83
				set.remove(listener);
84
				preActionListeners.put(action.getName(), set);
84
				preActionListeners.put(action.getName(), set);
85
			}
85
			}
86
		}
86
		}
87
	}
87
	}
88
	/**
88
	/**
89
	 * Allows an ActionListener to receive notification of a command being
89
	 * Allows an ActionListener to receive notification of a command being
90
	 * executed after the command has executed.
90
	 * executed after the command has executed.
91
	 * 
91
	 * 
92
	 * @param action
92
	 * @param action
93
	 *            the Class of the command for which the listener will
93
	 *            the Class of the command for which the listener will
94
	 *            notifications for. Class must extend
94
	 *            notifications for. Class must extend
95
	 *            org.apache.jmeter.gui.action.Command.
95
	 *            org.apache.jmeter.report.gui.action.Command.
96
	 * @param listener
96
	 * @param listener
97
	 */
97
	 */
98
	public void addPostActionListener(Class action, ActionListener listener) {
98
	public void addPostActionListener(Class action, ActionListener listener) {
99
		if (action != null) {
99
		if (action != null) {
100
			HashSet set = (HashSet) postActionListeners.get(action.getName());
100
			HashSet set = (HashSet) postActionListeners.get(action.getName());
101
			if (set == null) {
101
			if (set == null) {
102
				set = new HashSet();
102
				set = new HashSet();
103
			}
103
			}
104
			set.add(listener);
104
			set.add(listener);
105
			postActionListeners.put(action.getName(), set);
105
			postActionListeners.put(action.getName(), set);
106
		}
106
		}
107
	}
107
	}
108
	/**
108
	/**
109
	 * Allows an ActionListener to be removed from receiving notifications of a
109
	 * Allows an ActionListener to be removed from receiving notifications of a
110
	 * command being executed after the command has executed.
110
	 * command being executed after the command has executed.
111
	 * 
111
	 * 
112
	 * @param action
112
	 * @param action
113
	 *            the Class of the command for which the listener will
113
	 *            the Class of the command for which the listener will
114
	 *            notifications for. Class must extend
114
	 *            notifications for. Class must extend
115
	 *            org.apache.jmeter.gui.action.Command.
115
	 *            org.apache.jmeter.report.gui.action.Command.
116
	 * @param listener
116
	 * @param listener
117
	 */
117
	 */
118
	public void removePostActionListener(Class action, ActionListener listener) {
118
	public void removePostActionListener(Class action, ActionListener listener) {
119
		if (action != null) {
119
		if (action != null) {
120
			HashSet set = (HashSet) postActionListeners.get(action.getName());
120
			HashSet set = (HashSet) postActionListeners.get(action.getName());
121
			if (set != null) {
121
			if (set != null) {
122
				set.remove(listener);
122
				set.remove(listener);
123
				postActionListeners.put(action.getName(), set);
123
				postActionListeners.put(action.getName(), set);
124
			}
124
			}
125
		}
125
		}
126
	}
126
	}
127
	protected void preActionPerformed(Class action, ActionEvent e) {
127
	protected void preActionPerformed(Class action, ActionEvent e) {
128
		if (action != null) {
128
		if (action != null) {
129
			HashSet listenerSet = (HashSet) preActionListeners.get(action.getName());
129
			HashSet listenerSet = (HashSet) preActionListeners.get(action.getName());
130
			if (listenerSet != null && listenerSet.size() > 0) {
130
			if (listenerSet != null && listenerSet.size() > 0) {
131
				Object[] listeners = listenerSet.toArray();
131
				Object[] listeners = listenerSet.toArray();
132
				for (int i = 0; i < listeners.length; i++) {
132
				for (int i = 0; i < listeners.length; i++) {
133
					((ActionListener) listeners[i]).actionPerformed(e);
133
					((ActionListener) listeners[i]).actionPerformed(e);
134
				}
134
				}
135
			}
135
			}
136
		}
136
		}
137
	}
137
	}
138
	protected void postActionPerformed(Class action, ActionEvent e) {
138
	protected void postActionPerformed(Class action, ActionEvent e) {
139
		if (action != null) {
139
		if (action != null) {
140
			HashSet listenerSet = (HashSet) postActionListeners.get(action.getName());
140
			HashSet listenerSet = (HashSet) postActionListeners.get(action.getName());
141
			if (listenerSet != null && listenerSet.size() > 0) {
141
			if (listenerSet != null && listenerSet.size() > 0) {
142
				Object[] listeners = listenerSet.toArray();
142
				Object[] listeners = listenerSet.toArray();
143
				for (int i = 0; i < listeners.length; i++) {
143
				for (int i = 0; i < listeners.length; i++) {
144
					((ActionListener) listeners[i]).actionPerformed(e);
144
					((ActionListener) listeners[i]).actionPerformed(e);
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