Skip to content

Commit

Permalink
Added guard for making smc queries when model has strict intervals - …
Browse files Browse the repository at this point in the history
  • Loading branch information
srba authored Dec 1, 2024
2 parents fdfdaab + 3eeab95 commit 2bbc648
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/main/java/net/tapaal/gui/petrinet/widgets/QueryPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import pipe.gui.petrinet.undo.UndoManager;
import net.tapaal.gui.petrinet.dialog.QueryDialog.QueryDialogueOption;
import dk.aau.cs.Messenger;
import dk.aau.cs.model.tapn.TimedArcPetriNetNetwork;
import net.tapaal.gui.petrinet.TAPNLens;
import net.tapaal.gui.petrinet.dialog.BatchProcessingDialog;
import pipe.gui.petrinet.PetriNetTab;
import net.tapaal.gui.petrinet.undo.Command;
Expand Down Expand Up @@ -310,9 +312,17 @@ private void addButtons() {
addQueryButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {
TAPNQuery q = QueryDialog.showQueryDialogue(QueryDialogueOption.Save, null, tabContent.network(), tabContent.getGuiModels(), tabContent.getLens(), tabContent);
TimedArcPetriNetNetwork network = tabContent.network();
TAPNLens lens = tabContent.getLens();

if(q == null) return;
if (lens.isStochastic() && !network.isNonStrict()) {
JOptionPane.showMessageDialog(null, "SMC queries are only allowed for models with nonstrict intervals.", "Error", JOptionPane.ERROR_MESSAGE);
return;
}

TAPNQuery q = QueryDialog.showQueryDialogue(QueryDialogueOption.Save, null, network, tabContent.getGuiModels(), lens, tabContent);

if (q == null) return;

undoManager.addNewEdit(new AddQueryCommand(q, tabContent));
addQuery(q);
Expand Down

0 comments on commit 2bbc648

Please sign in to comment.