Documentation ¶
Index ¶
- type Broker
- type Caretaker
- type Component
- type Handler
- type InvalidStateError
- type InvalidTransitionError
- type Iterable
- type Iterator
- type Mediator
- type Memento
- type Observable
- type Observer
- type Originator
- type Query
- type State
- type StateMachine
- type StateMachineBuilder
- func (builder *StateMachineBuilder) SetCurrentState(initialState State) *StateMachineBuilder
- func (builder *StateMachineBuilder) SetMaxUnreachableState(MaxUnreachableState State) *StateMachineBuilder
- func (builder *StateMachineBuilder) SetStateToString(stateToString *map[State]string) *StateMachineBuilder
- func (builder *StateMachineBuilder) SetTransitionRules(transitionRules *map[State][]State) *StateMachineBuilder
- type StrategyApplicant
- type StrategyCreatorHandler
- type StrategyHandler
- type StrategyInstance
- type StrategyMethodHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broker ¶
func (*Broker[D, R]) Unsubscribe ¶
type Caretaker ¶
type Caretaker[T interface{}] struct {
MementoArray []*Memento[T]
}
func (*Caretaker[T]) AddMemento ¶
func (*Caretaker[T]) GetMemento ¶
type InvalidStateError ¶
type InvalidStateError struct{}
type InvalidTransitionError ¶
type InvalidTransitionError struct {
Current, Desired *State
// contains filtered or unexported fields
}
func (*InvalidTransitionError) Error ¶
func (e *InvalidTransitionError) Error() string
type Iterator ¶
type Iterator[T Iterable] struct { Item *T // contains filtered or unexported fields }
func (*Iterator[T]) InitIterator ¶
func (*Iterator[T]) Penultimate ¶
type Memento ¶
type Memento[T interface{}] struct {
State T
}
func (*Memento[T]) GetSavedState ¶
func (m *Memento[T]) GetSavedState() T
type Observable ¶
func NewObservable ¶
func NewObservable[T Observer]() Observable[T]
func (*Observable[T]) Notify ¶
func (o *Observable[T]) Notify(data interface{})
func (*Observable[T]) Subscribe ¶
func (o *Observable[T]) Subscribe(sub Observer)
func (*Observable[T]) Unsubscribe ¶
func (o *Observable[T]) Unsubscribe(sub Observer)
type Originator ¶
type Originator[T interface{}] struct {
State T
}
func (*Originator[T]) CreateMemento ¶
func (e *Originator[T]) CreateMemento() *Memento[T]
func (*Originator[T]) GetState ¶
func (e *Originator[T]) GetState() T
func (*Originator[T]) RestoreMemento ¶
func (e *Originator[T]) RestoreMemento(m *Memento[T])
func (*Originator[T]) SetState ¶
func (e *Originator[T]) SetState(state T)
type StateMachine ¶
type StateMachine struct { CurrentState State TransitionRules *map[State][]State MaxUnreachableState State // contains filtered or unexported fields }
func (*StateMachine) GoTo ¶
func (stateMachine *StateMachine) GoTo(desiredState State) error
func (*StateMachine) String ¶
func (stateMachine *StateMachine) String() string
type StateMachineBuilder ¶
type StateMachineBuilder struct { creational.FunctionalBuilder[StateMachine] }
func (*StateMachineBuilder) SetCurrentState ¶
func (builder *StateMachineBuilder) SetCurrentState(initialState State) *StateMachineBuilder
func (*StateMachineBuilder) SetMaxUnreachableState ¶
func (builder *StateMachineBuilder) SetMaxUnreachableState(MaxUnreachableState State) *StateMachineBuilder
func (*StateMachineBuilder) SetStateToString ¶
func (builder *StateMachineBuilder) SetStateToString(stateToString *map[State]string) *StateMachineBuilder
func (*StateMachineBuilder) SetTransitionRules ¶
func (builder *StateMachineBuilder) SetTransitionRules(transitionRules *map[State][]State) *StateMachineBuilder
type StrategyApplicant ¶
type StrategyApplicant interface{}
type StrategyCreatorHandler ¶
type StrategyCreatorHandler[T StrategyApplicant] func() *T
type StrategyHandler ¶
type StrategyHandler[T StrategyApplicant] func(T)
func NewStrategyHandler ¶
func NewStrategyHandler[T StrategyApplicant](handler func(T)) StrategyHandler[T]
type StrategyInstance ¶
type StrategyInstance[T StrategyApplicant] interface { Execute() }
type StrategyMethodHandler ¶
type StrategyMethodHandler[T StrategyApplicant] func()
Click to show internal directories.
Click to hide internal directories.