Browse Source

Some refactoring in SimulatorEngine.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@10928 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 10 years ago
parent
commit
400fcfcc45
  1. 26
      prism/src/simulator/SimulatorEngine.java

26
prism/src/simulator/SimulatorEngine.java

@ -932,6 +932,17 @@ public class SimulatorEngine extends PrismComponent
return transitionList;
}
/**
* Get the state for which the simulator is currently supplying information about its transitions.
* Usually, this is the current (final) state of the path.
* But if the user called {@link #computeTransitionsForStep(int step)}, it will be this state instead.
*/
public State getTransitionListState()
{
return (transitionListState == null) ? path.getCurrentState() : transitionListState;
}
/**
* Returns the current number of available choices.
*/
@ -1053,10 +1064,7 @@ public class SimulatorEngine extends PrismComponent
*/
public String getTransitionUpdateString(int index) throws PrismException
{
// We need the state containing the transitions. Usually, this is the current (final) state
// of the path. But if the user called computeTransitionsForStep(int step), this is not so.
State state = (transitionListState == null) ? path.getCurrentState() : transitionListState;
return getTransitionList().getTransitionUpdateString(index, state);
return getTransitionList().getTransitionUpdateString(index, getTransitionListState());
}
/**
@ -1076,10 +1084,7 @@ public class SimulatorEngine extends PrismComponent
*/
public State computeTransitionTarget(int i, int offset) throws PrismException
{
// We need the state containing the transitions. Usually, this is the current (final) state
// of the path. But if the user called computeTransitionsForStep(int step), this is not so.
State state = (transitionListState == null) ? path.getCurrentState() : transitionListState;
return getTransitionList().getChoice(i).computeTarget(offset, state);
return getTransitionList().getChoice(i).computeTarget(offset, getTransitionListState());
}
/**
@ -1087,10 +1092,7 @@ public class SimulatorEngine extends PrismComponent
*/
public State computeTransitionTarget(int index) throws PrismException
{
// We need the state containing the transitions. Usually, this is the current (final) state
// of the path. But if the user called computeTransitionsForStep(int step), this is not so.
State state = (transitionListState == null) ? path.getCurrentState() : transitionListState;
return getTransitionList().computeTransitionTarget(index, state);
return getTransitionList().computeTransitionTarget(index, getTransitionListState());
}
// ------------------------------------------------------------------------------

Loading…
Cancel
Save