Merge lp:~tapaal-contributor/tapaal/load-and-save-time-and-game-net-properties into lp:tapaal

Proposed by Lena Ernstsen
Status: Merged
Approved by: Jiri Srba
Approved revision: 1090
Merged at revision: 1069
Proposed branch: lp:~tapaal-contributor/tapaal/load-and-save-time-and-game-net-properties
Merge into: lp:tapaal
Diff against target: 856 lines (+348/-80)
12 files modified
src/dk/aau/cs/gui/TabContent.java (+40/-10)
src/dk/aau/cs/io/LoadedModel.java (+19/-3)
src/dk/aau/cs/io/TapnXmlLoader.java (+56/-21)
src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java (+41/-1)
src/dk/aau/cs/io/batchProcessing/BatchProcessingLoader.java (+25/-2)
src/dk/aau/cs/model/tapn/TimedArcPetriNet.java (+29/-7)
src/pipe/dataLayer/Template.java (+1/-1)
src/pipe/gui/GuiFrame.java (+12/-0)
src/pipe/gui/GuiFrameActions.java (+1/-0)
src/pipe/gui/GuiFrameController.java (+1/-0)
src/pipe/gui/widgets/NewTAPNPanel.java (+112/-11)
src/pipe/gui/widgets/QueryPane.java (+11/-24)
To merge this branch: bzr merge lp:~tapaal-contributor/tapaal/load-and-save-time-and-game-net-properties
Reviewer Review Type Date Requested Status
Jiri Srba Approve
Kenneth Yrke Jørgensen Approve
Lena Ernstsen (community) Needs Resubmitting
Review via email: mp+387301@code.launchpad.net

Commit message

Added the possibility to choose which time and game properties a net should include.

Description of the change

When creating a new net, it is possible to choose which kind of properties should be accessible (whether is is timed or untimed and whether it should contain game features).

This information is displayed in the toolbar beside the tokens.

The information will also be displayed when loading a file. However, only timing information is displayed. Game information is not displayed yet because the implementation of games is not included in this branch.

To post a comment you must log in.
1072. By Lena Ernstsen

Net information is saved in .tapn files (games are not implemented fully because these features are not included in this branch)

1073. By Lena Ernstsen

Minor fix

Revision history for this message
Kenneth Yrke Jørgensen (yrke) :
review: Needs Fixing
Revision history for this message
Kenneth Yrke Jørgensen (yrke) wrote :

See comments in code.

Revision history for this message
Jiri Srba (srba) wrote :

Loading and saving of net features does not work. Make a game untimed net and add just one place. Then save the net and open it again and it will say that the game is not a game net anymore.

When creating a new net, the layout is confusing. Instead, try to make a dialog like:

Use time semantics: [ ] Yes [ ] No
Use game semantics: [ ] Yes [ ] No

The status can contain information saying: "Time: Yes, Game: No" etc.
Kenneth, I like the current placement of this information next to the buttons, as it should be always
visible, the status bar is used more as context sensitive guide.

When you make a new query, it should offer either the CTL or Reachability dialog without asking,
depending on the Timed flag (if Timed, offer Reachability, if not Timed offer CTL).

review: Needs Fixing
1074. By Lena Ernstsen

Changed the dialog message when creating a new net. Changed the text in the toolbar. When saving, the time/game info is placed on each tapn instead of the entire net. Removed global lense information from TimedArcPetriNet. Made lense information invisble for guiframe again.

1075. By Lena Ernstsen

When net is timed, only reachability queries are available. When net is untimed, only CTL queries are available.

1076. By Lena Ernstsen

Net information is saved correctly.

1077. By Lena Ernstsen

Net information is loaded correctly.

1078. By Lena Ernstsen

Added the property as a tag for the entire net net, instead of each tapn.

Revision history for this message
Lena Ernstsen (lsaid) wrote :

The saving and loading should work now.
CTL queries are only available when the net is untimed.
Dialog message is changed to be more readable, as well as the text in the toolbar.
Made the lens information as a tag to the entire net instead of for each tapn.

review: Needs Resubmitting
1079. By Lena Ernstsen

Minor fix

1080. By Lena Ernstsen

Renamed property to feature

Revision history for this message
Jiri Srba (srba) wrote :

When you open a .tapn file that does not have any information about whether it is timed/untimed
and game/not game, it should autodetect the type of the net. In net statistics you can find the check for timed/untimed - all components, even the nonactive ones must be untimed in order to call the net untimed. The test for game must be implemented - if there is any controllable/environmental player information in the XML file then it is a game, otherwise it is not.

review: Needs Fixing
1081. By Lena Ernstsen

Added sanity check for loading the time/game info of nets. Renamed property to feature and removed unused methods.

1082. By Lena Ernstsen

Added warning message when net is timed/game and the feature says otherwise.

Revision history for this message
Lena Ernstsen (lsaid) wrote :

Added sanity check for loading time/game info of nets. A warning will appear if the net is timed/game, but the loaded info says otherwise.

The warning for the game feature is not fully implemented, because it can't be tested whether the network is a game yet.

review: Needs Resubmitting
1083. By Lena Ernstsen

Removed warning messages

1084. By Lena Ernstsen

Warning messages for time/game is shown in debugger

Revision history for this message
Jiri Srba (srba) wrote :

We need to change the method checking if a net is timed. At the moment, if there are no time intervals but the net has urgent transitions or age invariants, it will be still declared as "untimed" which we don't want anymore. So change the definition of untimed such that it will also check whether the net has urgent transitions or age invariants (except for the trivial one < infty), and if yes then report the net as timed.

review: Needs Fixing
Revision history for this message
Jiri Srba (srba) wrote :

The default options when making a new net should be No/No both for time and game semantics.

review: Needs Fixing
1085. By Lena Ernstsen

Set default game/time features to 'No'. Changed isUntimed to check urgent transitions and nontrivial age invariants.

Revision history for this message
Lena Ernstsen (lsaid) :
1086. By Lena Ernstsen

Fixed logic

Revision history for this message
Jiri Srba (srba) wrote :

The new semantics of inUntimed() where urgent transitions and nontrivial age invariants make the net timed it not reflected in net statistics panel.

review: Needs Fixing
Revision history for this message
Kenneth Yrke Jørgensen (yrke) :
review: Approve
1087. By Lena Ernstsen

Fixed statistics concering untimed net

1088. By Lena Ernstsen

Merge

Revision history for this message
Jiri Srba (srba) wrote :

The statistics cannot be fixed this way. It must be done online, everytime the dialog is called
it should be recomputed as the net could have been edited in between.
E.g. make two components, first one has urgent transition, the second one not - it will report the statistics in a wrong way.

