- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
Chapter Creation Patterns方案策划.ppt
Copyright ? 2007, College of Information Science and Engineering The Prototype Method Pattern Participants Client - The client object asks the prototype to clone itself Prototype - Data object defining an interface for creating clones of its self A clone function, returning a copy of the original object ConcretePrototype - Implements the cloning operation defined in the Prototype class Copies the data and state of the original object Copyright ? 2007, College of Information Science and Engineering JAVAEE Example 当创建对象非常耗费资源且复杂的时候,为避免重复对象的创建过程,而采用复制已有对象的副本(或重用已有对象)再作适当更改的方法来加快其创建速度。 JavaEE环境中,多数昂贵资源的创建都通过采用实例缓冲技术来实现Prototype模式。典型例子为JDBC的连接缓冲池。 Copyright ? 2007, College of Information Science and Engineering Consequences 好处: 相对Factory Method, Abstract Factory而言,减少子类的构造 不利: 每个prototype的子类都需要实现Clone方法。当内部包括一些不支持拷贝或有较复杂的循环引用的对象时,实现克隆会很困难。 Copyright ? 2007, College of Information Science and Engineering In this lesson, you will learn to: Factory Method Abstract Factory Prototype Singleton Objectives Copyright ? 2007, College of Information Science and Engineering Intent Ensure a class only has one instance, and provide a global point of access to it Motivation Sometimes we want just a single instance of a class to exist in the system For example, we want just one window manager. Or just one factory for a family of products. We need to have that one instance easily accessible And we want to ensure that additional instances of the class can not be created The Singleton Pattern Copyright ? 2007, College of Information Science and Engineering Structure The Singleton Pattern Copyright ? 2007, College of Information Science and Engineering First, lets look at the case where we are not concerned with subclassing the Singleton class Well use a static method to allow clients to get a reference to the single instance /** * Class Singleton is an implementation of a class that * only allows one instantiation. */ public class Singleton { // The priva
您可能关注的文档
- Capital Market Expectation from sellside analysts’ View 资产组合PPT 金融系研究生课程课件知识介绍.ppt
- Carbohydrate Digestion 大学动物营养学课件 英文版技术方案.ppt
- CEPA 商务现场口译课件单元PPT技术方案.ppt
- Ceremonial Address 商务现场口译课件单元PPT技术方案.ppt
- Ch Market Transition Strategy and Process 中国经济发展与转型(英文版) 知识介绍.ppt
- CH 物流与供应链基础 设施规划与物流分析课件教学 讲义.ppt
- CH 仓储库存及其系统 设施规划与物流分析课件技术方案.ppt
- CH 物料搬运系统设计 设施规划与物流分析课件培训讲解.ppt
- CH 物流仿真软件Flexsim入门 设施规划与物流分析课件一培训讲解.ppt
- CH 物流仿真软件Flexsim入门 设施规划与物流分析课件二培训讲解.ppt
- Chapter Introduction to DP技术方案.ppt
- Chapter 1 Interference教学讲稿技术方案.ppt
- Chapter cognition 语言学概论 知识介绍.ppt
- Chapter From Word to Text 语言学概论 培训讲解.ppt
- Chapter lexicon 语言学概论 培训讲解.ppt
- Chapter pragmatics 语言学概论 培训讲解.ppt
- Chapter semantics 语言学概论 培训讲解.ppt
- Chapter sound 语言学概论 培训讲解.ppt
- chapter4大气热力学教学 讲义.ppt
- chapter大气热力学教学 讲义.ppt
文档评论(0)