1 | package desmoj.core.simulator; |
2 | |
3 | /** |
4 | * ExternalEvent switching on the debug output for the experiment. The |
5 | * messagemanager's channel for debugnotes is switched on to forward tracenotes |
6 | * to the configured Output. |
7 | * |
8 | * @version DESMO-J, Ver. 2.3.3 copyright (c) 2011 |
9 | * @author Tim Lechler |
10 | * |
11 | * Licensed under the Apache License, Version 2.0 (the "License"); |
12 | * you may not use this file except in compliance with the License. You |
13 | * may obtain a copy of the License at |
14 | * http://www.apache.org/licenses/LICENSE-2.0 |
15 | * |
16 | * Unless required by applicable law or agreed to in writing, software |
17 | * distributed under the License is distributed on an "AS IS" |
18 | * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
19 | * or implied. See the License for the specific language governing |
20 | * permissions and limitations under the License. |
21 | * |
22 | */ |
23 | public class ExternalEventDebugOn extends ExternalEvent { |
24 | /** |
25 | * Creates the external event to start the debug output for an experiment. |
26 | * |
27 | * @param owner |
28 | * desmoj.Model : The model this external event is associated to |
29 | * @param showInTrace |
30 | * boolean : The flag indicating if this external event is shown |
31 | * in the trace output |
32 | */ |
33 | public ExternalEventDebugOn(Model owner, boolean showInTrace) { |
34 | |
35 | super(owner, "DebugOn", showInTrace); |
36 | |
37 | } |
38 | |
39 | /** |
40 | * Switches the messagemanager's debug note channel on to forward debugnotes |
41 | * to the configured output. |
42 | */ |
43 | public void eventRoutine() { |
44 | |
45 | Experiment ex = getModel().getExperiment(); |
46 | ex.getMessageManager().switchOn(Experiment.debugnote); |
47 | if (currentlySendTraceNotes()) |
48 | sendTraceNote("Debug switched on"); |
49 | |
50 | } |
51 | } |