actualCombat

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

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

Go to latest
Published: Jan 21, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HasMoneyState

type HasMoneyState struct {
	VendingMachine *VendingMachine
}

func (*HasMoneyState) AddProduct

func (i *HasMoneyState) AddProduct(count int) error

func (*HasMoneyState) DispenseProduct

func (i *HasMoneyState) DispenseProduct() error

func (*HasMoneyState) InsertMoney

func (i *HasMoneyState) InsertMoney(money int) error

func (*HasMoneyState) RequestProduct

func (i *HasMoneyState) RequestProduct() error

type HasProductState

type HasProductState struct {
	VendingMachine *VendingMachine
}

func (*HasProductState) AddProduct

func (i *HasProductState) AddProduct(count int) error

func (*HasProductState) DispenseProduct

func (i *HasProductState) DispenseProduct() error

func (*HasProductState) InsertMoney

func (i *HasProductState) InsertMoney(money int) error

func (*HasProductState) RequestProduct

func (i *HasProductState) RequestProduct() error

type NoProductState

type NoProductState struct {
	VendingMachine *VendingMachine
}

func (*NoProductState) AddProduct

func (i *NoProductState) AddProduct(count int) error

func (*NoProductState) DispenseProduct

func (i *NoProductState) DispenseProduct() error

func (*NoProductState) InsertMoney

func (i *NoProductState) InsertMoney(money int) error

func (*NoProductState) RequestProduct

func (i *NoProductState) RequestProduct() error

type ProductRequestedState

type ProductRequestedState struct {
	VendingMachine *VendingMachine
}

func (*ProductRequestedState) AddProduct

func (i *ProductRequestedState) AddProduct(count int) error

func (*ProductRequestedState) DispenseProduct

func (i *ProductRequestedState) DispenseProduct() error

func (*ProductRequestedState) InsertMoney

func (i *ProductRequestedState) InsertMoney(money int) error

func (*ProductRequestedState) RequestProduct

func (i *ProductRequestedState) RequestProduct() error

type State

type State interface {
	AddProduct(int) error
	RequestProduct() error
	InsertMoney(money int) error
	DispenseProduct() error
}

type VendingMachine

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

自动售货机类

func NewVendingMachine

func NewVendingMachine(productCount, productPrice int) *VendingMachine

func (*VendingMachine) AddProduct

func (v *VendingMachine) AddProduct(count int) error

func (*VendingMachine) DispenseProduct

func (v *VendingMachine) DispenseProduct() error

func (*VendingMachine) IncrementProductCount

func (v *VendingMachine) IncrementProductCount(count int)

func (*VendingMachine) InsertMoney

func (v *VendingMachine) InsertMoney(money int) error

func (*VendingMachine) RequestProduct

func (v *VendingMachine) RequestProduct() error

func (*VendingMachine) SetState

func (v *VendingMachine) SetState(s State)

Jump to

Keyboard shortcuts

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