Documentation ¶
Index ¶
- func Action()
- func Main()
- type AModuleAPI
- type API
- type AddDecorator
- type BModuleAPI
- type BridgeComputer
- type Client
- type Component
- type Computer
- type ConcreteComponent
- type Epson
- type Hp
- type ImageFlyweight
- type ImageFlyweightFactory
- type Mac
- type MulDecorator
- type Printer
- type Proxy
- type RealSubject
- type Subject
- type Windows
- type WindowsAdapter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddDecorator ¶
type AddDecorator struct { Component // contains filtered or unexported fields }
func (*AddDecorator) Calc ¶
func (d *AddDecorator) Calc() int
type BridgeComputer ¶
type BridgeComputer interface { Print() SetPrinter(Printer) }
还有另外一种理解方式:“一个类存在两个(或多个)独立变化的维度,我们通过组合的方式,让这两个(或多个)维度可以独立进行扩展。 ”通过组合关系来替代继承关系,避免继承层次的指数级爆炸
type Client ¶
type Client struct { }
适配器模式用于转换一种接口适配另一种接口。
func (*Client) InsertLightningConnectorIntoComputer ¶
type Component ¶
type Component interface {
Calc() int
}
Component
装饰模式使用对象组合的方式动态改变或增加对象行为。
func WrapAddDecorator ¶
func WrapMulDecorator ¶
type ConcreteComponent ¶
type ConcreteComponent struct{}
ConcreteComponent 原始组件
func (*ConcreteComponent) Calc ¶
func (*ConcreteComponent) Calc() int
type ImageFlyweight ¶
type ImageFlyweight struct {
// contains filtered or unexported fields
}
func NewImageFlyweight ¶
func NewImageFlyweight(filename string) *ImageFlyweight
func (*ImageFlyweight) Data ¶
func (i *ImageFlyweight) Data() string
type ImageFlyweightFactory ¶
type ImageFlyweightFactory struct {
// contains filtered or unexported fields
}
func GetImageFlyweightFactory ¶
func GetImageFlyweightFactory() *ImageFlyweightFactory
func (*ImageFlyweightFactory) Get ¶
func (f *ImageFlyweightFactory) Get(filename string) *ImageFlyweight
type MulDecorator ¶
type MulDecorator struct { Component // contains filtered or unexported fields }
func (*MulDecorator) Calc ¶
func (d *MulDecorator) Calc() int
type WindowsAdapter ¶
type WindowsAdapter struct {
// contains filtered or unexported fields
}
func (*WindowsAdapter) InsertIntoLightningPort ¶
func (w *WindowsAdapter) InsertIntoLightningPort()
Click to show internal directories.
Click to hide internal directories.