@Singleton public class InMemoryStateFlowGraph extends Object implements Serializable, StateFlowGraph
| Constructor and Description |
|---|
InMemoryStateFlowGraph(ExitNotifier exitNotifier)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addEdge(StateVertex sourceVert,
StateVertex targetVert,
Eventable clickable)
Adds the specified edge to this graph, going from the source vertex to the target vertex.
|
boolean |
canGoTo(StateVertex source,
StateVertex target)
Is it possible to go from s1 -> s2?
|
com.google.common.collect.ImmutableSet<Eventable> |
getAllEdges()
Return all the edges in the StateFlowGraph.
|
List<List<org.jgrapht.GraphPath<StateVertex,Eventable>>> |
getAllPossiblePaths(StateVertex index)
This method returns all possible paths from the index state using the Kshortest paths.
|
com.google.common.collect.ImmutableSet<StateVertex> |
getAllStates()
Return all the states in the StateFlowGraph.
|
StateVertex |
getById(int id) |
com.google.common.collect.ImmutableSet<Eventable> |
getIncomingClickable(StateVertex stateVertix)
Returns a set of all edges incoming into the specified vertex.
|
StateVertex |
getInitialState() |
int |
getMeanStateStringSize() |
int |
getNumberOfStates() |
com.google.common.collect.ImmutableSet<Eventable> |
getOutgoingClickables(StateVertex stateVertix)
Returns a set of all clickables outgoing from the specified vertex.
|
com.google.common.collect.ImmutableSet<StateVertex> |
getOutgoingStates(StateVertex stateVertix) |
com.google.common.collect.ImmutableList<Eventable> |
getShortestPath(StateVertex start,
StateVertex end)
Convenience method to find the Dijkstra shortest path between two states on the graph.
|
StateVertex |
putIfAbsent(StateVertex stateVertix)
Adds a state (as a vertix) to the State-Flow Graph if not already present.
|
StateVertex |
putIndex(StateVertex index) |
String |
toString() |
@Inject public InMemoryStateFlowGraph(ExitNotifier exitNotifier)
exitNotifier - used for triggering an exit.public StateVertex putIfAbsent(StateVertex stateVertix)
stateVertix - the state to be added.Graph.addVertex(Object)public StateVertex putIndex(StateVertex index)
public StateVertex getById(int id)
getById in interface StateFlowGraphid - The ID of the statenull.public StateVertex getInitialState()
getInitialState in interface StateFlowGraphpublic boolean addEdge(StateVertex sourceVert, StateVertex targetVert, Eventable clickable)
sourceVert - source vertex of the edge.targetVert - target vertex of the edge.clickable - the clickable edge to be added to this graph.Graph.addEdge(Object, Object, Object)public com.google.common.collect.ImmutableSet<Eventable> getOutgoingClickables(StateVertex stateVertix)
StateFlowGraphgetOutgoingClickables in interface StateFlowGraphstateVertix - the state vertix.DirectedGraph.outgoingEdgesOf(Object)public com.google.common.collect.ImmutableSet<Eventable> getIncomingClickable(StateVertex stateVertix)
StateFlowGraphgetIncomingClickable in interface StateFlowGraphstateVertix - the state vertix.DirectedGraph.incomingEdgesOf(Object)public boolean canGoTo(StateVertex source, StateVertex target)
StateFlowGraphcanGoTo in interface StateFlowGraphsource - the source state.target - the target state.public com.google.common.collect.ImmutableList<Eventable> getShortestPath(StateVertex start, StateVertex end)
StateFlowGraphgetShortestPath in interface StateFlowGraphstart - the start state.end - the end state.public com.google.common.collect.ImmutableSet<StateVertex> getAllStates()
StateFlowGraphgetAllStates in interface StateFlowGraphpublic com.google.common.collect.ImmutableSet<Eventable> getAllEdges()
StateFlowGraphgetAllEdges in interface StateFlowGraphpublic int getMeanStateStringSize()
getMeanStateStringSize in interface StateFlowGraphpublic int getNumberOfStates()
getNumberOfStates in interface StateFlowGraphpublic List<List<org.jgrapht.GraphPath<StateVertex,Eventable>>> getAllPossiblePaths(StateVertex index)
StateFlowGraphgetAllPossiblePaths in interface StateFlowGraphindex - the initial state.public com.google.common.collect.ImmutableSet<StateVertex> getOutgoingStates(StateVertex stateVertix)
getOutgoingStates in interface StateFlowGraphstateVertix - The source StateVertexSet of StateVertex that are connected to the source
StateVertex via one of the sources outgoing edges.Copyright © 2007-2013. All Rights Reserved.