fsm

package
v0.0.0-...-bdabdff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateVisualization

func GenerateVisualization(fsm FSM, newFilePath string)

generates a visualization of FSM

Types

type FSM

type FSM struct {
	// contains filtered or unexported fields
}

definition of an FSM

func ClearHistory

func ClearHistory(fsm FSM) FSM

returns new FSM with state history cleared

func Execute

func Execute(fsm FSM, transition string) FSM

returns new FSM with transition of given name executed

func Generate

func Generate(initialState string, flags ...bool) FSM

returns a new generated FSM with given name of initial state and given flags first flag is a boolean that indicates whether or not state history should be tracked

func HistoryBack

func HistoryBack(fsm FSM, numSteps int) FSM

returns new FSM with state stepped back given number of times

func HistoryForward

func HistoryForward(fsm FSM, numSteps int) FSM

returns new FSM with state stepped forwards given number of times

func LimitHistory

func LimitHistory(fsm FSM, limit int) FSM

returns new FSM with state history limited to the last given number of states

func SetCallbacks

func SetCallbacks(fsm FSM, newOnBeforeTransition onBeforeTransitionCallback, newOnAfterTransition onAfterTransitionCallback, newOnEnterState onEnterStateCallback, newOnLeaveState onLeaveStateCallback) FSM

returns new FSM with given callback functions

func SetTransitions

func SetTransitions(fsm FSM, newTransitions []Transition) FSM

returns a new FSM with given list of transitions

func (*FSM) AllStates

func (fsm *FSM) AllStates() []string

returns a list of states in FSM

func (*FSM) AllTransitions

func (fsm *FSM) AllTransitions() []string

returns a list of names of all transitions that can be made from all states of FSM

func (*FSM) Can

func (fsm *FSM) Can(state string) bool

checks if state of given name can be reached from current state of FSM

func (*FSM) Cannot

func (fsm *FSM) Cannot(state string) bool

checks if state of given name cannot be reached from current state of FSM

func (*FSM) Is

func (fsm *FSM) Is(state string) bool

checks if name of current state of FSM is the given state name

func (*FSM) ValidTransitions

func (fsm *FSM) ValidTransitions() []string

returns a list of names of valid transitions that can be made from current state of FSM

type State

type State struct {
	// contains filtered or unexported fields
}

definition of a State

type Transition

type Transition struct {
	// contains filtered or unexported fields
}

definition of a Transition

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL