Browse Source

Add some methods to the Strategy interface.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@7171 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 13 years ago
parent
commit
9b3d8345f3
  1. 25
      prism/src/strat/MDStrategy.java
  2. 18
      prism/src/strat/Strategy.java

25
prism/src/strat/MDStrategy.java

@ -34,6 +34,11 @@ import prism.PrismLog;
*/
public abstract class MDStrategy implements Strategy
{
/**
* Current state of model
*/
protected int currentState = -1;
/**
* Get the number of states of the model associated with this strategy.
*/
@ -56,6 +61,26 @@ public abstract class MDStrategy implements Strategy
*/
public abstract Object getChoiceAction(int s);
// Methods for Strategy
@Override
public void initialise(int s)
{
currentState = s;
}
@Override
public void update(int action, int s)
{
currentState = s;
}
@Override
public Object getChoiceAction()
{
return getChoiceAction(currentState);
}
@Override
public void exportActions(PrismLog out)
{

18
prism/src/strat/Strategy.java

@ -44,6 +44,24 @@ public interface Strategy
*/
public void exportActions(PrismLog out);
/**
* Initialise the strategy, based on an initial model state.
* @param s Initial state of the model
*/
public void initialise(int s);
/**
* Update the strategy, based on the next step in a model's history.
* @param action The action taken in the previous state of the model
* @param s The new state of the model
*/
public void update(int action, int s);
/**
* Get the action chosen by the strategy in the current state (assuming it is deterministic).
*/
public Object getChoiceAction();
/**
* Clear storage of the strategy.
*/

Loading…
Cancel
Save