Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 Command ¶
type Command interface {
Execute()
}
Example ¶
mb := &MotherBoard{} startCommand := NewStartCommand(mb) rebootCommand := NewRebootCommand(mb) box1 := NewBox(startCommand, rebootCommand) box1.PressButton1() box1.PressButton2() box2 := NewBox(rebootCommand, startCommand) box2.PressButton1() box2.PressButton2()
Output: system starting system rebooting system rebooting system starting
type MotherBoard ¶
type MotherBoard struct{}
func (*MotherBoard) Reboot ¶
func (*MotherBoard) Reboot()
func (*MotherBoard) Start ¶
func (*MotherBoard) Start()
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 StartCommand ¶
type StartCommand struct {
// contains filtered or unexported fields
}
func NewStartCommand ¶
func NewStartCommand(mb *MotherBoard) *StartCommand
func (*StartCommand) Execute ¶
func (c *StartCommand) Execute()
Click to show internal directories.
Click to hide internal directories.