Merge lp:~danilovesky/workcraft/trunk-circuit-env-stg into lp:workcraft
- trunk-circuit-env-stg
- Merge into trunk
Proposed by
Danil Sokolov
Status: | Merged |
---|---|
Merged at revision: | 501 |
Proposed branch: | lp:~danilovesky/workcraft/trunk-circuit-env-stg |
Merge into: | lp:workcraft |
Diff against target: |
2369 lines (+815/-640) 39 files modified
CircuitPlugin/src/org/workcraft/plugins/circuit/CircuitModule.java (+60/-16) CircuitPlugin/src/org/workcraft/plugins/circuit/Environment.java (+21/-0) CircuitPlugin/src/org/workcraft/plugins/circuit/VisualCircuit.java (+55/-47) CircuitPlugin/src/org/workcraft/plugins/circuit/VisualContact.java (+2/-1) CircuitPlugin/src/org/workcraft/plugins/circuit/VisualFunctionContact.java (+8/-4) CircuitPlugin/src/org/workcraft/plugins/circuit/tasks/CheckCircuitDeadlockTask.java (+0/-111) CircuitPlugin/src/org/workcraft/plugins/circuit/tasks/CheckCircuitHazardTask.java (+0/-110) CircuitPlugin/src/org/workcraft/plugins/circuit/tasks/CheckCircuitTask.java (+213/-68) CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CheckCircuitDeadlockTool.java (+0/-43) CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CheckCircuitHazardTool.java (+0/-43) CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CheckCircuitTool.java (+15/-3) CircuitPlugin/src/org/workcraft/plugins/circuit/tools/STGGenerator.java (+20/-23) CpogsPlugin/src/org/workcraft/plugins/cpog/optimisation/dnf/DnfGenerator.java (+3/-1) DfsPlugin/src/org/workcraft/plugins/dfs/VisualDfs.java (+1/-9) DfsPlugin/src/org/workcraft/plugins/dfs/tasks/CheckDataflowDeadlockTask.java (+15/-8) DfsPlugin/src/org/workcraft/plugins/dfs/tasks/CheckDataflowHazardTask.java (+15/-8) DfsPlugin/src/org/workcraft/plugins/dfs/tasks/CheckDataflowTask.java (+16/-10) MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatChainResultHandler.java (+44/-37) MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatMode.java (+2/-2) MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatSettings.java (+127/-17) MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatStgReachabilityResultHandler.java (+15/-7) MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatUndefinedResultHandler.java (+32/-0) MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatUtilitySettings.java (+22/-0) MpsatPlugin/src/org/workcraft/plugins/mpsat/gui/MpsatConfigurationDialog.java (+1/-1) MpsatPlugin/src/org/workcraft/plugins/mpsat/gui/SolutionPanel.java (+1/-1) MpsatPlugin/src/org/workcraft/plugins/mpsat/tasks/MpsatChainResult.java (+28/-23) MpsatPlugin/src/org/workcraft/plugins/mpsat/tasks/MpsatChainTask.java (+4/-4) MpsatPlugin/src/org/workcraft/plugins/pcomp/tasks/PcompResultHandler.java (+2/-2) MpsatPlugin/src/org/workcraft/plugins/pcomp/tools/PcompTool.java (+3/-1) PolicyNetPlugin/src/org/workcraft/plugins/policy/tasks/CheckDeadlockTask.java (+15/-8) STGPlugin/src/org/workcraft/plugins/stg/LabelParser.java (+1/-1) STGPlugin/src/org/workcraft/plugins/stg/STG.java (+3/-8) STGPlugin/src/org/workcraft/plugins/stg/VisualSTG.java (+0/-7) WorkcraftCore/src/org/workcraft/dom/AbstractModel.java (+9/-1) WorkcraftCore/src/org/workcraft/gui/propertyeditor/FileCellEditor.java (+0/-3) WorkcraftCore/src/org/workcraft/plugins/BuiltinSerialisers.java (+4/-0) WorkcraftCore/src/org/workcraft/plugins/serialisation/xml/FileDeserialiser.java (+19/-0) WorkcraftCore/src/org/workcraft/plugins/serialisation/xml/FileSerialiser.java (+22/-0) WorkcraftCore/src/org/workcraft/plugins/shared/CommonEditorSettings.java (+17/-12) |
To merge this branch: | bzr merge lp:~danilovesky/workcraft/trunk-circuit-env-stg |
Related bugs: | |
Related blueprints: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Danil Sokolov | Approve | ||
Review via email: mp+217640@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Danil Sokolov (danilovesky) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/CircuitModule.java' | |||
2 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/CircuitModule.java 2013-09-17 14:58:15 +0000 | |||
3 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/CircuitModule.java 2014-04-29 16:24:51 +0000 | |||
4 | @@ -9,8 +9,6 @@ | |||
5 | 9 | import org.workcraft.gui.propertyeditor.SettingsPage; | 9 | import org.workcraft.gui.propertyeditor.SettingsPage; |
6 | 10 | import org.workcraft.plugins.circuit.serialisation.FunctionDeserialiser; | 10 | import org.workcraft.plugins.circuit.serialisation.FunctionDeserialiser; |
7 | 11 | import org.workcraft.plugins.circuit.serialisation.FunctionSerialiser; | 11 | import org.workcraft.plugins.circuit.serialisation.FunctionSerialiser; |
8 | 12 | import org.workcraft.plugins.circuit.tools.CheckCircuitDeadlockTool; | ||
9 | 13 | import org.workcraft.plugins.circuit.tools.CheckCircuitHazardTool; | ||
10 | 14 | import org.workcraft.plugins.circuit.tools.CheckCircuitTool; | 12 | import org.workcraft.plugins.circuit.tools.CheckCircuitTool; |
11 | 15 | import org.workcraft.plugins.circuit.tools.STGGeneratorTool; | 13 | import org.workcraft.plugins.circuit.tools.STGGeneratorTool; |
12 | 16 | import org.workcraft.serialisation.xml.XMLDeserialiser; | 14 | import org.workcraft.serialisation.xml.XMLDeserialiser; |
13 | @@ -34,20 +32,6 @@ | |||
14 | 34 | return new STGGeneratorTool(framework); | 32 | return new STGGeneratorTool(framework); |
15 | 35 | } | 33 | } |
16 | 36 | }); | 34 | }); |
17 | 37 | |||
18 | 38 | pm.registerClass(Tool.class, new Initialiser<Tool>() { | ||
19 | 39 | @Override | ||
20 | 40 | public Tool create() { | ||
21 | 41 | return new CheckCircuitDeadlockTool(framework); | ||
22 | 42 | } | ||
23 | 43 | }); | ||
24 | 44 | |||
25 | 45 | pm.registerClass(Tool.class, new Initialiser<Tool>() { | ||
26 | 46 | @Override | ||
27 | 47 | public Tool create() { | ||
28 | 48 | return new CheckCircuitHazardTool(framework); | ||
29 | 49 | } | ||
30 | 50 | }); | ||
31 | 51 | 35 | ||
32 | 52 | pm.registerClass(Tool.class, new Initialiser<Tool>() { | 36 | pm.registerClass(Tool.class, new Initialiser<Tool>() { |
33 | 53 | @Override | 37 | @Override |
34 | @@ -56,6 +40,66 @@ | |||
35 | 56 | } | 40 | } |
36 | 57 | }); | 41 | }); |
37 | 58 | 42 | ||
38 | 43 | pm.registerClass(Tool.class, new Initialiser<Tool>() { | ||
39 | 44 | @Override | ||
40 | 45 | public Tool create() { | ||
41 | 46 | return new CheckCircuitTool(framework) { | ||
42 | 47 | @Override | ||
43 | 48 | public String getDisplayName() { | ||
44 | 49 | return "Check circuit only for conformation"; | ||
45 | 50 | } | ||
46 | 51 | @Override | ||
47 | 52 | public boolean checkDeadlock() { | ||
48 | 53 | return false; | ||
49 | 54 | } | ||
50 | 55 | @Override | ||
51 | 56 | public boolean checkHazard() { | ||
52 | 57 | return false; | ||
53 | 58 | } | ||
54 | 59 | }; | ||
55 | 60 | } | ||
56 | 61 | }); | ||
57 | 62 | |||
58 | 63 | pm.registerClass(Tool.class, new Initialiser<Tool>() { | ||
59 | 64 | @Override | ||
60 | 65 | public Tool create() { | ||
61 | 66 | return new CheckCircuitTool(framework) { | ||
62 | 67 | @Override | ||
63 | 68 | public String getDisplayName() { | ||
64 | 69 | return "Check circuit only for deadlocks"; | ||
65 | 70 | } | ||
66 | 71 | @Override | ||
67 | 72 | public boolean checkConformation() { | ||
68 | 73 | return false; | ||
69 | 74 | } | ||
70 | 75 | @Override | ||
71 | 76 | public boolean checkHazard() { | ||
72 | 77 | return false; | ||
73 | 78 | } | ||
74 | 79 | }; | ||
75 | 80 | } | ||
76 | 81 | }); | ||
77 | 82 | |||
78 | 83 | pm.registerClass(Tool.class, new Initialiser<Tool>() { | ||
79 | 84 | @Override | ||
80 | 85 | public Tool create() { | ||
81 | 86 | return new CheckCircuitTool(framework) { | ||
82 | 87 | @Override | ||
83 | 88 | public String getDisplayName() { | ||
84 | 89 | return "Check circuit only for hazards"; | ||
85 | 90 | } | ||
86 | 91 | @Override | ||
87 | 92 | public boolean checkConformation() { | ||
88 | 93 | return false; | ||
89 | 94 | } | ||
90 | 95 | @Override | ||
91 | 96 | public boolean checkDeadlock() { | ||
92 | 97 | return false; | ||
93 | 98 | } | ||
94 | 99 | }; | ||
95 | 100 | } | ||
96 | 101 | }); | ||
97 | 102 | |||
98 | 59 | pm.registerClass(ModelDescriptor.class, CircuitModelDescriptor.class); | 103 | pm.registerClass(ModelDescriptor.class, CircuitModelDescriptor.class); |
99 | 60 | pm.registerClass(XMLSerialiser.class, FunctionSerialiser.class); | 104 | pm.registerClass(XMLSerialiser.class, FunctionSerialiser.class); |
100 | 61 | pm.registerClass(XMLDeserialiser.class, FunctionDeserialiser.class); | 105 | pm.registerClass(XMLDeserialiser.class, FunctionDeserialiser.class); |
101 | 62 | 106 | ||
102 | === added file 'CircuitPlugin/src/org/workcraft/plugins/circuit/Environment.java' | |||
103 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/Environment.java 1970-01-01 00:00:00 +0000 | |||
104 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/Environment.java 2014-04-29 16:24:51 +0000 | |||
105 | @@ -0,0 +1,21 @@ | |||
106 | 1 | package org.workcraft.plugins.circuit; | ||
107 | 2 | |||
108 | 3 | import java.io.File; | ||
109 | 4 | |||
110 | 5 | import org.workcraft.dom.math.MathNode; | ||
111 | 6 | |||
112 | 7 | public class Environment extends MathNode { | ||
113 | 8 | private File file; | ||
114 | 9 | |||
115 | 10 | public Environment() { | ||
116 | 11 | |||
117 | 12 | } | ||
118 | 13 | |||
119 | 14 | public File getFile() { | ||
120 | 15 | return file; | ||
121 | 16 | } | ||
122 | 17 | |||
123 | 18 | public void setFile(File file) { | ||
124 | 19 | this.file = file; | ||
125 | 20 | } | ||
126 | 21 | } | ||
127 | 0 | 22 | ||
128 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/VisualCircuit.java' | |||
129 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/VisualCircuit.java 2014-04-09 22:33:19 +0000 | |||
130 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/VisualCircuit.java 2014-04-29 16:24:51 +0000 | |||
131 | @@ -37,6 +37,7 @@ | |||
132 | 37 | import org.workcraft.exceptions.VisualModelInstantiationException; | 37 | import org.workcraft.exceptions.VisualModelInstantiationException; |
133 | 38 | import org.workcraft.gui.propertyeditor.Properties; | 38 | import org.workcraft.gui.propertyeditor.Properties; |
134 | 39 | import org.workcraft.plugins.circuit.Contact.IOType; | 39 | import org.workcraft.plugins.circuit.Contact.IOType; |
135 | 40 | import org.workcraft.serialisation.xml.NoAutoSerialisation; | ||
136 | 40 | import org.workcraft.util.Hierarchy; | 41 | import org.workcraft.util.Hierarchy; |
137 | 41 | 42 | ||
138 | 42 | 43 | ||
139 | @@ -45,10 +46,9 @@ | |||
140 | 45 | public class VisualCircuit extends AbstractVisualModel { | 46 | public class VisualCircuit extends AbstractVisualModel { |
141 | 46 | 47 | ||
142 | 47 | private Circuit circuit; | 48 | private Circuit circuit; |
143 | 48 | private File environmentFile; | ||
144 | 49 | 49 | ||
145 | 50 | @Override | 50 | @Override |
147 | 51 | public void validateConnection(Node first, Node second) throws InvalidConnectionException { | 51 | public void validateConnection(Node first, Node second) throws InvalidConnectionException { |
148 | 52 | if (first==second) { | 52 | if (first==second) { |
149 | 53 | throw new InvalidConnectionException ("Connections are only valid between different objects"); | 53 | throw new InvalidConnectionException ("Connections are only valid between different objects"); |
150 | 54 | } | 54 | } |
151 | @@ -77,24 +77,12 @@ | |||
152 | 77 | } | 77 | } |
153 | 78 | } | 78 | } |
154 | 79 | 79 | ||
167 | 80 | /* | 80 | public VisualCircuit(Circuit model, VisualGroup root) { |
156 | 81 | private final class StateSupervisorExtension extends StateSupervisor { | ||
157 | 82 | @Override | ||
158 | 83 | public void handleEvent(StateEvent e) { | ||
159 | 84 | // if(e instanceof PropertyChangedEvent) | ||
160 | 85 | |||
161 | 86 | } | ||
162 | 87 | } | ||
163 | 88 | */ | ||
164 | 89 | |||
165 | 90 | public VisualCircuit(Circuit model, VisualGroup root) | ||
166 | 91 | { | ||
168 | 92 | super(model, root); | 81 | super(model, root); |
169 | 93 | circuit=model; | 82 | circuit=model; |
170 | 94 | } | 83 | } |
171 | 95 | 84 | ||
174 | 96 | public VisualCircuit(Circuit model) | 85 | public VisualCircuit(Circuit model) throws VisualModelInstantiationException { |
173 | 97 | throws VisualModelInstantiationException { | ||
175 | 98 | super(model); | 86 | super(model); |
176 | 99 | circuit=model; | 87 | circuit=model; |
177 | 100 | try { | 88 | try { |
178 | @@ -102,13 +90,10 @@ | |||
179 | 102 | } catch (NodeCreationException e) { | 90 | } catch (NodeCreationException e) { |
180 | 103 | throw new VisualModelInstantiationException(e); | 91 | throw new VisualModelInstantiationException(e); |
181 | 104 | } | 92 | } |
182 | 105 | |||
183 | 106 | //new StateSupervisorExtension().attach(getRoot()); | ||
184 | 107 | } | 93 | } |
185 | 108 | 94 | ||
186 | 109 | @Override | 95 | @Override |
189 | 110 | public void connect(Node first, Node second) | 96 | public void connect(Node first, Node second) throws InvalidConnectionException { |
188 | 111 | throws InvalidConnectionException { | ||
190 | 112 | validateConnection(first, second); | 97 | validateConnection(first, second); |
191 | 113 | 98 | ||
192 | 114 | if (first instanceof VisualComponent && second instanceof VisualComponent) { | 99 | if (first instanceof VisualComponent && second instanceof VisualComponent) { |
193 | @@ -121,6 +106,56 @@ | |||
194 | 121 | nearestAncestor.add(connection); | 106 | nearestAncestor.add(connection); |
195 | 122 | } | 107 | } |
196 | 123 | } | 108 | } |
197 | 109 | |||
198 | 110 | public VisualFunctionContact getOrCreateOutput(String name, double x, double y) { | ||
199 | 111 | for(VisualFunctionContact c : Hierarchy.filterNodesByType( | ||
200 | 112 | getRoot().getChildren(), VisualFunctionContact.class)) { | ||
201 | 113 | if(c.getName().equals(name)) return c; | ||
202 | 114 | } | ||
203 | 115 | VisualFunctionContact vc = new VisualFunctionContact(new FunctionContact(IOType.OUTPUT)); | ||
204 | 116 | vc.setPosition(new Point2D.Double(x, y)); | ||
205 | 117 | addFunctionContact(vc); | ||
206 | 118 | vc.setName(name); | ||
207 | 119 | return vc; | ||
208 | 120 | } | ||
209 | 121 | |||
210 | 122 | public void addFunctionComponent(VisualFunctionComponent component) { | ||
211 | 123 | for (Node node : component.getMathReferences()) { | ||
212 | 124 | circuit.add(node); | ||
213 | 125 | } | ||
214 | 126 | super.add(component); | ||
215 | 127 | } | ||
216 | 128 | |||
217 | 129 | public void addJoint(VisualJoint joint) { | ||
218 | 130 | for (Node node : joint.getMathReferences()) { | ||
219 | 131 | circuit.add(node); | ||
220 | 132 | } | ||
221 | 133 | super.add(joint); | ||
222 | 134 | } | ||
223 | 135 | |||
224 | 136 | public void addFunctionContact(VisualFunctionContact contact) { | ||
225 | 137 | circuit.add(contact.getFunction()); | ||
226 | 138 | super.add(contact); | ||
227 | 139 | } | ||
228 | 140 | |||
229 | 141 | @NoAutoSerialisation | ||
230 | 142 | public File getEnvironmentFile() { | ||
231 | 143 | File result = null; | ||
232 | 144 | for (Environment env: Hierarchy.filterNodesByType(getRoot().getChildren(), Environment.class)) { | ||
233 | 145 | result = env.getFile(); | ||
234 | 146 | } | ||
235 | 147 | return result; | ||
236 | 148 | } | ||
237 | 149 | |||
238 | 150 | @NoAutoSerialisation | ||
239 | 151 | public void setEnvironmentFile(File value) { | ||
240 | 152 | for (Environment env: Hierarchy.filterNodesByType(getRoot().getChildren(), Environment.class)) { | ||
241 | 153 | remove(env); | ||
242 | 154 | } | ||
243 | 155 | Environment env = new Environment(); | ||
244 | 156 | env.setFile(value); | ||
245 | 157 | add(env); | ||
246 | 158 | } | ||
247 | 124 | 159 | ||
248 | 125 | @Override | 160 | @Override |
249 | 126 | public Properties getProperties(Node node) { | 161 | public Properties getProperties(Node node) { |
250 | @@ -138,31 +173,4 @@ | |||
251 | 138 | return properties; | 173 | return properties; |
252 | 139 | } | 174 | } |
253 | 140 | 175 | ||
254 | 141 | public VisualFunctionContact getOrCreateOutput(String name, double x, double y) { | ||
255 | 142 | |||
256 | 143 | for(VisualFunctionContact c : Hierarchy.filterNodesByType(getRoot().getChildren(), VisualFunctionContact.class)) { | ||
257 | 144 | if(c.getName().equals(name)) return c; | ||
258 | 145 | } | ||
259 | 146 | |||
260 | 147 | FunctionContact fc = new FunctionContact(IOType.OUTPUT); | ||
261 | 148 | VisualFunctionContact vc = new VisualFunctionContact(fc); | ||
262 | 149 | Point2D p2d = new Point2D.Double(); | ||
263 | 150 | p2d.setLocation(x,y); | ||
264 | 151 | vc.setPosition(p2d); | ||
265 | 152 | circuit.add(fc); | ||
266 | 153 | this.add(vc); | ||
267 | 154 | |||
268 | 155 | vc.setName(name); | ||
269 | 156 | |||
270 | 157 | return vc; | ||
271 | 158 | } | ||
272 | 159 | |||
273 | 160 | public File getEnvironmentFile() { | ||
274 | 161 | return environmentFile; | ||
275 | 162 | } | ||
276 | 163 | |||
277 | 164 | public void setEnvironmentFile(File value) { | ||
278 | 165 | this.environmentFile = value; | ||
279 | 166 | } | ||
280 | 167 | |||
281 | 168 | } | 176 | } |
282 | 169 | 177 | ||
283 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/VisualContact.java' | |||
284 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/VisualContact.java 2014-01-15 14:11:43 +0000 | |||
285 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/VisualContact.java 2014-04-29 16:24:51 +0000 | |||
286 | @@ -375,7 +375,8 @@ | |||
287 | 375 | public static boolean isDriver(Node contact) { | 375 | public static boolean isDriver(Node contact) { |
288 | 376 | if (!(contact instanceof VisualContact)) return false; | 376 | if (!(contact instanceof VisualContact)) return false; |
289 | 377 | 377 | ||
291 | 378 | return (((VisualContact)contact).getIOType() == IOType.OUTPUT) == (((VisualContact)contact).getParent() instanceof VisualComponent); | 378 | return (((VisualContact)contact).getIOType() == IOType.OUTPUT) |
292 | 379 | == (((VisualContact)contact).getParent() instanceof VisualComponent); | ||
293 | 379 | } | 380 | } |
294 | 380 | 381 | ||
295 | 381 | 382 | ||
296 | 382 | 383 | ||
297 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/VisualFunctionContact.java' | |||
298 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/VisualFunctionContact.java 2014-04-09 17:11:48 +0000 | |||
299 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/VisualFunctionContact.java 2014-04-29 16:24:51 +0000 | |||
300 | @@ -89,16 +89,18 @@ | |||
301 | 89 | } | 89 | } |
302 | 90 | 90 | ||
303 | 91 | FormulaRenderingResult getRenderedSetFormula(FontRenderContext fcon) { | 91 | FormulaRenderingResult getRenderedSetFormula(FontRenderContext fcon) { |
305 | 92 | if (renderedSetFormula == null) { | 92 | if (((FunctionContact)getReferencedContact()).getSetFunction() == null) { |
306 | 93 | return null; | ||
307 | 94 | } else if (renderedSetFormula == null) { | ||
308 | 93 | renderedSetFormula = FormulaToGraphics.render(((FunctionContact)getReferencedContact()).getSetFunction(), fcon, font); | 95 | renderedSetFormula = FormulaToGraphics.render(((FunctionContact)getReferencedContact()).getSetFunction(), fcon, font); |
309 | 94 | } | 96 | } |
310 | 95 | return renderedSetFormula; | 97 | return renderedSetFormula; |
311 | 96 | } | 98 | } |
312 | 97 | 99 | ||
313 | 98 | FormulaRenderingResult getRenderedResetFormula(FontRenderContext fcon) { | 100 | FormulaRenderingResult getRenderedResetFormula(FontRenderContext fcon) { |
317 | 99 | if (((FunctionContact)getReferencedContact()).getResetFunction()==null) return null; | 101 | if (((FunctionContact)getReferencedContact()).getResetFunction() == null) { |
318 | 100 | 102 | return null; | |
319 | 101 | if (renderedResetFormula == null) { | 103 | } else if (renderedResetFormula == null) { |
320 | 102 | renderedResetFormula = FormulaToGraphics.render(((FunctionContact)getReferencedContact()).getResetFunction(), fcon, font); | 104 | renderedResetFormula = FormulaToGraphics.render(((FunctionContact)getReferencedContact()).getResetFunction(), fcon, font); |
321 | 103 | } | 105 | } |
322 | 104 | return renderedResetFormula; | 106 | return renderedResetFormula; |
323 | @@ -154,6 +156,8 @@ | |||
324 | 154 | 156 | ||
325 | 155 | 157 | ||
326 | 156 | private void drawFormula(Graphics2D g, int arrowType, float xOffset, float yOffset, Color foreground, Color background, FormulaRenderingResult result) { | 158 | private void drawFormula(Graphics2D g, int arrowType, float xOffset, float yOffset, Color foreground, Color background, FormulaRenderingResult result) { |
327 | 159 | if (result == null) return; | ||
328 | 160 | |||
329 | 157 | Rectangle2D textBB = result.boundingBox; | 161 | Rectangle2D textBB = result.boundingBox; |
330 | 158 | float textX = 0; | 162 | float textX = 0; |
331 | 159 | float textY = (float)-textBB.getCenterY()-(float)0.5-yOffset; | 163 | float textY = (float)-textBB.getCenterY()-(float)0.5-yOffset; |
332 | 160 | 164 | ||
333 | === removed file 'CircuitPlugin/src/org/workcraft/plugins/circuit/tasks/CheckCircuitDeadlockTask.java' | |||
334 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/tasks/CheckCircuitDeadlockTask.java 2014-04-16 21:55:15 +0000 | |||
335 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/tasks/CheckCircuitDeadlockTask.java 1970-01-01 00:00:00 +0000 | |||
336 | @@ -1,111 +0,0 @@ | |||
337 | 1 | package org.workcraft.plugins.circuit.tasks; | ||
338 | 2 | |||
339 | 3 | import java.io.File; | ||
340 | 4 | |||
341 | 5 | import org.workcraft.Framework; | ||
342 | 6 | import org.workcraft.interop.Exporter; | ||
343 | 7 | import org.workcraft.plugins.circuit.VisualCircuit; | ||
344 | 8 | import org.workcraft.plugins.circuit.tools.STGGenerator; | ||
345 | 9 | import org.workcraft.plugins.mpsat.MpsatMode; | ||
346 | 10 | import org.workcraft.plugins.mpsat.MpsatResultParser; | ||
347 | 11 | import org.workcraft.plugins.mpsat.MpsatSettings; | ||
348 | 12 | import org.workcraft.plugins.mpsat.MpsatUtilitySettings; | ||
349 | 13 | import org.workcraft.plugins.mpsat.tasks.MpsatChainResult; | ||
350 | 14 | import org.workcraft.plugins.mpsat.tasks.MpsatChainTask; | ||
351 | 15 | import org.workcraft.plugins.mpsat.tasks.MpsatTask; | ||
352 | 16 | import org.workcraft.plugins.mpsat.tasks.PunfTask; | ||
353 | 17 | import org.workcraft.plugins.shared.tasks.ExternalProcessResult; | ||
354 | 18 | import org.workcraft.plugins.stg.STGModel; | ||
355 | 19 | import org.workcraft.serialisation.Format; | ||
356 | 20 | import org.workcraft.tasks.ProgressMonitor; | ||
357 | 21 | import org.workcraft.tasks.Result; | ||
358 | 22 | import org.workcraft.tasks.Result.Outcome; | ||
359 | 23 | import org.workcraft.tasks.SubtaskMonitor; | ||
360 | 24 | import org.workcraft.util.Export; | ||
361 | 25 | import org.workcraft.util.Export.ExportTask; | ||
362 | 26 | import org.workcraft.workspace.WorkspaceEntry; | ||
363 | 27 | |||
364 | 28 | |||
365 | 29 | public class CheckCircuitDeadlockTask extends MpsatChainTask { | ||
366 | 30 | private final MpsatSettings settings; | ||
367 | 31 | private final WorkspaceEntry we; | ||
368 | 32 | private final Framework framework; | ||
369 | 33 | |||
370 | 34 | public CheckCircuitDeadlockTask(WorkspaceEntry we, Framework framework) { | ||
371 | 35 | super (we, null, framework); | ||
372 | 36 | this.we = we; | ||
373 | 37 | this.framework = framework; | ||
374 | 38 | this.settings = new MpsatSettings("Deadlock freedom", MpsatMode.DEADLOCK, 0, | ||
375 | 39 | MpsatUtilitySettings.getSolutionMode(), MpsatUtilitySettings.getSolutionCount(), null); | ||
376 | 40 | } | ||
377 | 41 | |||
378 | 42 | @Override | ||
379 | 43 | public Result<? extends MpsatChainResult> run(ProgressMonitor<? super MpsatChainResult> monitor) { | ||
380 | 44 | try { | ||
381 | 45 | monitor.progressUpdate(0.05); | ||
382 | 46 | VisualCircuit circuit = (VisualCircuit) we.getModelEntry().getVisualModel(); | ||
383 | 47 | STGModel model = (STGModel) STGGenerator.generate(circuit).getMathModel(); | ||
384 | 48 | monitor.progressUpdate(0.10); | ||
385 | 49 | |||
386 | 50 | Exporter exporter = Export.chooseBestExporter(framework.getPluginManager(), model, Format.STG); | ||
387 | 51 | if (exporter == null) { | ||
388 | 52 | throw new RuntimeException ("Exporter not available: model class " + model.getClass().getName() + " to format STG."); | ||
389 | 53 | } | ||
390 | 54 | |||
391 | 55 | File netFile = File.createTempFile("net", exporter.getExtenstion()); | ||
392 | 56 | ExportTask exportTask = new ExportTask(exporter, model, netFile.getCanonicalPath()); | ||
393 | 57 | SubtaskMonitor<Object> mon = new SubtaskMonitor<Object>(monitor); | ||
394 | 58 | Result<? extends Object> exportResult = framework.getTaskManager().execute(exportTask, "Exporting .g", mon); | ||
395 | 59 | if (exportResult.getOutcome() != Outcome.FINISHED) { | ||
396 | 60 | netFile.delete(); | ||
397 | 61 | if (exportResult.getOutcome() == Outcome.CANCELLED) { | ||
398 | 62 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | ||
399 | 63 | } | ||
400 | 64 | return new Result<MpsatChainResult>(Outcome.FAILED, | ||
401 | 65 | new MpsatChainResult(exportResult, null, null, settings)); | ||
402 | 66 | } | ||
403 | 67 | monitor.progressUpdate(0.20); | ||
404 | 68 | |||
405 | 69 | File mciFile = File.createTempFile("unfolding", ".mci"); | ||
406 | 70 | PunfTask punfTask = new PunfTask(netFile.getCanonicalPath(), mciFile.getCanonicalPath()); | ||
407 | 71 | Result<? extends ExternalProcessResult> punfResult = framework.getTaskManager().execute(punfTask, "Unfolding .g", mon); | ||
408 | 72 | netFile.delete(); | ||
409 | 73 | if (punfResult.getOutcome() != Outcome.FINISHED) { | ||
410 | 74 | mciFile.delete(); | ||
411 | 75 | if (punfResult.getOutcome() == Outcome.CANCELLED) { | ||
412 | 76 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | ||
413 | 77 | } | ||
414 | 78 | return new Result<MpsatChainResult>(Outcome.FAILED, | ||
415 | 79 | new MpsatChainResult(exportResult, punfResult, null, settings)); | ||
416 | 80 | } | ||
417 | 81 | monitor.progressUpdate(0.70); | ||
418 | 82 | |||
419 | 83 | MpsatTask mpsatTask = new MpsatTask(settings.getMpsatArguments(), mciFile.getCanonicalPath()); | ||
420 | 84 | Result<? extends ExternalProcessResult> mpsatResult = framework.getTaskManager().execute(mpsatTask, "Running deadlock checking [MPSat]", mon); | ||
421 | 85 | if (mpsatResult.getOutcome() != Outcome.FINISHED) { | ||
422 | 86 | if (mpsatResult.getOutcome() == Outcome.CANCELLED) { | ||
423 | 87 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | ||
424 | 88 | } | ||
425 | 89 | return new Result<MpsatChainResult>(Outcome.FAILED, | ||
426 | 90 | new MpsatChainResult(exportResult, punfResult, mpsatResult, settings )); | ||
427 | 91 | } | ||
428 | 92 | monitor.progressUpdate(0.90); | ||
429 | 93 | |||
430 | 94 | MpsatResultParser mdp = new MpsatResultParser(mpsatResult.getReturnValue()); | ||
431 | 95 | if (!mdp.getSolutions().isEmpty()) { | ||
432 | 96 | mciFile.delete(); | ||
433 | 97 | return new Result<MpsatChainResult>(Outcome.FINISHED, | ||
434 | 98 | new MpsatChainResult(exportResult, punfResult, mpsatResult, settings, "Circuit has a deadlock")); | ||
435 | 99 | } | ||
436 | 100 | monitor.progressUpdate(1.0); | ||
437 | 101 | |||
438 | 102 | mciFile.delete(); | ||
439 | 103 | return new Result<MpsatChainResult>(Outcome.FINISHED, | ||
440 | 104 | new MpsatChainResult(exportResult, punfResult, mpsatResult, settings, "Circuit is deadlock-free")); | ||
441 | 105 | |||
442 | 106 | } catch (Throwable e) { | ||
443 | 107 | return new Result<MpsatChainResult>(e); | ||
444 | 108 | } | ||
445 | 109 | } | ||
446 | 110 | |||
447 | 111 | } | ||
448 | 112 | 0 | ||
449 | === removed file 'CircuitPlugin/src/org/workcraft/plugins/circuit/tasks/CheckCircuitHazardTask.java' | |||
450 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/tasks/CheckCircuitHazardTask.java 2014-04-16 21:55:15 +0000 | |||
451 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/tasks/CheckCircuitHazardTask.java 1970-01-01 00:00:00 +0000 | |||
452 | @@ -1,110 +0,0 @@ | |||
453 | 1 | package org.workcraft.plugins.circuit.tasks; | ||
454 | 2 | |||
455 | 3 | import java.io.File; | ||
456 | 4 | |||
457 | 5 | import org.workcraft.Framework; | ||
458 | 6 | import org.workcraft.interop.Exporter; | ||
459 | 7 | import org.workcraft.plugins.circuit.VisualCircuit; | ||
460 | 8 | import org.workcraft.plugins.circuit.tools.STGGenerator; | ||
461 | 9 | import org.workcraft.plugins.mpsat.MpsatMode; | ||
462 | 10 | import org.workcraft.plugins.mpsat.MpsatResultParser; | ||
463 | 11 | import org.workcraft.plugins.mpsat.MpsatSettings; | ||
464 | 12 | import org.workcraft.plugins.mpsat.MpsatUtilitySettings; | ||
465 | 13 | import org.workcraft.plugins.mpsat.tasks.MpsatChainResult; | ||
466 | 14 | import org.workcraft.plugins.mpsat.tasks.MpsatChainTask; | ||
467 | 15 | import org.workcraft.plugins.mpsat.tasks.MpsatTask; | ||
468 | 16 | import org.workcraft.plugins.mpsat.tasks.PunfTask; | ||
469 | 17 | import org.workcraft.plugins.shared.tasks.ExternalProcessResult; | ||
470 | 18 | import org.workcraft.plugins.stg.STGModel; | ||
471 | 19 | import org.workcraft.serialisation.Format; | ||
472 | 20 | import org.workcraft.tasks.ProgressMonitor; | ||
473 | 21 | import org.workcraft.tasks.Result; | ||
474 | 22 | import org.workcraft.tasks.Result.Outcome; | ||
475 | 23 | import org.workcraft.tasks.SubtaskMonitor; | ||
476 | 24 | import org.workcraft.util.Export; | ||
477 | 25 | import org.workcraft.util.Export.ExportTask; | ||
478 | 26 | import org.workcraft.workspace.WorkspaceEntry; | ||
479 | 27 | |||
480 | 28 | |||
481 | 29 | public class CheckCircuitHazardTask extends MpsatChainTask { | ||
482 | 30 | private final MpsatSettings settings; | ||
483 | 31 | private final WorkspaceEntry we; | ||
484 | 32 | private final Framework framework; | ||
485 | 33 | |||
486 | 34 | public CheckCircuitHazardTask(WorkspaceEntry we, Framework framework) { | ||
487 | 35 | super (we, null, framework); | ||
488 | 36 | this.we = we; | ||
489 | 37 | this.framework = framework; | ||
490 | 38 | this.settings = new MpsatSettings("Output persistence", MpsatMode.STG_REACHABILITY, 0, | ||
491 | 39 | MpsatUtilitySettings.getSolutionMode(), MpsatUtilitySettings.getSolutionCount(), | ||
492 | 40 | MpsatSettings.reachSemimodularity); | ||
493 | 41 | } | ||
494 | 42 | |||
495 | 43 | @Override | ||
496 | 44 | public Result<? extends MpsatChainResult> run(ProgressMonitor<? super MpsatChainResult> monitor) { | ||
497 | 45 | try { | ||
498 | 46 | monitor.progressUpdate(0.05); | ||
499 | 47 | VisualCircuit circuit = (VisualCircuit) we.getModelEntry().getVisualModel(); | ||
500 | 48 | STGModel model = (STGModel) STGGenerator.generate(circuit).getMathModel(); | ||
501 | 49 | monitor.progressUpdate(0.10); | ||
502 | 50 | |||
503 | 51 | Exporter exporter = Export.chooseBestExporter(framework.getPluginManager(), model, Format.STG); | ||
504 | 52 | if (exporter == null) { | ||
505 | 53 | throw new RuntimeException ("Exporter not available: model class " + model.getClass().getName() + " to format STG."); | ||
506 | 54 | } | ||
507 | 55 | |||
508 | 56 | File netFile = File.createTempFile("net", exporter.getExtenstion()); | ||
509 | 57 | ExportTask exportTask = new ExportTask(exporter, model, netFile.getCanonicalPath()); | ||
510 | 58 | SubtaskMonitor<Object> mon = new SubtaskMonitor<Object>(monitor); | ||
511 | 59 | Result<? extends Object> exportResult = framework.getTaskManager().execute(exportTask, "Exporting .g", mon); | ||
512 | 60 | if (exportResult.getOutcome() != Outcome.FINISHED) { | ||
513 | 61 | netFile.delete(); | ||
514 | 62 | if (exportResult.getOutcome() == Outcome.CANCELLED) { | ||
515 | 63 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | ||
516 | 64 | } | ||
517 | 65 | return new Result<MpsatChainResult>(Outcome.FAILED, new MpsatChainResult(exportResult, null, null, settings)); | ||
518 | 66 | } | ||
519 | 67 | monitor.progressUpdate(0.20); | ||
520 | 68 | |||
521 | 69 | File mciFile = File.createTempFile("unfolding", ".mci"); | ||
522 | 70 | PunfTask punfTask = new PunfTask(netFile.getCanonicalPath(), mciFile.getCanonicalPath()); | ||
523 | 71 | Result<? extends ExternalProcessResult> punfResult = framework.getTaskManager().execute(punfTask, "Unfolding .g", mon); | ||
524 | 72 | netFile.delete(); | ||
525 | 73 | if (punfResult.getOutcome() != Outcome.FINISHED) { | ||
526 | 74 | mciFile.delete(); | ||
527 | 75 | if (punfResult.getOutcome() == Outcome.CANCELLED) { | ||
528 | 76 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | ||
529 | 77 | } | ||
530 | 78 | return new Result<MpsatChainResult>(Outcome.FAILED, | ||
531 | 79 | new MpsatChainResult(exportResult, punfResult, null, settings)); | ||
532 | 80 | } | ||
533 | 81 | monitor.progressUpdate(0.70); | ||
534 | 82 | |||
535 | 83 | MpsatTask mpsatTask = new MpsatTask(settings.getMpsatArguments(), mciFile.getCanonicalPath()); | ||
536 | 84 | Result<? extends ExternalProcessResult> mpsatResult = framework.getTaskManager().execute(mpsatTask, "Running semimodularity checking [MPSat]", mon); | ||
537 | 85 | if (mpsatResult.getOutcome() != Outcome.FINISHED) { | ||
538 | 86 | if (mpsatResult.getOutcome() == Outcome.CANCELLED) | ||
539 | 87 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | ||
540 | 88 | |||
541 | 89 | return new Result<MpsatChainResult>(Outcome.FAILED, | ||
542 | 90 | new MpsatChainResult(exportResult, punfResult, mpsatResult, settings)); | ||
543 | 91 | } | ||
544 | 92 | |||
545 | 93 | MpsatResultParser mdp = new MpsatResultParser(mpsatResult.getReturnValue()); | ||
546 | 94 | if (!mdp.getSolutions().isEmpty()) { | ||
547 | 95 | mciFile.delete(); | ||
548 | 96 | return new Result<MpsatChainResult>(Outcome.FINISHED, | ||
549 | 97 | new MpsatChainResult(exportResult, punfResult, mpsatResult, settings, "Circuit has hazard(s)")); | ||
550 | 98 | } | ||
551 | 99 | monitor.progressUpdate(1.0); | ||
552 | 100 | |||
553 | 101 | mciFile.delete(); | ||
554 | 102 | return new Result<MpsatChainResult>(Outcome.FINISHED, | ||
555 | 103 | new MpsatChainResult(exportResult, punfResult, mpsatResult, settings, "Circuit is hazard-free")); | ||
556 | 104 | |||
557 | 105 | } catch (Throwable e) { | ||
558 | 106 | return new Result<MpsatChainResult>(e); | ||
559 | 107 | } | ||
560 | 108 | } | ||
561 | 109 | |||
562 | 110 | } | ||
563 | 111 | 0 | ||
564 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/tasks/CheckCircuitTask.java' | |||
565 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/tasks/CheckCircuitTask.java 2014-04-16 21:55:15 +0000 | |||
566 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/tasks/CheckCircuitTask.java 2014-04-29 16:24:51 +0000 | |||
567 | @@ -14,8 +14,10 @@ | |||
568 | 14 | import org.workcraft.plugins.mpsat.tasks.MpsatChainTask; | 14 | import org.workcraft.plugins.mpsat.tasks.MpsatChainTask; |
569 | 15 | import org.workcraft.plugins.mpsat.tasks.MpsatTask; | 15 | import org.workcraft.plugins.mpsat.tasks.MpsatTask; |
570 | 16 | import org.workcraft.plugins.mpsat.tasks.PunfTask; | 16 | import org.workcraft.plugins.mpsat.tasks.PunfTask; |
571 | 17 | import org.workcraft.plugins.pcomp.PCompOutputMode; | ||
572 | 18 | import org.workcraft.plugins.pcomp.tasks.PcompTask; | ||
573 | 17 | import org.workcraft.plugins.shared.tasks.ExternalProcessResult; | 19 | import org.workcraft.plugins.shared.tasks.ExternalProcessResult; |
575 | 18 | import org.workcraft.plugins.stg.STGModel; | 20 | import org.workcraft.plugins.stg.STG; |
576 | 19 | import org.workcraft.serialisation.Format; | 21 | import org.workcraft.serialisation.Format; |
577 | 20 | import org.workcraft.tasks.ProgressMonitor; | 22 | import org.workcraft.tasks.ProgressMonitor; |
578 | 21 | import org.workcraft.tasks.Result; | 23 | import org.workcraft.tasks.Result; |
579 | @@ -23,111 +25,254 @@ | |||
580 | 23 | import org.workcraft.tasks.SubtaskMonitor; | 25 | import org.workcraft.tasks.SubtaskMonitor; |
581 | 24 | import org.workcraft.util.Export; | 26 | import org.workcraft.util.Export; |
582 | 25 | import org.workcraft.util.Export.ExportTask; | 27 | import org.workcraft.util.Export.ExportTask; |
583 | 28 | import org.workcraft.util.FileUtils; | ||
584 | 26 | import org.workcraft.workspace.WorkspaceEntry; | 29 | import org.workcraft.workspace.WorkspaceEntry; |
585 | 27 | 30 | ||
586 | 28 | 31 | ||
587 | 29 | public class CheckCircuitTask extends MpsatChainTask { | 32 | public class CheckCircuitTask extends MpsatChainTask { |
590 | 30 | private final MpsatSettings deadlockSettings; | 33 | private final MpsatSettings toolchainPreparationSettings = new MpsatSettings("Toolchain preparation of data", |
591 | 31 | private final MpsatSettings hazardSettings; | 34 | MpsatMode.UNDEFINED, 0, null, 0, null); |
592 | 35 | |||
593 | 36 | private final MpsatSettings toolchainCompletionSettings = new MpsatSettings("Toolchain completion", | ||
594 | 37 | MpsatMode.UNDEFINED, 0, null, 0, null); | ||
595 | 38 | |||
596 | 39 | private final MpsatSettings deadlockSettings = new MpsatSettings("Deadlock freedom", | ||
597 | 40 | MpsatMode.DEADLOCK, 0, MpsatUtilitySettings.getSolutionMode(), | ||
598 | 41 | MpsatUtilitySettings.getSolutionCount(), null); | ||
599 | 42 | |||
600 | 43 | private final MpsatSettings hazardSettings = new MpsatSettings("Output persistence", | ||
601 | 44 | MpsatMode.STG_REACHABILITY, 0, MpsatUtilitySettings.getSolutionMode(), | ||
602 | 45 | MpsatUtilitySettings.getSolutionCount(), MpsatSettings.reachSemimodularity); | ||
603 | 46 | |||
604 | 32 | private final WorkspaceEntry we; | 47 | private final WorkspaceEntry we; |
605 | 33 | private final Framework framework; | 48 | private final Framework framework; |
606 | 49 | private final boolean checkConformation; | ||
607 | 50 | private final boolean checkDeadlock; | ||
608 | 51 | private final boolean checkHazard; | ||
609 | 34 | 52 | ||
611 | 35 | public CheckCircuitTask(WorkspaceEntry we, Framework framework) { | 53 | public CheckCircuitTask(WorkspaceEntry we, Framework framework, |
612 | 54 | boolean checkConformation, boolean checkDeadlock, boolean checkHazard) { | ||
613 | 36 | super (we, null, framework); | 55 | super (we, null, framework); |
614 | 37 | this.we = we; | 56 | this.we = we; |
615 | 38 | this.framework = framework; | 57 | this.framework = framework; |
623 | 39 | 58 | this.checkConformation = checkConformation; | |
624 | 40 | this.deadlockSettings = new MpsatSettings("Deadlock freedom", MpsatMode.DEADLOCK, 0, | 59 | this.checkDeadlock = checkDeadlock; |
625 | 41 | MpsatUtilitySettings.getSolutionMode(), MpsatUtilitySettings.getSolutionCount(), null); | 60 | this.checkHazard = checkHazard; |
619 | 42 | |||
620 | 43 | this.hazardSettings = new MpsatSettings("Output persistence", MpsatMode.STG_REACHABILITY, 0, | ||
621 | 44 | MpsatUtilitySettings.getSolutionMode(), MpsatUtilitySettings.getSolutionCount(), | ||
622 | 45 | MpsatSettings.reachSemimodularity); | ||
626 | 46 | } | 61 | } |
627 | 47 | 62 | ||
628 | 48 | @Override | 63 | @Override |
629 | 49 | public Result<? extends MpsatChainResult> run(ProgressMonitor<? super MpsatChainResult> monitor) { | 64 | public Result<? extends MpsatChainResult> run(ProgressMonitor<? super MpsatChainResult> monitor) { |
630 | 50 | try { | 65 | try { |
631 | 66 | // Common variables | ||
632 | 51 | monitor.progressUpdate(0.05); | 67 | monitor.progressUpdate(0.05); |
635 | 52 | VisualCircuit circuit = (VisualCircuit) we.getModelEntry().getVisualModel(); | 68 | String title = we.getWorkspacePath().getNode(); |
636 | 53 | STGModel model = (STGModel) STGGenerator.generate(circuit).getMathModel(); | 69 | if (title.endsWith(".work")) { |
637 | 70 | title = title.substring(0, title.length() - 5); | ||
638 | 71 | } | ||
639 | 72 | VisualCircuit visualCircuit = (VisualCircuit)we.getModelEntry().getVisualModel(); | ||
640 | 73 | STG circuitStg = (STG)STGGenerator.generate(visualCircuit).getMathModel(); | ||
641 | 74 | Exporter stgExporter = Export.chooseBestExporter(framework.getPluginManager(), circuitStg, Format.STG); | ||
642 | 75 | if (stgExporter == null) { | ||
643 | 76 | throw new RuntimeException ("Exporter not available: model class " + circuitStg.getClass().getName() + " to format STG."); | ||
644 | 77 | } | ||
645 | 78 | SubtaskMonitor<Object> subtaskMonitor = new SubtaskMonitor<Object>(monitor); | ||
646 | 54 | monitor.progressUpdate(0.10); | 79 | monitor.progressUpdate(0.10); |
660 | 55 | 80 | ||
661 | 56 | Exporter exporter = Export.chooseBestExporter(framework.getPluginManager(), model, Format.STG); | 81 | // Generating .g for the circuit |
662 | 57 | if (exporter == null) { | 82 | File circuitStgFile = File.createTempFile(title + "-circuit-", stgExporter.getExtenstion()); |
663 | 58 | throw new RuntimeException ("Exporter not available: model class " + model.getClass().getName() + " to format STG."); | 83 | ExportTask circuitExportTask = new ExportTask(stgExporter, circuitStg, circuitStgFile.getCanonicalPath()); |
664 | 59 | } | 84 | Result<? extends Object> circuitExportResult = framework.getTaskManager().execute( |
665 | 60 | 85 | circuitExportTask, "Exporting circuit .g", subtaskMonitor); | |
666 | 61 | File netFile = File.createTempFile("net", exporter.getExtenstion()); | 86 | |
667 | 62 | ExportTask exportTask = new ExportTask(exporter, model, netFile.getCanonicalPath()); | 87 | if (circuitExportResult.getOutcome() != Outcome.FINISHED) { |
668 | 63 | SubtaskMonitor<Object> mon = new SubtaskMonitor<Object>(monitor); | 88 | circuitStgFile.delete(); |
669 | 64 | Result<? extends Object> exportResult = framework.getTaskManager().execute(exportTask, "Exporting .g", mon); | 89 | if (circuitExportResult.getOutcome() == Outcome.CANCELLED) { |
657 | 65 | if (exportResult.getOutcome() != Outcome.FINISHED) { | ||
658 | 66 | netFile.delete(); | ||
659 | 67 | if (exportResult.getOutcome() == Outcome.CANCELLED) { | ||
670 | 68 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | 90 | return new Result<MpsatChainResult>(Outcome.CANCELLED); |
671 | 69 | } | 91 | } |
674 | 70 | return new Result<MpsatChainResult>(Outcome.FAILED, | 92 | return new Result<MpsatChainResult>(Outcome.FAILED, |
675 | 71 | new MpsatChainResult(exportResult, null, null, deadlockSettings)); | 93 | new MpsatChainResult(circuitExportResult, null, null, null, toolchainPreparationSettings)); |
676 | 72 | } | 94 | } |
677 | 73 | monitor.progressUpdate(0.20); | 95 | monitor.progressUpdate(0.20); |
678 | 74 | 96 | ||
683 | 75 | File mciFile = File.createTempFile("unfolding", ".mci"); | 97 | // Generating .g for the environment |
684 | 76 | PunfTask punfTask = new PunfTask(netFile.getCanonicalPath(), mciFile.getCanonicalPath()); | 98 | File stgFile; |
685 | 77 | Result<? extends ExternalProcessResult> punfResult = framework.getTaskManager().execute(punfTask, "Unfolding .g", mon); | 99 | STG stg; |
686 | 78 | netFile.delete(); | 100 | Result<? extends ExternalProcessResult> pcompResult = null; |
687 | 101 | File environmentFile = visualCircuit.getEnvironmentFile(); | ||
688 | 102 | boolean hasEnvironment = ((environmentFile != null) && environmentFile.exists()); | ||
689 | 103 | if ( !hasEnvironment ) { | ||
690 | 104 | // No environment to compose with | ||
691 | 105 | stgFile = circuitStgFile; | ||
692 | 106 | stg = circuitStg; | ||
693 | 107 | } else { | ||
694 | 108 | // Compose circuit with its environment | ||
695 | 109 | File environmentStgFile; | ||
696 | 110 | if (environmentFile.getName().endsWith(".g")) { | ||
697 | 111 | environmentStgFile = environmentFile; | ||
698 | 112 | } else { | ||
699 | 113 | STG environementStg = (STG)framework.loadFile(environmentFile).getMathModel(); | ||
700 | 114 | environmentStgFile = File.createTempFile(title + "-environment-", stgExporter.getExtenstion()); | ||
701 | 115 | ExportTask environmentExportTask = new ExportTask(stgExporter, environementStg, environmentStgFile.getCanonicalPath()); | ||
702 | 116 | Result<? extends Object> environmentExportResult = framework.getTaskManager().execute( | ||
703 | 117 | environmentExportTask, "Exporting environment .g", subtaskMonitor); | ||
704 | 118 | |||
705 | 119 | if (environmentExportResult.getOutcome() != Outcome.FINISHED) { | ||
706 | 120 | environmentStgFile.delete(); | ||
707 | 121 | if (environmentExportResult.getOutcome() == Outcome.CANCELLED) { | ||
708 | 122 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | ||
709 | 123 | } | ||
710 | 124 | return new Result<MpsatChainResult>(Outcome.FAILED, | ||
711 | 125 | new MpsatChainResult(environmentExportResult, null, null, null, toolchainPreparationSettings)); | ||
712 | 126 | } | ||
713 | 127 | } | ||
714 | 128 | monitor.progressUpdate(0.25); | ||
715 | 129 | |||
716 | 130 | // Generating .g for the whole system (circuit and environment) | ||
717 | 131 | stgFile = File.createTempFile(title + "-system-", stgExporter.getExtenstion()); | ||
718 | 132 | PcompTask pcompTask = new PcompTask(new File[]{circuitStgFile, environmentStgFile}, PCompOutputMode.OUTPUT, false); | ||
719 | 133 | pcompResult = framework.getTaskManager().execute( | ||
720 | 134 | pcompTask, "Running pcomp", subtaskMonitor); | ||
721 | 135 | |||
722 | 136 | if (pcompResult.getOutcome() != Outcome.FINISHED) { | ||
723 | 137 | circuitStgFile.delete(); | ||
724 | 138 | if (pcompResult.getOutcome() == Outcome.CANCELLED) { | ||
725 | 139 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | ||
726 | 140 | } | ||
727 | 141 | return new Result<MpsatChainResult>(Outcome.FAILED, | ||
728 | 142 | new MpsatChainResult(circuitExportResult, pcompResult, null, null, toolchainPreparationSettings)); | ||
729 | 143 | } | ||
730 | 144 | FileUtils.writeAllText(stgFile, new String(pcompResult.getReturnValue().getOutput())); | ||
731 | 145 | WorkspaceEntry stgWorkspaceEntry = framework.getWorkspace().open(stgFile, true); | ||
732 | 146 | stg = (STG)stgWorkspaceEntry.getModelEntry().getMathModel(); | ||
733 | 147 | } | ||
734 | 148 | monitor.progressUpdate(0.30); | ||
735 | 149 | |||
736 | 150 | // Generate unfolding | ||
737 | 151 | File mciFile = File.createTempFile(title+"-unfolding-", ".mci"); | ||
738 | 152 | PunfTask punfTask = new PunfTask(stgFile.getCanonicalPath(), mciFile.getCanonicalPath()); | ||
739 | 153 | Result<? extends ExternalProcessResult> punfResult = framework.getTaskManager().execute( | ||
740 | 154 | punfTask, "Unfolding .g", subtaskMonitor); | ||
741 | 155 | |||
742 | 156 | stgFile.delete(); | ||
743 | 79 | if (punfResult.getOutcome() != Outcome.FINISHED) { | 157 | if (punfResult.getOutcome() != Outcome.FINISHED) { |
744 | 80 | mciFile.delete(); | 158 | mciFile.delete(); |
745 | 81 | if (punfResult.getOutcome() == Outcome.CANCELLED) { | 159 | if (punfResult.getOutcome() == Outcome.CANCELLED) { |
746 | 82 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | 160 | return new Result<MpsatChainResult>(Outcome.CANCELLED); |
747 | 83 | } | 161 | } |
748 | 84 | return new Result<MpsatChainResult>(Outcome.FAILED, | 162 | return new Result<MpsatChainResult>(Outcome.FAILED, |
750 | 85 | new MpsatChainResult(exportResult, punfResult, null, deadlockSettings)); | 163 | new MpsatChainResult(circuitExportResult, pcompResult, punfResult, null, toolchainPreparationSettings)); |
751 | 86 | } | 164 | } |
752 | 87 | monitor.progressUpdate(0.40); | 165 | monitor.progressUpdate(0.40); |
762 | 88 | 166 | ||
763 | 89 | MpsatTask mpsatTask = new MpsatTask(deadlockSettings.getMpsatArguments(), mciFile.getCanonicalPath()); | 167 | // Check for interface conformation (only if the environment is specified) |
764 | 90 | Result<? extends ExternalProcessResult> mpsatResult = framework.getTaskManager().execute(mpsatTask, "Running deadlock checking [MPSat]", mon); | 168 | if (hasEnvironment && checkConformation) { |
765 | 91 | if (mpsatResult.getOutcome() != Outcome.FINISHED) { | 169 | String reachConformation = MpsatSettings.genReachConformation(stg, circuitStg); |
766 | 92 | if (mpsatResult.getOutcome() == Outcome.CANCELLED) { | 170 | if (MpsatUtilitySettings.getDebugReach()) { |
767 | 93 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | 171 | System.out.println("\nReach expression for the interface conformation property:"); |
768 | 94 | } | 172 | System.out.println(reachConformation); |
769 | 95 | return new Result<MpsatChainResult>(Outcome.FAILED, | 173 | } |
770 | 96 | new MpsatChainResult(exportResult, punfResult, mpsatResult, deadlockSettings)); | 174 | MpsatSettings conformationSettings = new MpsatSettings("Interface conformation", |
771 | 175 | MpsatMode.STG_REACHABILITY, 0, MpsatUtilitySettings.getSolutionMode(), | ||
772 | 176 | MpsatUtilitySettings.getSolutionCount(), reachConformation); | ||
773 | 177 | |||
774 | 178 | MpsatTask mpsatConformationTask = new MpsatTask(conformationSettings.getMpsatArguments(), mciFile.getCanonicalPath()); | ||
775 | 179 | Result<? extends ExternalProcessResult> mpsatConformationResult = framework.getTaskManager().execute( | ||
776 | 180 | mpsatConformationTask, "Running conformation check [MPSat]", subtaskMonitor); | ||
777 | 181 | |||
778 | 182 | if (mpsatConformationResult.getOutcome() != Outcome.FINISHED) { | ||
779 | 183 | if (mpsatConformationResult.getOutcome() == Outcome.CANCELLED) { | ||
780 | 184 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | ||
781 | 185 | } | ||
782 | 186 | return new Result<MpsatChainResult>(Outcome.FAILED, | ||
783 | 187 | new MpsatChainResult(circuitExportResult, pcompResult, punfResult, mpsatConformationResult, conformationSettings)); | ||
784 | 188 | } | ||
785 | 189 | monitor.progressUpdate(0.50); | ||
786 | 190 | |||
787 | 191 | MpsatResultParser mpsatConformationParser = new MpsatResultParser(mpsatConformationResult.getReturnValue()); | ||
788 | 192 | if (!mpsatConformationParser.getSolutions().isEmpty()) { | ||
789 | 193 | mciFile.delete(); | ||
790 | 194 | return new Result<MpsatChainResult>(Outcome.FINISHED, | ||
791 | 195 | new MpsatChainResult(circuitExportResult, pcompResult, punfResult, mpsatConformationResult, conformationSettings, | ||
792 | 196 | "Circuit does not conform to the environment after the following trace:")); | ||
793 | 197 | } | ||
794 | 97 | } | 198 | } |
795 | 98 | monitor.progressUpdate(0.60); | 199 | monitor.progressUpdate(0.60); |
796 | 99 | 200 | ||
821 | 100 | MpsatResultParser mdp = new MpsatResultParser(mpsatResult.getReturnValue()); | 201 | // Check for deadlock |
822 | 101 | if (!mdp.getSolutions().isEmpty()) { | 202 | if (checkDeadlock) { |
823 | 102 | mciFile.delete(); | 203 | MpsatTask mpsatDeadlockTask = new MpsatTask(deadlockSettings.getMpsatArguments(), mciFile.getCanonicalPath()); |
824 | 103 | return new Result<MpsatChainResult>(Outcome.FINISHED, | 204 | Result<? extends ExternalProcessResult> mpsatDeadlockResult = framework.getTaskManager().execute( |
825 | 104 | new MpsatChainResult(exportResult, punfResult, mpsatResult, deadlockSettings, "Circuit has a deadlock")); | 205 | mpsatDeadlockTask, "Running deadlock check [MPSat]", subtaskMonitor); |
826 | 105 | } | 206 | |
827 | 106 | monitor.progressUpdate(0.70); | 207 | if (mpsatDeadlockResult.getOutcome() != Outcome.FINISHED) { |
828 | 107 | 208 | if (mpsatDeadlockResult.getOutcome() == Outcome.CANCELLED) { | |
829 | 108 | mpsatTask = new MpsatTask(hazardSettings.getMpsatArguments(), mciFile.getCanonicalPath()); | 209 | return new Result<MpsatChainResult>(Outcome.CANCELLED); |
830 | 109 | mpsatResult = framework.getTaskManager().execute(mpsatTask, "Running semimodularity checking [MPSat]", mon); | 210 | } |
831 | 110 | if (mpsatResult.getOutcome() != Outcome.FINISHED) { | 211 | return new Result<MpsatChainResult>(Outcome.FAILED, |
832 | 111 | if (mpsatResult.getOutcome() == Outcome.CANCELLED) | 212 | new MpsatChainResult(circuitExportResult, pcompResult, punfResult, mpsatDeadlockResult, deadlockSettings)); |
833 | 112 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | 213 | } |
834 | 113 | 214 | monitor.progressUpdate(0.70); | |
835 | 114 | return new Result<MpsatChainResult>(Outcome.FAILED, | 215 | |
836 | 115 | new MpsatChainResult(exportResult, punfResult, mpsatResult, hazardSettings)); | 216 | MpsatResultParser mpsatDeadlockParser = new MpsatResultParser(mpsatDeadlockResult.getReturnValue()); |
837 | 116 | } | 217 | if (!mpsatDeadlockParser.getSolutions().isEmpty()) { |
838 | 117 | monitor.progressUpdate(0.90); | 218 | mciFile.delete(); |
839 | 118 | 219 | return new Result<MpsatChainResult>(Outcome.FINISHED, | |
840 | 119 | mdp = new MpsatResultParser(mpsatResult.getReturnValue()); | 220 | new MpsatChainResult(circuitExportResult, pcompResult, punfResult, mpsatDeadlockResult, deadlockSettings, |
841 | 120 | if (!mdp.getSolutions().isEmpty()) { | 221 | "Circuit has a deadlock after the following trace:")); |
842 | 121 | mciFile.delete(); | 222 | } |
843 | 122 | return new Result<MpsatChainResult>(Outcome.FINISHED, | 223 | } |
844 | 123 | new MpsatChainResult(exportResult, punfResult, mpsatResult, hazardSettings, "Circuit has hazard(s)")); | 224 | monitor.progressUpdate(0.80); |
845 | 225 | |||
846 | 226 | // Check for hazards | ||
847 | 227 | if (checkHazard) { | ||
848 | 228 | MpsatTask mpsatHazardTask = new MpsatTask(hazardSettings.getMpsatArguments(), mciFile.getCanonicalPath()); | ||
849 | 229 | if (MpsatUtilitySettings.getDebugReach()) { | ||
850 | 230 | System.out.println("\nReach expression for the hazard property:"); | ||
851 | 231 | System.out.println(hazardSettings.getReach()); | ||
852 | 232 | } | ||
853 | 233 | Result<? extends ExternalProcessResult> mpsatHazardResult = framework.getTaskManager().execute( | ||
854 | 234 | mpsatHazardTask, "Running hazard check [MPSat]", subtaskMonitor); | ||
855 | 235 | |||
856 | 236 | if (mpsatHazardResult.getOutcome() != Outcome.FINISHED) { | ||
857 | 237 | if (mpsatHazardResult.getOutcome() == Outcome.CANCELLED) { | ||
858 | 238 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | ||
859 | 239 | } | ||
860 | 240 | return new Result<MpsatChainResult>(Outcome.FAILED, | ||
861 | 241 | new MpsatChainResult(circuitExportResult, pcompResult, punfResult, mpsatHazardResult, hazardSettings)); | ||
862 | 242 | } | ||
863 | 243 | monitor.progressUpdate(0.90); | ||
864 | 244 | |||
865 | 245 | MpsatResultParser mpsatHazardParser = new MpsatResultParser(mpsatHazardResult.getReturnValue()); | ||
866 | 246 | if (!mpsatHazardParser.getSolutions().isEmpty()) { | ||
867 | 247 | mciFile.delete(); | ||
868 | 248 | return new Result<MpsatChainResult>(Outcome.FINISHED, | ||
869 | 249 | new MpsatChainResult(circuitExportResult, pcompResult, punfResult, mpsatHazardResult, hazardSettings, | ||
870 | 250 | "Circuit has a hazard after the following trace:")); | ||
871 | 251 | } | ||
872 | 124 | } | 252 | } |
873 | 125 | monitor.progressUpdate(1.0); | 253 | monitor.progressUpdate(1.0); |
874 | 126 | 254 | ||
875 | 255 | // Success | ||
876 | 127 | mciFile.delete(); | 256 | mciFile.delete(); |
877 | 257 | String message = ""; | ||
878 | 258 | if (hasEnvironment) { | ||
879 | 259 | message = "Under the given environment (" + environmentFile.getName() + ")"; | ||
880 | 260 | } else { | ||
881 | 261 | message = "Without environment restrictions"; | ||
882 | 262 | } | ||
883 | 263 | message += " the circuit is:\n"; | ||
884 | 264 | if (checkConformation) { | ||
885 | 265 | message += " * conformant\n"; | ||
886 | 266 | } | ||
887 | 267 | if (checkDeadlock) { | ||
888 | 268 | message += " * deadlock-free\n"; | ||
889 | 269 | } | ||
890 | 270 | if (checkHazard) { | ||
891 | 271 | message += " * hazard-free\n"; | ||
892 | 272 | } | ||
893 | 128 | return new Result<MpsatChainResult>(Outcome.FINISHED, | 273 | return new Result<MpsatChainResult>(Outcome.FINISHED, |
896 | 129 | new MpsatChainResult(exportResult, punfResult, mpsatResult, hazardSettings, "Circuit is deadlock-free and hazard-free")); | 274 | new MpsatChainResult(circuitExportResult, pcompResult, punfResult, null, toolchainCompletionSettings, message)); |
897 | 130 | 275 | ||
898 | 131 | } catch (Throwable e) { | 276 | } catch (Throwable e) { |
899 | 132 | return new Result<MpsatChainResult>(e); | 277 | return new Result<MpsatChainResult>(e); |
900 | 133 | } | 278 | } |
901 | 134 | 279 | ||
902 | === removed file 'CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CheckCircuitDeadlockTool.java' | |||
903 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CheckCircuitDeadlockTool.java 2013-09-17 14:58:15 +0000 | |||
904 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CheckCircuitDeadlockTool.java 1970-01-01 00:00:00 +0000 | |||
905 | @@ -1,43 +0,0 @@ | |||
906 | 1 | package org.workcraft.plugins.circuit.tools; | ||
907 | 2 | |||
908 | 3 | import org.workcraft.Framework; | ||
909 | 4 | import org.workcraft.Tool; | ||
910 | 5 | import org.workcraft.plugins.circuit.Circuit; | ||
911 | 6 | import org.workcraft.plugins.circuit.tasks.CheckCircuitDeadlockTask; | ||
912 | 7 | import org.workcraft.plugins.mpsat.MpsatChainResultHandler; | ||
913 | 8 | import org.workcraft.workspace.WorkspaceEntry; | ||
914 | 9 | |||
915 | 10 | public class CheckCircuitDeadlockTool implements Tool { | ||
916 | 11 | private final Framework framework; | ||
917 | 12 | |||
918 | 13 | public CheckCircuitDeadlockTool(Framework framework) { | ||
919 | 14 | this.framework = framework; | ||
920 | 15 | } | ||
921 | 16 | |||
922 | 17 | public String getDisplayName() { | ||
923 | 18 | return "Check circuit for deadlocks"; | ||
924 | 19 | } | ||
925 | 20 | |||
926 | 21 | |||
927 | 22 | @Override | ||
928 | 23 | public String getSection() { | ||
929 | 24 | return "Verification"; | ||
930 | 25 | } | ||
931 | 26 | |||
932 | 27 | @Override | ||
933 | 28 | public boolean isApplicableTo(WorkspaceEntry we) { | ||
934 | 29 | return we.getModelEntry().getMathModel() instanceof Circuit; | ||
935 | 30 | } | ||
936 | 31 | |||
937 | 32 | @Override | ||
938 | 33 | public void run(WorkspaceEntry we) { | ||
939 | 34 | final CheckCircuitDeadlockTask task = new CheckCircuitDeadlockTask(we, framework); | ||
940 | 35 | String description = "MPSat tool chain"; | ||
941 | 36 | String title = we.getModelEntry().getModel().getTitle(); | ||
942 | 37 | if (!title.isEmpty()) { | ||
943 | 38 | description += "(" + title +")"; | ||
944 | 39 | } | ||
945 | 40 | framework.getTaskManager().queue(task, description, new MpsatChainResultHandler(task)); | ||
946 | 41 | } | ||
947 | 42 | |||
948 | 43 | } | ||
949 | 44 | 0 | ||
950 | === removed file 'CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CheckCircuitHazardTool.java' | |||
951 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CheckCircuitHazardTool.java 2013-09-17 14:58:15 +0000 | |||
952 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CheckCircuitHazardTool.java 1970-01-01 00:00:00 +0000 | |||
953 | @@ -1,43 +0,0 @@ | |||
954 | 1 | package org.workcraft.plugins.circuit.tools; | ||
955 | 2 | |||
956 | 3 | import org.workcraft.Framework; | ||
957 | 4 | import org.workcraft.Tool; | ||
958 | 5 | import org.workcraft.plugins.circuit.Circuit; | ||
959 | 6 | import org.workcraft.plugins.circuit.tasks.CheckCircuitHazardTask; | ||
960 | 7 | import org.workcraft.plugins.mpsat.MpsatChainResultHandler; | ||
961 | 8 | import org.workcraft.workspace.WorkspaceEntry; | ||
962 | 9 | |||
963 | 10 | public class CheckCircuitHazardTool implements Tool { | ||
964 | 11 | private final Framework framework; | ||
965 | 12 | |||
966 | 13 | public CheckCircuitHazardTool(Framework framework) { | ||
967 | 14 | this.framework = framework; | ||
968 | 15 | } | ||
969 | 16 | |||
970 | 17 | public String getDisplayName() { | ||
971 | 18 | return "Check circuit for hazards"; | ||
972 | 19 | } | ||
973 | 20 | |||
974 | 21 | |||
975 | 22 | @Override | ||
976 | 23 | public String getSection() { | ||
977 | 24 | return "Verification"; | ||
978 | 25 | } | ||
979 | 26 | |||
980 | 27 | @Override | ||
981 | 28 | public boolean isApplicableTo(WorkspaceEntry we) { | ||
982 | 29 | return we.getModelEntry().getMathModel() instanceof Circuit; | ||
983 | 30 | } | ||
984 | 31 | |||
985 | 32 | @Override | ||
986 | 33 | public void run(WorkspaceEntry we) { | ||
987 | 34 | final CheckCircuitHazardTask task = new CheckCircuitHazardTask(we, framework); | ||
988 | 35 | String description = "MPSat tool chain"; | ||
989 | 36 | String title = we.getModelEntry().getModel().getTitle(); | ||
990 | 37 | if (!title.isEmpty()) { | ||
991 | 38 | description += "(" + title +")"; | ||
992 | 39 | } | ||
993 | 40 | framework.getTaskManager().queue(task, description, new MpsatChainResultHandler(task)); | ||
994 | 41 | } | ||
995 | 42 | |||
996 | 43 | } | ||
997 | 44 | 0 | ||
998 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CheckCircuitTool.java' | |||
999 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CheckCircuitTool.java 2013-09-17 14:58:15 +0000 | |||
1000 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CheckCircuitTool.java 2014-04-29 16:24:51 +0000 | |||
1001 | @@ -15,10 +15,9 @@ | |||
1002 | 15 | } | 15 | } |
1003 | 16 | 16 | ||
1004 | 17 | public String getDisplayName() { | 17 | public String getDisplayName() { |
1006 | 18 | return "Check circuit for deadlocks and hazards (reuse unfolding data)"; | 18 | return "Check circuit for conformation, deadlocks and hazards (reuse unfolding)"; |
1007 | 19 | } | 19 | } |
1008 | 20 | 20 | ||
1009 | 21 | |||
1010 | 22 | @Override | 21 | @Override |
1011 | 23 | public String getSection() { | 22 | public String getSection() { |
1012 | 24 | return "Verification"; | 23 | return "Verification"; |
1013 | @@ -31,7 +30,8 @@ | |||
1014 | 31 | 30 | ||
1015 | 32 | @Override | 31 | @Override |
1016 | 33 | public void run(WorkspaceEntry we) { | 32 | public void run(WorkspaceEntry we) { |
1018 | 34 | final CheckCircuitTask task = new CheckCircuitTask(we, framework); | 33 | final CheckCircuitTask task = new CheckCircuitTask(we, framework, |
1019 | 34 | checkConformation(), checkDeadlock(), checkHazard()); | ||
1020 | 35 | String description = "MPSat tool chain"; | 35 | String description = "MPSat tool chain"; |
1021 | 36 | String title = we.getModelEntry().getModel().getTitle(); | 36 | String title = we.getModelEntry().getModel().getTitle(); |
1022 | 37 | if (!title.isEmpty()) { | 37 | if (!title.isEmpty()) { |
1023 | @@ -40,4 +40,16 @@ | |||
1024 | 40 | framework.getTaskManager().queue(task, description, new MpsatChainResultHandler(task)); | 40 | framework.getTaskManager().queue(task, description, new MpsatChainResultHandler(task)); |
1025 | 41 | } | 41 | } |
1026 | 42 | 42 | ||
1027 | 43 | public boolean checkConformation() { | ||
1028 | 44 | return true; | ||
1029 | 45 | } | ||
1030 | 46 | |||
1031 | 47 | public boolean checkDeadlock() { | ||
1032 | 48 | return true; | ||
1033 | 49 | } | ||
1034 | 50 | |||
1035 | 51 | public boolean checkHazard() { | ||
1036 | 52 | return true; | ||
1037 | 53 | } | ||
1038 | 54 | |||
1039 | 43 | } | 55 | } |
1040 | 44 | 56 | ||
1041 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/tools/STGGenerator.java' | |||
1042 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/tools/STGGenerator.java 2014-01-14 10:38:16 +0000 | |||
1043 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/tools/STGGenerator.java 2014-04-29 16:24:51 +0000 | |||
1044 | @@ -22,6 +22,7 @@ | |||
1045 | 22 | import org.workcraft.dom.visual.VisualNode; | 22 | import org.workcraft.dom.visual.VisualNode; |
1046 | 23 | import org.workcraft.exceptions.InvalidConnectionException; | 23 | import org.workcraft.exceptions.InvalidConnectionException; |
1047 | 24 | import org.workcraft.plugins.circuit.Contact; | 24 | import org.workcraft.plugins.circuit.Contact; |
1048 | 25 | import org.workcraft.plugins.circuit.Contact.IOType; | ||
1049 | 25 | import org.workcraft.plugins.circuit.VisualCircuit; | 26 | import org.workcraft.plugins.circuit.VisualCircuit; |
1050 | 26 | import org.workcraft.plugins.circuit.VisualCircuitComponent; | 27 | import org.workcraft.plugins.circuit.VisualCircuitComponent; |
1051 | 27 | import org.workcraft.plugins.circuit.VisualCircuitConnection; | 28 | import org.workcraft.plugins.circuit.VisualCircuitConnection; |
1052 | @@ -29,7 +30,6 @@ | |||
1053 | 29 | import org.workcraft.plugins.circuit.VisualFunctionComponent; | 30 | import org.workcraft.plugins.circuit.VisualFunctionComponent; |
1054 | 30 | import org.workcraft.plugins.circuit.VisualFunctionContact; | 31 | import org.workcraft.plugins.circuit.VisualFunctionContact; |
1055 | 31 | import org.workcraft.plugins.circuit.VisualJoint; | 32 | import org.workcraft.plugins.circuit.VisualJoint; |
1056 | 32 | import org.workcraft.plugins.circuit.Contact.IOType; | ||
1057 | 33 | import org.workcraft.plugins.cpog.optimisation.Literal; | 33 | import org.workcraft.plugins.cpog.optimisation.Literal; |
1058 | 34 | import org.workcraft.plugins.cpog.optimisation.booleanvisitors.FormulaToString; | 34 | import org.workcraft.plugins.cpog.optimisation.booleanvisitors.FormulaToString; |
1059 | 35 | import org.workcraft.plugins.cpog.optimisation.dnf.Dnf; | 35 | import org.workcraft.plugins.cpog.optimisation.dnf.Dnf; |
1060 | @@ -40,9 +40,9 @@ | |||
1061 | 40 | import org.workcraft.plugins.petri.VisualPlace; | 40 | import org.workcraft.plugins.petri.VisualPlace; |
1062 | 41 | import org.workcraft.plugins.stg.STG; | 41 | import org.workcraft.plugins.stg.STG; |
1063 | 42 | import org.workcraft.plugins.stg.SignalTransition; | 42 | import org.workcraft.plugins.stg.SignalTransition; |
1064 | 43 | import org.workcraft.plugins.stg.SignalTransition.Direction; | ||
1065 | 43 | import org.workcraft.plugins.stg.VisualSTG; | 44 | import org.workcraft.plugins.stg.VisualSTG; |
1066 | 44 | import org.workcraft.plugins.stg.VisualSignalTransition; | 45 | import org.workcraft.plugins.stg.VisualSignalTransition; |
1067 | 45 | import org.workcraft.plugins.stg.SignalTransition.Direction; | ||
1068 | 46 | import org.workcraft.util.Hierarchy; | 46 | import org.workcraft.util.Hierarchy; |
1069 | 47 | 47 | ||
1070 | 48 | public class STGGenerator { | 48 | public class STGGenerator { |
1071 | @@ -172,36 +172,34 @@ | |||
1072 | 172 | } | 172 | } |
1073 | 173 | 173 | ||
1074 | 174 | // generate implementation for each of the drivers | 174 | // generate implementation for each of the drivers |
1077 | 175 | for(VisualContact c : drivers.keySet()) | 175 | for(VisualContact c : drivers.keySet()) { |
1076 | 176 | { | ||
1078 | 177 | if (c instanceof VisualFunctionContact) { | 176 | if (c instanceof VisualFunctionContact) { |
1079 | 178 | // function based driver | 177 | // function based driver |
1080 | 178 | Dnf set = null; | ||
1081 | 179 | Dnf reset = null; | ||
1082 | 179 | VisualFunctionContact contact = (VisualFunctionContact)c; | 180 | VisualFunctionContact contact = (VisualFunctionContact)c; |
1083 | 180 | Dnf set = DnfGenerator.generate(contact.getFunction().getSetFunction()); | ||
1084 | 181 | Dnf reset = null; | ||
1085 | 182 | |||
1086 | 183 | if (contact.getFunction().getResetFunction()!=null) | ||
1087 | 184 | reset = DnfGenerator.generate(contact.getFunction().getResetFunction()); | ||
1088 | 185 | else { | ||
1089 | 186 | BooleanOperations.worker = new DumbBooleanWorker(); | ||
1090 | 187 | reset = DnfGenerator.generate(BooleanOperations.worker.not(contact.getFunction().getSetFunction())); | ||
1091 | 188 | } | ||
1092 | 189 | |||
1093 | 190 | SignalTransition.Type ttype = SignalTransition.Type.OUTPUT; | 181 | SignalTransition.Type ttype = SignalTransition.Type.OUTPUT; |
1094 | 191 | |||
1095 | 192 | |||
1096 | 193 | if (contact.getParent() instanceof VisualCircuitComponent) { | 182 | if (contact.getParent() instanceof VisualCircuitComponent) { |
1100 | 194 | if (((VisualCircuitComponent)contact.getParent()).getIsEnvironment()) | 183 | set = DnfGenerator.generate(contact.getFunction().getSetFunction()); |
1101 | 195 | ttype = SignalTransition.Type.INPUT; | 184 | if (contact.getFunction().getResetFunction() != null) { |
1102 | 196 | else if (contact.getIOType()==IOType.INPUT) | 185 | reset = DnfGenerator.generate(contact.getFunction().getResetFunction()); |
1103 | 186 | } else { | ||
1104 | 187 | BooleanOperations.worker = new DumbBooleanWorker(); | ||
1105 | 188 | reset = DnfGenerator.generate(BooleanOperations.worker.not(contact.getFunction().getSetFunction())); | ||
1106 | 189 | } | ||
1107 | 190 | if (((VisualCircuitComponent)contact.getParent()).getIsEnvironment()) { | ||
1108 | 191 | ttype = SignalTransition.Type.INPUT; | ||
1109 | 192 | } else if (contact.getIOType()==IOType.INPUT) { | ||
1110 | 197 | ttype = SignalTransition.Type.INPUT; | 193 | ttype = SignalTransition.Type.INPUT; |
1111 | 194 | } | ||
1112 | 198 | } else { | 195 | } else { |
1114 | 199 | if (contact.getIOType()==IOType.INPUT) | 196 | set = DnfGenerator.generate(contact.getFunction().getSetFunction()); |
1115 | 197 | reset = DnfGenerator.generate(contact.getFunction().getResetFunction()); | ||
1116 | 198 | if (contact.getIOType()==IOType.INPUT) { | ||
1117 | 200 | ttype = SignalTransition.Type.INPUT; | 199 | ttype = SignalTransition.Type.INPUT; |
1118 | 200 | } | ||
1119 | 201 | } | 201 | } |
1120 | 202 | |||
1121 | 203 | implementDriver(circuit, stg, contact, drivers, targetDrivers, set, reset, ttype); | 202 | implementDriver(circuit, stg, contact, drivers, targetDrivers, set, reset, ttype); |
1122 | 204 | |||
1123 | 205 | } else { | 203 | } else { |
1124 | 206 | // some generic driver implementation otherwise | 204 | // some generic driver implementation otherwise |
1125 | 207 | Dnf set = new Dnf(new DnfClause()); | 205 | Dnf set = new Dnf(new DnfClause()); |
1126 | @@ -209,7 +207,6 @@ | |||
1127 | 209 | implementDriver(circuit, stg, c, drivers, targetDrivers, set, reset, SignalTransition.Type.INPUT); | 207 | implementDriver(circuit, stg, c, drivers, targetDrivers, set, reset, SignalTransition.Type.INPUT); |
1128 | 210 | } | 208 | } |
1129 | 211 | } | 209 | } |
1130 | 212 | |||
1131 | 213 | return stg; | 210 | return stg; |
1132 | 214 | } catch (InvalidConnectionException e) { | 211 | } catch (InvalidConnectionException e) { |
1133 | 215 | throw new RuntimeException(e); | 212 | throw new RuntimeException(e); |
1134 | 216 | 213 | ||
1135 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/optimisation/dnf/DnfGenerator.java' | |||
1136 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/optimisation/dnf/DnfGenerator.java 2012-07-25 10:32:14 +0000 | |||
1137 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/optimisation/dnf/DnfGenerator.java 2014-04-29 16:24:51 +0000 | |||
1138 | @@ -20,6 +20,9 @@ | |||
1139 | 20 | public class DnfGenerator { | 20 | public class DnfGenerator { |
1140 | 21 | public static Dnf generate(BooleanFormula formula) | 21 | public static Dnf generate(BooleanFormula formula) |
1141 | 22 | { | 22 | { |
1142 | 23 | if (formula == null) { | ||
1143 | 24 | formula = One.instance(); | ||
1144 | 25 | } | ||
1145 | 23 | return formula.accept(new BooleanVisitor<Dnf>() | 26 | return formula.accept(new BooleanVisitor<Dnf>() |
1146 | 24 | { | 27 | { |
1147 | 25 | boolean negation = false; | 28 | boolean negation = false; |
1148 | @@ -218,7 +221,6 @@ | |||
1149 | 218 | 221 | ||
1150 | 219 | } | 222 | } |
1151 | 220 | 223 | ||
1152 | 221 | |||
1153 | 222 | return simplifyDnf(result); | 224 | return simplifyDnf(result); |
1154 | 223 | } | 225 | } |
1155 | 224 | 226 | ||
1156 | 225 | 227 | ||
1157 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/VisualDfs.java' | |||
1158 | --- DfsPlugin/src/org/workcraft/plugins/dfs/VisualDfs.java 2014-04-08 08:59:38 +0000 | |||
1159 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/VisualDfs.java 2014-04-29 16:24:51 +0000 | |||
1160 | @@ -28,7 +28,6 @@ | |||
1161 | 28 | 28 | ||
1162 | 29 | import org.workcraft.annotations.CustomTools; | 29 | import org.workcraft.annotations.CustomTools; |
1163 | 30 | import org.workcraft.annotations.DisplayName; | 30 | import org.workcraft.annotations.DisplayName; |
1164 | 31 | import org.workcraft.dom.Connection; | ||
1165 | 32 | import org.workcraft.dom.Node; | 31 | import org.workcraft.dom.Node; |
1166 | 33 | import org.workcraft.dom.math.MathConnection; | 32 | import org.workcraft.dom.math.MathConnection; |
1167 | 34 | import org.workcraft.dom.math.MathNode; | 33 | import org.workcraft.dom.math.MathNode; |
1168 | @@ -221,11 +220,4 @@ | |||
1169 | 221 | return result; | 220 | return result; |
1170 | 222 | } | 221 | } |
1171 | 223 | 222 | ||
1172 | 224 | public Connection getConnection(Node first, Node second) { | ||
1173 | 225 | for(Connection connection : getConnections(first)) { | ||
1174 | 226 | if (connection.getSecond() == second) return connection; | ||
1175 | 227 | } | ||
1176 | 228 | return null; | ||
1177 | 229 | } | ||
1178 | 230 | |||
1179 | 231 | } | ||
1180 | 232 | \ No newline at end of file | 223 | \ No newline at end of file |
1181 | 224 | } | ||
1182 | 233 | 225 | ||
1183 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/tasks/CheckDataflowDeadlockTask.java' | |||
1184 | --- DfsPlugin/src/org/workcraft/plugins/dfs/tasks/CheckDataflowDeadlockTask.java 2014-04-16 21:55:15 +0000 | |||
1185 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/tasks/CheckDataflowDeadlockTask.java 2014-04-29 16:24:51 +0000 | |||
1186 | @@ -53,20 +53,24 @@ | |||
1187 | 53 | File netFile = File.createTempFile("net", exporter.getExtenstion()); | 53 | File netFile = File.createTempFile("net", exporter.getExtenstion()); |
1188 | 54 | ExportTask exportTask = new ExportTask(exporter, model, netFile.getCanonicalPath()); | 54 | ExportTask exportTask = new ExportTask(exporter, model, netFile.getCanonicalPath()); |
1189 | 55 | SubtaskMonitor<Object> mon = new SubtaskMonitor<Object>(monitor); | 55 | SubtaskMonitor<Object> mon = new SubtaskMonitor<Object>(monitor); |
1191 | 56 | Result<? extends Object> exportResult = framework.getTaskManager().execute(exportTask, "Exporting .g", mon); | 56 | Result<? extends Object> exportResult = framework.getTaskManager().execute( |
1192 | 57 | exportTask, "Exporting .g", mon); | ||
1193 | 58 | |||
1194 | 57 | if (exportResult.getOutcome() != Outcome.FINISHED) { | 59 | if (exportResult.getOutcome() != Outcome.FINISHED) { |
1195 | 58 | netFile.delete(); | 60 | netFile.delete(); |
1196 | 59 | if (exportResult.getOutcome() == Outcome.CANCELLED) { | 61 | if (exportResult.getOutcome() == Outcome.CANCELLED) { |
1197 | 60 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | 62 | return new Result<MpsatChainResult>(Outcome.CANCELLED); |
1198 | 61 | } | 63 | } |
1199 | 62 | return new Result<MpsatChainResult>(Outcome.FAILED, | 64 | return new Result<MpsatChainResult>(Outcome.FAILED, |
1201 | 63 | new MpsatChainResult(exportResult, null, null, settings)); | 65 | new MpsatChainResult(exportResult, null, null, null, settings)); |
1202 | 64 | } | 66 | } |
1203 | 65 | monitor.progressUpdate(0.20); | 67 | monitor.progressUpdate(0.20); |
1204 | 66 | 68 | ||
1205 | 67 | File mciFile = File.createTempFile("unfolding", ".mci"); | 69 | File mciFile = File.createTempFile("unfolding", ".mci"); |
1206 | 68 | PunfTask punfTask = new PunfTask(netFile.getCanonicalPath(), mciFile.getCanonicalPath()); | 70 | PunfTask punfTask = new PunfTask(netFile.getCanonicalPath(), mciFile.getCanonicalPath()); |
1208 | 69 | Result<? extends ExternalProcessResult> punfResult = framework.getTaskManager().execute(punfTask, "Unfolding .g", mon); | 71 | Result<? extends ExternalProcessResult> punfResult = framework.getTaskManager().execute( |
1209 | 72 | punfTask, "Unfolding .g", mon); | ||
1210 | 73 | |||
1211 | 70 | netFile.delete(); | 74 | netFile.delete(); |
1212 | 71 | if (punfResult.getOutcome() != Outcome.FINISHED) { | 75 | if (punfResult.getOutcome() != Outcome.FINISHED) { |
1213 | 72 | mciFile.delete(); | 76 | mciFile.delete(); |
1214 | @@ -74,18 +78,21 @@ | |||
1215 | 74 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | 78 | return new Result<MpsatChainResult>(Outcome.CANCELLED); |
1216 | 75 | } | 79 | } |
1217 | 76 | return new Result<MpsatChainResult>(Outcome.FAILED, | 80 | return new Result<MpsatChainResult>(Outcome.FAILED, |
1219 | 77 | new MpsatChainResult(exportResult, punfResult, null, settings)); | 81 | new MpsatChainResult(exportResult, null, punfResult, null, settings)); |
1220 | 78 | } | 82 | } |
1221 | 79 | monitor.progressUpdate(0.70); | 83 | monitor.progressUpdate(0.70); |
1222 | 80 | 84 | ||
1223 | 81 | MpsatTask mpsatTask = new MpsatTask(settings.getMpsatArguments(), mciFile.getCanonicalPath()); | 85 | MpsatTask mpsatTask = new MpsatTask(settings.getMpsatArguments(), mciFile.getCanonicalPath()); |
1225 | 82 | Result<? extends ExternalProcessResult> mpsatResult = framework.getTaskManager().execute(mpsatTask, "Running deadlock checking [MPSat]", mon); | 86 | Result<? extends ExternalProcessResult> mpsatResult = framework.getTaskManager().execute( |
1226 | 87 | mpsatTask, "Running deadlock checking [MPSat]", mon); | ||
1227 | 88 | |||
1228 | 83 | if (mpsatResult.getOutcome() != Outcome.FINISHED) { | 89 | if (mpsatResult.getOutcome() != Outcome.FINISHED) { |
1229 | 84 | if (mpsatResult.getOutcome() == Outcome.CANCELLED) { | 90 | if (mpsatResult.getOutcome() == Outcome.CANCELLED) { |
1230 | 85 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | 91 | return new Result<MpsatChainResult>(Outcome.CANCELLED); |
1231 | 86 | } | 92 | } |
1232 | 87 | return new Result<MpsatChainResult>(Outcome.FAILED, | 93 | return new Result<MpsatChainResult>(Outcome.FAILED, |
1234 | 88 | new MpsatChainResult(exportResult, punfResult, mpsatResult, settings, new String(mpsatResult.getReturnValue().getErrors()))); | 94 | new MpsatChainResult(exportResult, null, punfResult, mpsatResult, settings, |
1235 | 95 | new String(mpsatResult.getReturnValue().getErrors()))); | ||
1236 | 89 | } | 96 | } |
1237 | 90 | monitor.progressUpdate(0.90); | 97 | monitor.progressUpdate(0.90); |
1238 | 91 | 98 | ||
1239 | @@ -93,13 +100,13 @@ | |||
1240 | 93 | if (!mdp.getSolutions().isEmpty()) { | 100 | if (!mdp.getSolutions().isEmpty()) { |
1241 | 94 | mciFile.delete(); | 101 | mciFile.delete(); |
1242 | 95 | return new Result<MpsatChainResult>(Outcome.FINISHED, | 102 | return new Result<MpsatChainResult>(Outcome.FINISHED, |
1244 | 96 | new MpsatChainResult(exportResult, punfResult, mpsatResult, settings, "Dataflow has a deadlock")); | 103 | new MpsatChainResult(exportResult, null, punfResult, mpsatResult, settings, "Dataflow has a deadlock")); |
1245 | 97 | } | 104 | } |
1246 | 98 | monitor.progressUpdate(1.0); | 105 | monitor.progressUpdate(1.0); |
1247 | 99 | 106 | ||
1248 | 100 | mciFile.delete(); | 107 | mciFile.delete(); |
1249 | 101 | return new Result<MpsatChainResult>(Outcome.FINISHED, | 108 | return new Result<MpsatChainResult>(Outcome.FINISHED, |
1251 | 102 | new MpsatChainResult(exportResult, punfResult, mpsatResult, settings, "Dataflow is deadlock-free")); | 109 | new MpsatChainResult(exportResult, null, punfResult, mpsatResult, settings, "Dataflow is deadlock-free")); |
1252 | 103 | 110 | ||
1253 | 104 | } catch (Throwable e) { | 111 | } catch (Throwable e) { |
1254 | 105 | return new Result<MpsatChainResult>(e); | 112 | return new Result<MpsatChainResult>(e); |
1255 | 106 | 113 | ||
1256 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/tasks/CheckDataflowHazardTask.java' | |||
1257 | --- DfsPlugin/src/org/workcraft/plugins/dfs/tasks/CheckDataflowHazardTask.java 2014-04-16 21:55:15 +0000 | |||
1258 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/tasks/CheckDataflowHazardTask.java 2014-04-29 16:24:51 +0000 | |||
1259 | @@ -54,38 +54,45 @@ | |||
1260 | 54 | File netFile = File.createTempFile("net", exporter.getExtenstion()); | 54 | File netFile = File.createTempFile("net", exporter.getExtenstion()); |
1261 | 55 | ExportTask exportTask = new ExportTask(exporter, model, netFile.getCanonicalPath()); | 55 | ExportTask exportTask = new ExportTask(exporter, model, netFile.getCanonicalPath()); |
1262 | 56 | SubtaskMonitor<Object> mon = new SubtaskMonitor<Object>(monitor); | 56 | SubtaskMonitor<Object> mon = new SubtaskMonitor<Object>(monitor); |
1264 | 57 | Result<? extends Object> exportResult = framework.getTaskManager().execute(exportTask, "Exporting .g", mon); | 57 | Result<? extends Object> exportResult = framework.getTaskManager().execute( |
1265 | 58 | exportTask, "Exporting .g", mon); | ||
1266 | 59 | |||
1267 | 58 | if (exportResult.getOutcome() != Outcome.FINISHED) { | 60 | if (exportResult.getOutcome() != Outcome.FINISHED) { |
1268 | 59 | netFile.delete(); | 61 | netFile.delete(); |
1269 | 60 | if (exportResult.getOutcome() == Outcome.CANCELLED) { | 62 | if (exportResult.getOutcome() == Outcome.CANCELLED) { |
1270 | 61 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | 63 | return new Result<MpsatChainResult>(Outcome.CANCELLED); |
1271 | 62 | } | 64 | } |
1272 | 63 | return new Result<MpsatChainResult>(Outcome.FAILED, | 65 | return new Result<MpsatChainResult>(Outcome.FAILED, |
1274 | 64 | new MpsatChainResult(exportResult, null, null, settings)); | 66 | new MpsatChainResult(exportResult, null, null, null, settings)); |
1275 | 65 | } | 67 | } |
1276 | 66 | monitor.progressUpdate(0.20); | 68 | monitor.progressUpdate(0.20); |
1277 | 67 | 69 | ||
1278 | 68 | File mciFile = File.createTempFile("unfolding", ".mci"); | 70 | File mciFile = File.createTempFile("unfolding", ".mci"); |
1279 | 69 | PunfTask punfTask = new PunfTask(netFile.getCanonicalPath(), mciFile.getCanonicalPath()); | 71 | PunfTask punfTask = new PunfTask(netFile.getCanonicalPath(), mciFile.getCanonicalPath()); |
1281 | 70 | Result<? extends ExternalProcessResult> punfResult = framework.getTaskManager().execute(punfTask, "Unfolding .g", mon); | 72 | Result<? extends ExternalProcessResult> punfResult = framework.getTaskManager().execute( |
1282 | 73 | punfTask, "Unfolding .g", mon); | ||
1283 | 74 | |||
1284 | 71 | netFile.delete(); | 75 | netFile.delete(); |
1285 | 72 | if (punfResult.getOutcome() != Outcome.FINISHED) { | 76 | if (punfResult.getOutcome() != Outcome.FINISHED) { |
1286 | 73 | mciFile.delete(); | 77 | mciFile.delete(); |
1287 | 74 | if (punfResult.getOutcome() == Outcome.CANCELLED) { | 78 | if (punfResult.getOutcome() == Outcome.CANCELLED) { |
1288 | 75 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | 79 | return new Result<MpsatChainResult>(Outcome.CANCELLED); |
1289 | 76 | } | 80 | } |
1291 | 77 | return new Result<MpsatChainResult>(Outcome.FAILED, new MpsatChainResult(exportResult, punfResult, null, settings)); | 81 | return new Result<MpsatChainResult>(Outcome.FAILED, |
1292 | 82 | new MpsatChainResult(exportResult, null, punfResult, null, settings)); | ||
1293 | 78 | } | 83 | } |
1294 | 79 | monitor.progressUpdate(0.40); | 84 | monitor.progressUpdate(0.40); |
1295 | 80 | 85 | ||
1296 | 81 | MpsatTask mpsatTask = new MpsatTask(settings.getMpsatArguments(), mciFile.getCanonicalPath()); | 86 | MpsatTask mpsatTask = new MpsatTask(settings.getMpsatArguments(), mciFile.getCanonicalPath()); |
1298 | 82 | Result<? extends ExternalProcessResult> mpsatResult = framework.getTaskManager().execute(mpsatTask, "Running semimodularity checking [MPSat]", mon); | 87 | Result<? extends ExternalProcessResult> mpsatResult = framework.getTaskManager().execute( |
1299 | 88 | mpsatTask, "Running semimodularity checking [MPSat]", mon); | ||
1300 | 89 | |||
1301 | 83 | if (mpsatResult.getOutcome() != Outcome.FINISHED) { | 90 | if (mpsatResult.getOutcome() != Outcome.FINISHED) { |
1302 | 84 | if (mpsatResult.getOutcome() == Outcome.CANCELLED) { | 91 | if (mpsatResult.getOutcome() == Outcome.CANCELLED) { |
1303 | 85 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | 92 | return new Result<MpsatChainResult>(Outcome.CANCELLED); |
1304 | 86 | } | 93 | } |
1305 | 87 | return new Result<MpsatChainResult>(Outcome.FAILED, | 94 | return new Result<MpsatChainResult>(Outcome.FAILED, |
1307 | 88 | new MpsatChainResult(exportResult, punfResult, mpsatResult, settings)); | 95 | new MpsatChainResult(exportResult, null, punfResult, mpsatResult, settings)); |
1308 | 89 | } | 96 | } |
1309 | 90 | monitor.progressUpdate(0.90); | 97 | monitor.progressUpdate(0.90); |
1310 | 91 | 98 | ||
1311 | @@ -93,13 +100,13 @@ | |||
1312 | 93 | if (!mdp.getSolutions().isEmpty()) { | 100 | if (!mdp.getSolutions().isEmpty()) { |
1313 | 94 | mciFile.delete(); | 101 | mciFile.delete(); |
1314 | 95 | return new Result<MpsatChainResult>(Outcome.FINISHED, | 102 | return new Result<MpsatChainResult>(Outcome.FINISHED, |
1316 | 96 | new MpsatChainResult(exportResult, punfResult, mpsatResult, settings, "Dataflow has hazard(s)")); | 103 | new MpsatChainResult(exportResult, null, punfResult, mpsatResult, settings, "Dataflow has hazard(s)")); |
1317 | 97 | } | 104 | } |
1318 | 98 | monitor.progressUpdate(1.0); | 105 | monitor.progressUpdate(1.0); |
1319 | 99 | 106 | ||
1320 | 100 | mciFile.delete(); | 107 | mciFile.delete(); |
1321 | 101 | return new Result<MpsatChainResult>(Outcome.FINISHED, | 108 | return new Result<MpsatChainResult>(Outcome.FINISHED, |
1323 | 102 | new MpsatChainResult(exportResult, punfResult, mpsatResult, settings, "Dataflow is hazard-free")); | 109 | new MpsatChainResult(exportResult, null, punfResult, mpsatResult, settings, "Dataflow is hazard-free")); |
1324 | 103 | 110 | ||
1325 | 104 | } catch (Throwable e) { | 111 | } catch (Throwable e) { |
1326 | 105 | return new Result<MpsatChainResult>(e); | 112 | return new Result<MpsatChainResult>(e); |
1327 | 106 | 113 | ||
1328 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/tasks/CheckDataflowTask.java' | |||
1329 | --- DfsPlugin/src/org/workcraft/plugins/dfs/tasks/CheckDataflowTask.java 2014-04-16 21:55:15 +0000 | |||
1330 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/tasks/CheckDataflowTask.java 2014-04-29 16:24:51 +0000 | |||
1331 | @@ -59,20 +59,24 @@ | |||
1332 | 59 | File netFile = File.createTempFile("net", exporter.getExtenstion()); | 59 | File netFile = File.createTempFile("net", exporter.getExtenstion()); |
1333 | 60 | ExportTask exportTask = new ExportTask(exporter, model, netFile.getCanonicalPath()); | 60 | ExportTask exportTask = new ExportTask(exporter, model, netFile.getCanonicalPath()); |
1334 | 61 | SubtaskMonitor<Object> mon = new SubtaskMonitor<Object>(monitor); | 61 | SubtaskMonitor<Object> mon = new SubtaskMonitor<Object>(monitor); |
1336 | 62 | Result<? extends Object> exportResult = framework.getTaskManager().execute(exportTask, "Exporting .g", mon); | 62 | Result<? extends Object> exportResult = framework.getTaskManager().execute( |
1337 | 63 | exportTask, "Exporting .g", mon); | ||
1338 | 64 | |||
1339 | 63 | if (exportResult.getOutcome() != Outcome.FINISHED) { | 65 | if (exportResult.getOutcome() != Outcome.FINISHED) { |
1340 | 64 | netFile.delete(); | 66 | netFile.delete(); |
1341 | 65 | if (exportResult.getOutcome() == Outcome.CANCELLED) { | 67 | if (exportResult.getOutcome() == Outcome.CANCELLED) { |
1342 | 66 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | 68 | return new Result<MpsatChainResult>(Outcome.CANCELLED); |
1343 | 67 | } | 69 | } |
1344 | 68 | return new Result<MpsatChainResult>(Outcome.FAILED, | 70 | return new Result<MpsatChainResult>(Outcome.FAILED, |
1346 | 69 | new MpsatChainResult(exportResult, null, null, deadlockSettings)); | 71 | new MpsatChainResult(exportResult, null, null, null, deadlockSettings)); |
1347 | 70 | } | 72 | } |
1348 | 71 | monitor.progressUpdate(0.20); | 73 | monitor.progressUpdate(0.20); |
1349 | 72 | 74 | ||
1350 | 73 | File mciFile = File.createTempFile("unfolding", ".mci"); | 75 | File mciFile = File.createTempFile("unfolding", ".mci"); |
1351 | 74 | PunfTask punfTask = new PunfTask(netFile.getCanonicalPath(), mciFile.getCanonicalPath()); | 76 | PunfTask punfTask = new PunfTask(netFile.getCanonicalPath(), mciFile.getCanonicalPath()); |
1353 | 75 | Result<? extends ExternalProcessResult> punfResult = framework.getTaskManager().execute(punfTask, "Unfolding .g", mon); | 77 | Result<? extends ExternalProcessResult> punfResult = framework.getTaskManager().execute( |
1354 | 78 | punfTask, "Unfolding .g", mon); | ||
1355 | 79 | |||
1356 | 76 | netFile.delete(); | 80 | netFile.delete(); |
1357 | 77 | if (punfResult.getOutcome() != Outcome.FINISHED) { | 81 | if (punfResult.getOutcome() != Outcome.FINISHED) { |
1358 | 78 | mciFile.delete(); | 82 | mciFile.delete(); |
1359 | @@ -80,18 +84,20 @@ | |||
1360 | 80 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | 84 | return new Result<MpsatChainResult>(Outcome.CANCELLED); |
1361 | 81 | } | 85 | } |
1362 | 82 | return new Result<MpsatChainResult>(Outcome.FAILED, | 86 | return new Result<MpsatChainResult>(Outcome.FAILED, |
1364 | 83 | new MpsatChainResult(exportResult, punfResult, null, deadlockSettings)); | 87 | new MpsatChainResult(exportResult, null, punfResult, null, deadlockSettings)); |
1365 | 84 | } | 88 | } |
1366 | 85 | monitor.progressUpdate(0.40); | 89 | monitor.progressUpdate(0.40); |
1367 | 86 | 90 | ||
1368 | 87 | MpsatTask mpsatTask = new MpsatTask(deadlockSettings.getMpsatArguments(), mciFile.getCanonicalPath()); | 91 | MpsatTask mpsatTask = new MpsatTask(deadlockSettings.getMpsatArguments(), mciFile.getCanonicalPath()); |
1370 | 88 | Result<? extends ExternalProcessResult> mpsatResult = framework.getTaskManager().execute(mpsatTask, "Running deadlock checking [MPSat]", mon); | 92 | Result<? extends ExternalProcessResult> mpsatResult = framework.getTaskManager().execute( |
1371 | 93 | mpsatTask, "Running deadlock checking [MPSat]", mon); | ||
1372 | 94 | |||
1373 | 89 | if (mpsatResult.getOutcome() != Outcome.FINISHED) { | 95 | if (mpsatResult.getOutcome() != Outcome.FINISHED) { |
1374 | 90 | if (mpsatResult.getOutcome() == Outcome.CANCELLED) { | 96 | if (mpsatResult.getOutcome() == Outcome.CANCELLED) { |
1375 | 91 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | 97 | return new Result<MpsatChainResult>(Outcome.CANCELLED); |
1376 | 92 | } | 98 | } |
1377 | 93 | return new Result<MpsatChainResult>(Outcome.FAILED, | 99 | return new Result<MpsatChainResult>(Outcome.FAILED, |
1379 | 94 | new MpsatChainResult(exportResult, punfResult, mpsatResult, deadlockSettings)); | 100 | new MpsatChainResult(exportResult, null, punfResult, mpsatResult, deadlockSettings)); |
1380 | 95 | } | 101 | } |
1381 | 96 | monitor.progressUpdate(0.60); | 102 | monitor.progressUpdate(0.60); |
1382 | 97 | 103 | ||
1383 | @@ -99,7 +105,7 @@ | |||
1384 | 99 | if (!mdp.getSolutions().isEmpty()) { | 105 | if (!mdp.getSolutions().isEmpty()) { |
1385 | 100 | mciFile.delete(); | 106 | mciFile.delete(); |
1386 | 101 | return new Result<MpsatChainResult>(Outcome.FINISHED, | 107 | return new Result<MpsatChainResult>(Outcome.FINISHED, |
1388 | 102 | new MpsatChainResult(exportResult, punfResult, mpsatResult, deadlockSettings, "Dataflow has a deadlock")); | 108 | new MpsatChainResult(exportResult, null, punfResult, mpsatResult, deadlockSettings, "Dataflow has a deadlock")); |
1389 | 103 | } | 109 | } |
1390 | 104 | monitor.progressUpdate(0.70); | 110 | monitor.progressUpdate(0.70); |
1391 | 105 | 111 | ||
1392 | @@ -110,7 +116,7 @@ | |||
1393 | 110 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | 116 | return new Result<MpsatChainResult>(Outcome.CANCELLED); |
1394 | 111 | } | 117 | } |
1395 | 112 | return new Result<MpsatChainResult>(Outcome.FAILED, | 118 | return new Result<MpsatChainResult>(Outcome.FAILED, |
1397 | 113 | new MpsatChainResult(exportResult, punfResult, mpsatResult, hazardSettings)); | 119 | new MpsatChainResult(exportResult, null, punfResult, mpsatResult, hazardSettings)); |
1398 | 114 | } | 120 | } |
1399 | 115 | monitor.progressUpdate(0.90); | 121 | monitor.progressUpdate(0.90); |
1400 | 116 | 122 | ||
1401 | @@ -118,13 +124,13 @@ | |||
1402 | 118 | if (!mdp.getSolutions().isEmpty()) { | 124 | if (!mdp.getSolutions().isEmpty()) { |
1403 | 119 | mciFile.delete(); | 125 | mciFile.delete(); |
1404 | 120 | return new Result<MpsatChainResult>(Outcome.FINISHED, | 126 | return new Result<MpsatChainResult>(Outcome.FINISHED, |
1406 | 121 | new MpsatChainResult(exportResult, punfResult, mpsatResult, hazardSettings, "Dataflow has hazard(s)")); | 127 | new MpsatChainResult(exportResult, null, punfResult, mpsatResult, hazardSettings, "Dataflow has hazard(s)")); |
1407 | 122 | } | 128 | } |
1408 | 123 | monitor.progressUpdate(1.0); | 129 | monitor.progressUpdate(1.0); |
1409 | 124 | 130 | ||
1410 | 125 | mciFile.delete(); | 131 | mciFile.delete(); |
1411 | 126 | return new Result<MpsatChainResult>(Outcome.FINISHED, | 132 | return new Result<MpsatChainResult>(Outcome.FINISHED, |
1413 | 127 | new MpsatChainResult(exportResult, punfResult, mpsatResult, hazardSettings, "Dataflow is deadlock-free and hazard-free")); | 133 | new MpsatChainResult(exportResult, null, punfResult, mpsatResult, hazardSettings, "Dataflow is deadlock-free and hazard-free")); |
1414 | 128 | 134 | ||
1415 | 129 | } catch (Throwable e) { | 135 | } catch (Throwable e) { |
1416 | 130 | return new Result<MpsatChainResult>(e); | 136 | return new Result<MpsatChainResult>(e); |
1417 | 131 | 137 | ||
1418 | === modified file 'MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatChainResultHandler.java' | |||
1419 | --- MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatChainResultHandler.java 2014-04-16 21:55:15 +0000 | |||
1420 | +++ MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatChainResultHandler.java 2014-04-29 16:24:51 +0000 | |||
1421 | @@ -26,6 +26,9 @@ | |||
1422 | 26 | if (result.getOutcome() == Outcome.FINISHED) { | 26 | if (result.getOutcome() == Outcome.FINISHED) { |
1423 | 27 | final MpsatMode mpsatMode = result.getReturnValue().getMpsatSettings().getMode(); | 27 | final MpsatMode mpsatMode = result.getReturnValue().getMpsatSettings().getMode(); |
1424 | 28 | switch (mpsatMode) { | 28 | switch (mpsatMode) { |
1425 | 29 | case UNDEFINED: | ||
1426 | 30 | SwingUtilities.invokeLater(new MpsatUndefinedResultHandler(task, result)); | ||
1427 | 31 | break; | ||
1428 | 29 | case STG_REACHABILITY: | 32 | case STG_REACHABILITY: |
1429 | 30 | case CSC_CONFLICT_DETECTION: | 33 | case CSC_CONFLICT_DETECTION: |
1430 | 31 | case USC_CONFLICT_DETECTION: | 34 | case USC_CONFLICT_DETECTION: |
1431 | @@ -41,7 +44,6 @@ | |||
1432 | 41 | case COMPLEX_GATE_IMPLEMENTATION: | 44 | case COMPLEX_GATE_IMPLEMENTATION: |
1433 | 42 | SwingUtilities.invokeLater(new MpsatSynthesisResultHandler(task, result)); | 45 | SwingUtilities.invokeLater(new MpsatSynthesisResultHandler(task, result)); |
1434 | 43 | break; | 46 | break; |
1435 | 44 | |||
1436 | 45 | default: | 47 | default: |
1437 | 46 | SwingUtilities.invokeLater(new Runnable() { | 48 | SwingUtilities.invokeLater(new Runnable() { |
1438 | 47 | @Override | 49 | @Override |
1439 | @@ -53,57 +55,62 @@ | |||
1440 | 53 | }); | 55 | }); |
1441 | 54 | break; | 56 | break; |
1442 | 55 | } | 57 | } |
1445 | 56 | } | 58 | } else if (result.getOutcome() != Outcome.CANCELLED) { |
1444 | 57 | else if (result.getOutcome() != Outcome.CANCELLED) { | ||
1446 | 58 | errorMessage = "MPSat tool chain execution failed :-("; | 59 | errorMessage = "MPSat tool chain execution failed :-("; |
1447 | 59 | |||
1448 | 60 | Throwable cause1 = result.getCause(); | 60 | Throwable cause1 = result.getCause(); |
1449 | 61 | 61 | ||
1450 | 62 | if (cause1 != null) { | 62 | if (cause1 != null) { |
1451 | 63 | // Exception was thrown somewhere in the chain task run() method (not in any of the subtasks) | 63 | // Exception was thrown somewhere in the chain task run() method (not in any of the subtasks) |
1452 | 64 | errorMessage += "\n\nFailure caused by: " + cause1.toString() + "\nPlease see the \"Problems\" tab for more details."; | 64 | errorMessage += "\n\nFailure caused by: " + cause1.toString() + "\nPlease see the \"Problems\" tab for more details."; |
1457 | 65 | } else | 65 | } else { |
1458 | 66 | { | 66 | MpsatChainResult returnValue = result.getReturnValue(); |
1459 | 67 | Result<? extends Object> exportResult = result.getReturnValue().getExportResult(); | 67 | Result<? extends Object> exportResult = returnValue.getExportResult(); |
1460 | 68 | if (exportResult.getOutcome() == Outcome.FAILED) { | 68 | Result<? extends ExternalProcessResult> pcompResult = returnValue.getPcompResult(); |
1461 | 69 | Result<? extends ExternalProcessResult> punfResult = returnValue.getPunfResult(); | ||
1462 | 70 | Result<? extends ExternalProcessResult> mpsatResult = returnValue.getMpsatResult(); | ||
1463 | 71 | if (exportResult != null && exportResult.getOutcome() == Outcome.FAILED) { | ||
1464 | 69 | errorMessage += "\n\nFailed to export the model as a .g file."; | 72 | errorMessage += "\n\nFailed to export the model as a .g file."; |
1465 | 70 | Throwable cause = exportResult.getCause(); | 73 | Throwable cause = exportResult.getCause(); |
1469 | 71 | if (cause != null) | 74 | if (cause != null) { |
1470 | 72 | errorMessage += "\n\nFailure caused by: " + cause.toString() + "\nPlease see the \"Problems\" tab for more details."; | 75 | errorMessage += "\n\nFailure caused by: " + cause.toString(); |
1471 | 73 | else | 76 | } else { |
1472 | 74 | errorMessage += "\n\nThe exporter class did not offer further explanation."; | 77 | errorMessage += "\n\nThe exporter class did not offer further explanation."; |
1473 | 78 | } | ||
1474 | 79 | } else if (pcompResult != null && pcompResult.getOutcome() == Outcome.FAILED) { | ||
1475 | 80 | errorMessage += "\n\nPcomp could not compose the STGs."; | ||
1476 | 81 | Throwable cause = pcompResult.getCause(); | ||
1477 | 82 | if (cause != null) { | ||
1478 | 83 | errorMessage += "\n\nFailure caused by: " + cause.toString(); | ||
1479 | 84 | } else { | ||
1480 | 85 | errorMessage += "\n\nFailure caused by the following errors:\n" + new String(pcompResult.getReturnValue().getErrors()); | ||
1481 | 86 | } | ||
1482 | 87 | } else if (punfResult != null && punfResult.getOutcome() == Outcome.FAILED) { | ||
1483 | 88 | errorMessage += "\n\nPunf could not build the unfolding prefix."; | ||
1484 | 89 | Throwable cause = punfResult.getCause(); | ||
1485 | 90 | if (cause != null) { | ||
1486 | 91 | errorMessage += "\n\nFailure caused by: " + cause.toString(); | ||
1487 | 92 | } else { | ||
1488 | 93 | errorMessage += "\n\nFailure caused by the following errors:\n" + new String(punfResult.getReturnValue().getErrors()); | ||
1489 | 94 | } | ||
1490 | 95 | } else if (mpsatResult != null && mpsatResult.getOutcome() == Outcome.FAILED) { | ||
1491 | 96 | errorMessage += "\n\nMPSat failed to execute as expected."; | ||
1492 | 97 | Throwable cause = mpsatResult.getCause(); | ||
1493 | 98 | if (cause != null) { | ||
1494 | 99 | errorMessage += "\n\nFailure caused by: " + cause.toString(); | ||
1495 | 100 | } else { | ||
1496 | 101 | errorMessage += "\n\nFailure caused by the following errors:\n" + new String(mpsatResult.getReturnValue().getErrors()); | ||
1497 | 102 | } | ||
1498 | 75 | } else { | 103 | } else { |
1523 | 76 | Result<? extends ExternalProcessResult> punfResult = result.getReturnValue().getPunfResult(); | 104 | errorMessage += "\n\nMPSat chain task returned failure status without further explanation."; |
1500 | 77 | |||
1501 | 78 | if (punfResult.getOutcome() == Outcome.FAILED) { | ||
1502 | 79 | errorMessage += "\n\nPunf could not build the unfolding prefix."; | ||
1503 | 80 | Throwable cause = punfResult.getCause(); | ||
1504 | 81 | if (cause != null) | ||
1505 | 82 | errorMessage += "\n\nFailure caused by: " + cause.toString() + "\nPlease see the \"Problems\" tab for more details."; | ||
1506 | 83 | else | ||
1507 | 84 | errorMessage += "\n\nFailure caused by the following errors:\n" + new String(punfResult.getReturnValue().getErrors()); | ||
1508 | 85 | } else { | ||
1509 | 86 | Result<? extends ExternalProcessResult> mpsatResult = result.getReturnValue().getMpsatResult(); | ||
1510 | 87 | |||
1511 | 88 | if (mpsatResult.getOutcome() == Outcome.FAILED) { | ||
1512 | 89 | errorMessage += "\n\nMPSat failed to execute as expected."; | ||
1513 | 90 | Throwable cause = mpsatResult.getCause(); | ||
1514 | 91 | if (cause != null) | ||
1515 | 92 | errorMessage += "\n\nFailure caused by: " + cause.toString() + "\nPlease see the \"Problems\" tab for more details."; | ||
1516 | 93 | else | ||
1517 | 94 | errorMessage += "\n\nFailure caused by the following errors:\n" + new String(mpsatResult.getReturnValue().getErrors()); | ||
1518 | 95 | } | ||
1519 | 96 | else { | ||
1520 | 97 | errorMessage += "\n\nMPSat chain task returned failure status without further explanation. This should not have happened -_-a."; | ||
1521 | 98 | } | ||
1522 | 99 | } | ||
1524 | 100 | } | 105 | } |
1525 | 101 | } | 106 | } |
1526 | 102 | SwingUtilities.invokeLater(new Runnable() { | 107 | SwingUtilities.invokeLater(new Runnable() { |
1527 | 103 | @Override | 108 | @Override |
1528 | 104 | public void run() { | 109 | public void run() { |
1530 | 105 | JOptionPane.showMessageDialog(null, errorMessage, "Oops..", JOptionPane.ERROR_MESSAGE); } | 110 | JOptionPane.showMessageDialog(null, errorMessage, "Oops..", JOptionPane.ERROR_MESSAGE); |
1531 | 111 | } | ||
1532 | 106 | }); | 112 | }); |
1533 | 107 | } | 113 | } |
1534 | 108 | } | 114 | } |
1535 | 109 | } | ||
1536 | 110 | \ No newline at end of file | 115 | \ No newline at end of file |
1537 | 116 | |||
1538 | 117 | } | ||
1539 | 111 | 118 | ||
1540 | === modified file 'MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatMode.java' | |||
1541 | --- MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatMode.java 2010-10-06 15:51:01 +0000 | |||
1542 | +++ MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatMode.java 2014-04-29 16:24:51 +0000 | |||
1543 | @@ -4,6 +4,7 @@ | |||
1544 | 4 | package org.workcraft.plugins.mpsat; | 4 | package org.workcraft.plugins.mpsat; |
1545 | 5 | 5 | ||
1546 | 6 | public enum MpsatMode { | 6 | public enum MpsatMode { |
1547 | 7 | UNDEFINED (null, null, false), // Special mode to integrate foreign tasks into Mpsat toolchain (export, composition, unfolding) | ||
1548 | 7 | DEADLOCK ("-D", "Deadlock checking", false), | 8 | DEADLOCK ("-D", "Deadlock checking", false), |
1549 | 8 | REACHABILITY ("-F", "Reachability analysis", true), | 9 | REACHABILITY ("-F", "Reachability analysis", true), |
1550 | 9 | STG_REACHABILITY ("-Fs", "STG reachability analysis", true), | 10 | STG_REACHABILITY ("-Fs", "STG reachability analysis", true), |
1551 | @@ -20,8 +21,7 @@ | |||
1552 | 20 | private String description; | 21 | private String description; |
1553 | 21 | private boolean reach; | 22 | private boolean reach; |
1554 | 22 | 23 | ||
1557 | 23 | public static final MpsatMode[] modes = | 24 | public static final MpsatMode[] modes = { |
1556 | 24 | { | ||
1558 | 25 | DEADLOCK, | 25 | DEADLOCK, |
1559 | 26 | REACHABILITY, | 26 | REACHABILITY, |
1560 | 27 | STG_REACHABILITY, | 27 | STG_REACHABILITY, |
1561 | 28 | 28 | ||
1562 | === modified file 'MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatSettings.java' | |||
1563 | --- MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatSettings.java 2014-04-16 21:55:15 +0000 | |||
1564 | +++ MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatSettings.java 2014-04-29 16:24:51 +0000 | |||
1565 | @@ -6,9 +6,14 @@ | |||
1566 | 6 | import java.io.File; | 6 | import java.io.File; |
1567 | 7 | import java.io.IOException; | 7 | import java.io.IOException; |
1568 | 8 | import java.util.ArrayList; | 8 | import java.util.ArrayList; |
1569 | 9 | import java.util.HashSet; | ||
1570 | 9 | import java.util.LinkedHashMap; | 10 | import java.util.LinkedHashMap; |
1571 | 10 | import java.util.Map; | 11 | import java.util.Map; |
1572 | 11 | 12 | ||
1573 | 13 | import org.workcraft.dom.Node; | ||
1574 | 14 | import org.workcraft.plugins.stg.STG; | ||
1575 | 15 | import org.workcraft.plugins.stg.SignalTransition; | ||
1576 | 16 | import org.workcraft.plugins.stg.SignalTransition.Type; | ||
1577 | 12 | import org.workcraft.util.FileUtils; | 17 | import org.workcraft.util.FileUtils; |
1578 | 13 | 18 | ||
1579 | 14 | public class MpsatSettings { | 19 | public class MpsatSettings { |
1580 | @@ -33,12 +38,12 @@ | |||
1581 | 33 | } | 38 | } |
1582 | 34 | } | 39 | } |
1583 | 35 | 40 | ||
1590 | 36 | private String name = null; | 41 | private final String name; |
1591 | 37 | private MpsatMode mode = MpsatMode.DEADLOCK; | 42 | private final MpsatMode mode; |
1592 | 38 | private int verbosity = 0; | 43 | private final int verbosity; |
1593 | 39 | private SolutionMode solutionMode = SolutionMode.FIRST; | 44 | private final SolutionMode solutionMode; |
1594 | 40 | private int solutionNumberLimit = 0; | 45 | private final int solutionNumberLimit; |
1595 | 41 | private String reach = ""; | 46 | private final String reach; |
1596 | 42 | 47 | ||
1597 | 43 | // Reach expression for checking signal consistency | 48 | // Reach expression for checking signal consistency |
1598 | 44 | public static final String reachConsistency = | 49 | public static final String reachConsistency = |
1599 | @@ -52,17 +57,121 @@ | |||
1600 | 52 | 57 | ||
1601 | 53 | // Reach expression for checking semimodularity (output persistency) | 58 | // Reach expression for checking semimodularity (output persistency) |
1602 | 54 | public static final String reachSemimodularity = | 59 | public static final String reachSemimodularity = |
1612 | 55 | "card DUMMY != 0 ? fail \"This property can be checked only on STGs without dummies\" :\n"+ | 60 | "card DUMMY != 0 ? fail \"This property can be checked only on STGs without dummies\" :\n" + |
1613 | 56 | " exists t1 in tran EVENTS s.t. sig t1 in LOCAL {\n"+ | 61 | " exists t1 in tran EVENTS s.t. sig t1 in LOCAL {\n" + |
1614 | 57 | " @t1 &\n"+ | 62 | " @t1 &\n" + |
1615 | 58 | " exists t2 in tran EVENTS s.t. sig t2 != sig t1 & card (pre t1 * (pre t2 \\ post t2)) != 0 {\n"+ | 63 | " exists t2 in tran EVENTS s.t. sig t2 != sig t1 & card (pre t1 * (pre t2 \\ post t2)) != 0 {\n" + |
1616 | 59 | " @t2 &\n"+ | 64 | " @t2 &\n" + |
1617 | 60 | " forall t3 in tran EVENTS * (tran sig t1 \\ {t1}) s.t. card (pre t3 * (pre t2 \\ post t2)) = 0 {\n"+ | 65 | " forall t3 in tran EVENTS * (tran sig t1 \\ {t1}) s.t. card (pre t3 * (pre t2 \\ post t2)) = 0 {\n" + |
1618 | 61 | " exists p in pre t3 \\ post t2 { ~$p }\n"+ | 66 | " exists p in pre t3 \\ post t2 { ~$p }\n" + |
1619 | 62 | " }\n"+ | 67 | " }\n" + |
1620 | 63 | " }\n"+ | 68 | " }\n" + |
1621 | 64 | " }\n"; | 69 | " }\n"; |
1622 | 65 | 70 | ||
1623 | 71 | // Reach expression for checking conformation (this is a template, | ||
1624 | 72 | // the list of places needs to be updated for each circuit) | ||
1625 | 73 | public static final String reachConformation = | ||
1626 | 74 | "let CPnames = {\"in1_0\", \"in1_1\", \"in0_0\", \"in0_1\", \"out0_0\", \"out0_1\"},\n" + | ||
1627 | 75 | "CP=gather n in CPnames { P n } {\n" + | ||
1628 | 76 | " exists s in SIGNALS \\ DUMMY {\n" + | ||
1629 | 77 | " exists t in tran s {\n" + | ||
1630 | 78 | " forall p in pre t * CP { $p }\n" + | ||
1631 | 79 | " }\n" + | ||
1632 | 80 | " &\n" + | ||
1633 | 81 | " forall t in tran s {\n" + | ||
1634 | 82 | " exists p in pre t \\ CP { ~$p }\n" + | ||
1635 | 83 | " }\n" + | ||
1636 | 84 | " }\n" + | ||
1637 | 85 | "}\n"; | ||
1638 | 86 | |||
1639 | 87 | // FIXME: Currently Punf does not support dead signals, transitions and places well | ||
1640 | 88 | // (e.g. a dead transition may disappear from unfolding), therefore the | ||
1641 | 89 | // conformation property cannot be checked reliably. | ||
1642 | 90 | public static String genReachConformation(STG stg, STG circuitStg) { | ||
1643 | 91 | // Form a set of system STG places which came from the circuitStg | ||
1644 | 92 | HashSet<Node> circuitPlaces = new HashSet<Node>(); | ||
1645 | 93 | for (Type type: Type.values()) { | ||
1646 | 94 | for (String s : circuitStg.getSignalNames(type)) { | ||
1647 | 95 | Node p0 = stg.getNodeByReference(s + "_0"); | ||
1648 | 96 | if (p0 == null) { | ||
1649 | 97 | p0 = stg.getNodeByReference("<" + s + "-," + s + "+>"); | ||
1650 | 98 | } | ||
1651 | 99 | if (p0 != null) { | ||
1652 | 100 | circuitPlaces.add(p0); | ||
1653 | 101 | } | ||
1654 | 102 | Node p1 = stg.getNodeByReference(s + "_1"); | ||
1655 | 103 | if (p1 == null) { | ||
1656 | 104 | p1 = stg.getNodeByReference("<" + s + "+," + s + "->"); | ||
1657 | 105 | } | ||
1658 | 106 | if (p1 != null) { | ||
1659 | 107 | circuitPlaces.add(p1); | ||
1660 | 108 | } | ||
1661 | 109 | } | ||
1662 | 110 | } | ||
1663 | 111 | // Generate Reach expression | ||
1664 | 112 | String result = ""; | ||
1665 | 113 | for (String s : circuitStg.getSignalNames(Type.OUTPUT)) { | ||
1666 | 114 | String circuitPredicate = ""; | ||
1667 | 115 | String environmentPredicate = ""; | ||
1668 | 116 | for (SignalTransition t: stg.getSignalTransitions(Type.OUTPUT)) { | ||
1669 | 117 | if (!t.getSignalName().equals(s)) continue; | ||
1670 | 118 | String circuitPreset = ""; | ||
1671 | 119 | String environmentPreset = ""; | ||
1672 | 120 | for (Node p: stg.getPreset(t)) { | ||
1673 | 121 | String name = stg.getNodeReference(p); | ||
1674 | 122 | if (circuitPlaces.contains(p)) { | ||
1675 | 123 | if (circuitPreset.isEmpty()) { | ||
1676 | 124 | circuitPreset += "{"; | ||
1677 | 125 | } else { | ||
1678 | 126 | circuitPreset += ", "; | ||
1679 | 127 | } | ||
1680 | 128 | circuitPreset += "\"" + name + "\""; | ||
1681 | 129 | } else { | ||
1682 | 130 | if (environmentPreset.isEmpty()) { | ||
1683 | 131 | environmentPreset += "{"; | ||
1684 | 132 | } else { | ||
1685 | 133 | environmentPreset += ", "; | ||
1686 | 134 | } | ||
1687 | 135 | environmentPreset += "\"" + name + "\""; | ||
1688 | 136 | } | ||
1689 | 137 | } | ||
1690 | 138 | circuitPreset += "}"; | ||
1691 | 139 | environmentPreset += "}"; | ||
1692 | 140 | |||
1693 | 141 | if (circuitPredicate.isEmpty()) { | ||
1694 | 142 | circuitPredicate += " (\n"; | ||
1695 | 143 | } else { | ||
1696 | 144 | circuitPredicate += " |\n"; | ||
1697 | 145 | } | ||
1698 | 146 | circuitPredicate += " forall p in " + circuitPreset + " {\n"; | ||
1699 | 147 | circuitPredicate += " $ P p\n"; | ||
1700 | 148 | circuitPredicate += " }\n"; | ||
1701 | 149 | |||
1702 | 150 | if (environmentPredicate.isEmpty()) { | ||
1703 | 151 | environmentPredicate += " (\n"; | ||
1704 | 152 | } else { | ||
1705 | 153 | environmentPredicate += " &\n"; | ||
1706 | 154 | } | ||
1707 | 155 | environmentPredicate += " exists p in " + environmentPreset + " {\n"; | ||
1708 | 156 | environmentPredicate += " ~$ P p\n"; | ||
1709 | 157 | environmentPredicate += " }\n"; | ||
1710 | 158 | } | ||
1711 | 159 | circuitPredicate += " )\n"; | ||
1712 | 160 | environmentPredicate += " )\n"; | ||
1713 | 161 | if (!result.isEmpty()) { | ||
1714 | 162 | result += "|\n"; | ||
1715 | 163 | } | ||
1716 | 164 | result += "/* Conformation check for signal " + s + " */\n"; | ||
1717 | 165 | result += "(\n"; | ||
1718 | 166 | result += circuitPredicate; | ||
1719 | 167 | result += " &\n"; | ||
1720 | 168 | result += environmentPredicate; | ||
1721 | 169 | result += ")\n"; | ||
1722 | 170 | } | ||
1723 | 171 | return result; | ||
1724 | 172 | } | ||
1725 | 173 | |||
1726 | 174 | |||
1727 | 66 | public MpsatSettings(String name, MpsatMode mode, int verbosity, SolutionMode solutionMode, int solutionNumberLimit, String reach) { | 175 | public MpsatSettings(String name, MpsatMode mode, int verbosity, SolutionMode solutionMode, int solutionNumberLimit, String reach) { |
1728 | 67 | super(); | 176 | super(); |
1729 | 68 | this.name = name; | 177 | this.name = name; |
1730 | @@ -122,10 +231,11 @@ | |||
1731 | 122 | break; | 231 | break; |
1732 | 123 | case ALL: | 232 | case ALL: |
1733 | 124 | int solutionNumberLimit = getSolutionNumberLimit(); | 233 | int solutionNumberLimit = getSolutionNumberLimit(); |
1735 | 125 | if (solutionNumberLimit>0) | 234 | if (solutionNumberLimit>0) { |
1736 | 126 | args.add("-a" + Integer.toString(solutionNumberLimit)); | 235 | args.add("-a" + Integer.toString(solutionNumberLimit)); |
1738 | 127 | else | 236 | } else { |
1739 | 128 | args.add("-a"); | 237 | args.add("-a"); |
1740 | 238 | } | ||
1741 | 129 | } | 239 | } |
1742 | 130 | 240 | ||
1743 | 131 | return args.toArray(new String[args.size()]); | 241 | return args.toArray(new String[args.size()]); |
1744 | 132 | 242 | ||
1745 | === modified file 'MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatStgReachabilityResultHandler.java' | |||
1746 | --- MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatStgReachabilityResultHandler.java 2014-04-16 21:55:15 +0000 | |||
1747 | +++ MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatStgReachabilityResultHandler.java 2014-04-29 16:24:51 +0000 | |||
1748 | @@ -22,24 +22,32 @@ | |||
1749 | 22 | this.result = result; | 22 | this.result = result; |
1750 | 23 | } | 23 | } |
1751 | 24 | 24 | ||
1752 | 25 | private String getPropertyName() { | ||
1753 | 26 | String propertyName; | ||
1754 | 27 | MpsatSettings settings = task.getSettings(); | ||
1755 | 28 | if (settings != null && settings.getName() != null) { | ||
1756 | 29 | propertyName = settings.getName(); | ||
1757 | 30 | } else { | ||
1758 | 31 | propertyName = "The property"; | ||
1759 | 32 | } | ||
1760 | 33 | return propertyName; | ||
1761 | 34 | } | ||
1762 | 25 | 35 | ||
1763 | 26 | @Override | 36 | @Override |
1764 | 27 | public void run() { | 37 | public void run() { |
1765 | 28 | MpsatResultParser mdp = new MpsatResultParser(result.getReturnValue().getMpsatResult().getReturnValue()); | 38 | MpsatResultParser mdp = new MpsatResultParser(result.getReturnValue().getMpsatResult().getReturnValue()); |
1766 | 29 | List<Trace> solutions = mdp.getSolutions(); | 39 | List<Trace> solutions = mdp.getSolutions(); |
1771 | 30 | String propertyName = task.getSettings().getName(); | 40 | String message = result.getReturnValue().getMessage(); |
1768 | 31 | if (propertyName == null) { | ||
1769 | 32 | propertyName = "The property"; | ||
1770 | 33 | } | ||
1772 | 34 | if (!solutions.isEmpty()) { | 41 | if (!solutions.isEmpty()) { |
1774 | 35 | String message = propertyName + " is violated with the following trace:\n"; | 42 | if (message == null) { |
1775 | 43 | message = getPropertyName() + " is violated with the following trace:\n"; | ||
1776 | 44 | } | ||
1777 | 36 | final SolutionsDialog solutionsDialog = new SolutionsDialog(task, message, solutions); | 45 | final SolutionsDialog solutionsDialog = new SolutionsDialog(task, message, solutions); |
1778 | 37 | GUI.centerAndSizeToParent(solutionsDialog, task.getFramework().getMainWindow()); | 46 | GUI.centerAndSizeToParent(solutionsDialog, task.getFramework().getMainWindow()); |
1779 | 38 | solutionsDialog.setVisible(true); | 47 | solutionsDialog.setVisible(true); |
1780 | 39 | } else { | 48 | } else { |
1781 | 40 | String message = result.getReturnValue().getMessage(); | ||
1782 | 41 | if (message == null) { | 49 | if (message == null) { |
1784 | 42 | message = propertyName + " is satisfied."; | 50 | message = getPropertyName() + " is satisfied."; |
1785 | 43 | } | 51 | } |
1786 | 44 | JOptionPane.showMessageDialog(null, message); | 52 | JOptionPane.showMessageDialog(null, message); |
1787 | 45 | } | 53 | } |
1788 | 46 | 54 | ||
1789 | === added file 'MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatUndefinedResultHandler.java' | |||
1790 | --- MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatUndefinedResultHandler.java 1970-01-01 00:00:00 +0000 | |||
1791 | +++ MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatUndefinedResultHandler.java 2014-04-29 16:24:51 +0000 | |||
1792 | @@ -0,0 +1,32 @@ | |||
1793 | 1 | package org.workcraft.plugins.mpsat; | ||
1794 | 2 | |||
1795 | 3 | import javax.swing.JOptionPane; | ||
1796 | 4 | |||
1797 | 5 | import org.workcraft.plugins.mpsat.tasks.MpsatChainResult; | ||
1798 | 6 | import org.workcraft.plugins.mpsat.tasks.MpsatChainTask; | ||
1799 | 7 | import org.workcraft.tasks.Result; | ||
1800 | 8 | |||
1801 | 9 | |||
1802 | 10 | final class MpsatUndefinedResultHandler implements Runnable { | ||
1803 | 11 | |||
1804 | 12 | private final Result<? extends MpsatChainResult> result; | ||
1805 | 13 | private final MpsatChainTask task; | ||
1806 | 14 | |||
1807 | 15 | MpsatUndefinedResultHandler(MpsatChainTask task, Result<? extends MpsatChainResult> result) { | ||
1808 | 16 | this.task = task; | ||
1809 | 17 | this.result = result; | ||
1810 | 18 | } | ||
1811 | 19 | |||
1812 | 20 | @Override | ||
1813 | 21 | public void run() { | ||
1814 | 22 | String message = result.getReturnValue().getMessage(); | ||
1815 | 23 | if (message == null) { | ||
1816 | 24 | MpsatSettings settings = task.getSettings(); | ||
1817 | 25 | if (settings != null && settings.getName() != null) { | ||
1818 | 26 | message = settings.getName(); | ||
1819 | 27 | } | ||
1820 | 28 | } | ||
1821 | 29 | JOptionPane.showMessageDialog(null, message); | ||
1822 | 30 | } | ||
1823 | 31 | |||
1824 | 32 | } | ||
1825 | 0 | 33 | ||
1826 | === modified file 'MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatUtilitySettings.java' | |||
1827 | --- MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatUtilitySettings.java 2013-10-15 12:25:49 +0000 | |||
1828 | +++ MpsatPlugin/src/org/workcraft/plugins/mpsat/MpsatUtilitySettings.java 2014-04-29 16:24:51 +0000 | |||
1829 | @@ -35,10 +35,12 @@ | |||
1830 | 35 | private static final String commandKey = "Tools.mpsat.command"; | 35 | private static final String commandKey = "Tools.mpsat.command"; |
1831 | 36 | private static final String solutionModeKey = "Tools.mpsat.solutionMode"; | 36 | private static final String solutionModeKey = "Tools.mpsat.solutionMode"; |
1832 | 37 | private static final String extraArgsKey = "Tools.mpsat.args"; | 37 | private static final String extraArgsKey = "Tools.mpsat.args"; |
1833 | 38 | private static final String debugReachKey = "Tools.mpsat.debugReach"; | ||
1834 | 38 | 39 | ||
1835 | 39 | private static String command = "mpsat"; | 40 | private static String command = "mpsat"; |
1836 | 40 | private static SolutionMode solutionMode = SolutionMode.MINIMUM_COST; | 41 | private static SolutionMode solutionMode = SolutionMode.MINIMUM_COST; |
1837 | 41 | private static String extraArgs = ""; | 42 | private static String extraArgs = ""; |
1838 | 43 | private static Boolean debugReach = false; | ||
1839 | 42 | 44 | ||
1840 | 43 | public MpsatUtilitySettings() { | 45 | public MpsatUtilitySettings() { |
1841 | 44 | properties = new LinkedList<PropertyDescriptor>(); | 46 | properties = new LinkedList<PropertyDescriptor>(); |
1842 | @@ -72,6 +74,16 @@ | |||
1843 | 72 | return MpsatUtilitySettings.getExtraArgs(); | 74 | return MpsatUtilitySettings.getExtraArgs(); |
1844 | 73 | } | 75 | } |
1845 | 74 | }); | 76 | }); |
1846 | 77 | |||
1847 | 78 | properties.add(new PropertyDeclaration<MpsatUtilitySettings, Boolean>( | ||
1848 | 79 | this, "MPSat debug", Boolean.class) { | ||
1849 | 80 | protected void setter(MpsatUtilitySettings object, Boolean value) { | ||
1850 | 81 | MpsatUtilitySettings.setDebugReach(value); | ||
1851 | 82 | } | ||
1852 | 83 | protected Boolean getter(MpsatUtilitySettings object) { | ||
1853 | 84 | return MpsatUtilitySettings.getDebugReach(); | ||
1854 | 85 | } | ||
1855 | 86 | }); | ||
1856 | 75 | } | 87 | } |
1857 | 76 | 88 | ||
1858 | 77 | @Override | 89 | @Override |
1859 | @@ -84,6 +96,7 @@ | |||
1860 | 84 | command = config.getString(commandKey, "mpsat"); | 96 | command = config.getString(commandKey, "mpsat"); |
1861 | 85 | solutionMode = config.getEnum(solutionModeKey, SolutionMode.class, SolutionMode.FIRST); | 97 | solutionMode = config.getEnum(solutionModeKey, SolutionMode.class, SolutionMode.FIRST); |
1862 | 86 | extraArgs = config.getString(extraArgsKey, ""); | 98 | extraArgs = config.getString(extraArgsKey, ""); |
1863 | 99 | debugReach = config.getBoolean(debugReachKey, false); | ||
1864 | 87 | } | 100 | } |
1865 | 88 | 101 | ||
1866 | 89 | @Override | 102 | @Override |
1867 | @@ -91,6 +104,7 @@ | |||
1868 | 91 | config.set(commandKey, command); | 104 | config.set(commandKey, command); |
1869 | 92 | config.setEnum(solutionModeKey, SolutionMode.class, solutionMode); | 105 | config.setEnum(solutionModeKey, SolutionMode.class, solutionMode); |
1870 | 93 | config.set(extraArgsKey, extraArgs); | 106 | config.set(extraArgsKey, extraArgs); |
1871 | 107 | config.setBoolean(debugReachKey, debugReach); | ||
1872 | 94 | } | 108 | } |
1873 | 95 | 109 | ||
1874 | 96 | @Override | 110 | @Override |
1875 | @@ -130,4 +144,12 @@ | |||
1876 | 130 | public static int getSolutionCount() { | 144 | public static int getSolutionCount() { |
1877 | 131 | return (MpsatUtilitySettings.solutionMode == SolutionMode.ALL) ? 10 : 1; | 145 | return (MpsatUtilitySettings.solutionMode == SolutionMode.ALL) ? 10 : 1; |
1878 | 132 | } | 146 | } |
1879 | 147 | |||
1880 | 148 | public static Boolean getDebugReach() { | ||
1881 | 149 | return debugReach; | ||
1882 | 150 | } | ||
1883 | 151 | |||
1884 | 152 | public static void setDebugReach(Boolean debug) { | ||
1885 | 153 | MpsatUtilitySettings.debugReach = debug; | ||
1886 | 154 | } | ||
1887 | 133 | } | 155 | } |
1888 | 134 | \ No newline at end of file | 156 | \ No newline at end of file |
1889 | 135 | 157 | ||
1890 | === modified file 'MpsatPlugin/src/org/workcraft/plugins/mpsat/gui/MpsatConfigurationDialog.java' | |||
1891 | --- MpsatPlugin/src/org/workcraft/plugins/mpsat/gui/MpsatConfigurationDialog.java 2014-04-16 22:13:32 +0000 | |||
1892 | +++ MpsatPlugin/src/org/workcraft/plugins/mpsat/gui/MpsatConfigurationDialog.java 2014-04-29 16:24:51 +0000 | |||
1893 | @@ -154,7 +154,7 @@ | |||
1894 | 154 | } | 154 | } |
1895 | 155 | 155 | ||
1896 | 156 | private void createSolutionModeButtons() { | 156 | private void createSolutionModeButtons() { |
1898 | 157 | firstSolutionButton = new JRadioButton ("Find any solution (default)"); | 157 | firstSolutionButton = new JRadioButton ("Find any solution"); |
1899 | 158 | firstSolutionButton.setSelected(true); | 158 | firstSolutionButton.setSelected(true); |
1900 | 159 | firstSolutionButton.addActionListener(new ActionListener() { | 159 | firstSolutionButton.addActionListener(new ActionListener() { |
1901 | 160 | @Override | 160 | @Override |
1902 | 161 | 161 | ||
1903 | === modified file 'MpsatPlugin/src/org/workcraft/plugins/mpsat/gui/SolutionPanel.java' | |||
1904 | --- MpsatPlugin/src/org/workcraft/plugins/mpsat/gui/SolutionPanel.java 2014-04-16 21:55:15 +0000 | |||
1905 | +++ MpsatPlugin/src/org/workcraft/plugins/mpsat/gui/SolutionPanel.java 2014-04-29 16:24:51 +0000 | |||
1906 | @@ -43,7 +43,7 @@ | |||
1907 | 43 | 43 | ||
1908 | 44 | JButton saveButton = new JButton("Save"); | 44 | JButton saveButton = new JButton("Save"); |
1909 | 45 | 45 | ||
1911 | 46 | JButton playButton = new JButton("Play trace"); | 46 | JButton playButton = new JButton("Play"); |
1912 | 47 | playButton.addActionListener(new ActionListener() | 47 | playButton.addActionListener(new ActionListener() |
1913 | 48 | { | 48 | { |
1914 | 49 | @Override | 49 | @Override |
1915 | 50 | 50 | ||
1916 | === modified file 'MpsatPlugin/src/org/workcraft/plugins/mpsat/tasks/MpsatChainResult.java' | |||
1917 | --- MpsatPlugin/src/org/workcraft/plugins/mpsat/tasks/MpsatChainResult.java 2010-11-18 02:08:34 +0000 | |||
1918 | +++ MpsatPlugin/src/org/workcraft/plugins/mpsat/tasks/MpsatChainResult.java 2014-04-29 16:24:51 +0000 | |||
1919 | @@ -5,38 +5,47 @@ | |||
1920 | 5 | import org.workcraft.tasks.Result; | 5 | import org.workcraft.tasks.Result; |
1921 | 6 | 6 | ||
1922 | 7 | public class MpsatChainResult { | 7 | public class MpsatChainResult { |
1923 | 8 | private Result<? extends Object> exportResult; | ||
1924 | 9 | private Result<? extends ExternalProcessResult> pcompResult; | ||
1925 | 8 | private Result<? extends ExternalProcessResult> punfResult; | 10 | private Result<? extends ExternalProcessResult> punfResult; |
1926 | 9 | private Result<? extends ExternalProcessResult> mpsatResult; | 11 | private Result<? extends ExternalProcessResult> mpsatResult; |
1927 | 10 | private Result<? extends Object> exportResult; | ||
1928 | 11 | private MpsatSettings mpsatSettings; | 12 | private MpsatSettings mpsatSettings; |
1929 | 12 | private String message; | 13 | private String message; |
1930 | 14 | |||
1931 | 15 | public MpsatChainResult(Result<? extends Object> exportResult, | ||
1932 | 16 | Result<? extends ExternalProcessResult> pcompResult, | ||
1933 | 17 | Result<? extends ExternalProcessResult> punfResult, | ||
1934 | 18 | Result<? extends ExternalProcessResult> mpsatResult, | ||
1935 | 19 | MpsatSettings mpsatSettings, String message) { | ||
1936 | 13 | 20 | ||
1937 | 21 | this.exportResult = exportResult; | ||
1938 | 22 | this.pcompResult = pcompResult; | ||
1939 | 23 | this.punfResult = punfResult; | ||
1940 | 24 | this.mpsatResult = mpsatResult; | ||
1941 | 25 | this.mpsatSettings = mpsatSettings; | ||
1942 | 26 | this.message = message; | ||
1943 | 27 | } | ||
1944 | 28 | |||
1945 | 14 | public MpsatChainResult(Result<? extends Object> exportResult, | 29 | public MpsatChainResult(Result<? extends Object> exportResult, |
1947 | 15 | Result<? extends ExternalProcessResult> punfResult, | 30 | Result<? extends ExternalProcessResult> pcompResult, |
1948 | 31 | Result<? extends ExternalProcessResult> punfResult, | ||
1949 | 16 | Result<? extends ExternalProcessResult> mpsatResult, | 32 | Result<? extends ExternalProcessResult> mpsatResult, |
1950 | 17 | MpsatSettings mpsatSettings) { | 33 | MpsatSettings mpsatSettings) { |
1968 | 18 | this.punfResult = punfResult; | 34 | |
1969 | 19 | this.mpsatResult = mpsatResult; | 35 | this(exportResult, pcompResult, punfResult, mpsatResult, mpsatSettings, null); |
1953 | 20 | this.exportResult = exportResult; | ||
1954 | 21 | this.mpsatSettings = mpsatSettings; | ||
1955 | 22 | } | ||
1956 | 23 | |||
1957 | 24 | public MpsatChainResult(Result<? extends Object> exportResult, | ||
1958 | 25 | Result<? extends ExternalProcessResult> punfResult, | ||
1959 | 26 | Result<? extends ExternalProcessResult> mpsatResult, | ||
1960 | 27 | MpsatSettings mpsatSettings, String message) { | ||
1961 | 28 | |||
1962 | 29 | this.punfResult = punfResult; | ||
1963 | 30 | this.mpsatResult = mpsatResult; | ||
1964 | 31 | this.exportResult = exportResult; | ||
1965 | 32 | this.mpsatSettings = mpsatSettings; | ||
1966 | 33 | |||
1967 | 34 | this.message = message; | ||
1970 | 35 | } | 36 | } |
1971 | 36 | 37 | ||
1972 | 37 | public MpsatSettings getMpsatSettings() { | 38 | public MpsatSettings getMpsatSettings() { |
1973 | 38 | return mpsatSettings; | 39 | return mpsatSettings; |
1974 | 39 | } | 40 | } |
1975 | 41 | |||
1976 | 42 | public Result<? extends Object> getExportResult() { | ||
1977 | 43 | return exportResult; | ||
1978 | 44 | } | ||
1979 | 45 | |||
1980 | 46 | public Result<? extends ExternalProcessResult> getPcompResult() { | ||
1981 | 47 | return pcompResult; | ||
1982 | 48 | } | ||
1983 | 40 | 49 | ||
1984 | 41 | public Result<? extends ExternalProcessResult> getPunfResult() { | 50 | public Result<? extends ExternalProcessResult> getPunfResult() { |
1985 | 42 | return punfResult; | 51 | return punfResult; |
1986 | @@ -49,8 +58,4 @@ | |||
1987 | 49 | public String getMessage() { | 58 | public String getMessage() { |
1988 | 50 | return message; | 59 | return message; |
1989 | 51 | } | 60 | } |
1990 | 52 | |||
1991 | 53 | public Result<? extends Object> getExportResult() { | ||
1992 | 54 | return exportResult; | ||
1993 | 55 | } | ||
1994 | 56 | } | 61 | } |
1995 | 57 | \ No newline at end of file | 62 | \ No newline at end of file |
1996 | 58 | 63 | ||
1997 | === modified file 'MpsatPlugin/src/org/workcraft/plugins/mpsat/tasks/MpsatChainTask.java' | |||
1998 | --- MpsatPlugin/src/org/workcraft/plugins/mpsat/tasks/MpsatChainTask.java 2014-04-16 21:55:15 +0000 | |||
1999 | +++ MpsatPlugin/src/org/workcraft/plugins/mpsat/tasks/MpsatChainTask.java 2014-04-29 16:24:51 +0000 | |||
2000 | @@ -50,7 +50,7 @@ | |||
2001 | 50 | netFile.delete(); | 50 | netFile.delete(); |
2002 | 51 | if (exportResult.getOutcome() == Outcome.CANCELLED) | 51 | if (exportResult.getOutcome() == Outcome.CANCELLED) |
2003 | 52 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | 52 | return new Result<MpsatChainResult>(Outcome.CANCELLED); |
2005 | 53 | return new Result<MpsatChainResult>(Outcome.FAILED, new MpsatChainResult(exportResult, null, null, settings)); | 53 | return new Result<MpsatChainResult>(Outcome.FAILED, new MpsatChainResult(exportResult, null, null, null, settings)); |
2006 | 54 | } | 54 | } |
2007 | 55 | monitor.progressUpdate(0.33); | 55 | monitor.progressUpdate(0.33); |
2008 | 56 | 56 | ||
2009 | @@ -63,7 +63,7 @@ | |||
2010 | 63 | mciFile.delete(); | 63 | mciFile.delete(); |
2011 | 64 | if (punfResult.getOutcome() == Outcome.CANCELLED) | 64 | if (punfResult.getOutcome() == Outcome.CANCELLED) |
2012 | 65 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | 65 | return new Result<MpsatChainResult>(Outcome.CANCELLED); |
2014 | 66 | return new Result<MpsatChainResult>(Outcome.FAILED, new MpsatChainResult(exportResult, punfResult, null, settings)); | 66 | return new Result<MpsatChainResult>(Outcome.FAILED, new MpsatChainResult(exportResult, null, punfResult, null, settings)); |
2015 | 67 | } | 67 | } |
2016 | 68 | 68 | ||
2017 | 69 | monitor.progressUpdate(0.66); | 69 | monitor.progressUpdate(0.66); |
2018 | @@ -75,12 +75,12 @@ | |||
2019 | 75 | if (mpsatResult.getOutcome() != Outcome.FINISHED) { | 75 | if (mpsatResult.getOutcome() != Outcome.FINISHED) { |
2020 | 76 | if (mpsatResult.getOutcome() == Outcome.CANCELLED) | 76 | if (mpsatResult.getOutcome() == Outcome.CANCELLED) |
2021 | 77 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | 77 | return new Result<MpsatChainResult>(Outcome.CANCELLED); |
2023 | 78 | return new Result<MpsatChainResult>(Outcome.FAILED, new MpsatChainResult(exportResult, punfResult, mpsatResult, settings )); | 78 | return new Result<MpsatChainResult>(Outcome.FAILED, new MpsatChainResult(exportResult, null, punfResult, mpsatResult, settings )); |
2024 | 79 | } | 79 | } |
2025 | 80 | 80 | ||
2026 | 81 | monitor.progressUpdate(1.0); | 81 | monitor.progressUpdate(1.0); |
2027 | 82 | 82 | ||
2029 | 83 | return new Result<MpsatChainResult>(Outcome.FINISHED, new MpsatChainResult(exportResult, punfResult, mpsatResult, settings)); | 83 | return new Result<MpsatChainResult>(Outcome.FINISHED, new MpsatChainResult(exportResult, null, punfResult, mpsatResult, settings)); |
2030 | 84 | } catch (Throwable e) { | 84 | } catch (Throwable e) { |
2031 | 85 | return new Result<MpsatChainResult>(e); | 85 | return new Result<MpsatChainResult>(e); |
2032 | 86 | } | 86 | } |
2033 | 87 | 87 | ||
2034 | === modified file 'MpsatPlugin/src/org/workcraft/plugins/pcomp/tasks/PcompResultHandler.java' | |||
2035 | --- MpsatPlugin/src/org/workcraft/plugins/pcomp/tasks/PcompResultHandler.java 2010-09-21 15:39:20 +0000 | |||
2036 | +++ MpsatPlugin/src/org/workcraft/plugins/pcomp/tasks/PcompResultHandler.java 2014-04-29 16:24:51 +0000 | |||
2037 | @@ -40,9 +40,9 @@ | |||
2038 | 40 | if (result.getCause() != null) { | 40 | if (result.getCause() != null) { |
2039 | 41 | message = result.getCause().getMessage(); | 41 | message = result.getCause().getMessage(); |
2040 | 42 | result.getCause().printStackTrace(); | 42 | result.getCause().printStackTrace(); |
2043 | 43 | } | 43 | } else { |
2042 | 44 | else | ||
2044 | 45 | message = "Pcomp errors: \n" + new String(result.getReturnValue().getErrors()); | 44 | message = "Pcomp errors: \n" + new String(result.getReturnValue().getErrors()); |
2045 | 45 | } | ||
2046 | 46 | JOptionPane.showMessageDialog(framework.getMainWindow(), message, "Parallel composition failed", JOptionPane.ERROR_MESSAGE); | 46 | JOptionPane.showMessageDialog(framework.getMainWindow(), message, "Parallel composition failed", JOptionPane.ERROR_MESSAGE); |
2047 | 47 | } else if (result.getOutcome() == Outcome.FINISHED) { | 47 | } else if (result.getOutcome() == Outcome.FINISHED) { |
2048 | 48 | try { | 48 | try { |
2049 | 49 | 49 | ||
2050 | === modified file 'MpsatPlugin/src/org/workcraft/plugins/pcomp/tools/PcompTool.java' | |||
2051 | --- MpsatPlugin/src/org/workcraft/plugins/pcomp/tools/PcompTool.java 2014-04-16 17:52:01 +0000 | |||
2052 | +++ MpsatPlugin/src/org/workcraft/plugins/pcomp/tools/PcompTool.java 2014-04-29 16:24:51 +0000 | |||
2053 | @@ -45,7 +45,9 @@ | |||
2054 | 45 | inputs.add(dotGProvider.getDotG(p)); | 45 | inputs.add(dotGProvider.getDotG(p)); |
2055 | 46 | } | 46 | } |
2056 | 47 | 47 | ||
2058 | 48 | framework.getTaskManager().queue(new PcompTask(inputs.toArray(new File[0]), dialog.getMode(), dialog.isImprovedPcompChecked()), "Running pcomp", new PcompResultHandler(framework, dialog.showInEditor())); | 48 | PcompTask pcompTask = new PcompTask(inputs.toArray(new File[0]), dialog.getMode(), dialog.isImprovedPcompChecked()); |
2059 | 49 | PcompResultHandler pcompResult = new PcompResultHandler(framework, dialog.showInEditor()); | ||
2060 | 50 | framework.getTaskManager().queue(pcompTask, "Running pcomp", pcompResult); | ||
2061 | 49 | } | 51 | } |
2062 | 50 | } | 52 | } |
2063 | 51 | 53 | ||
2064 | 52 | 54 | ||
2065 | === modified file 'PolicyNetPlugin/src/org/workcraft/plugins/policy/tasks/CheckDeadlockTask.java' | |||
2066 | --- PolicyNetPlugin/src/org/workcraft/plugins/policy/tasks/CheckDeadlockTask.java 2014-04-16 21:55:15 +0000 | |||
2067 | +++ PolicyNetPlugin/src/org/workcraft/plugins/policy/tasks/CheckDeadlockTask.java 2014-04-29 16:24:51 +0000 | |||
2068 | @@ -53,20 +53,24 @@ | |||
2069 | 53 | File netFile = File.createTempFile("net", exporter.getExtenstion()); | 53 | File netFile = File.createTempFile("net", exporter.getExtenstion()); |
2070 | 54 | ExportTask exportTask = new ExportTask(exporter, model, netFile.getCanonicalPath()); | 54 | ExportTask exportTask = new ExportTask(exporter, model, netFile.getCanonicalPath()); |
2071 | 55 | SubtaskMonitor<Object> mon = new SubtaskMonitor<Object>(monitor); | 55 | SubtaskMonitor<Object> mon = new SubtaskMonitor<Object>(monitor); |
2073 | 56 | Result<? extends Object> exportResult = framework.getTaskManager().execute(exportTask, "Exporting .g", mon); | 56 | Result<? extends Object> exportResult = framework.getTaskManager().execute( |
2074 | 57 | exportTask, "Exporting .g", mon); | ||
2075 | 58 | |||
2076 | 57 | if (exportResult.getOutcome() != Outcome.FINISHED) { | 59 | if (exportResult.getOutcome() != Outcome.FINISHED) { |
2077 | 58 | netFile.delete(); | 60 | netFile.delete(); |
2078 | 59 | if (exportResult.getOutcome() == Outcome.CANCELLED) { | 61 | if (exportResult.getOutcome() == Outcome.CANCELLED) { |
2079 | 60 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | 62 | return new Result<MpsatChainResult>(Outcome.CANCELLED); |
2080 | 61 | } | 63 | } |
2081 | 62 | return new Result<MpsatChainResult>(Outcome.FAILED, | 64 | return new Result<MpsatChainResult>(Outcome.FAILED, |
2083 | 63 | new MpsatChainResult(exportResult, null, null, settings)); | 65 | new MpsatChainResult(exportResult, null, null, null, settings)); |
2084 | 64 | } | 66 | } |
2085 | 65 | monitor.progressUpdate(0.20); | 67 | monitor.progressUpdate(0.20); |
2086 | 66 | 68 | ||
2087 | 67 | File mciFile = File.createTempFile("unfolding", ".mci"); | 69 | File mciFile = File.createTempFile("unfolding", ".mci"); |
2088 | 68 | PunfTask punfTask = new PunfTask(netFile.getCanonicalPath(), mciFile.getCanonicalPath()); | 70 | PunfTask punfTask = new PunfTask(netFile.getCanonicalPath(), mciFile.getCanonicalPath()); |
2090 | 69 | Result<? extends ExternalProcessResult> punfResult = framework.getTaskManager().execute(punfTask, "Unfolding .g", mon); | 71 | Result<? extends ExternalProcessResult> punfResult = framework.getTaskManager().execute( |
2091 | 72 | punfTask, "Unfolding .g", mon); | ||
2092 | 73 | |||
2093 | 70 | netFile.delete(); | 74 | netFile.delete(); |
2094 | 71 | if (punfResult.getOutcome() != Outcome.FINISHED) { | 75 | if (punfResult.getOutcome() != Outcome.FINISHED) { |
2095 | 72 | mciFile.delete(); | 76 | mciFile.delete(); |
2096 | @@ -74,18 +78,21 @@ | |||
2097 | 74 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | 78 | return new Result<MpsatChainResult>(Outcome.CANCELLED); |
2098 | 75 | } | 79 | } |
2099 | 76 | return new Result<MpsatChainResult>(Outcome.FAILED, | 80 | return new Result<MpsatChainResult>(Outcome.FAILED, |
2101 | 77 | new MpsatChainResult(exportResult, punfResult, null, settings)); | 81 | new MpsatChainResult(exportResult, null, punfResult, null, settings)); |
2102 | 78 | } | 82 | } |
2103 | 79 | monitor.progressUpdate(0.70); | 83 | monitor.progressUpdate(0.70); |
2104 | 80 | 84 | ||
2105 | 81 | MpsatTask mpsatTask = new MpsatTask(settings.getMpsatArguments(), mciFile.getCanonicalPath()); | 85 | MpsatTask mpsatTask = new MpsatTask(settings.getMpsatArguments(), mciFile.getCanonicalPath()); |
2107 | 82 | Result<? extends ExternalProcessResult> mpsatResult = framework.getTaskManager().execute(mpsatTask, "Running deadlock checking [MPSat]", mon); | 86 | Result<? extends ExternalProcessResult> mpsatResult = framework.getTaskManager().execute( |
2108 | 87 | mpsatTask, "Running deadlock checking [MPSat]", mon); | ||
2109 | 88 | |||
2110 | 83 | if (mpsatResult.getOutcome() != Outcome.FINISHED) { | 89 | if (mpsatResult.getOutcome() != Outcome.FINISHED) { |
2111 | 84 | if (mpsatResult.getOutcome() == Outcome.CANCELLED) { | 90 | if (mpsatResult.getOutcome() == Outcome.CANCELLED) { |
2112 | 85 | return new Result<MpsatChainResult>(Outcome.CANCELLED); | 91 | return new Result<MpsatChainResult>(Outcome.CANCELLED); |
2113 | 86 | } | 92 | } |
2114 | 87 | return new Result<MpsatChainResult>(Outcome.FAILED, | 93 | return new Result<MpsatChainResult>(Outcome.FAILED, |
2116 | 88 | new MpsatChainResult(exportResult, punfResult, mpsatResult, settings, new String(mpsatResult.getReturnValue().getErrors()))); | 94 | new MpsatChainResult(exportResult, null, punfResult, mpsatResult, settings, |
2117 | 95 | new String(mpsatResult.getReturnValue().getErrors()))); | ||
2118 | 89 | } | 96 | } |
2119 | 90 | monitor.progressUpdate(0.90); | 97 | monitor.progressUpdate(0.90); |
2120 | 91 | 98 | ||
2121 | @@ -93,13 +100,13 @@ | |||
2122 | 93 | if (!mdp.getSolutions().isEmpty()) { | 100 | if (!mdp.getSolutions().isEmpty()) { |
2123 | 94 | mciFile.delete(); | 101 | mciFile.delete(); |
2124 | 95 | return new Result<MpsatChainResult>(Outcome.FINISHED, | 102 | return new Result<MpsatChainResult>(Outcome.FINISHED, |
2126 | 96 | new MpsatChainResult(exportResult, punfResult, mpsatResult, settings, "Policy net has a deadlock")); | 103 | new MpsatChainResult(exportResult, null, punfResult, mpsatResult, settings, "Policy net has a deadlock")); |
2127 | 97 | } | 104 | } |
2128 | 98 | monitor.progressUpdate(1.0); | 105 | monitor.progressUpdate(1.0); |
2129 | 99 | 106 | ||
2130 | 100 | mciFile.delete(); | 107 | mciFile.delete(); |
2131 | 101 | return new Result<MpsatChainResult>(Outcome.FINISHED, | 108 | return new Result<MpsatChainResult>(Outcome.FINISHED, |
2133 | 102 | new MpsatChainResult(exportResult, punfResult, mpsatResult, settings, "Policy net is deadlock-free")); | 109 | new MpsatChainResult(exportResult, null, punfResult, mpsatResult, settings, "Policy net is deadlock-free")); |
2134 | 103 | 110 | ||
2135 | 104 | } catch (Throwable e) { | 111 | } catch (Throwable e) { |
2136 | 105 | return new Result<MpsatChainResult>(e); | 112 | return new Result<MpsatChainResult>(e); |
2137 | 106 | 113 | ||
2138 | === modified file 'STGPlugin/src/org/workcraft/plugins/stg/LabelParser.java' | |||
2139 | --- STGPlugin/src/org/workcraft/plugins/stg/LabelParser.java 2014-04-03 17:30:41 +0000 | |||
2140 | +++ STGPlugin/src/org/workcraft/plugins/stg/LabelParser.java 2014-04-29 16:24:51 +0000 | |||
2141 | @@ -20,7 +20,7 @@ | |||
2142 | 20 | 20 | ||
2143 | 21 | public static Pair<String, String> parseImplicitPlaceReference(String ref) { | 21 | public static Pair<String, String> parseImplicitPlaceReference(String ref) { |
2144 | 22 | String[] parts = ref.replaceAll(" ", "").split(","); | 22 | String[] parts = ref.replaceAll(" ", "").split(","); |
2146 | 23 | if (parts.length < 2 || !parts[0].startsWith("<") || !parts[0].endsWith(">")) { | 23 | if (parts.length < 2 || !parts[0].startsWith("<") || !parts[1].endsWith(">")) { |
2147 | 24 | return null; | 24 | return null; |
2148 | 25 | } | 25 | } |
2149 | 26 | return Pair.of(parts[0].substring(1), parts[1].substring(0, parts[1].length()-1)); | 26 | return Pair.of(parts[0].substring(1), parts[1].substring(0, parts[1].length()-1)); |
2150 | 27 | 27 | ||
2151 | === modified file 'STGPlugin/src/org/workcraft/plugins/stg/STG.java' | |||
2152 | --- STGPlugin/src/org/workcraft/plugins/stg/STG.java 2014-04-22 13:51:18 +0000 | |||
2153 | +++ STGPlugin/src/org/workcraft/plugins/stg/STG.java 2014-04-29 16:24:51 +0000 | |||
2154 | @@ -320,12 +320,8 @@ | |||
2155 | 320 | throw new RuntimeException( | 320 | throw new RuntimeException( |
2156 | 321 | "An implicit place cannot have more that one transition in its preset or postset."); | 321 | "An implicit place cannot have more that one transition in its preset or postset."); |
2157 | 322 | } | 322 | } |
2164 | 323 | return "<" | 323 | return "<" + referenceManager.getNodeReference(preset.iterator().next()) + "," |
2165 | 324 | + referenceManager.getNodeReference(preset.iterator() | 324 | + referenceManager.getNodeReference(postset.iterator().next()) + ">"; |
2160 | 325 | .next()) | ||
2161 | 326 | + "," | ||
2162 | 327 | + referenceManager.getNodeReference(postset.iterator() | ||
2163 | 328 | .next()) + ">"; | ||
2166 | 329 | } else { | 325 | } else { |
2167 | 330 | return referenceManager.getNodeReference(node); | 326 | return referenceManager.getNodeReference(node); |
2168 | 331 | } | 327 | } |
2169 | @@ -335,8 +331,7 @@ | |||
2170 | 335 | } | 331 | } |
2171 | 336 | 332 | ||
2172 | 337 | public Node getNodeByReference(String reference) { | 333 | public Node getNodeByReference(String reference) { |
2175 | 338 | Pair<String, String> implicitPlaceTransitions = LabelParser | 334 | Pair<String, String> implicitPlaceTransitions = LabelParser.parseImplicitPlaceReference(reference); |
2174 | 339 | .parseImplicitPlaceReference(reference); | ||
2176 | 340 | if (implicitPlaceTransitions != null) { | 335 | if (implicitPlaceTransitions != null) { |
2177 | 341 | Node t1 = referenceManager | 336 | Node t1 = referenceManager |
2178 | 342 | .getNodeByReference(implicitPlaceTransitions.getFirst()); | 337 | .getNodeByReference(implicitPlaceTransitions.getFirst()); |
2179 | 343 | 338 | ||
2180 | === modified file 'STGPlugin/src/org/workcraft/plugins/stg/VisualSTG.java' | |||
2181 | --- STGPlugin/src/org/workcraft/plugins/stg/VisualSTG.java 2014-04-17 15:33:40 +0000 | |||
2182 | +++ STGPlugin/src/org/workcraft/plugins/stg/VisualSTG.java 2014-04-29 16:24:51 +0000 | |||
2183 | @@ -246,12 +246,5 @@ | |||
2184 | 246 | } | 246 | } |
2185 | 247 | return null; | 247 | return null; |
2186 | 248 | } | 248 | } |
2187 | 249 | |||
2188 | 250 | public Connection getConnection(Node first, Node second) { | ||
2189 | 251 | for(Connection connection : getConnections(first)) { | ||
2190 | 252 | if (connection.getSecond() == second) return connection; | ||
2191 | 253 | } | ||
2192 | 254 | return null; | ||
2193 | 255 | } | ||
2194 | 256 | 249 | ||
2195 | 257 | } | 250 | } |
2196 | 258 | 251 | ||
2197 | === modified file 'WorkcraftCore/src/org/workcraft/dom/AbstractModel.java' | |||
2198 | --- WorkcraftCore/src/org/workcraft/dom/AbstractModel.java 2014-01-29 19:00:22 +0000 | |||
2199 | +++ WorkcraftCore/src/org/workcraft/dom/AbstractModel.java 2014-04-29 16:24:51 +0000 | |||
2200 | @@ -131,4 +131,12 @@ | |||
2201 | 131 | protected ReferenceManager getReferenceManager() { | 131 | protected ReferenceManager getReferenceManager() { |
2202 | 132 | return referenceManager; | 132 | return referenceManager; |
2203 | 133 | } | 133 | } |
2204 | 134 | } | ||
2205 | 135 | \ No newline at end of file | 134 | \ No newline at end of file |
2206 | 135 | |||
2207 | 136 | public Connection getConnection(Node first, Node second) { | ||
2208 | 137 | for(Connection connection : getConnections(first)) { | ||
2209 | 138 | if (connection.getSecond() == second) return connection; | ||
2210 | 139 | } | ||
2211 | 140 | return null; | ||
2212 | 141 | } | ||
2213 | 142 | |||
2214 | 143 | } | ||
2215 | 136 | 144 | ||
2216 | === modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/FileCellEditor.java' | |||
2217 | --- WorkcraftCore/src/org/workcraft/gui/propertyeditor/FileCellEditor.java 2014-04-09 22:33:19 +0000 | |||
2218 | +++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/FileCellEditor.java 2014-04-29 16:24:51 +0000 | |||
2219 | @@ -11,8 +11,6 @@ | |||
2220 | 11 | import javax.swing.JTable; | 11 | import javax.swing.JTable; |
2221 | 12 | import javax.swing.table.TableCellEditor; | 12 | import javax.swing.table.TableCellEditor; |
2222 | 13 | 13 | ||
2223 | 14 | import org.workcraft.gui.FileFilters; | ||
2224 | 15 | |||
2225 | 16 | @SuppressWarnings("serial") | 14 | @SuppressWarnings("serial") |
2226 | 17 | public class FileCellEditor extends AbstractCellEditor implements TableCellEditor, ActionListener { | 15 | public class FileCellEditor extends AbstractCellEditor implements TableCellEditor, ActionListener { |
2227 | 18 | 16 | ||
2228 | @@ -34,7 +32,6 @@ | |||
2229 | 34 | if (EDIT.equals(e.getActionCommand())) { | 32 | if (EDIT.equals(e.getActionCommand())) { |
2230 | 35 | JFileChooser fc = new JFileChooser(); | 33 | JFileChooser fc = new JFileChooser(); |
2231 | 36 | fc.setDialogType(JFileChooser.OPEN_DIALOG); | 34 | fc.setDialogType(JFileChooser.OPEN_DIALOG); |
2232 | 37 | fc.setFileFilter(FileFilters.DOCUMENT_FILES); | ||
2233 | 38 | fc.setMultiSelectionEnabled(false); | 35 | fc.setMultiSelectionEnabled(false); |
2234 | 39 | fc.setSelectedFile(file); | 36 | fc.setSelectedFile(file); |
2235 | 40 | fc.setDialogTitle("Open environment file"); | 37 | fc.setDialogTitle("Open environment file"); |
2236 | 41 | 38 | ||
2237 | === modified file 'WorkcraftCore/src/org/workcraft/plugins/BuiltinSerialisers.java' | |||
2238 | --- WorkcraftCore/src/org/workcraft/plugins/BuiltinSerialisers.java 2012-05-22 09:39:39 +0000 | |||
2239 | +++ WorkcraftCore/src/org/workcraft/plugins/BuiltinSerialisers.java 2014-04-29 16:24:51 +0000 | |||
2240 | @@ -20,6 +20,8 @@ | |||
2241 | 20 | import org.workcraft.plugins.serialisation.xml.DoubleSerialiser; | 20 | import org.workcraft.plugins.serialisation.xml.DoubleSerialiser; |
2242 | 21 | import org.workcraft.plugins.serialisation.xml.EnumDeserialiser; | 21 | import org.workcraft.plugins.serialisation.xml.EnumDeserialiser; |
2243 | 22 | import org.workcraft.plugins.serialisation.xml.EnumSerialiser; | 22 | import org.workcraft.plugins.serialisation.xml.EnumSerialiser; |
2244 | 23 | import org.workcraft.plugins.serialisation.xml.FileDeserialiser; | ||
2245 | 24 | import org.workcraft.plugins.serialisation.xml.FileSerialiser; | ||
2246 | 23 | import org.workcraft.plugins.serialisation.xml.IntDeserialiser; | 25 | import org.workcraft.plugins.serialisation.xml.IntDeserialiser; |
2247 | 24 | import org.workcraft.plugins.serialisation.xml.IntSerialiser; | 26 | import org.workcraft.plugins.serialisation.xml.IntSerialiser; |
2248 | 25 | import org.workcraft.plugins.serialisation.xml.StringDeserialiser; | 27 | import org.workcraft.plugins.serialisation.xml.StringDeserialiser; |
2249 | @@ -46,6 +48,7 @@ | |||
2250 | 46 | p.registerClass(org.workcraft.serialisation.xml.XMLSerialiser.class, BezierSerialiser.class); | 48 | p.registerClass(org.workcraft.serialisation.xml.XMLSerialiser.class, BezierSerialiser.class); |
2251 | 47 | p.registerClass(org.workcraft.serialisation.xml.XMLSerialiser.class, ConnectionSerialiser.class); | 49 | p.registerClass(org.workcraft.serialisation.xml.XMLSerialiser.class, ConnectionSerialiser.class); |
2252 | 48 | p.registerClass(org.workcraft.serialisation.xml.XMLSerialiser.class, VisualConnectionSerialiser.class); | 50 | p.registerClass(org.workcraft.serialisation.xml.XMLSerialiser.class, VisualConnectionSerialiser.class); |
2253 | 51 | p.registerClass(org.workcraft.serialisation.xml.XMLSerialiser.class, FileSerialiser.class); | ||
2254 | 49 | 52 | ||
2255 | 50 | p.registerClass(org.workcraft.serialisation.xml.XMLDeserialiser.class, AffineTransformDeserialiser.class); | 53 | p.registerClass(org.workcraft.serialisation.xml.XMLDeserialiser.class, AffineTransformDeserialiser.class); |
2256 | 51 | p.registerClass(org.workcraft.serialisation.xml.XMLDeserialiser.class, BooleanDeserialiser.class); | 54 | p.registerClass(org.workcraft.serialisation.xml.XMLDeserialiser.class, BooleanDeserialiser.class); |
2257 | @@ -57,6 +60,7 @@ | |||
2258 | 57 | p.registerClass(org.workcraft.serialisation.xml.XMLDeserialiser.class, BezierDeserialiser.class); | 60 | p.registerClass(org.workcraft.serialisation.xml.XMLDeserialiser.class, BezierDeserialiser.class); |
2259 | 58 | p.registerClass(org.workcraft.serialisation.xml.XMLDeserialiser.class, ConnectionDeserialiser.class); | 61 | p.registerClass(org.workcraft.serialisation.xml.XMLDeserialiser.class, ConnectionDeserialiser.class); |
2260 | 59 | p.registerClass(org.workcraft.serialisation.xml.XMLDeserialiser.class, VisualConnectionDeserialiser.class); | 62 | p.registerClass(org.workcraft.serialisation.xml.XMLDeserialiser.class, VisualConnectionDeserialiser.class); |
2261 | 63 | p.registerClass(org.workcraft.serialisation.xml.XMLDeserialiser.class, FileDeserialiser.class); | ||
2262 | 60 | } | 64 | } |
2263 | 61 | 65 | ||
2264 | 62 | @Override | 66 | @Override |
2265 | 63 | 67 | ||
2266 | === added file 'WorkcraftCore/src/org/workcraft/plugins/serialisation/xml/FileDeserialiser.java' | |||
2267 | --- WorkcraftCore/src/org/workcraft/plugins/serialisation/xml/FileDeserialiser.java 1970-01-01 00:00:00 +0000 | |||
2268 | +++ WorkcraftCore/src/org/workcraft/plugins/serialisation/xml/FileDeserialiser.java 2014-04-29 16:24:51 +0000 | |||
2269 | @@ -0,0 +1,19 @@ | |||
2270 | 1 | package org.workcraft.plugins.serialisation.xml; | ||
2271 | 2 | |||
2272 | 3 | import java.io.File; | ||
2273 | 4 | |||
2274 | 5 | import org.w3c.dom.Element; | ||
2275 | 6 | import org.workcraft.exceptions.DeserialisationException; | ||
2276 | 7 | import org.workcraft.serialisation.xml.BasicXMLDeserialiser; | ||
2277 | 8 | |||
2278 | 9 | public class FileDeserialiser implements BasicXMLDeserialiser{ | ||
2279 | 10 | |||
2280 | 11 | public String getClassName() { | ||
2281 | 12 | return File.class.getName(); | ||
2282 | 13 | } | ||
2283 | 14 | |||
2284 | 15 | public Object deserialise(Element element) throws DeserialisationException { | ||
2285 | 16 | return new File(element.getAttribute("path")); | ||
2286 | 17 | } | ||
2287 | 18 | |||
2288 | 19 | } | ||
2289 | 0 | 20 | ||
2290 | === added file 'WorkcraftCore/src/org/workcraft/plugins/serialisation/xml/FileSerialiser.java' | |||
2291 | --- WorkcraftCore/src/org/workcraft/plugins/serialisation/xml/FileSerialiser.java 1970-01-01 00:00:00 +0000 | |||
2292 | +++ WorkcraftCore/src/org/workcraft/plugins/serialisation/xml/FileSerialiser.java 2014-04-29 16:24:51 +0000 | |||
2293 | @@ -0,0 +1,22 @@ | |||
2294 | 1 | package org.workcraft.plugins.serialisation.xml; | ||
2295 | 2 | |||
2296 | 3 | import java.io.File; | ||
2297 | 4 | |||
2298 | 5 | import org.w3c.dom.Element; | ||
2299 | 6 | import org.workcraft.exceptions.SerialisationException; | ||
2300 | 7 | import org.workcraft.serialisation.xml.BasicXMLSerialiser; | ||
2301 | 8 | |||
2302 | 9 | public class FileSerialiser implements BasicXMLSerialiser { | ||
2303 | 10 | |||
2304 | 11 | public String getClassName() { | ||
2305 | 12 | return File.class.getName(); | ||
2306 | 13 | } | ||
2307 | 14 | |||
2308 | 15 | public void serialise(Element element, Object object) | ||
2309 | 16 | throws SerialisationException { | ||
2310 | 17 | if (object != null) { | ||
2311 | 18 | element.setAttribute("path", ((File)object).getPath()); | ||
2312 | 19 | } | ||
2313 | 20 | } | ||
2314 | 21 | |||
2315 | 22 | } | ||
2316 | 0 | 23 | ||
2317 | === modified file 'WorkcraftCore/src/org/workcraft/plugins/shared/CommonEditorSettings.java' | |||
2318 | --- WorkcraftCore/src/org/workcraft/plugins/shared/CommonEditorSettings.java 2014-03-13 15:09:13 +0000 | |||
2319 | +++ WorkcraftCore/src/org/workcraft/plugins/shared/CommonEditorSettings.java 2014-04-29 16:24:51 +0000 | |||
2320 | @@ -31,12 +31,17 @@ | |||
2321 | 31 | 31 | ||
2322 | 32 | public class CommonEditorSettings implements SettingsPage { | 32 | public class CommonEditorSettings implements SettingsPage { |
2323 | 33 | private static LinkedList<PropertyDescriptor> properties; | 33 | private static LinkedList<PropertyDescriptor> properties; |
2325 | 34 | 34 | ||
2326 | 35 | private static final String backgroundColorKey = "CommonEditorSettings.backgroundColor"; | ||
2327 | 36 | private static final String showGridKey = "CommonEditorSettings.showGrid"; | ||
2328 | 37 | private static final String showRulersKey = "CommonEditorSettings.showRulers"; | ||
2329 | 38 | private static final String iconSizeKey = "CommonEditorSettings.iconSize"; | ||
2330 | 39 | private static final String debugClipboardKey = "CommonEditorSettings.debugClipboard"; | ||
2331 | 40 | |||
2332 | 35 | protected static Color backgroundColor = Color.WHITE; | 41 | protected static Color backgroundColor = Color.WHITE; |
2333 | 36 | private static boolean showGrid = true; | 42 | private static boolean showGrid = true; |
2334 | 37 | private static boolean showRulers = true; | 43 | private static boolean showRulers = true; |
2335 | 38 | protected static int iconSize = 24; | 44 | protected static int iconSize = 24; |
2336 | 39 | |||
2337 | 40 | private static boolean debugClipboard = false; | 45 | private static boolean debugClipboard = false; |
2338 | 41 | 46 | ||
2339 | 42 | public String getSection() { | 47 | public String getSection() { |
2340 | @@ -115,19 +120,19 @@ | |||
2341 | 115 | } | 120 | } |
2342 | 116 | 121 | ||
2343 | 117 | public void load(Config config) { | 122 | public void load(Config config) { |
2349 | 118 | backgroundColor = config.getColor("CommonEditorSettings.backgroundColor", Color.WHITE); | 123 | backgroundColor = config.getColor(backgroundColorKey, Color.WHITE); |
2350 | 119 | showGrid = config.getBoolean("CommonEditorSettings.showGrid", true); | 124 | showGrid = config.getBoolean(showGridKey, true); |
2351 | 120 | showRulers = config.getBoolean("CommonEditorSettings.showRullers", true); | 125 | showRulers = config.getBoolean(showRulersKey, true); |
2352 | 121 | iconSize = config.getInt("CommonEditorSettings.iconSize", 24); | 126 | iconSize = config.getInt(iconSizeKey, 24); |
2353 | 122 | debugClipboard = config.getBoolean("CommonEditorSettings.debugClipboard", false); | 127 | debugClipboard = config.getBoolean(debugClipboardKey, false); |
2354 | 123 | } | 128 | } |
2355 | 124 | 129 | ||
2356 | 125 | public void save(Config config) { | 130 | public void save(Config config) { |
2362 | 126 | config.setColor("CommonEditorSettings.backgroundColor", backgroundColor); | 131 | config.setColor(backgroundColorKey, backgroundColor); |
2363 | 127 | config.setBoolean("CommonEditorSettings.showGrid", showGrid); | 132 | config.setBoolean(showGridKey, showGrid); |
2364 | 128 | config.setBoolean("CommonEditorSettings.showRullers", showRulers); | 133 | config.setBoolean(showRulersKey, showRulers); |
2365 | 129 | config.setInt("CommonEditorSettings.iconSize", iconSize); | 134 | config.setInt(iconSizeKey, iconSize); |
2366 | 130 | config.setBoolean("CommonEditorSettings.debugClipboard", debugClipboard); | 135 | config.setBoolean(debugClipboardKey, debugClipboard); |
2367 | 131 | } | 136 | } |
2368 | 132 | 137 | ||
2369 | 133 | public static Color getBackgroundColor() { | 138 | public static Color getBackgroundColor() { |