java.lang.Object
dev.civl.gmc.Simulator<STATE,TRANSITION>
- Type Parameters:
STATE- the type for the states in the transition systemTRANSITION- the type for the transitions in the transition system
A
. Or, it could be used to perform a
random execution.
Simulator is used to execute a transition system using a
TransitionChooser to determine which transition to execute from each
state. E.g., this could be used to replay an execution trace of a transition
system, for which the trace was stored in a file created by method
invalid reference
DfsSearcher#writeStack(File)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetLog()booleanbooleanisQuiet()Trace<TRANSITION,STATE>[] play(STATE[] states, boolean[] print, String[] names, TransitionChooser<STATE, TRANSITION> chooser, boolean verbose) Plays the trace.Trace<TRANSITION,STATE>[] play(STATE initialState, TransitionChooser<STATE, TRANSITION> chooser, boolean verbose) Trace<TRANSITION,STATE>[] play(STATE initialSymbolicState, STATE initialConcreteState, boolean printSymbolicStates, TransitionChooser<STATE, TRANSITION> chooser, boolean verbose) voidvoidsetPredicate(StatePredicateIF<STATE> predicate) voidsetPrintAllStates(boolean value) voidsetQuiet(boolean quiet)
-
Constructor Details
-
Simulator
- Parameters:
manager- state manager; used to compute the next state given a state and transitionout- stream to which the trace should be written in human-readable formenabler- enabler used to determine the set of enabled transitions at a given state
-
-
Method Details
-
setPredicate
-
getPredicate
-
setPrintAllStates
public void setPrintAllStates(boolean value) -
getPrintAllStates
public boolean getPrintAllStates() -
setLog
-
getLog
-
isQuiet
public boolean isQuiet() -
setQuiet
public void setQuiet(boolean quiet) -
play
public Trace<TRANSITION,STATE>[] play(STATE initialState, TransitionChooser<STATE, TRANSITION> chooser, boolean verbose) throws MisguidedExecutionException- Throws:
MisguidedExecutionException
-
play
public Trace<TRANSITION,STATE>[] play(STATE[] states, boolean[] print, String[] names, TransitionChooser<STATE, TRANSITION> chooser, boolean verbose) throws MisguidedExecutionExceptionPlays the trace. This method accepts an array of initial states, and will create executions in parallel, one for each initial state. All of the executions will use the same sequence of transitions, but may start from different initial states. The common use case has two initial states, the first one a symbolic state and the second a concrete state obtained by solving the path condition.- Parameters:
states- the states from which the execution should start. The first state in the initial state (index 0) will be the one assumed to execute according to the guide. This method will modify this array so that upon returning the array will hold the final states.print- which states should be printed at a point when states will be printed. Array of length states.length.names- the names to use for the different executions. Array of length states.lengthchooser- the object used to decide which transition to choose when more than one is enabled at a stateverbose- print verbose output about what's going on?- Returns:
- An array of traces after executing the trace with different
initial states. See also
Trace. - Throws:
MisguidedExecutionException
-
play
public Trace<TRANSITION,STATE>[] play(STATE initialSymbolicState, STATE initialConcreteState, boolean printSymbolicStates, TransitionChooser<STATE, TRANSITION> chooser, boolean verbose) throws MisguidedExecutionException- Throws:
MisguidedExecutionException
-