command

package
v0.0.0-...-54da96c Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2025 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command interface {
	Execute()
}

Command 定義了命令接口

type Light

type Light struct{}

Light 是接收者,執行具體操作

func (*Light) Off

func (l *Light) Off()

func (*Light) On

func (l *Light) On()

type LightOffCommand

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

LightOffCommand 是具體命令,關閉燈

func NewLightOffCommand

func NewLightOffCommand(light *Light) *LightOffCommand

func (*LightOffCommand) Execute

func (c *LightOffCommand) Execute()

type LightOnCommand

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

LightOnCommand 是具體命令,打開燈

func NewLightOnCommand

func NewLightOnCommand(light *Light) *LightOnCommand

func (*LightOnCommand) Execute

func (c *LightOnCommand) Execute()

type RemoteControl

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

RemoteControl 是調用者,調用命令

func (*RemoteControl) PressButton

func (r *RemoteControl) PressButton()

func (*RemoteControl) SetCommand

func (r *RemoteControl) SetCommand(command Command)

Jump to

Keyboard shortcuts

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