example

package
v0.0.0-...-05962f3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConcreteFlyweight

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

创建具体享元类,可以共享以支持大型有效的对象数量

func NewConcreteFlyweight

func NewConcreteFlyweight(state string) *ConcreteFlyweight

创建一个新的具体享元类

func (ConcreteFlyweight) Init

func (fw ConcreteFlyweight) Init(intrinsicState string)

具体享元对象初始化

func (ConcreteFlyweight) Operation

func (fw ConcreteFlyweight) Operation(extrinsicState string) string

具体享元对象的方法

type Flyweight

type Flyweight interface {
	Operation()
}

享元接口

type FlyweightFactory

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

创建用于创建和存储享元的享元工厂类

func NewFlyweightFactory

func NewFlyweightFactory() *FlyweightFactory

创建一个新的享元工厂对象

func (*FlyweightFactory) GetFlyweight

func (f *FlyweightFactory) GetFlyweight(state string) *ConcreteFlyweight

获取或创建具体享元对象

Jump to

Keyboard shortcuts

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