Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrTableMustBeSet = validation.NewError(
"transitions_table_must_be_set",
"the transitions table must be set and cannot be an empty",
)
ErrTableMustBeSet is the validation check error returned when the transitions table is empty.
Functions ¶
This section is empty.
Types ¶
type Transitions ¶
Transitions represents a structure for describing states and the valid transitions between them.
func Generate ¶
func Generate[T state.State](rand *rand.Rand, states []T) *Transitions[T]
Generate from a set of random states.
func New ¶
func New[T state.State](transitions Table[T]) (*Transitions[T], validation.ErrorGroup)
New creates and validates a new Transitions.
func (*Transitions[T]) Check ¶
func (t *Transitions[T]) Check() validation.ErrorGroup
Check runs default validation checks for the Transitions.
func (*Transitions[T]) Len ¶
func (t *Transitions[T]) Len() int
Len returns number of registered transitions for all states.
func (*Transitions[T]) Valid ¶
func (t *Transitions[T]) Valid(current, next T) bool
Valid return true for registered transition between current -> next states.
Click to show internal directories.
Click to hide internal directories.