gfsm

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSM

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

func CreateFSM

func CreateFSM() *FSM

*****************************************************************************************

func (*FSM) AddState

func (f *FSM) AddState(key string, state *FSMState)

添状态机方法:加状态到FSM @param1 : 状态对应的key @param : state:状态

func (*FSM) CalcNextStateKey

func (f *FSM) CalcNextStateKey(current *FSMState) string

状态机方法:计算下一个状态 @parma1: crrrent:当前的状态

func (*FSM) DoFsmState

func (f *FSM) DoFsmState()

状状态机方法:态切换

func (*FSM) GetCurrentState

func (f *FSM) GetCurrentState() *FSMState

获状态机方法:取当前状态

func (*FSM) GetNextState

func (f *FSM) GetNextState() *FSMState

获状态机方法:取下一下状态

func (*FSM) GetStateById

func (f *FSM) GetStateById(key string) *FSMState

根状态机方法:据key获取状态 @param: key:状态的Id

func (*FSM) Init

func (f *FSM) Init()

状态机方法:初始化FSM

func (*FSM) PauseStateMachine

func (f *FSM) PauseStateMachine()

暂状态机方法:停FSM

func (*FSM) ResetStateMachine

func (f *FSM) ResetStateMachine()

重状态机方法:置FSM

func (*FSM) SetDefaultState

func (f *FSM) SetDefaultState(state *FSMState)

设状态机方法:置默认的State @param: state:状态

func (*FSM) SetStateCallBackArg

func (f *FSM) SetStateCallBackArg(key string, arg interface{})

状态机方法:设置状态的执行参数 @param1: key:状态对应的Id @param2: arg:状态的回调函数执行参数

func (*FSM) Start

func (f *FSM) Start()

状态机方法:启动状态机

func (*FSM) SwitchFsmState

func (f *FSM) SwitchFsmState()

type FSMState

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

FSMState State父struct

func CreateMatchineState

func CreateMatchineState(id string, fun callBackFunc, arg interface{}, object interface{}, name string) *FSMState

创建状态机的状态方法 @param1 id: 状态对应的id @param2: fun: 普通函数回调函数,兼容接口 @param3: arg: 回调函数的参数 @param4: object: 创建状态机的对象 @param5: name: 对象的回调方法,兼容接口 注意:两个兼容的回调函数,区别是:一个是函数,一个是创建状态机的对象的方法

func (*FSMState) CheckTransition

func (fs *FSMState) CheckTransition()

状态方法:状态转移检测

func (*FSMState) Do

func (fs *FSMState) Do()

状态方法:状态处理函数

func (*FSMState) Enter

func (fs *FSMState) Enter()

状态方法:进入状态

func (*FSMState) Exit

func (fs *FSMState) Exit()

状态方法:退出状态

Jump to

Keyboard shortcuts

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