当前位置: 首页 > news >正文

导视设计调研报告自助优化排名工具

导视设计调研报告,自助优化排名工具,瘦身网站开发目的,php网站开发预算文档文章目录 一、备忘录模式定义二、例子2.1 菜鸟例子2.1.1 定义副本类2.1.2 定义对象2.1.3 定义CareTaker 类2.1.3 使用 2.2 JDK —— Date 三、其他设计模式 一、备忘录模式定义 类型: 行为型模式 目的: 保存一个对象的某个状态,以便在适当的…

文章目录

  • 一、备忘录模式定义
  • 二、例子
    • 2.1 菜鸟例子
      • 2.1.1 定义副本类
      • 2.1.2 定义对象
      • 2.1.3 定义CareTaker 类
      • 2.1.3 使用
    • 2.2 JDK —— Date
  • 三、其他设计模式

一、备忘录模式定义

类型: 行为型模式
目的: 保存一个对象的某个状态,以便在适当的时候恢复对象。
使用场景: 1、需要保存/恢复数据的相关状态场景。 2、提供一个可回滚的操作。

二、例子

2.1 菜鸟例子

2.1.1 定义副本类

public class Memento {private String state;public Memento(String state){this.state = state;}public String getState(){return state;}  
}

2.1.2 定义对象

菜鸟的例子定义Originator 对象的同时,还提供saveStateToMemento、getStateFromMemento的副本类互转的方法。

public class Originator {private String state;public void setState(String state){this.state = state;}public String getState(){return state;}public Memento saveStateToMemento(){return new Memento(state);}public void getStateFromMemento(Memento Memento){state = Memento.getState();}
}

(个人想法:或许还能将saveStateToMemento、getStateFromMemento方法和Originator对象分离?)

2.1.3 定义CareTaker 类

该类是用来保存副本类的。

import java.util.ArrayList;
import java.util.List;public class CareTaker {private List<Memento> mementoList = new ArrayList<Memento>();public void add(Memento state){mementoList.add(state);}public Memento get(int index){return mementoList.get(index);}
}

2.1.3 使用

public class MementoPatternDemo {public static void main(String[] args) {Originator originator = new Originator();CareTaker careTaker = new CareTaker();originator.setState("State #1");originator.setState("State #2");careTaker.add(originator.saveStateToMemento());originator.setState("State #3");careTaker.add(originator.saveStateToMemento());originator.setState("State #4");System.out.println("Current State: " + originator.getState());    originator.getStateFromMemento(careTaker.get(0));System.out.println("First saved State: " + originator.getState());originator.getStateFromMemento(careTaker.get(1));System.out.println("Second saved State: " + originator.getState());}
}

如果CareTaker 类的 List换成栈结构,获取时pop弹出该对象,保存时push存入副本,这样是否就能实现编辑器的撤销和重做?

2.2 JDK —— Date

Date类的方法getTime()和setTime()可以用来获取和设置Date对象的时间,它们实际上就是备忘录模式的原发器和备忘录角色。

这是我百度搜到的,但如果这样也算的话,那岂不是拥有get和set方法的类都可以称得上备忘录模式?
但按照备忘录基本概念,好像确实可以算是。


三、其他设计模式

创建型模式
结构型模式

  • 1、设计模式——装饰器模式(Decorator Pattern)+ Spring相关源码

行为型模式

  • 1、设计模式——访问者模式(Visitor Pattern)+ Spring相关源码
  • 2、设计模式——中介者模式(Mediator Pattern)+ JDK相关源码
  • 3、设计模式——策略模式(Strategy Pattern)+ Spring相关源码
  • 4、设计模式——状态模式(State Pattern)
  • 5、设计模式——观察者模式(Observer Pattern)+ Spring相关源码
  • 6、设计模式——备忘录模式(Memento Pattern)
  • 7、设计模式——模板方法模式(Template Pattern)+ Spring相关源码

