java.lang.Object
dev.civl.gmc.seq.StateManager<STATE,TRANSITION>
- Type Parameters:
STATE- the type used to represent states in the state-transition system being analyzedTRANSITION- the type used to represent transitions in the state-transition system being analyzed
- Direct Known Subclasses:
ConcurrentStateManagerIF,SimpleStateManager
A StateManagerIF provides part of a generic interface to a state-transition
system. The primary method is
nextState(STATE, TRANSITION), which, given a state and a
transition, returns the "next state", i.e., the state which results from
executing the transition from the given state. Other methods are provided
that are needed specifically for depth-first search, including methods to
mark a state as "seen before", and to make a state as "currently on (or off)
the stack". Still other methods are provided for printing information about
states.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidgetEnabledProcesses(STATE state) intGet the id of a normalizedState.getLiveProcesses(STATE state) abstract intgetPid(TRANSITION transition) Gets the ID number of the process that is responsible for executing transition.abstract Collection<TRANSITION> getTransitions(STATE state, int pid) abstract TraceStepIF<STATE> nextState(STATE state, TRANSITION transition) Given a state and a transition, returns the trace step after executing the transition at the given state.abstract voidnormalize(TraceStepIF<STATE> traceStep) Normalize/simplify a state.abstract voidPrints out all the states, in long form, currently "held" by this manager.abstract voidPrints out all the states, in short form, currently "held" by this manager.abstract voidprintStateLong(PrintStream out, STATE state) Prints out a long human-readable representation of the state.abstract voidprintStateShort(PrintStream out, STATE state) Prints out a short human-readable representation of the state.abstract voidprintTraceStep(STATE sourceState, TraceStepIF<STATE> traceStep) This method should print the source state id and transitions within this traceStep.abstract voidprintTraceStepFinalState(STATE finalState, int normalizedID) This method should print the final state of a trace step.abstract voidprintTransitionLong(PrintStream out, TRANSITION transition) Prints out a long human-readable representation of the transition.abstract voidprintTransitionShort(PrintStream out, TRANSITION transition) Prints out a short human-readable representation of the transition.voidsetGetIdFunction(GetIdFunction<STATE> getIdFunc) abstract TraceStepIF<STATE> tryNextState(STATE state, TRANSITION transition) Same asnextState(STATE,TRANSITION)except if an error is encountered then it is not reported and null is returned
-
Constructor Details
-
StateManager
public StateManager()
-
-
Method Details
-
nextState
Given a state and a transition, returns the trace step after executing the transition at the given state. SeeTraceStepIF.- Parameters:
state- a state in the state transition systemtransition- a transition which is enabled at the given state- Returns:
- the trace step after executing the transition at the given state.
-
tryNextState
Same asnextState(STATE,TRANSITION)except if an error is encountered then it is not reported and null is returned- Parameters:
state- a state in the state transition systemtransition- an transition which is enabled at the given state- Returns:
- the trace step after executing the transition at the given state.
-
getPid
Gets the ID number of the process that is responsible for executing transition. This is used for the preemption-bounding search. If not doing preemption-bounded search, this method is not used. The preemption-bounded search determines if the given transition is a preemption if the PID is different from the PID of the previous transition but there is a transition in the enabled (or ample) set with the PID of the previous transition.- Parameters:
transition- a non-null transition- Returns:
- a PID of the given transition
-
getEnabledProcesses
-
getLiveProcesses
-
getTransitions
-
normalize
Normalize/simplify a state. It takes a
TraceStepIFas input since normalize always happens afternextState(Object, Object)which will return aTraceStepIFand normalize may need information fromTraceStepIF.Note that each distinct state (not equal with each other) will only normalized once. Since when a unnormalized state is seen again, you can get its normalized state through its associated
SequentialNode.- Parameters:
state- The state that is being normalized/simplified.
-
printTraceStep
This method should print the source state id and transitions within this traceStep. Note that this method should not print the final state in the traceStep.- Parameters:
traceStep- The traceStep you want to print
-
printTraceStepFinalState
This method should print the final state of a trace step. So a complete print of a trace step consists of a call to
printTraceStep(Object, TraceStepIF)and a call to this method.When this method is called, the final state of the traceStep is already normalized if (-saveStates option is enabled).
- Parameters:
finalState- The final state of a trace stepnormalizedID- The ID of a normalized state (-1, if -saveStates option is diabled). see alsogetId(Object)
-
printStateShort
Prints out a short human-readable representation of the state. This is intended to be something like "State 13", or something similar.- Parameters:
out- the stream to which to send the outputstate- any state in the state transition system
-
printStateLong
Prints out a long human-readable representation of the state. This is intended to show all the details of the state, e.g., the values of all variables, etc.- Parameters:
out- the stream to which to send the outputstate- any state in the state transition system
-
printTransitionShort
Prints out a short human-readable representation of the transition.- Parameters:
out- the stream to which to send the outputtransition- any transition in the state transition system
-
printTransitionLong
Prints out a long human-readable representation of the transition. This is intended to show all details of the transition.- Parameters:
out- the stream to which to send the outputtransition- any transition in the state transition system
-
printAllStatesShort
Prints out all the states, in short form, currently "held" by this manager. It is up to each implementation to decide what states are "held".- Parameters:
out- the stream to which to send the output
-
printAllStatesLong
Prints out all the states, in long form, currently "held" by this manager. It is up to each implementation to decide what states are "held".- Parameters:
out- the stream to which to send the output
-
debug
-
getId
Get the id of a normalizedState.- Parameters:
normalizedState- The State of which you want the id.- Returns:
- the id of the normalizedState.
-
setGetIdFunction
-