mow.cli: Index | Files | Directories

package fsm

import ""


Package Files


type State Uses

type State struct {
    Terminal    bool
    Transitions StateTransitions

State is the basic building block in the FSM. A State can be final or not, and has transitions to other states

func NewState Uses

func NewState() *State

NewState create a new state

func (*State) Parse Uses

func (s *State) Parse(args []string) error

Parse tries to navigate into the FSM according to the provided args

func (*State) Prepare Uses

func (s *State) Prepare()

Prepare simplifies the FSM and sorts the transitions according to their priorities

func (*State) T Uses

func (s *State) T(matcher matcher.Matcher, next *State) *State

T creates a transition between 2 states

type StateTransitions Uses

type StateTransitions []*Transition

StateTransitions is a sortable slice of transitions according to their priorities

func (StateTransitions) Len Uses

func (t StateTransitions) Len() int

func (StateTransitions) Less Uses

func (t StateTransitions) Less(i, j int) bool

func (StateTransitions) Swap Uses

func (t StateTransitions) Swap(i, j int)

type Transition Uses

type Transition struct {
    Matcher matcher.Matcher
    Next    *State

Transition links 2 states. If a transition's matcher matches, the next state can be reached



Package fsm imports 5 packages (graph) and is imported by 6 packages. Updated 2019-06-27. Refresh now. Tools for package owners.