From 737ad9cd222215d3c8bf3e58ab1596800ab82ba1 Mon Sep 17 00:00:00 2001 From: Joachim Klein Date: Thu, 4 Oct 2018 17:24:00 +0200 Subject: [PATCH] GUISimulator: Fix "Simulate up to step x, backtrack x steps" handling for CTMC models Previously, the resulting distance was considered as a time value, not a step value. For discrete time models, this coincidently does the right thing, but for continuous time models this does not work as expected. Technically, as engine.getPathSize() is a long and the value from the text box is an int, the result is a long and that leads Java to prefer the a_backTrack(double) and a_autoStep(double) variants of these methods. We cast to an int to ensure that the int-parameter variants are taken. --- prism/src/userinterface/simulator/GUISimulator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prism/src/userinterface/simulator/GUISimulator.java b/prism/src/userinterface/simulator/GUISimulator.java index 1b9a4756..2c55d43f 100644 --- a/prism/src/userinterface/simulator/GUISimulator.java +++ b/prism/src/userinterface/simulator/GUISimulator.java @@ -1525,7 +1525,7 @@ public class GUISimulator extends GUIPlugin implements MouseListener, ListSelect else if (noSteps == 0) return; // Do backtrack - a_backTrack(engine.getPathSize() - noSteps); + a_backTrack((int)(engine.getPathSize() - noSteps)); } catch (NumberFormatException nfe) { String msg = "The \"" + typeBacktrackCombo.getSelectedItem() + "\" parameter is invalid: "; msg += "it should be a positive integer"; @@ -1829,7 +1829,7 @@ public class GUISimulator extends GUIPlugin implements MouseListener, ListSelect if (uptoState <= engine.getPathSize()) throw new NumberFormatException(); // Do simulation - a_autoStep(uptoState - engine.getPathSize()); + a_autoStep((int)(uptoState - engine.getPathSize())); } catch (NumberFormatException nfe) { String msg = "The \"" + typeExploreCombo.getSelectedItem() + "\" parameter is invalid: "; msg += "it should be greater than " + engine.getPathSize();