|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nz.ac.waikato.modeljunit.AbstractListener nz.ac.waikato.modeljunit.GraphListener
public class GraphListener
This ModelListener builds a graph of the observed parts of the model. Note that it is some other class (typically a Tester subclass) that determines which parts of the model are explored. As well as building the graph, this listener also keeps track of which paths have not yet been explored. Internally, it keeps track of two bitsets for each node/state. The 'done_' set records the outgoing transitions that have been taken/explored since the last call to clearDoneTodo(). The 'wasEnabled_' set records the actions that have been observed to have true guards at some point since the last call to clearDoneTodo() (this includes implicitly true guards, where the action has no explicit guard).
Field Summary |
---|
Fields inherited from class nz.ac.waikato.modeljunit.AbstractListener |
---|
model_ |
Constructor Summary | |
---|---|
GraphListener()
|
Method Summary | |
---|---|
void |
clearDoneTodo()
Resets all the done and todo information. |
void |
doneTransition(int action,
Transition tr)
Records a transition in the graph, if it is not already there. |
java.util.BitSet |
getDone(java.lang.Object state)
Returns a bitset of all the DONE bits for this state. |
InspectableGraph |
getGraph()
Returns the graph of the FSM model. |
java.lang.String |
getName()
Get the short name that this listener is known by. |
java.util.BitSet |
getTodo(java.lang.Object state)
Returns a bitset of all the TODO bits for this state. |
Vertex |
getVertex(java.lang.Object state)
Maps a state to a vertex object of the FSM graph. |
java.util.Map<java.lang.Object,Vertex> |
getVertexMap()
Returns a map that maps each state of the model to the corresponding vertex of the graph. |
boolean |
isComplete()
Returns true after the graph seems to be completely explored. |
boolean |
isDone(java.lang.Object state,
int action)
True if the given action has been executed from the given state. |
boolean |
isTodo(java.lang.Object state,
int action)
True if the guard of the given action was once true in the given state, but that action has not yet been executed from that state. |
int |
numTodo()
Returns the number of unexplored paths/branches in the graph. |
void |
printGraphDot(java.lang.String filename)
Saves the FSM graph into the given file, in DOT format. |
void |
printProgress(int importance,
java.lang.String msg)
|
void |
setModel(Model model)
Starts to build the FSM graph by exploring the fsm object. |
static java.lang.String |
stateName(java.lang.Object state)
Converts a state into a name. |
Methods inherited from class nz.ac.waikato.modeljunit.AbstractListener |
---|
doneGuard, doneReset, failure, getModel, startAction |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GraphListener()
Method Detail |
---|
public java.lang.String getName()
ModelListener
public boolean isComplete()
public int numTodo()
public boolean isTodo(java.lang.Object state, int action)
state
- A non-null state of the model.action
- The number of one of the actions of the model.
public java.util.BitSet getTodo(java.lang.Object state)
state
-
public boolean isDone(java.lang.Object state, int action)
state
- A non-null state of the model.action
- The number of one of the actions of the model.
public java.util.BitSet getDone(java.lang.Object state)
state
-
public void clearDoneTodo()
public InspectableGraph getGraph()
public java.util.Map<java.lang.Object,Vertex> getVertexMap()
public Vertex getVertex(java.lang.Object state)
public void printProgress(int importance, java.lang.String msg)
public void setModel(Model model)
setModel
in interface ModelListener
setModel
in class AbstractListener
public void printGraphDot(java.lang.String filename) throws java.io.FileNotFoundException
filename
- The filename should end with ".dot".
java.io.FileNotFoundException
public static java.lang.String stateName(java.lang.Object state)
state
-
public void doneTransition(int action, Transition tr)
doneTransition
in interface ModelListener
doneTransition
in class AbstractListener
action
- The number of the action just takentr
- A possibly new transition (and state).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |