android设计模式--之原型模式(prototype)
来源:互联网 发布:手机版淘宝店铺收藏 编辑:程序博客网 时间:2024/05/16 15:48
1、简介
(1)意图根据原型实例创造出一个新的实例,并且新实例的状态与原型实例保持相同。(2)说明
a.适用于不需要知道实例的具体类型,以及需要复制某种特定状态下的实例时,另一说法是在java中不需要从头构造,提升了速度。
b.需要注意深拷贝or浅拷贝问题
2、实例
@Override public RoundRectShape clone() throws CloneNotSupportedException { RoundRectShape shape = (RoundRectShape) super.clone(); shape.mOuterRadii = mOuterRadii != null ? mOuterRadii.clone() : null; shape.mInnerRadii = mInnerRadii != null ? mInnerRadii.clone() : null; shape.mInset = new RectF(mInset); shape.mInnerRect = new RectF(mInnerRect); shape.mPath = new Path(mPath); return shape; }主要是在java语言中见到,在C++中暂时没有看到
0 0
- android设计模式--之原型模式(prototype)
- 设计模式之原型模式(Prototype)
- 设计模式之原型模式(Prototype)
- 设计模式之原型模式(Prototype)
- 设计模式之----------原型模式(prototype)
- 设计模式之原型模式(Prototype)
- 设计模式之原型模式(ProtoType)
- 设计模式之:原型模式(Prototype)
- 设计模式之原型模式(Prototype)
- 设计模式之原型模式(Prototype)
- 设计模式之原型模式(Prototype)
- 设计模式之原型模式(Prototype)
- 设计模式之原型模式(Prototype)
- 设计模式(二)之 Prototype(原型)
- 设计模式之Prototype(原型)
- 设计模式之Prototype(原型)
- 设计模式之Prototype(原型)
- 设计模式之Prototype(原型)
- Ajax 缓存问题
- Myeclipse 使用总结
- 工作半年记
- Ubuntu下截图软件 - Shutter
- 写程序笔记
- android设计模式--之原型模式(prototype)
- 【leetcode】Add Two Numbers
- Android ProgressBar 自定义样式(六),仿真QQ pad版加载(位置居中)
- 用户注册时的格式化判断函数
- NYoj-喷水装置(二)
- HTML form 避免(回车)表单自动提交
- Leetcode Unique Paths II
- 2.1 Git 基础 - 取得项目的 Git 仓库
- 安装基于虚拟用户的虚拟域邮件服务器系统