Documentation ¶
Index ¶
- func IteratorPrint(i Iterator)
- type AResponsibility
- type Bank
- type Box
- type Cash
- type Command
- type Downloader
- type FTPDownloader
- type Generator
- type HTTPDownloader
- type HasItemState
- type Iterator
- type MotherBoard
- type NoItemState
- type Numbers
- type NumbersIterator
- type Observer
- type Payment
- type PaymentContext
- type PaymentStrategy
- type Reader
- type RebootCommand
- type ResponsibilityLibrary
- type StartCommand
- type State
- type Subject
- type UI
- type VendingMachine
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IteratorPrint ¶
func IteratorPrint(i Iterator)
Types ¶
type AResponsibility ¶
type AResponsibility struct {
// contains filtered or unexported fields
}
func (*AResponsibility) Render ¶
func (r *AResponsibility) Render(ui *UI)
func (*AResponsibility) SetNext ¶
func (r *AResponsibility) SetNext(next ResponsibilityLibrary)
type Box ¶
type Box struct {
// contains filtered or unexported fields
}
func (*Box) PressButton1 ¶
func (b *Box) PressButton1()
func (*Box) PressButton2 ¶
func (b *Box) PressButton2()
type Downloader ¶
type Downloader interface {
Download(uri string)
}
Downloader 定义模版行为
func NewFTPDownloader ¶
func NewFTPDownloader() Downloader
func NewHTTPDownloader ¶
func NewHTTPDownloader() Downloader
type FTPDownloader ¶
type FTPDownloader struct {
// contains filtered or unexported fields
}
FTPDownloader 具体模版实现
type HTTPDownloader ¶
type HTTPDownloader struct {
// contains filtered or unexported fields
}
HTTPDownloader 具体模版实现
type HasItemState ¶
type HasItemState struct {
// contains filtered or unexported fields
}
type MotherBoard ¶
type MotherBoard struct{}
func (*MotherBoard) Reboot ¶
func (*MotherBoard) Reboot()
func (*MotherBoard) Start ¶
func (*MotherBoard) Start()
type NoItemState ¶
type NoItemState struct {
// contains filtered or unexported fields
}
type NumbersIterator ¶
type NumbersIterator struct {
// contains filtered or unexported fields
}
func (*NumbersIterator) First ¶
func (i *NumbersIterator) First()
func (*NumbersIterator) IsDone ¶
func (i *NumbersIterator) IsDone() bool
func (*NumbersIterator) Next ¶
func (i *NumbersIterator) Next() interface{}
type Payment ¶
type Payment struct {
// contains filtered or unexported fields
}
func NewPayment ¶
func NewPayment(name, cardid string, money int, strategy PaymentStrategy) *Payment
type PaymentContext ¶
type PaymentStrategy ¶
type PaymentStrategy interface {
Pay(*PaymentContext)
}
type RebootCommand ¶
type RebootCommand struct {
// contains filtered or unexported fields
}
func NewRebootCommand ¶
func NewRebootCommand(mb *MotherBoard) *RebootCommand
func (*RebootCommand) Execute ¶
func (c *RebootCommand) Execute()
type ResponsibilityLibrary ¶
type ResponsibilityLibrary interface { Render(*UI) SetNext(library ResponsibilityLibrary) }
type StartCommand ¶
type StartCommand struct {
// contains filtered or unexported fields
}
func NewStartCommand ¶
func NewStartCommand(mb *MotherBoard) *StartCommand
func (*StartCommand) Execute ¶
func (c *StartCommand) Execute()
type Subject ¶
type Subject struct {
// contains filtered or unexported fields
}
func NewSubject ¶
func NewSubject() *Subject
func (*Subject) UpdateContext ¶
type VendingMachine ¶
type VendingMachine struct {
// contains filtered or unexported fields
}
VendingMachine 状态模式用于分离状态和行为。
Click to show internal directories.
Click to hide internal directories.