review: Needs Fixing
1089. By Lena Ernstsen

Fixed wrong untimed information in statistics

Revision history for this message
Jiri Srba (srba) wrote :

Still does not work. Try to make several components, some untimed, other with urgent transition. Now depending which component is shown, different answer are given. E.g. if you are in the untimed component it will claim that all components are untimed.

review: Needs Fixing
1090. By Lena Ernstsen

urgent transitions are checked correctly when checking whether net is untimed

Revision history for this message
Jiri Srba (srba) wrote :

Works as expected now.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/dk/aau/cs/gui/TabContent.java'
--- src/dk/aau/cs/gui/TabContent.java 2020-07-09 12:55:25 +0000
+++ src/dk/aau/cs/gui/TabContent.java 2020-08-03 12:48:32 +0000
@@ -476,21 +476,23 @@
476 ModelLoader loader = new ModelLoader();476 ModelLoader loader = new ModelLoader();
477 LoadedModel loadedModel = loader.load(file);477 LoadedModel loadedModel = loader.load(file);
478478
479 TabContent tab = new TabContent(loadedModel.network(), loadedModel.templates(), loadedModel.queries());479 TabContent tab = new TabContent(loadedModel.network(), loadedModel.templates(), loadedModel.queries(), loadedModel.isTimed(), loadedModel.isGame());
480
480 tab.setInitialName(name);481 tab.setInitialName(name);
481482
482 tab.selectFirstElements();483 tab.selectFirstElements();
483484
484 tab.setFile(null);485 tab.setFile(null);
485 return tab;486
487 return tab;
486 } catch (Exception e) {488 } catch (Exception e) {
487 throw new Exception("TAPAAL encountered an error while loading the file: " + name + "\n\nPossible explanations:\n - " + e.toString());489 throw new Exception("TAPAAL encountered an error while loading the file: " + name + "\n\nPossible explanations:\n - " + e.toString());
488 }490 }
489491
490 }492 }
491493
492 public static TabContent createNewEmptyTab(String name){494 public static TabContent createNewEmptyTab(String name, boolean isTimed, boolean isGame){
493 TabContent tab = new TabContent();495 TabContent tab = new TabContent(isTimed, isGame);
494 tab.setInitialName(name);496 tab.setInitialName(name);
495497
496 //Set Default Template498 //Set Default Template
@@ -631,8 +633,8 @@
631 private WorkflowDialog workflowDialog = null;633 private WorkflowDialog workflowDialog = null;
632634
633635
634 private TabContent() {636 private TabContent(boolean isTimed, boolean isGame) {
635 this(new TimedArcPetriNetNetwork(), new ArrayList<>(), new TAPNLens(true,false));637 this(new TimedArcPetriNetNetwork(), new ArrayList<>(), new TAPNLens(isTimed,isGame));
636 }638 }
637639
638 private TabContent(TimedArcPetriNetNetwork network, Collection<Template> templates, TAPNLens lens) {640 private TabContent(TimedArcPetriNetNetwork network, Collection<Template> templates, TAPNLens lens) {
@@ -687,6 +689,10 @@
687 animationModeController = new CanvasAnimationController(getAnimator());689 animationModeController = new CanvasAnimationController(getAnimator());
688 }690 }
689691
692 private TabContent(TimedArcPetriNetNetwork network, Collection<Template> templates, Iterable<TAPNQuery> tapnqueries, boolean isTimed, boolean isGame) {
693 this(network, templates, tapnqueries, new TAPNLens(isTimed, isGame));
694 }
695
690 private TabContent(TimedArcPetriNetNetwork network, Collection<Template> templates, Iterable<TAPNQuery> tapnqueries) {696 private TabContent(TimedArcPetriNetNetwork network, Collection<Template> templates, Iterable<TAPNQuery> tapnqueries) {
691 this(network, templates, tapnqueries, new TAPNLens(true, false));697 this(network, templates, tapnqueries, new TAPNLens(true, false));
692 }698 }
@@ -697,7 +703,7 @@
697 setQueries(tapnqueries);703 setQueries(tapnqueries);
698 setConstants(network().constants());704 setConstants(network().constants());
699 }705 }
700 706
701 public SharedPlacesAndTransitionsPanel getSharedPlacesAndTransitionsPanel(){707 public SharedPlacesAndTransitionsPanel getSharedPlacesAndTransitionsPanel(){
702 return sharedPTPanel;708 return sharedPTPanel;
703 }709 }
@@ -1646,6 +1652,8 @@
1646 this.app = Optional.ofNullable(newApp);1652 this.app = Optional.ofNullable(newApp);
1647 undoManager.setApp(newApp);1653 undoManager.setApp(newApp);
16481654
1655 updateFeatureText();
1656
1649 //XXX1657 //XXX
1650 if (isInAnimationMode()) {1658 if (isInAnimationMode()) {
1651 app.ifPresent(o->o.setGUIMode(GuiFrame.GUIMode.animation));1659 app.ifPresent(o->o.setGUIMode(GuiFrame.GUIMode.animation));
@@ -1761,7 +1769,7 @@
1761 final AbstractDrawingSurfaceManager animationModeController;1769 final AbstractDrawingSurfaceManager animationModeController;
17621770
1763 //Writes a tapaal net to a file, with the posibility to overwrite the quires1771 //Writes a tapaal net to a file, with the posibility to overwrite the quires
1764 public void writeNetToFile(File outFile, List<TAPNQuery> queriesOverwrite) {1772 public void writeNetToFile(File outFile, List<TAPNQuery> queriesOverwrite, TAPNLens lens) {
1765 try {1773 try {
1766 NetworkMarking currentMarking = null;1774 NetworkMarking currentMarking = null;
1767 if(isInAnimationMode()){1775 if(isInAnimationMode()){
@@ -1773,7 +1781,9 @@
1773 network(),1781 network(),
1774 allTemplates(),1782 allTemplates(),
1775 queriesOverwrite,1783 queriesOverwrite,
1776 network().constants()1784 network().constants(),
1785 lens.timed,
1786 lens.game
1777 );1787 );
17781788
1779 tapnWriter.savePNML(outFile);1789 tapnWriter.savePNML(outFile);
@@ -1790,7 +1800,7 @@
1790 }1800 }
17911801
1792 public void writeNetToFile(File outFile) {1802 public void writeNetToFile(File outFile) {
1793 writeNetToFile(outFile, (List<TAPNQuery>) queries());1803 writeNetToFile(outFile, (List<TAPNQuery>) queries(), lens);
1794 }1804 }
17951805
1796 @Override1806 @Override
@@ -2244,6 +2254,26 @@
2244 managerRef.get().registerManager(drawingSurface);2254 managerRef.get().registerManager(drawingSurface);
2245 }2255 }
22462256
2257 public void updateFeatureText() {
2258
2259 String properties = "Timed: " + (lens.isTimed() ? "Yes" : "No") +
2260 ", Game: " + (lens.isGame() ? "Yes" : "No");
2261 app.ifPresent(o->o.setFeatureInfoText(properties));
2262
2263 }
2264
2265 public boolean isNetTimed() {
2266 return lens.isTimed();
2267 }
2268
2269 public boolean isNetGame() {
2270 return lens.isGame();
2271 }
2272
2273 public TAPNLens getLens() {
2274 return lens;
2275 }
2276
2247 private final class CanvasTransportarcDrawController extends AbstractDrawingSurfaceManager {2277 private final class CanvasTransportarcDrawController extends AbstractDrawingSurfaceManager {
22482278
2249 private TimedTransitionComponent transition;2279 private TimedTransitionComponent transition;
22502280
=== modified file 'src/dk/aau/cs/io/LoadedModel.java'
--- src/dk/aau/cs/io/LoadedModel.java 2019-03-22 09:17:07 +0000
+++ src/dk/aau/cs/io/LoadedModel.java 2020-08-03 12:48:32 +0000
@@ -9,15 +9,31 @@
9public class LoadedModel{9public class LoadedModel{
10 private Collection<Template> templates;10 private Collection<Template> templates;
11 private Collection<TAPNQuery> queries;11 private Collection<TAPNQuery> queries;
12 private TimedArcPetriNetNetwork network; 12 private TimedArcPetriNetNetwork network;
13 13 private boolean isTimed;
14 private boolean isGame;
15
14 public LoadedModel(TimedArcPetriNetNetwork network, Collection<Template> templates, Collection<TAPNQuery> queries){16 public LoadedModel(TimedArcPetriNetNetwork network, Collection<Template> templates, Collection<TAPNQuery> queries){
15 this.templates = templates;17 this.templates = templates;
16 this.network = network;18 this.network = network;
17 this.queries = queries; 19 this.queries = queries;
18 }20 }
1921
22 public LoadedModel(TimedArcPetriNetNetwork network, Collection<Template> templates, Collection<TAPNQuery> queries, boolean isTimed, boolean isGame){
23 this.templates = templates;
24 this.network = network;
25 this.queries = queries;
26 this.isTimed = isTimed;
27 this.isGame = isGame;
28 }
29
20 public Collection<Template> templates(){ return templates; }30 public Collection<Template> templates(){ return templates; }
21 public Collection<TAPNQuery> queries(){ return queries; }31 public Collection<TAPNQuery> queries(){ return queries; }
22 public TimedArcPetriNetNetwork network(){ return network; }32 public TimedArcPetriNetNetwork network(){ return network; }
33 public boolean isTimed() {
34 return isTimed;
35 }
36 public boolean isGame() {
37 return isGame;
38 }
23}39}
24\ No newline at end of file40\ No newline at end of file
2541
=== modified file 'src/dk/aau/cs/io/TapnXmlLoader.java'
--- src/dk/aau/cs/io/TapnXmlLoader.java 2020-07-14 11:18:47 +0000
+++ src/dk/aau/cs/io/TapnXmlLoader.java 2020-08-03 12:48:32 +0000
@@ -8,11 +8,12 @@
8import java.util.HashMap;8import java.util.HashMap;
9import java.util.List;9import java.util.List;
1010
11import javax.swing.JOptionPane;11import javax.swing.*;
12import javax.xml.parsers.DocumentBuilder;12import javax.xml.parsers.DocumentBuilder;
13import javax.xml.parsers.DocumentBuilderFactory;13import javax.xml.parsers.DocumentBuilderFactory;
14import javax.xml.parsers.ParserConfigurationException;14import javax.xml.parsers.ParserConfigurationException;
1515
16import dk.aau.cs.debug.Logger;
16import org.w3c.dom.Document;17import org.w3c.dom.Document;
17import org.w3c.dom.Element;18import org.w3c.dom.Element;
18import org.w3c.dom.Node;19import org.w3c.dom.Node;
@@ -61,7 +62,7 @@
6162
62public class TapnXmlLoader {63public class TapnXmlLoader {
63 private static final String PLACENAME_ERROR_MESSAGE = "The keywords \"true\" and \"false\" are reserved and can not be used as place names.\nPlaces with these names will be renamed to \"_true\" and \"_false\" respectively.\n\n Note that any queries using these places may not be parsed correctly.";64 private static final String PLACENAME_ERROR_MESSAGE = "The keywords \"true\" and \"false\" are reserved and can not be used as place names.\nPlaces with these names will be renamed to \"_true\" and \"_false\" respectively.\n\n Note that any queries using these places may not be parsed correctly.";
64 private HashMap<TimedTransitionComponent, TimedTransportArcComponent> presetArcs = new HashMap<TimedTransitionComponent, TimedTransportArcComponent>();65 private HashMap<TimedTransitionComponent, TimedTransportArcComponent> presetArcs = new HashMap<TimedTransitionComponent, TimedTransportArcComponent>();
65 private HashMap<TimedTransitionComponent, TimedTransportArcComponent> postsetArcs = new HashMap<TimedTransitionComponent, TimedTransportArcComponent>();66 private HashMap<TimedTransitionComponent, TimedTransportArcComponent> postsetArcs = new HashMap<TimedTransitionComponent, TimedTransportArcComponent>();
66 private HashMap<TimedTransportArcComponent, TimeInterval> transportArcsTimeIntervals = new HashMap<TimedTransportArcComponent, TimeInterval>();67 private HashMap<TimedTransportArcComponent, TimeInterval> transportArcsTimeIntervals = new HashMap<TimedTransportArcComponent, TimeInterval>();
6768
@@ -70,6 +71,10 @@
70 private boolean firstPlaceRenameWarning = true;71 private boolean firstPlaceRenameWarning = true;
71 private IdResolver idResolver = new IdResolver();72 private IdResolver idResolver = new IdResolver();
7273
74 private boolean isTimed;
75 private boolean isGame;
76 private boolean hasUncontrollableTransitions = false;
77
73 public TapnXmlLoader() {78 public TapnXmlLoader() {
74 }79 }
7580
@@ -124,8 +129,10 @@
124 network.buildConstraints();129 network.buildConstraints();
125 130
126 parseBound(doc, network);131 parseBound(doc, network);
127 132
128 return new LoadedModel(network, templates, queries);133 parseFeature(doc, network);
134
135 return new LoadedModel(network, templates, queries, isTimed, isGame);
129 }136 }
130137
131 private void parseBound(Document doc, TimedArcPetriNetNetwork network){138 private void parseBound(Document doc, TimedArcPetriNetNetwork network){
@@ -135,6 +142,30 @@
135 }142 }
136 }143 }
137144
145 private void parseFeature(Document doc, TimedArcPetriNetNetwork network) {
146 boolean networkIsTimed = !network.isUntimed();
147
148 if (doc.getElementsByTagName("feature").getLength() > 0) {
149 NodeList nodeList = doc.getElementsByTagName("feature");
150
151 isTimed = Boolean.parseBoolean(nodeList.item(0).getAttributes().getNamedItem("isTimed").getNodeValue());
152 isGame = Boolean.parseBoolean(nodeList.item(0).getAttributes().getNamedItem("isGame").getNodeValue());
153
154 if (networkIsTimed && !isTimed) {
155 isTimed = true;
156 Logger.log("The net contains time features. The entire net will be changed to include time features.");
157 }
158 if (hasUncontrollableTransitions && !isGame) {
159 isGame = true;
160 Logger.log("The net contains game features. The entire net will be changed to include game features.");
161
162 }
163 } else {
164 isTimed = networkIsTimed;
165 isGame = hasUncontrollableTransitions;
166 }
167 }
168
138 private void parseSharedPlaces(Document doc, TimedArcPetriNetNetwork network, ConstantStore constants) {169 private void parseSharedPlaces(Document doc, TimedArcPetriNetNetwork network, ConstantStore constants) {
139 NodeList sharedPlaceNodes = doc.getElementsByTagName("shared-place");170 NodeList sharedPlaceNodes = doc.getElementsByTagName("shared-place");
140171
@@ -220,10 +251,10 @@
220 }251 }
221252
222 private Template parseTimedArcPetriNet(Node tapnNode, TimedArcPetriNetNetwork network, ConstantStore constants) throws FormatException {253 private Template parseTimedArcPetriNet(Node tapnNode, TimedArcPetriNetNetwork network, ConstantStore constants) throws FormatException {
223 String name = getTAPNName(tapnNode);254 String name = getTAPNName(tapnNode);
224255
225 boolean active = getActiveStatus(tapnNode);256 boolean active = getActiveStatus(tapnNode);
226 257
227 TimedArcPetriNet tapn = new TimedArcPetriNet(name);258 TimedArcPetriNet tapn = new TimedArcPetriNet(name);
228 tapn.setActive(active);259 tapn.setActive(active);
229 network.add(tapn);260 network.add(tapn);
@@ -240,23 +271,22 @@
240 }271 }
241 }272 }
242273
243
244 return template;274 return template;
245 }275 }
246276
247 private boolean getActiveStatus(Node tapnNode) {277 private boolean getActiveStatus(Node tapnNode) {
248 if (tapnNode instanceof Element) {278 if (tapnNode instanceof Element) {
249 Element element = (Element)tapnNode;279 Element element = (Element)tapnNode;
250 String activeString = element.getAttribute("active");280 String activeString = element.getAttribute("active");
251 281
252 if (activeString == null || activeString.equals(""))282 if (activeString == null || activeString.equals(""))
253 return true;283 return true;
254 else284 else
255 return activeString.equals("true");285 return activeString.equals("true");
256 } else {286 } else {
257 return true;287 return true;
258 }288 }
259 }289 }
260290
261 private void parseElement(Element element, Template template, TimedArcPetriNetNetwork network, ConstantStore constants) throws FormatException {291 private void parseElement(Element element, Template template, TimedArcPetriNetNetwork network, ConstantStore constants) throws FormatException {
262 if ("labels".equals(element.getNodeName())) {292 if ("labels".equals(element.getNodeName())) {
@@ -269,8 +299,8 @@
269 TimedTransitionComponent transition = parseTransition(element, network, template.model());299 TimedTransitionComponent transition = parseTransition(element, network, template.model());
270 template.guiModel().addPetriNetObject(transition);300 template.guiModel().addPetriNetObject(transition);
271 } else if ("arc".equals(element.getNodeName())) {301 } else if ("arc".equals(element.getNodeName())) {
272 parseAndAddArc(element, template, constants);302 parseAndAddArc(element, template, constants);
273 }303 }
274 }304 }
275305
276 private boolean isNameAllowed(String name) {306 private boolean isNameAllowed(String name) {
@@ -343,6 +373,11 @@
343 String idInput = transition.getAttribute("id");373 String idInput = transition.getAttribute("id");
344 String nameInput = transition.getAttribute("name");374 String nameInput = transition.getAttribute("name");
345 boolean isUrgent = Boolean.parseBoolean(transition.getAttribute("urgent"));375 boolean isUrgent = Boolean.parseBoolean(transition.getAttribute("urgent"));
376
377 String player = transition.getAttribute("player");
378 if (player.length() > 0 && player.equals("1")) {
379 hasUncontrollableTransitions = true;
380 }
346 381
347 idResolver.add(tapn.name(), idInput, nameInput);382 idResolver.add(tapn.name(), idInput, nameInput);
348 383
349384
=== modified file 'src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java'
--- src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java 2020-06-18 08:32:13 +0000
+++ src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java 2020-08-03 12:48:32 +0000
@@ -55,6 +55,8 @@
55 private Iterable<TAPNQuery> queries;55 private Iterable<TAPNQuery> queries;
56 private Iterable<Constant> constants;56 private Iterable<Constant> constants;
57 private final TimedArcPetriNetNetwork network;57 private final TimedArcPetriNetNetwork network;
58 private boolean isTimed;
59 private boolean isGame;
5860
59 public TimedArcPetriNetNetworkWriter(61 public TimedArcPetriNetNetworkWriter(
60 TimedArcPetriNetNetwork network, 62 TimedArcPetriNetNetwork network,
@@ -66,6 +68,21 @@
66 this.queries = queries;68 this.queries = queries;
67 this.constants = constants;69 this.constants = constants;
68 }70 }
71
72 public TimedArcPetriNetNetworkWriter(
73 TimedArcPetriNetNetwork network,
74 Iterable<Template> templates,
75 Iterable<TAPNQuery> queries,
76 Iterable<Constant> constants,
77 boolean isTimed,
78 boolean isGame) {
79 this.network = network;
80 this.templates = templates;
81 this.queries = queries;
82 this.constants = constants;
83 this.isTimed = isTimed;
84 this.isGame = isGame;
85 }
69 86
70 public ByteArrayOutputStream savePNML() throws IOException, ParserConfigurationException, DOMException, TransformerConfigurationException, TransformerException {87 public ByteArrayOutputStream savePNML() throws IOException, ParserConfigurationException, DOMException, TransformerConfigurationException, TransformerException {
71 Document document = null;88 Document document = null;
@@ -89,6 +106,7 @@
89 appendTemplates(document, pnmlRootNode);106 appendTemplates(document, pnmlRootNode);
90 appendQueries(document, pnmlRootNode);107 appendQueries(document, pnmlRootNode);
91 appendDefaultBound(document, pnmlRootNode);108 appendDefaultBound(document, pnmlRootNode);
109 appendFeature(document, pnmlRootNode);
92110
93 document.normalize();111 document.normalize();
94 // Create Transformer with XSL Source File112 // Create Transformer with XSL Source File
@@ -139,6 +157,29 @@
139 element.setAttribute("bound", network.getDefaultBound() + "");157 element.setAttribute("bound", network.getDefaultBound() + "");
140 root.appendChild(element);158 root.appendChild(element);
141 }159 }
160
161 private void appendFeature(Document document, Element root) {
162 String isTimed = "true";
163 String isGame = "true";
164 if (!this.isTimed) {
165 isTimed = "false";
166 }
167 if (!this.isGame) {
168 isGame = "false";
169 }
170
171 root.appendChild(createFeatureElement(isTimed, isGame, document));
172 }
173
174 private Element createFeatureElement(String isTimed, String isGame, Document document) {
175 Require.that(document != null, "Error: document was null");
176 Element feature = document.createElement("feature");
177
178 feature.setAttribute("isTimed", isTimed);
179 feature.setAttribute("isGame", isGame);
180
181 return feature;
182 }
142 183
143 private void appendSharedPlaces(Document document, Element root) {184 private void appendSharedPlaces(Document document, Element root) {
144 for(SharedPlace place : network.sharedPlaces()){185 for(SharedPlace place : network.sharedPlaces()){
@@ -194,7 +235,6 @@
194235
195 Attr netAttrType = document.createAttribute("type");236 Attr netAttrType = document.createAttribute("type");
196 netAttrType.setValue("P/T net");237 netAttrType.setValue("P/T net");
197
198 NET.setAttributeNode(netAttrType);238 NET.setAttributeNode(netAttrType);
199239
200 appendAnnotationNotes(document, guiModel, NET);240 appendAnnotationNotes(document, guiModel, NET);
201241
=== modified file 'src/dk/aau/cs/io/batchProcessing/BatchProcessingLoader.java'
--- src/dk/aau/cs/io/batchProcessing/BatchProcessingLoader.java 2019-03-22 12:45:44 +0000
+++ src/dk/aau/cs/io/batchProcessing/BatchProcessingLoader.java 2020-08-03 12:48:32 +0000
@@ -232,10 +232,10 @@
232 }232 }
233233
234 private void parseTimedArcPetriNet(Node tapnNode, TimedArcPetriNetNetwork network, ConstantStore constants) throws FormatException {234 private void parseTimedArcPetriNet(Node tapnNode, TimedArcPetriNetNetwork network, ConstantStore constants) throws FormatException {
235 String name = getTAPNName(tapnNode);235 String name = getTAPNName(tapnNode);
236 boolean active = getActiveStatus(tapnNode);236 boolean active = getActiveStatus(tapnNode);
237237
238 TimedArcPetriNet tapn = new TimedArcPetriNet(name);238 TimedArcPetriNet tapn = new TimedArcPetriNet(name);
239 tapn.setActive(active);239 tapn.setActive(active);
240 network.add(tapn);240 network.add(tapn);
241 nameGenerator.add(tapn);241 nameGenerator.add(tapn);
@@ -263,6 +263,29 @@
263 }263 }
264 }264 }
265265
266 private boolean getInfo(Node tapnNode, String attribute) {
267 Element element = (Element)tapnNode;
268 String string = element.getAttribute(attribute);
269 return string.equals("true");
270 }
271
272 private boolean canGetInfo(Node tapnNode) {
273 if (tapnNode instanceof Element) {
274 Element element = (Element)tapnNode;
275 String timedString = element.getAttribute("timed");
276 String gameString = element.getAttribute("game");
277
278 if (timedString == null || timedString.equals("") ||
279 gameString == null || gameString.equals("")) {
280 return false;
281 } else {
282 return true;
283 }
284 } else {
285 return false;
286 }
287 }
288
266 private void parseElement(Element element, TimedArcPetriNet tapn, TimedArcPetriNetNetwork network, ConstantStore constants) throws FormatException {289 private void parseElement(Element element, TimedArcPetriNet tapn, TimedArcPetriNetNetwork network, ConstantStore constants) throws FormatException {
267 if ("place".equals(element.getNodeName())) {290 if ("place".equals(element.getNodeName())) {
268 parsePlace(element, network, tapn, constants);291 parsePlace(element, network, tapn, constants);
269292
=== modified file 'src/dk/aau/cs/model/tapn/TimedArcPetriNet.java'
--- src/dk/aau/cs/model/tapn/TimedArcPetriNet.java 2020-06-22 08:20:47 +0000
+++ src/dk/aau/cs/model/tapn/TimedArcPetriNet.java 2020-08-03 12:48:32 +0000
@@ -12,8 +12,8 @@
12public class TimedArcPetriNet {12public class TimedArcPetriNet {
13 private String name;13 private String name;
14 private TimedArcPetriNetNetwork parentNetwork;14 private TimedArcPetriNetNetwork parentNetwork;
15 private boolean isActive;15 private boolean isActive;
16 16
17 //Should the names be checked to see if the name is already used 17 //Should the names be checked to see if the name is already used
18 //This is used when loading big nets as the checking of names is slow.18 //This is used when loading big nets as the checking of names is slow.
19 private boolean checkNames = true; 19 private boolean checkNames = true;
@@ -28,9 +28,9 @@
28 private TimedMarking currentMarking = new LocalTimedMarking();28 private TimedMarking currentMarking = new LocalTimedMarking();
2929
30 public TimedArcPetriNet(String name) {30 public TimedArcPetriNet(String name) {
31 setName(name);31 setName(name);
32 isActive = true;32 isActive = true;
33 }33 }
3434
35 public TimedMarking marking(){35 public TimedMarking marking(){
36 return currentMarking;36 return currentMarking;
@@ -436,7 +436,7 @@
436 numberOfOrphanPlaces += t.getOrphanPlaces().size();436 numberOfOrphanPlaces += t.getOrphanPlaces().size();
437 //Test if all inputarcs is untimed and get the number of untimed input arcs437 //Test if all inputarcs is untimed and get the number of untimed input arcs
438 for(TimedInputArc in : t.inputArcs()){438 for(TimedInputArc in : t.inputArcs()){
439 if(!((in.interval().lowerBound().value() == 0 && in.interval().IsLowerBoundNonStrict() && in.interval().upperBound().equals(Bound.Infinity)))){439 if(!(in.interval().lowerBound().value() == 0 && in.interval().IsLowerBoundNonStrict() && in.interval().upperBound().equals(Bound.Infinity))){
440 networkUntimed = false;440 networkUntimed = false;
441 } else {441 } else {
442 numberOfUntimedInputArcs++;442 numberOfUntimedInputArcs++;
@@ -447,7 +447,7 @@
447 }447 }
448 //Test if all tansportarcs is untimed and get the number of untimed transport arcs448 //Test if all tansportarcs is untimed and get the number of untimed transport arcs
449 for(TransportArc in : t.transportArcs()){449 for(TransportArc in : t.transportArcs()){
450 if(!((in.interval().lowerBound().value() == 0 && in.interval().IsLowerBoundNonStrict() && in.interval().upperBound().equals(Bound.Infinity)))){450 if(!(in.interval().lowerBound().value() == 0 && in.interval().IsLowerBoundNonStrict() && in.interval().upperBound().equals(Bound.Infinity))){
451 networkUntimed = false;451 networkUntimed = false;
452 } else {452 } else {
453 numberOfUntimedTransportArcs++;453 numberOfUntimedTransportArcs++;
@@ -456,6 +456,18 @@
456 networkWeighted = true;456 networkWeighted = true;
457 }457 }
458 }458 }
459
460 for (TimedPlace p : t.places) {
461 if (!p.invariant().upperBound().equals(Bound.Infinity)) {
462 networkUntimed = false;
463 }
464 }
465
466 for (TimedTransition transition : t.transitions) {
467 if (transition.isUrgent()) {
468 networkUntimed = false;
469 }
470 }
459 471
460 // Test all output arcs for weights472 // Test all output arcs for weights
461 if(!networkWeighted){473 if(!networkWeighted){
@@ -613,6 +625,16 @@
613 return false;625 return false;
614 }626 }
615 }627 }
628
629 if (hasUrgentTransitions()) {
630 return false;
631 }
632
633 for (TimedPlace p : places) {
634 if (!p.invariant().upperBound().toString().equals("inf")) {
635 return false;
636 }
637 }
616 638
617 return true;639 return true;
618 }640 }
619641
=== modified file 'src/pipe/dataLayer/Template.java'
--- src/pipe/dataLayer/Template.java 2020-06-12 10:28:49 +0000
+++ src/pipe/dataLayer/Template.java 2020-08-03 12:48:32 +0000
@@ -54,7 +54,7 @@
54 public void setHasPositionalInfo(boolean positionalInfo) {54 public void setHasPositionalInfo(boolean positionalInfo) {
55 hasPositionalInfo = positionalInfo;55 hasPositionalInfo = positionalInfo;
56 }56 }
57 57
58 @Override58 @Override
59 public boolean equals(Object obj) {59 public boolean equals(Object obj) {
60 if(obj instanceof Template){60 if(obj instanceof Template){
6161
=== modified file 'src/pipe/gui/GuiFrame.java'
--- src/pipe/gui/GuiFrame.java 2020-07-05 18:13:46 +0000
+++ src/pipe/gui/GuiFrame.java 2020-08-03 12:48:32 +0000
@@ -58,6 +58,7 @@
58 private StatusBar statusBar;58 private StatusBar statusBar;
59 private JMenuBar menuBar;59 private JMenuBar menuBar;
60 private JToolBar drawingToolBar;60 private JToolBar drawingToolBar;
61 private final JLabel featureInfoText = new JLabel();
61 private JComboBox<String> zoomComboBox;62 private JComboBox<String> zoomComboBox;
6263
63 private static final int shortcutkey = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();64 private static final int shortcutkey = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
@@ -898,6 +899,10 @@
898 drawingToolBar.add(new ToggleButtonWithoutText(tokenAction));899 drawingToolBar.add(new ToggleButtonWithoutText(tokenAction));
899 drawingToolBar.add(new ToggleButtonWithoutText(deleteTokenAction));900 drawingToolBar.add(new ToggleButtonWithoutText(deleteTokenAction));
900901
902 //Net Type
903 drawingToolBar.addSeparator();
904 drawingToolBar.add(featureInfoText);
905
901 // Create panel to put toolbars in906 // Create panel to put toolbars in
902 JPanel toolBarPanel = new JPanel();907 JPanel toolBarPanel = new JPanel();
903 toolBarPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));908 toolBarPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
@@ -1271,6 +1276,7 @@
12711276
1272 break;1277 break;
1273 case noNet:1278 case noNet:
1279 setFeatureInfoText("");
1274 break;1280 break;
12751281
1276 default:1282 default:
@@ -1642,4 +1648,10 @@
1642 return CreateGui.getCurrentTab();1648 return CreateGui.getCurrentTab();
1643 }1649 }
16441650
1651 @Override
1652 public void setFeatureInfoText(String s) {
1653 if (s == null) s = "";
1654 featureInfoText.setText(s);
1655 }
1656
1645}1657}
16461658
=== modified file 'src/pipe/gui/GuiFrameActions.java'
--- src/pipe/gui/GuiFrameActions.java 2020-05-18 18:17:06 +0000
+++ src/pipe/gui/GuiFrameActions.java 2020-08-03 12:48:32 +0000
@@ -44,4 +44,5 @@
44 void setShowZeroToInfinityIntervalsSelected(boolean b);44 void setShowZeroToInfinityIntervalsSelected(boolean b);
45 void setShowTokenAgeSelected(boolean b);45 void setShowTokenAgeSelected(boolean b);
4646
47 void setFeatureInfoText(String s);
47}48}
4849
=== modified file 'src/pipe/gui/GuiFrameController.java'
--- src/pipe/gui/GuiFrameController.java 2020-07-14 11:18:47 +0000
+++ src/pipe/gui/GuiFrameController.java 2020-08-03 12:48:32 +0000
@@ -147,6 +147,7 @@
147147
148 currentTab.ifPresent(t -> t.setApp(guiFrame));148 currentTab.ifPresent(t -> t.setApp(guiFrame));
149 guiFrameDirectAccess.setTitle(currentTab.map(TabContentActions::getTabTitle).orElse(null));149 guiFrameDirectAccess.setTitle(currentTab.map(TabContentActions::getTabTitle).orElse(null));
150
150 }151 }
151152
152 @Override153 @Override
153154
=== modified file 'src/pipe/gui/widgets/NewTAPNPanel.java'
--- src/pipe/gui/widgets/NewTAPNPanel.java 2020-04-30 12:52:28 +0000
+++ src/pipe/gui/widgets/NewTAPNPanel.java 2020-08-03 12:48:32 +0000
@@ -4,17 +4,15 @@
4import java.awt.GridBagConstraints;4import java.awt.GridBagConstraints;
5import java.awt.GridBagLayout;5import java.awt.GridBagLayout;
6import java.awt.Insets;6import java.awt.Insets;
7import java.awt.event.ActionEvent;
8import java.awt.event.ActionListener;
7import java.awt.event.KeyEvent;9import java.awt.event.KeyEvent;
810
9import javax.swing.JButton;11import javax.swing.*;
10import javax.swing.JLabel;
11import javax.swing.JOptionPane;
12import javax.swing.JPanel;
13import javax.swing.JRootPane;
14import javax.swing.JTextField;
1512
16import dk.aau.cs.gui.TabContent;13import dk.aau.cs.gui.TabContent;
17import pipe.gui.CreateGui;14import pipe.gui.CreateGui;
15import pipe.gui.Grid;
18import pipe.gui.GuiFrame;16import pipe.gui.GuiFrame;
1917
20public class NewTAPNPanel extends JPanel {18public class NewTAPNPanel extends JPanel {
@@ -22,6 +20,8 @@
22 private JRootPane rootPane;20 private JRootPane rootPane;
23 private GuiFrame frame;21 private GuiFrame frame;
24 private JTextField nameTextBox;22 private JTextField nameTextBox;
23 private JRadioButton timedNet;
24 private JRadioButton gameNet;
2525
26 public NewTAPNPanel(JRootPane rootPane, GuiFrame frame) {26 public NewTAPNPanel(JRootPane rootPane, GuiFrame frame) {
27 this.rootPane = rootPane;27 this.rootPane = rootPane;
@@ -34,6 +34,7 @@
34 this.setLayout(new GridBagLayout());34 this.setLayout(new GridBagLayout());
3535
36 initNamePanel();36 initNamePanel();
37 initSelectionPanel();
37 initButtonPanel();38 initButtonPanel();
38 }39 }
3940
@@ -64,7 +65,7 @@
64 gbc.anchor = GridBagConstraints.EAST;65 gbc.anchor = GridBagConstraints.EAST;
65 buttonPanel.add(cancelButton,gbc); 66 buttonPanel.add(cancelButton,gbc);
6667
67 okButton.addActionListener(e -> createNewTAPNBasedOnSelection(nameTextBox.getText()));68 okButton.addActionListener(e -> createNewTAPNBasedOnSelection(nameTextBox.getText(), timedNet.isSelected(), gameNet.isSelected()));
6869
69 rootPane.setDefaultButton(okButton);70 rootPane.setDefaultButton(okButton);
70 71
@@ -72,7 +73,7 @@
7273
73 gbc = new GridBagConstraints();74 gbc = new GridBagConstraints();
74 gbc.gridx = 0;75 gbc.gridx = 0;
75 gbc.gridy = 1;76 gbc.gridy = 2;
76 gbc.insets = new Insets(0, 8, 5, 8);77 gbc.insets = new Insets(0, 8, 5, 8);
77 gbc.anchor = GridBagConstraints.EAST;78 gbc.anchor = GridBagConstraints.EAST;
78 add(buttonPanel, gbc);79 add(buttonPanel, gbc);
@@ -82,7 +83,7 @@
82 rootPane.getParent().setVisible(false);83 rootPane.getParent().setVisible(false);
83 }84 }
8485
85 protected void createNewTAPNBasedOnSelection(String name) {86 protected void createNewTAPNBasedOnSelection(String name, boolean isTimed, boolean isGame) {
86 if (!name.endsWith(".tapn")) {87 if (!name.endsWith(".tapn")) {
87 name = name + ".tapn";88 name = name + ".tapn";
88 }89 }
@@ -95,7 +96,7 @@
95 }96 }
9697
97 try {98 try {
98 TabContent tab = TabContent.createNewEmptyTab(name);99 TabContent tab = TabContent.createNewEmptyTab(name, isTimed, isGame);
99 CreateGui.openNewTabFromStream(tab);100 CreateGui.openNewTabFromStream(tab);
100 } catch (Exception e) {101 } catch (Exception e) {
101 JOptionPane102 JOptionPane
@@ -113,7 +114,7 @@
113114
114 private void initNamePanel() {115 private void initNamePanel() {
115 JPanel namePanel = new JPanel(new GridBagLayout());116 JPanel namePanel = new JPanel(new GridBagLayout());
116 117
117 JLabel nameLabel = new JLabel("Name:");118 JLabel nameLabel = new JLabel("Name:");
118 GridBagConstraints gbc = new GridBagConstraints();119 GridBagConstraints gbc = new GridBagConstraints();
119 gbc.gridx = 0;120 gbc.gridx = 0;
@@ -145,4 +146,104 @@
145 gbc.insets = new Insets(5, 5, 5, 5);146 gbc.insets = new Insets(5, 5, 5, 5);
146 add(namePanel, gbc);147 add(namePanel, gbc);
147 }148 }
149
150 private void initSelectionPanel() {
151 JPanel selectionPanel = new JPanel(new GridBagLayout());
152
153 initTimeOptions(selectionPanel);
154 initGameOptions(selectionPanel);
155
156 GridBagConstraints gbc = new GridBagConstraints();
157 gbc.gridx = 0;
158 gbc.gridy = 1;
159 gbc.weightx = 0;
160 gbc.anchor = GridBagConstraints.WEST;
161 gbc.insets = new Insets(5, 5, 5, 5);
162 add(selectionPanel, gbc);
163 }
164
165 private void initTimeOptions(JPanel selectionPanel) {
166 JPanel isTimedPanel = new JPanel(new GridBagLayout());
167 ButtonGroup isTimedRadioButtonGroup = new ButtonGroup();
168
169 JLabel timedText = new JLabel("Use time semantics: ");
170 GridBagConstraints gbc = new GridBagConstraints();
171 gbc.gridx = 0;
172 gbc.gridy = 0;
173 gbc.weightx = 0;
174 gbc.anchor = GridBagConstraints.WEST;
175 gbc.insets = new Insets(3, 3, 3, 3);
176 isTimedPanel.add(timedText, gbc);
177
178 JRadioButton untimedNet = new JRadioButton("No");
179 untimedNet.setSelected(true);
180 gbc = new GridBagConstraints();
181 gbc.gridx = 1;
182 gbc.gridy = 0;
183 gbc.weightx = 0;
184 gbc.anchor = GridBagConstraints.WEST;
185 gbc.insets = new Insets(3, 3, 3, 3);
186 isTimedPanel.add(untimedNet, gbc);
187 isTimedRadioButtonGroup.add(untimedNet);
188
189 timedNet = new JRadioButton("Yes");
190 gbc = new GridBagConstraints();
191 gbc.gridx = 2;
192 gbc.gridy = 0;
193 gbc.weightx = 0;
194 gbc.anchor = GridBagConstraints.WEST;
195 gbc.insets = new Insets(3, 3, 3, 3);
196 isTimedPanel.add(timedNet, gbc);
197 isTimedRadioButtonGroup.add(timedNet);
198
199 gbc = new GridBagConstraints();
200 gbc.gridx = 0;
201 gbc.gridy = 1;
202 gbc.weightx = 0;
203 gbc.anchor = GridBagConstraints.WEST;
204 gbc.insets = new Insets(5, 5, 5, 5);
205 selectionPanel.add(isTimedPanel, gbc);
206 }
207
208 private void initGameOptions(JPanel selectionPanel) {
209 JPanel isGamePanel = new JPanel(new GridBagLayout());
210 ButtonGroup isGameRadioButtonGroup = new ButtonGroup();
211
212 JLabel gameText = new JLabel("Use game semantics:");
213 GridBagConstraints gbc = new GridBagConstraints();
214 gbc.gridx = 0;
215 gbc.gridy = 0;
216 gbc.weightx = 0;
217 gbc.anchor = GridBagConstraints.WEST;
218 gbc.insets = new Insets(3, 3, 3, 3);
219 isGamePanel.add(gameText, gbc);
220
221 JRadioButton nonGameNet = new JRadioButton("No");
222 nonGameNet.setSelected(true);
223 gbc = new GridBagConstraints();
224 gbc.gridx = 1;
225 gbc.gridy = 0;
226 gbc.weightx = 0;
227 gbc.anchor = GridBagConstraints.WEST;
228 gbc.insets = new Insets(3, 3, 3, 3);
229 isGamePanel.add(nonGameNet, gbc);
230 isGameRadioButtonGroup.add(nonGameNet);
231
232 gameNet = new JRadioButton("Yes");
233 gbc = new GridBagConstraints();
234 gbc.gridx = 2;
235 gbc.gridy = 0;
236 gbc.weightx = 0;
237 gbc.anchor = GridBagConstraints.WEST;
238 gbc.insets = new Insets(3, 3, 3, 3);
239 isGamePanel.add(gameNet, gbc);
240 isGameRadioButtonGroup.add(gameNet);
241
242 gbc = new GridBagConstraints();
243 gbc.gridx = 0;
244 gbc.gridy = 2;
245 gbc.anchor = GridBagConstraints.EAST;
246 gbc.insets = new Insets(5, 5, 5, 5);
247 selectionPanel.add(isGamePanel, gbc);
248 }
148}249}
149250
=== modified file 'src/pipe/gui/widgets/QueryPane.java'
--- src/pipe/gui/widgets/QueryPane.java 2020-05-27 13:15:44 +0000
+++ src/pipe/gui/widgets/QueryPane.java 2020-08-03 12:48:32 +0000
@@ -320,31 +320,18 @@
320 addQueryButton.setPreferredSize(dimension);320 addQueryButton.setPreferredSize(dimension);
321 addQueryButton.setToolTipText(toolTipNewQuery);321 addQueryButton.setToolTipText(toolTipNewQuery);
322 addQueryButton.addActionListener(new ActionListener() {322 addQueryButton.addActionListener(new ActionListener() {
323 public void actionPerformed(ActionEvent e) { 323 public void actionPerformed(ActionEvent e) {
324 int openCTLDialog = JOptionPane.YES_OPTION;324
325 boolean netIsUntimed = tabContent.network().isUntimed();325 TAPNQuery q;
326 String optionText = "Do you want to create a CTL query (use for untimed nets) \n or a Reachability query (use for timed nets)?";326 if (!tabContent.isNetTimed()){
327 327 q = CTLQueryDialog.showQueryDialogue(CTLQueryDialog.QueryDialogueOption.Save, null, tabContent.network(), tabContent.getGuiModels());
328 // YES_OPTION = CTL dialog, NO_OPTION = Reachability dialog328 } else {
329 Object[] options = {
330 "CTL",
331 "Reachability"};
332
333 TAPNQuery q = null;
334 if(netIsUntimed){
335 openCTLDialog = JOptionPane.showOptionDialog(CreateGui.getApp(), optionText, "Query Dialog", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
336 if(openCTLDialog == JOptionPane.YES_OPTION){
337 q = CTLQueryDialog.showQueryDialogue(CTLQueryDialog.QueryDialogueOption.Save, null, tabContent.network(), tabContent.getGuiModels());
338 } else if(openCTLDialog == JOptionPane.NO_OPTION){
339 q = QueryDialog.showQueryDialogue(QueryDialogueOption.Save, null, tabContent.network(), tabContent.getGuiModels());
340 }
341 } else{
342 q = QueryDialog.showQueryDialogue(QueryDialogueOption.Save, null, tabContent.network(), tabContent.getGuiModels());329 q = QueryDialog.showQueryDialogue(QueryDialogueOption.Save, null, tabContent.network(), tabContent.getGuiModels());
343 }330 }
344 if (q != null) {331
345 undoManager.addNewEdit(new AddQueryCommand(q, tabContent));332 undoManager.addNewEdit(new AddQueryCommand(q, tabContent));
346 addQuery(q);333 addQuery(q);
347 }334
348 updateQueryButtons();335 updateQueryButtons();
349 }336 }
350 });337 });
@@ -496,7 +483,7 @@
496 tempFile = File.createTempFile(CreateGui.getAppGui().getCurrentTabName(), ".xml");483 tempFile = File.createTempFile(CreateGui.getAppGui().getCurrentTabName(), ".xml");
497484
498 TabContent tab = CreateGui.getApp().getCurrentTab();485 TabContent tab = CreateGui.getApp().getCurrentTab();
499 tab.writeNetToFile(tempFile, selectedQueries);486 tab.writeNetToFile(tempFile, selectedQueries, tab.getLens());
500 BatchProcessingDialog.showBatchProcessingDialog(queryList);487 BatchProcessingDialog.showBatchProcessingDialog(queryList);
501 tempFile.deleteOnExit();488 tempFile.deleteOnExit();
502 if(tempFile == null) {489 if(tempFile == null) {

Subscribers

People subscribed via source and target branches