action

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

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 Bank

type Bank struct{}

func (*Bank) Pay

func (*Bank) Pay(ctx *PaymentContext)

type Box

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

func NewBox

func NewBox(button1, button2 Command) *Box

func (*Box) PressButton1

func (b *Box) PressButton1()

func (*Box) PressButton2

func (b *Box) PressButton2()

type Cash

type Cash struct{}

func (*Cash) Pay

func (*Cash) Pay(ctx *PaymentContext)

type Command

type Command interface {
	Execute()
}

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 具体模版实现

func (FTPDownloader) Download

func (t FTPDownloader) Download(uri string)

type Generator

type Generator interface {
	Iterator() Iterator
}

Generator 实现该接口,生成迭代器

type HTTPDownloader

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

HTTPDownloader 具体模版实现

func (HTTPDownloader) Download

func (t HTTPDownloader) Download(uri string)

type HasItemState

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

type Iterator

type Iterator interface {
	First()
	IsDone() bool
	Next() interface{}
}

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 Numbers

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

func NewNumbers

func NewNumbers(start, end int) *Numbers

func (*Numbers) Iterator

func (n *Numbers) Iterator() Iterator

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 Observer

type Observer interface {
	Update(*Subject)
}

type Payment

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

func NewPayment

func NewPayment(name, cardid string, money int, strategy PaymentStrategy) *Payment

func (*Payment) Pay

func (p *Payment) Pay()

type PaymentContext

type PaymentContext struct {
	Name, CardID string
	Money        int
}

type PaymentStrategy

type PaymentStrategy interface {
	Pay(*PaymentContext)
}

type Reader

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

func NewReader

func NewReader(name string) *Reader

func (*Reader) Update

func (r *Reader) Update(s *Subject)

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 State

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

type Subject

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

func NewSubject

func NewSubject() *Subject

func (*Subject) Attach

func (s *Subject) Attach(o Observer)

func (*Subject) UpdateContext

func (s *Subject) UpdateContext(context string)

type UI

type UI struct {
	Done bool
	Data string
}

type VendingMachine

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

VendingMachine 状态模式用于分离状态和行为。

Jump to

Keyboard shortcuts

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