_8_mediator

package
v0.0.0-...-eb36113 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: Apache-2.0, MIT Imports: 2 Imported by: 0

README

中介者模式

中介者模式封装对象之间互交,使依赖变的简单,并且使复杂互交简单化,封装在中介者中。

例子中的中介者使用单例模式生成中介者。

中介者的change使用switch判断类型。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CDDriver

type CDDriver struct {
	Data string
}

func (*CDDriver) ReadData

func (c *CDDriver) ReadData()

type CPU

type CPU struct {
	Video string
	Sound string
}

func (*CPU) Process

func (c *CPU) Process(data string)

type Mediator

type Mediator struct {
	CD    *CDDriver
	CPU   *CPU
	Video *VideoCard
	Sound *SoundCard
}

func GetMediatorInstance

func GetMediatorInstance() *Mediator

type SoundCard

type SoundCard struct {
	Data string
}

func (*SoundCard) Play

func (s *SoundCard) Play(data string)

type VideoCard

type VideoCard struct {
	Data string
}

func (*VideoCard) Display

func (v *VideoCard) Display(data string)

Jump to

Keyboard shortcuts

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