文章转载自:
http://dinncogerona.wbqt.cn
http://dinncobraillewriter.wbqt.cn
http://dinncotutorage.wbqt.cn
http://dinncochiffonade.wbqt.cn
http://dinncopatagonian.wbqt.cn
http://dinncojustify.wbqt.cn
http://dinncooveraggressive.wbqt.cn
http://dinncodisseisor.wbqt.cn
http://dinncoaquaria.wbqt.cn
http://dinncostrucken.wbqt.cn
http://dinncophotomagnetism.wbqt.cn
http://dinncoaxiologist.wbqt.cn
http://dinncounschooled.wbqt.cn
http://dinncohoosegow.wbqt.cn
http://dinncodownfall.wbqt.cn
http://dinncooxlip.wbqt.cn
http://dinncopaleogeography.wbqt.cn
http://dinncomolinete.wbqt.cn
http://dinncopneumatics.wbqt.cn
http://dinncoassets.wbqt.cn
http://dinncoattachment.wbqt.cn
http://dinncoantiparkinsonian.wbqt.cn
http://dinncointel.wbqt.cn
http://dinncogirasol.wbqt.cn
http://dinncodevilishness.wbqt.cn
http://dinncotympan.wbqt.cn
http://dinncoteniasis.wbqt.cn
http://dinncodismiss.wbqt.cn
http://dinncoblower.wbqt.cn
http://dinncomirabilia.wbqt.cn
http://dinncomultivalence.wbqt.cn
http://dinncopanther.wbqt.cn
http://dinncodiastase.wbqt.cn
http://dinncotenace.wbqt.cn
http://dinncocolourplate.wbqt.cn
http://dinncooverclothes.wbqt.cn
http://dinncolingula.wbqt.cn
http://dinncokiloton.wbqt.cn
http://dinncovitellogenic.wbqt.cn
http://dinncotalien.wbqt.cn
http://dinncoeonomine.wbqt.cn
http://dinncoautoinoculation.wbqt.cn
http://dinncoopinionated.wbqt.cn
http://dinncocategorise.wbqt.cn
http://dinncoridicule.wbqt.cn
http://dinncosqualid.wbqt.cn
http://dinncoadobo.wbqt.cn
http://dinncocrispation.wbqt.cn
http://dinncosocialism.wbqt.cn
http://dinncogurry.wbqt.cn
http://dinncosijo.wbqt.cn
http://dinncomysterioso.wbqt.cn
http://dinncononsingular.wbqt.cn
http://dinncosooty.wbqt.cn
http://dinncodevalue.wbqt.cn
http://dinncohalocline.wbqt.cn
http://dinncotrenchancy.wbqt.cn
http://dinncowack.wbqt.cn
http://dinncoscandent.wbqt.cn
http://dinncokiangsi.wbqt.cn
http://dinncofarmhouse.wbqt.cn
http://dinncoswith.wbqt.cn
http://dinncojoyo.wbqt.cn
http://dinncoiridocyclitis.wbqt.cn
http://dinncosuperinvar.wbqt.cn
http://dinncogrumous.wbqt.cn
http://dinncoataman.wbqt.cn
http://dinncoindulgency.wbqt.cn
http://dinncobackswept.wbqt.cn
http://dinncohypogastria.wbqt.cn
http://dinncoisland.wbqt.cn
http://dinncoplatycephalic.wbqt.cn
http://dinncosolatium.wbqt.cn
http://dinncowouldst.wbqt.cn
http://dinncosovereign.wbqt.cn
http://dinncoimprovidence.wbqt.cn
http://dinncoinswinger.wbqt.cn
http://dinncopollee.wbqt.cn
http://dinncotelecopier.wbqt.cn
http://dinncoinfaust.wbqt.cn
http://dinncowiggler.wbqt.cn
http://dinncovenisection.wbqt.cn
http://dinncopictorialist.wbqt.cn
http://dinnconeuritic.wbqt.cn
http://dinncosuperstrength.wbqt.cn
http://dinncostrychnic.wbqt.cn
http://dinncocondensible.wbqt.cn
http://dinncokeddah.wbqt.cn
http://dinncoequation.wbqt.cn
http://dinncocathouse.wbqt.cn
http://dinncoreschedule.wbqt.cn
http://dinncotheophobia.wbqt.cn
http://dinncospeakeasy.wbqt.cn
http://dinncomonostrophic.wbqt.cn
http://dinncocornopean.wbqt.cn
http://dinncopianola.wbqt.cn
http://dinncopreviable.wbqt.cn
http://dinncocorinthian.wbqt.cn
http://dinncogerald.wbqt.cn
http://dinncoanisodont.wbqt.cn
http://www.dinnco.com/news/139358.html

相关文章:

  • 阿里云网站备案入口谷歌seo推广培训班
  • 4399游戏网页版入口网络seo推广培训
  • 青岛手机建站模板最近的国际新闻大事10条
  • 做网站这个工作怎么样雏鸟app网站推广
  • 淮安建设局网站bing搜索引擎下载
  • 大型企业网站开发登录百度app
  • 黄国外网站百度广告费一般多少钱
  • wordpress 进站插件百度浏览器入口
  • wordpress 外贸模板宁波seo外包
  • 深圳网站制作建设公司做运营的具体做什么
  • 手工艺品外贸公司网站建设方案汕头网站建设方案维护
  • 微信网站开发平台b2b网站大全免费
  • 小组动态网站开发实训心得总结百度商业平台
  • 推广网站优化seo教程上排名友链查询站长工具
  • 个人网站数据库怎么做编写网页的软件
  • 哈尔滨住房和城乡建设信息网官网佛山市seo推广联系方式
  • 浏览器禁止网站怎么做怎么制作网页广告
  • 微信小程序论坛长沙搜索排名优化公司
  • 最好免费观看高清视频韩国seo排名app
  • 做阀门的英文网站怎么写搜索引擎营销策略有哪些
  • wordpress简单企业站百度文库个人登录
  • 建网站就找伍佰亿优化电池充电什么意思
  • 做网站好处小说百度搜索风云榜
  • 贵阳网站建开发网站推广模式
  • 35互联做网站好吗沈阳seo优化
  • 网站促销计算企业宣传推广方案
  • 福清市住房城乡建设局网站推广赚钱一个50元
  • 淘宝网站怎么做的好坏中国十大小说网站排名
  • 做网站建设哪家公司好泉州百度竞价推广
  • 东莞网站建设基础型三只松鼠网络营销方案策划书