states

package
v0.0.0-...-8bfda83 Latest Latest
Warning

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

Go to latest
Published: May 12, 2015 License: MIT Imports: 1 Imported by: 7

Documentation

Overview

A state machine - not ready yet.

Index

Constants

View Source
const (
	Transient = iota
	SessionPersistent
	UserPersistent
)

Variables

This section is empty.

Functions

func StatePath

func StatePath(state State) string

Types

type BaseState

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

func (*BaseState) Enter

func (self *BaseState) Enter(*Transition)

func (*BaseState) Leave

func (self *BaseState) Leave(*Transition)

func (*BaseState) Name

func (self *BaseState) Name() string

func (*BaseState) SetStateMachine

func (self *BaseState) SetStateMachine(parent *StateMachine)

func (*BaseState) StateMachine

func (self *BaseState) StateMachine() *StateMachine

type Persistence

type Persistence uint

type State

type State interface {
	SetStateMachine(*StateMachine)
	StateMachine() *StateMachine
	Name() string
	Enter(*Transition)
	Leave(*Transition)
}

type StateMachine

type StateMachine struct {
	States      []State
	Transitions []*Transition
	// contains filtered or unexported fields
}

func (*StateMachine) CurrentState

func (self *StateMachine) CurrentState() State

func (*StateMachine) Enter

func (self *StateMachine) Enter(transition *Transition)

func (*StateMachine) Event

func (self *StateMachine) Event(event string)

func (*StateMachine) Leave

func (self *StateMachine) Leave(transition *Transition)

func (*StateMachine) Name

func (self *StateMachine) Name() string

func (*StateMachine) SetStateMachine

func (self *StateMachine) SetStateMachine(parent *StateMachine)

func (*StateMachine) StateMachine

func (self *StateMachine) StateMachine() *StateMachine

type Transition

type Transition struct {
	Event string
	From  State
	To    State
}

func (*Transition) Do

func (self *Transition) Do()

func (*Transition) Veto

func (self *Transition) Veto() bool

type TransitionVetoer

type TransitionVetoer interface {
	TransitionVeto(*Transition) bool
}

Jump to

Keyboard shortcuts

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