@Singleton public class StateFlowGraph extends Object implements Serializable
| Constructor and Description |
|---|
StateFlowGraph(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) |
List<StateVertex> |
getDeepStates(StateVertex state) |
com.google.common.collect.ImmutableSet<Eventable> |
getIncomingClickable(StateVertex stateVertix)
Returns a set of all edges incoming into the specified vertex.
|
StateVertex |
getInitialState() |
int |
getMeanStateStringSize() |
String |
getNewStateName(int id)
Return the name of the (new)State.
|
int |
getNextStateId() |
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)
Returns the set of outgoing states.
|
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 |
getTargetState(Eventable clickable) |
StateVertex |
putIfAbsent(StateVertex stateVertix)
Adds a state (as a vertix) to the State-Flow Graph if not already present.
|
StateVertex |
putIfAbsent(StateVertex stateVertix,
boolean correctName)
Adds a state (as a vertix) to the State-Flow Graph if not already present.
|
String |
toString() |
@Inject public StateFlowGraph(ExitNotifier exitNotifier)
initialState - the state to start from.public StateVertex putIfAbsent(StateVertex stateVertix)
stateVertix - the state to be added.Graph.addVertex(Object)public StateVertex putIfAbsent(StateVertex stateVertix, boolean correctName)
stateVertix - the state to be added.correctName - if true the name of the state will be corrected according to the internal state
counter.null otherwise.Graph.addVertex(Object)public StateVertex getById(int id)
id - The ID of the statenull.public StateVertex getInitialState()
public 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 String toString()
public com.google.common.collect.ImmutableSet<Eventable> getOutgoingClickables(StateVertex stateVertix)
stateVertix - the state vertix.DirectedGraph.outgoingEdgesOf(Object)public com.google.common.collect.ImmutableSet<Eventable> getIncomingClickable(StateVertex stateVertix)
stateVertix - the state vertix.DirectedGraph.incomingEdgesOf(Object)public com.google.common.collect.ImmutableSet<StateVertex> getOutgoingStates(StateVertex stateVertix)
stateVertix - the state.public StateVertex getTargetState(Eventable clickable)
clickable - the edge.public boolean canGoTo(StateVertex source, StateVertex target)
source - the source state.target - the target state.public com.google.common.collect.ImmutableList<Eventable> getShortestPath(StateVertex start, StateVertex end)
start - the start state.end - the end state.public com.google.common.collect.ImmutableSet<StateVertex> getAllStates()
public com.google.common.collect.ImmutableSet<Eventable> getAllEdges()
public int getMeanStateStringSize()
public List<StateVertex> getDeepStates(StateVertex state)
state - The starting state.public List<List<org.jgrapht.GraphPath<StateVertex,Eventable>>> getAllPossiblePaths(StateVertex index)
index - the initial state.public String getNewStateName(int id)
public int getNextStateId()
public int getNumberOfStates()
Copyright © 2007-2013. All Rights Reserved.