diff options
Diffstat (limited to 'Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/visualizer')
3 files changed, 135 insertions, 0 deletions
diff --git a/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/visualizer/DesignSpaceVisualizerOptions.java b/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/visualizer/DesignSpaceVisualizerOptions.java new file mode 100644 index 00000000..bb8000d5 --- /dev/null +++ b/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/visualizer/DesignSpaceVisualizerOptions.java | |||
@@ -0,0 +1,56 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010-2014, Miklos Foldenyi, Andras Szabolcs Nagy, Abel Hegedus, Akos Horvath, Zoltan Ujhelyi and Daniel Varro | ||
3 | * This program and the accompanying materials are made available under the | ||
4 | * terms of the Eclipse Public License v. 2.0 which is available at | ||
5 | * http://www.eclipse.org/legal/epl-v20.html. | ||
6 | * | ||
7 | * SPDX-License-Identifier: EPL-2.0 | ||
8 | *******************************************************************************/ | ||
9 | package org.eclipse.viatra.dse.visualizer; | ||
10 | |||
11 | public class DesignSpaceVisualizerOptions { | ||
12 | |||
13 | public boolean showExplorationTrace = true; | ||
14 | public boolean showStateCodes = true; | ||
15 | public boolean showTransitionCodes = true; | ||
16 | |||
17 | public DesignSpaceVisualizerOptions withOutExploraionTrace() { | ||
18 | showExplorationTrace = false; | ||
19 | return this; | ||
20 | } | ||
21 | |||
22 | public DesignSpaceVisualizerOptions withOutstateCodes() { | ||
23 | showStateCodes = false; | ||
24 | return this; | ||
25 | } | ||
26 | |||
27 | public DesignSpaceVisualizerOptions withOutTransitionCodes() { | ||
28 | showTransitionCodes = false; | ||
29 | return this; | ||
30 | } | ||
31 | |||
32 | public boolean isShowExplorationTrace() { | ||
33 | return showExplorationTrace; | ||
34 | } | ||
35 | |||
36 | public void setShowExplorationTrace(boolean showExplorationTrace) { | ||
37 | this.showExplorationTrace = showExplorationTrace; | ||
38 | } | ||
39 | |||
40 | public boolean isShowStateCodes() { | ||
41 | return showStateCodes; | ||
42 | } | ||
43 | |||
44 | public void setShowStateCodes(boolean showStateCodes) { | ||
45 | this.showStateCodes = showStateCodes; | ||
46 | } | ||
47 | |||
48 | public boolean isShowTransitionCodes() { | ||
49 | return showTransitionCodes; | ||
50 | } | ||
51 | |||
52 | public void setShowTransitionCodes(boolean showTransitionCodes) { | ||
53 | this.showTransitionCodes = showTransitionCodes; | ||
54 | } | ||
55 | |||
56 | } | ||
diff --git a/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/visualizer/IDesignSpaceVisualizer.java b/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/visualizer/IDesignSpaceVisualizer.java new file mode 100644 index 00000000..da598b91 --- /dev/null +++ b/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/visualizer/IDesignSpaceVisualizer.java | |||
@@ -0,0 +1,39 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010-2014, Miklos Foldenyi, Andras Szabolcs Nagy, Abel Hegedus, Akos Horvath, Zoltan Ujhelyi and Daniel Varro | ||
3 | * This program and the accompanying materials are made available under the | ||
4 | * terms of the Eclipse Public License v. 2.0 which is available at | ||
5 | * http://www.eclipse.org/legal/epl-v20.html. | ||
6 | * | ||
7 | * SPDX-License-Identifier: EPL-2.0 | ||
8 | *******************************************************************************/ | ||
9 | package org.eclipse.viatra.dse.visualizer; | ||
10 | |||
11 | import org.eclipse.viatra.dse.api.DesignSpaceExplorer; | ||
12 | import org.eclipse.viatra.dse.base.ThreadContext; | ||
13 | |||
14 | /** | ||
15 | * | ||
16 | * An implementation of this interface is notified about the traversal of the design space from every traversing thread, | ||
17 | * if registered to the {@link DesignSpaceExplorer}. Its purpose is to able to visualize the design space (a directed | ||
18 | * graph with IDs of the nodes and transitions) and to able to visualize the order of the exploration (the trace of a | ||
19 | * thread). | ||
20 | * | ||
21 | * @author Andras Szabolcs Nagy | ||
22 | * | ||
23 | */ | ||
24 | public interface IDesignSpaceVisualizer extends IExploreEventHandler { | ||
25 | |||
26 | /** | ||
27 | * Initializes the instance with a starting thread's context. Can be called multiple times and concurrently. | ||
28 | * | ||
29 | * @see DesignSpaceVisualizerOptions | ||
30 | * @param context | ||
31 | */ | ||
32 | void init(ThreadContext context); | ||
33 | |||
34 | /** | ||
35 | * Saves the captured data. | ||
36 | */ | ||
37 | void save(); | ||
38 | |||
39 | } | ||
diff --git a/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/visualizer/IExploreEventHandler.java b/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/visualizer/IExploreEventHandler.java new file mode 100644 index 00000000..9f902f31 --- /dev/null +++ b/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/visualizer/IExploreEventHandler.java | |||
@@ -0,0 +1,40 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010-2014, Miklos Foldenyi, Andras Szabolcs Nagy, Abel Hegedus, Akos Horvath, Zoltan Ujhelyi and Daniel Varro | ||
3 | * This program and the accompanying materials are made available under the | ||
4 | * terms of the Eclipse Public License v. 2.0 which is available at | ||
5 | * http://www.eclipse.org/legal/epl-v20.html. | ||
6 | * | ||
7 | * SPDX-License-Identifier: EPL-2.0 | ||
8 | *******************************************************************************/ | ||
9 | package org.eclipse.viatra.dse.visualizer; | ||
10 | |||
11 | import org.eclipse.viatra.dse.base.DesignSpaceManager; | ||
12 | |||
13 | /** | ||
14 | * An implementation of this interface is notified about every move in the design space (firing a rule activation or | ||
15 | * undoing it) of a single thread, if registered to the corresponding {@link DesignSpaceManager}. Its methods are called | ||
16 | * synchronously, therefore the implementation can have an impact on the performance. Also note, if the same instance is | ||
17 | * registered to multiple threads ({@link DesignSpaceManager}), it has to be thread safe. | ||
18 | * | ||
19 | * @author Andras Szabolcs Nagy | ||
20 | * | ||
21 | */ | ||
22 | public interface IExploreEventHandler { | ||
23 | |||
24 | /** | ||
25 | * Called by the {@link DesignSpaceManager}, after a rule activation (transition) is fired. Multiple calls with the | ||
26 | * same transition can occur. | ||
27 | * | ||
28 | * @param transition The fired transition. | ||
29 | */ | ||
30 | void transitionFired(Object transition); | ||
31 | |||
32 | /** | ||
33 | * Called by the {@link DesignSpaceManager}, after undoing the previously fired rule activation (transition). | ||
34 | * Multiple calls with the same transition can occur. | ||
35 | * | ||
36 | * @param transition The undone transition. | ||
37 | */ | ||
38 | void undo(Object transition); | ||
39 | |||
40 | } | ||