states

package
v0.0.0-...-69341d4 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2020 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LastActionIDExecuted = 0

LastActionIDExecuted helps with testing

Functions

This section is empty.

Types

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

Jump to

Keyboard shortcuts

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