vfsm

package
v0.0.0-...-7516b9f Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExceptionTransition

type ExceptionTransition[T StatefulObjectIf] struct {
	// contains filtered or unexported fields
}

func (ExceptionTransition[T]) Transit

func (tr ExceptionTransition[T]) Transit(self T, params map[string]any, e error, st string) (string, error)

type ExpressionCondtion

type ExpressionCondtion[T StatefulObjectIf] struct {
	// contains filtered or unexported fields
}

func (*ExpressionCondtion[T]) Eval

func (expr *ExpressionCondtion[T]) Eval(obj T, params map[string]any) (bool, error)

func (*ExpressionCondtion[T]) Parse

func (expr *ExpressionCondtion[T]) Parse(v string) error

func (*ExpressionCondtion[T]) SetAdvance

func (expr *ExpressionCondtion[T]) SetAdvance(f func(any) (bool, error))

type State

type State[T StatefulObjectIf] struct {
	// contains filtered or unexported fields
}

func (*State[T]) Exit

func (st *State[T]) Exit(obj T) error

func (*State[T]) Next

func (st *State[T]) Next(obj T, params map[string]any) (next string, err error)

func (*State[T]) Resolves

func (st *State[T]) Resolves(t ...*Transition[T])

type StateDescriptor

type StateDescriptor struct {
	Name        string
	Description string
	Next        []string
}

type StateObjectDescriptor

type StateObjectDescriptor struct {
	Name        string
	Description string
	States      []StateDescriptor
}

type StatefulObjectIf

type StatefulObjectIf interface {
	IsStopped() bool
	Error() error
	Descriptor() StateObjectDescriptor
	Current() string
	Shutdown() error
	Start() error
}

type Transition

type Transition[T StatefulObjectIf] struct {
	// contains filtered or unexported fields
}

func BindHitThen

func BindHitThen[T StatefulObjectIf](cond func(T, map[string]any) (bool, error), next string) *Transition[T]

func (Transition[T]) Transit

func (tr Transition[T]) Transit(self T, params map[string]any) (string, error)

type VFSM

type VFSM[T StatefulObjectIf] struct {
	// contains filtered or unexported fields
}

func NewVFSM

func NewVFSM[T StatefulObjectIf](origin string, states ...*State[T]) (vptr *VFSM[T], err error)

func (*VFSM[T]) Move

func (f *VFSM[T]) Move(params map[string]any) error

func (*VFSM[T]) Start

func (f *VFSM[T]) Start(params map[string]any) error

Jump to

Keyboard shortcuts

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