fsm

package
v3.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Args

type Args map[string]interface{}

type Event

type Event string
const (
	EVENT_ENTRY Event = "ENTRY EVENT"
)

type FSM

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

func NewFSM

func NewFSM(initState State, table FuncTable) (fsm *FSM, err error)

func (*FSM) AddState

func (fsm *FSM) AddState(state State, callback HandleFunc)

func (*FSM) AllStates

func (fsm *FSM) AllStates() (states []State)

func (*FSM) Check

func (fsm *FSM) Check(state State) bool

func (*FSM) Current

func (fsm *FSM) Current() State

func (*FSM) PrintStates

func (fsm *FSM) PrintStates()

func (*FSM) SendEvent

func (fsm *FSM) SendEvent(event Event, args Args) (err error)

func (*FSM) Transfer

func (fsm *FSM) Transfer(trans State, args Args) error

args is for ENTRY params

type FuncTable

type FuncTable map[State]HandleFunc

func NewFuncTable

func NewFuncTable() (table FuncTable)

type HandleFunc

type HandleFunc func(*FSM, Event, Args) error

type State

type State string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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