flyweight

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: 1 Imported by: 0

README

享元模式

享元模式从对象中剥离出不发生改变且多个实例需要的重复数据,独立出一个享元,使多个对象共享,从而节省内存以及减少对象数量。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 ImageViewer

type ImageViewer struct {
	*ImageFlyweight
}

func NewImageViewer

func NewImageViewer(filename string) *ImageViewer

func (*ImageViewer) Display

func (i *ImageViewer) Display()

Jump to

Keyboard shortcuts

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