display

package
v0.0.0-...-62e5a7b Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Halt = iota
	Rest
	Work
	Tare
	Wait
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AbstractState

type AbstractState interface {
	GetType() WorkoutStateType
	GetMutableState() MutableState
	// contains filtered or unexported methods
}

type ActualInput

type ActualInput interface {
	UserInput
	Satisfies(input ExpectedInput) bool
}

type AutoRefreshingModel

type AutoRefreshingModel interface {
	Model
	Start(ctx context.Context)
}

type ExpectedInput

type ExpectedInput interface {
	UserInput
}

type ExpiringState

type ExpiringState interface {
	AbstractState
	Deadline() time.Time
	Fallback() State
}

type InputDependentState

type InputDependentState interface {
	AbstractState
	InputRequired() ExpectedInput
	InputReceived() ActualInput
	// TODO(rchew): make Satisfied return read-once channel and add an evolving state
	Satisfied() bool
}

type Model

type Model interface {
	UpdateState(state State) error
}

func ModelMux

func ModelMux(models ...Model) Model

TODO(rchew) States are mutable now, so muxing is weird... A single StateHolder that is shared between multiple displays seems better -> I need to refactor displays to take a StateHolder, then delete this file

type MutableState

type MutableState interface {
	Start()
	Started() bool
	GetStartTime() time.Time
}

type State

type State interface {
	AbstractState
	// TODO(rchew) better to just do this with casting?
	ExpiringState() (ExpiringState, bool)
	InputDependentState() (InputDependentState, bool)
}

func NewState

func NewState(stateType WorkoutStateType, opts ...StateBuilderOption) State

type StateBuilderOption

type StateBuilderOption interface {
	// contains filtered or unexported methods
}

func WithExpectedUserInput

func WithExpectedUserInput(expected ExpectedInput, actual ActualInput) StateBuilderOption

func WithExpiryAndFallback

func WithExpiryAndFallback(deadline time.Time, fallback State) StateBuilderOption

type UserInput

type UserInput interface {
	GetValue() UserInputValue
}

type UserInputValue

type UserInputValue interface {
	fmt.Stringer
}

type WorkoutStateType

type WorkoutStateType int

func (WorkoutStateType) String

func (t WorkoutStateType) String() string

Directories

Path Synopsis
cli

Jump to

Keyboard shortcuts

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