网站首页  英汉词典

请输入您要查询的英文单词:

 

单词 Flyweight pattern
释义

Flyweight pattern

中文百科

享元模式

享元模式(英语:Flyweight Pattern)是一种软件设计模式。它使用共享对象,用来尽可能减少内存使用量以及分享信息给尽可能多的相似对象;它适合用于当大量对象只是重复因而导致无法令人接受的使用大量内存。通常对象中的部分状态是可以分享。常见做法是把它们放在外部数据结构,当需要使用时再将它们传递给享元。

典型的享元模式的例子为文字处理器中以图形结构来表示字符。一个做法是,每个字形有其字体外观, 字模 metrics, 和其它格式信息,但这会使每个字符就耗用上千字节。取而代之的是,每个字符参照到一个共享字形对象,此对象会被其它有共同特质的字符所分享;只有每个字符(文档中或页面中)的位置才需要另外保存。

英语百科

Flyweight pattern 享元模式

In computer programming, flyweight is a software design pattern. A flyweight is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. Often some parts of the object state can be shared, and it is common practice to hold them in external data structures and pass them to the flyweight objects temporarily when they are used.

随便看

 

英汉网英语在线翻译词典收录了3779314条英语词汇在线翻译词条,基本涵盖了全部常用英语词汇的中英文双语翻译及用法,是英语学习的有利工具。

 

Copyright © 2004-2024 encnc.com All Rights Reserved
更新时间:2025/6/20 11:07:56