Browse Source

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.
master
Joachim Klein 7 years ago
parent
commit
737ad9cd22
  1. 4
      prism/src/userinterface/simulator/GUISimulator.java

4
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();

Loading…
Cancel
Save