N - the type of nodesM - the type of messagesT - the type of transitionspublic interface Transitioner<N extends Node,M extends Message,T extends Transition<N,M>>
| Modifier and Type | Method and Description |
|---|---|
void |
add(T transition)
Adds a new transition
|
void |
addAll(Collection<T> transitions)
Adds a collection of Transition to the state
machine.
|
void |
clear()
Removes all transitions from the state machine
|
Optional<N> |
find(String nodeName)
Finds the node in the transition
associated with the give name.
|
Collection<T> |
getAllTransitions()
Retrieves all state transitions currently
defined.
|
N |
getCurrent()
Retrieves the node
of the last transition performed.
|
Optional<N> |
getNext(M m)
Retrieves the next node upon
transitioning from the current node
on message reception.
|
Collection<N> |
getSiblings(String nodeName)
Retrieves the adjacent nodes i.e.
|
Collection<T> |
getTransitions(String nodeName)
Retrieves the transitions currently
defined for the given node.
|
TransitionIndex<N,M,T> |
getTransitionsIndex()
Retrieves the transition index used
by the transition.
|
void |
init()
Performs generic initialization e.g.
|
Transitioner<N,M,T> |
next()
Sends an empty message to the transitioner triggering
a potential transition in case the current node
supports empty messages.
|
List<N> |
prune()
Remove orphan nodes.
|
void |
remove(N node)
Removes an existing node and all
its transitions.
|
void |
remove(String nodeName)
Removes a node matching the given name
and allits transitions
|
void |
remove(T transition)
Removes an existing transition
|
void |
removeAllTransitions()
Removes all existing Transitions from the state machine.
|
Transitioner<N,M,T> |
send(M message)
Sends a message to the transitioner triggering
a potential transition.
|
void |
setCurrent(String nodeName)
Sets the current node to the one
supplied by the the given name.
|
int |
size()
Retrieves the number of nodes currently
handled by the transition.
|
void add(T transition)
transition - the transition to addvoid addAll(Collection<T> transitions)
transitions - the transitions to addvoid remove(T transition)
transition - the transition to removevoid remove(String nodeName)
nodeName - the node mame to removevoid remove(N node)
node - the node to removevoid removeAllTransitions()
void clear()
Optional<N> find(String nodeName)
nodeName - the node's namevoid init()
void setCurrent(String nodeName)
nodeName - the node's nameN getCurrent()
Optional<N> getNext(M m)
m - the messageTransitioner<N,M,T> next()
Transitioner instance for chaining purposesTransitioner<N,M,T> send(M message)
message - the messageint size()
Collection<T> getTransitions(String nodeName)
nodeName - the node's nameCollection<N> getSiblings(String nodeName)
nodeName - the node's nameCollection<T> getAllTransitions()
TransitionIndex<N,M,T> getTransitionsIndex()
Copyright © 2019 state-machine. All rights reserved.