Back to godoc.org

Package states

v0.0.0-...-69341d4
Latest Go to latest

The highest tagged major version is .

Published: Jan 20, 2020 | License: MIT | Module: github.com/Enflick/gohsm

Index

Variables

var LastActionIDExecuted = 0

LastActionIDExecuted helps with testing

type KeyPressEvent

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

KeyPressEvent represents a keyboard entered event

func NewKeyPressEvent

func NewKeyPressEvent(text string) *KeyPressEvent

NewKeyPressEvent constructor

func (*KeyPressEvent) ID

func (kpe *KeyPressEvent) ID() string

ID returns the events identifier

type StateA

type StateA struct {
	hsm.BaseState
	// contains filtered or unexported fields
}

StateA represents State A

func NewStateA

func NewStateA(logger *zap.Logger, a bool) *StateA

NewStateA constructor

func (*StateA) EventHandler

func (s *StateA) EventHandler(event hsm.Event) hsm.Transition

EventHandler returns the transition associated with the event or nil if this state does not handle the event

func (*StateA) OnEnter

func (s *StateA) OnEnter(event hsm.Event) hsm.State

OnEnter enters this state and returns the new current state

func (*StateA) OnExit

func (s *StateA) OnExit(event hsm.Event) hsm.State

OnExit exits this state and returns the parentState or nil if this state does not have a parent

type StateB

type StateB struct {
	hsm.BaseState
}

StateB represents State B

func NewStateB

func NewStateB(logger *zap.Logger, parentState *StateA) *StateB

NewStateB constructor

func (*StateB) EventHandler

func (s *StateB) EventHandler(event hsm.Event) hsm.Transition

EventHandler returns the transition associated with the event or nil if this state does not handle the event

func (*StateB) OnEnter

func (s *StateB) OnEnter(event hsm.Event) hsm.State

OnEnter enters this state and returns the new current state

func (*StateB) OnExit

func (s *StateB) OnExit(event hsm.Event) hsm.State

OnExit exits this state and returns the parentState or nil if this state does not have a parent

type StateC

type StateC struct {
	hsm.BaseState
}

StateC represents State C

func NewStateC

func NewStateC(logger *zap.Logger, parentState hsm.State) *StateC

NewStateC constructor

func (*StateC) EventHandler

func (s *StateC) EventHandler(event hsm.Event) hsm.Transition

EventHandler returns the transition associated with the event or nil if this state does not handle the event

func (*StateC) OnEnter

func (s *StateC) OnEnter(event hsm.Event) hsm.State

OnEnter enters this state and returns the new current state

func (*StateC) OnExit

func (s *StateC) OnExit(event hsm.Event) hsm.State

OnExit exits this state and returns the parentState or nil if this state does not have a parent

type StateD

type StateD struct {
	hsm.BaseState
}

StateD represents State D

func NewStateD

func NewStateD(logger *zap.Logger) *StateD

NewStateD constructor

func (*StateD) EventHandler

func (s *StateD) EventHandler(event hsm.Event) hsm.Transition

EventHandler returns the transition associated with the event or nil if this state does not handle the event

func (*StateD) OnEnter

func (s *StateD) OnEnter(event hsm.Event) hsm.State

OnEnter enters this state and returns the new current state

func (*StateD) OnExit

func (s *StateD) OnExit(event hsm.Event) hsm.State

OnExit exits this state and returns the parentState or nil if this state does not have a parent

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier