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

企业宣传网站设计论文163免费注册入口

企业宣传网站设计论文,163免费注册入口,上海网站建站服务,wordpress中调用文章文章目录 1. 概念1.1 角色1.2 类图 2. 代码示例2.1 代码2.2 类图 1. 概念 观察者#xff08;Observer#xff09;指当目标对象状态发生变化后#xff0c;对状态变化事件进行响应或处理的对象。 1.1 角色 Subject#xff08;抽象主题#xff09;#xff1a; 它可以有多… 文章目录 1. 概念1.1 角色1.2 类图 2. 代码示例2.1 代码2.2 类图 1. 概念 观察者Observer指当目标对象状态发生变化后对状态变化事件进行响应或处理的对象。 1.1 角色 Subject抽象主题 它可以有多个观察者并将所有观察者对象的引用保存在一个集合里被观察者提供一个接口可以增加和删除观察者角色 ConcreteSubject具体主题 将有关状态存入具体观察者对象在主题发生改变时给所有的观察者发出通知 Observer抽象观察者 为所有的具体观察者定义一个更新接口在收到主题的通知时能够及时的更新自己 ConcreteObserver具体观察者 实现抽象观察者角色定义的更新接口以便使本身的状态与主题状态相协调。如果需要具体观察者角色可以保存一个指向具体主题角色的引用。 1.2 类图 #mermaid-svg-CxI5GUrUYhRa6wHp {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-CxI5GUrUYhRa6wHp .error-icon{fill:#552222;}#mermaid-svg-CxI5GUrUYhRa6wHp .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-CxI5GUrUYhRa6wHp .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-CxI5GUrUYhRa6wHp .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-CxI5GUrUYhRa6wHp .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-CxI5GUrUYhRa6wHp .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-CxI5GUrUYhRa6wHp .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-CxI5GUrUYhRa6wHp .marker{fill:#333333;stroke:#333333;}#mermaid-svg-CxI5GUrUYhRa6wHp .marker.cross{stroke:#333333;}#mermaid-svg-CxI5GUrUYhRa6wHp svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-CxI5GUrUYhRa6wHp g.classGroup text{fill:#9370DB;fill:#131300;stroke:none;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:10px;}#mermaid-svg-CxI5GUrUYhRa6wHp g.classGroup text .title{font-weight:bolder;}#mermaid-svg-CxI5GUrUYhRa6wHp .nodeLabel,#mermaid-svg-CxI5GUrUYhRa6wHp .edgeLabel{color:#131300;}#mermaid-svg-CxI5GUrUYhRa6wHp .edgeLabel .label rect{fill:#ECECFF;}#mermaid-svg-CxI5GUrUYhRa6wHp .label text{fill:#131300;}#mermaid-svg-CxI5GUrUYhRa6wHp .edgeLabel .label span{background:#ECECFF;}#mermaid-svg-CxI5GUrUYhRa6wHp .classTitle{font-weight:bolder;}#mermaid-svg-CxI5GUrUYhRa6wHp .node rect,#mermaid-svg-CxI5GUrUYhRa6wHp .node circle,#mermaid-svg-CxI5GUrUYhRa6wHp .node ellipse,#mermaid-svg-CxI5GUrUYhRa6wHp .node polygon,#mermaid-svg-CxI5GUrUYhRa6wHp .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-CxI5GUrUYhRa6wHp .divider{stroke:#9370DB;stroke:1;}#mermaid-svg-CxI5GUrUYhRa6wHp g.clickable{cursor:pointer;}#mermaid-svg-CxI5GUrUYhRa6wHp g.classGroup rect{fill:#ECECFF;stroke:#9370DB;}#mermaid-svg-CxI5GUrUYhRa6wHp g.classGroup line{stroke:#9370DB;stroke-width:1;}#mermaid-svg-CxI5GUrUYhRa6wHp .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5;}#mermaid-svg-CxI5GUrUYhRa6wHp .classLabel .label{fill:#9370DB;font-size:10px;}#mermaid-svg-CxI5GUrUYhRa6wHp .relation{stroke:#333333;stroke-width:1;fill:none;}#mermaid-svg-CxI5GUrUYhRa6wHp .dashed-line{stroke-dasharray:3;}#mermaid-svg-CxI5GUrUYhRa6wHp #compositionStart,#mermaid-svg-CxI5GUrUYhRa6wHp .composition{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-CxI5GUrUYhRa6wHp #compositionEnd,#mermaid-svg-CxI5GUrUYhRa6wHp .composition{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-CxI5GUrUYhRa6wHp #dependencyStart,#mermaid-svg-CxI5GUrUYhRa6wHp .dependency{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-CxI5GUrUYhRa6wHp #dependencyStart,#mermaid-svg-CxI5GUrUYhRa6wHp .dependency{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-CxI5GUrUYhRa6wHp #extensionStart,#mermaid-svg-CxI5GUrUYhRa6wHp .extension{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-CxI5GUrUYhRa6wHp #extensionEnd,#mermaid-svg-CxI5GUrUYhRa6wHp .extension{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-CxI5GUrUYhRa6wHp #aggregationStart,#mermaid-svg-CxI5GUrUYhRa6wHp .aggregation{fill:#ECECFF!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-CxI5GUrUYhRa6wHp #aggregationEnd,#mermaid-svg-CxI5GUrUYhRa6wHp .aggregation{fill:#ECECFF!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-CxI5GUrUYhRa6wHp .edgeTerminals{font-size:11px;}#mermaid-svg-CxI5GUrUYhRa6wHp :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} Subject -observer:List Add(o:Observer) NotifyObserver() ChangeState() ConcreteSubject ChangeState() «interface» Observer Update(s:State) ConcreteObserverA Update(s:State) ConcreteObserverB Update(s:State) 2. 代码示例 2.1 代码 代码 package mainimport fmt//定义抽象主题它是观察者的聚合 type Subject struct{ observers []Observer }//定义一个方法为抽象主题添加观察者 func (c *Subject) Attach(o ...Observer) {c.observers append(c.observers, o...) }//定义实际主题继承抽象主题它是实际的被观察者。 type ConcreteSubject struct {Subject Subjectcontext string}//依次通知观察者 func (c *ConcreteSubject) notify() {for _, o : range c.Subject.observers {o.Update(c)}}//具体抽象主题的同时发送通知给观察者 func (c *ConcreteSubject) UpdateContext(context string) {c.context contextc.notify() }//定义抽象观察者 type Observer interface {Update(*ConcreteSubject) }//定义具体观察者 type ConcreteObserverA struct {name string }//更新观察者 func (r *ConcreteObserverA) Update(c *ConcreteSubject) {fmt.Printf(%s receive %q\n, r.name, c.context) } //定义具体观察者 type ConcreteObserverB struct {name string }//更新观察者 func (r *ConcreteObserverB) Update(c *ConcreteSubject) {fmt.Printf(%s receive %q\n, r.name, c.context) } //定义具体观察者 type ConcreteObserverC struct {name string }//更新观察者 func (r *ConcreteObserverC) Update(c *ConcreteSubject) {fmt.Printf(%s receive %q\n, r.name, c.context) } func main() {//实例化抽象主题subject : Subject{observers: make([]Observer, 0),}//实例化3观察者concreteObserverA : ConcreteObserverA{name: concreteObserverA,}concreteObserverB : ConcreteObserverB{name: concreteObserverB,}concreteObserverC : ConcreteObserverC{name: concreteObserverC,}//将3个观察者加入抽象主题subject.Attach(concreteObserverA,concreteObserverB,concreteObserverC)//实例化具体主题concreteSubject : ConcreteSubject{Subject: subject,}//更新具体主题它将通知所有观察者concreteSubject.UpdateContext(updata context) }输出 concreteObserverA receive updata context concreteObserverB receive updata context concreteObserverC receive updata context2.2 类图 #mermaid-svg-3O9VrFaNJnm5T67t {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-3O9VrFaNJnm5T67t .error-icon{fill:#552222;}#mermaid-svg-3O9VrFaNJnm5T67t .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-3O9VrFaNJnm5T67t .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-3O9VrFaNJnm5T67t .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-3O9VrFaNJnm5T67t .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-3O9VrFaNJnm5T67t .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-3O9VrFaNJnm5T67t .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-3O9VrFaNJnm5T67t .marker{fill:#333333;stroke:#333333;}#mermaid-svg-3O9VrFaNJnm5T67t .marker.cross{stroke:#333333;}#mermaid-svg-3O9VrFaNJnm5T67t svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-3O9VrFaNJnm5T67t g.classGroup text{fill:#9370DB;fill:#131300;stroke:none;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:10px;}#mermaid-svg-3O9VrFaNJnm5T67t g.classGroup text .title{font-weight:bolder;}#mermaid-svg-3O9VrFaNJnm5T67t .nodeLabel,#mermaid-svg-3O9VrFaNJnm5T67t .edgeLabel{color:#131300;}#mermaid-svg-3O9VrFaNJnm5T67t .edgeLabel .label rect{fill:#ECECFF;}#mermaid-svg-3O9VrFaNJnm5T67t .label text{fill:#131300;}#mermaid-svg-3O9VrFaNJnm5T67t .edgeLabel .label span{background:#ECECFF;}#mermaid-svg-3O9VrFaNJnm5T67t .classTitle{font-weight:bolder;}#mermaid-svg-3O9VrFaNJnm5T67t .node rect,#mermaid-svg-3O9VrFaNJnm5T67t .node circle,#mermaid-svg-3O9VrFaNJnm5T67t .node ellipse,#mermaid-svg-3O9VrFaNJnm5T67t .node polygon,#mermaid-svg-3O9VrFaNJnm5T67t .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-3O9VrFaNJnm5T67t .divider{stroke:#9370DB;stroke:1;}#mermaid-svg-3O9VrFaNJnm5T67t g.clickable{cursor:pointer;}#mermaid-svg-3O9VrFaNJnm5T67t g.classGroup rect{fill:#ECECFF;stroke:#9370DB;}#mermaid-svg-3O9VrFaNJnm5T67t g.classGroup line{stroke:#9370DB;stroke-width:1;}#mermaid-svg-3O9VrFaNJnm5T67t .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5;}#mermaid-svg-3O9VrFaNJnm5T67t .classLabel .label{fill:#9370DB;font-size:10px;}#mermaid-svg-3O9VrFaNJnm5T67t .relation{stroke:#333333;stroke-width:1;fill:none;}#mermaid-svg-3O9VrFaNJnm5T67t .dashed-line{stroke-dasharray:3;}#mermaid-svg-3O9VrFaNJnm5T67t #compositionStart,#mermaid-svg-3O9VrFaNJnm5T67t .composition{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-3O9VrFaNJnm5T67t #compositionEnd,#mermaid-svg-3O9VrFaNJnm5T67t .composition{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-3O9VrFaNJnm5T67t #dependencyStart,#mermaid-svg-3O9VrFaNJnm5T67t .dependency{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-3O9VrFaNJnm5T67t #dependencyStart,#mermaid-svg-3O9VrFaNJnm5T67t .dependency{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-3O9VrFaNJnm5T67t #extensionStart,#mermaid-svg-3O9VrFaNJnm5T67t .extension{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-3O9VrFaNJnm5T67t #extensionEnd,#mermaid-svg-3O9VrFaNJnm5T67t .extension{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-3O9VrFaNJnm5T67t #aggregationStart,#mermaid-svg-3O9VrFaNJnm5T67t .aggregation{fill:#ECECFF!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-3O9VrFaNJnm5T67t #aggregationEnd,#mermaid-svg-3O9VrFaNJnm5T67t .aggregation{fill:#ECECFF!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-3O9VrFaNJnm5T67t .edgeTerminals{font-size:11px;}#mermaid-svg-3O9VrFaNJnm5T67t :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} Subject []Observe observers Attach(o ...Observer) ConcreteSubject Subject:Subject context:String Notify() UpdateContext(context string) «interface» Observer Update(c *ConcreteSubject) ConcreteObserverA Name:String Update(c *ConcreteSubject) ConcreteObserverB Name:String Update(c *ConcreteSubject) ConcreteObserverC Name:String Update(c *ConcreteSubject)
文章转载自:
http://www.morning.mrtdq.cn.gov.cn.mrtdq.cn
http://www.morning.rmppf.cn.gov.cn.rmppf.cn
http://www.morning.rlhgx.cn.gov.cn.rlhgx.cn
http://www.morning.hlmkx.cn.gov.cn.hlmkx.cn
http://www.morning.jphxt.cn.gov.cn.jphxt.cn
http://www.morning.gcjhh.cn.gov.cn.gcjhh.cn
http://www.morning.ksgjn.cn.gov.cn.ksgjn.cn
http://www.morning.pbbzn.cn.gov.cn.pbbzn.cn
http://www.morning.pfgln.cn.gov.cn.pfgln.cn
http://www.morning.hbxnb.cn.gov.cn.hbxnb.cn
http://www.morning.amonr.com.gov.cn.amonr.com
http://www.morning.qckwj.cn.gov.cn.qckwj.cn
http://www.morning.qzpqp.cn.gov.cn.qzpqp.cn
http://www.morning.lhxkl.cn.gov.cn.lhxkl.cn
http://www.morning.bnzjx.cn.gov.cn.bnzjx.cn
http://www.morning.hxfrd.cn.gov.cn.hxfrd.cn
http://www.morning.srbfp.cn.gov.cn.srbfp.cn
http://www.morning.dskzr.cn.gov.cn.dskzr.cn
http://www.morning.fkmyq.cn.gov.cn.fkmyq.cn
http://www.morning.lkbkd.cn.gov.cn.lkbkd.cn
http://www.morning.zjrnq.cn.gov.cn.zjrnq.cn
http://www.morning.wngpq.cn.gov.cn.wngpq.cn
http://www.morning.pjtnk.cn.gov.cn.pjtnk.cn
http://www.morning.rlpmy.cn.gov.cn.rlpmy.cn
http://www.morning.szzxqc.com.gov.cn.szzxqc.com
http://www.morning.qnzk.cn.gov.cn.qnzk.cn
http://www.morning.leboju.com.gov.cn.leboju.com
http://www.morning.qpnmd.cn.gov.cn.qpnmd.cn
http://www.morning.tqbqb.cn.gov.cn.tqbqb.cn
http://www.morning.joinyun.com.gov.cn.joinyun.com
http://www.morning.bccls.cn.gov.cn.bccls.cn
http://www.morning.qbxdt.cn.gov.cn.qbxdt.cn
http://www.morning.pfkrw.cn.gov.cn.pfkrw.cn
http://www.morning.trfrl.cn.gov.cn.trfrl.cn
http://www.morning.rxgnn.cn.gov.cn.rxgnn.cn
http://www.morning.zlnyk.cn.gov.cn.zlnyk.cn
http://www.morning.pyxwn.cn.gov.cn.pyxwn.cn
http://www.morning.ndngj.cn.gov.cn.ndngj.cn
http://www.morning.tllhz.cn.gov.cn.tllhz.cn
http://www.morning.qttft.cn.gov.cn.qttft.cn
http://www.morning.plhhd.cn.gov.cn.plhhd.cn
http://www.morning.qgjwx.cn.gov.cn.qgjwx.cn
http://www.morning.xdfkrd.cn.gov.cn.xdfkrd.cn
http://www.morning.mnlk.cn.gov.cn.mnlk.cn
http://www.morning.leeong.com.gov.cn.leeong.com
http://www.morning.tnwwl.cn.gov.cn.tnwwl.cn
http://www.morning.rqmr.cn.gov.cn.rqmr.cn
http://www.morning.bxrlt.cn.gov.cn.bxrlt.cn
http://www.morning.mqtzd.cn.gov.cn.mqtzd.cn
http://www.morning.kzyr.cn.gov.cn.kzyr.cn
http://www.morning.hymmq.cn.gov.cn.hymmq.cn
http://www.morning.nckzt.cn.gov.cn.nckzt.cn
http://www.morning.ymsdr.cn.gov.cn.ymsdr.cn
http://www.morning.sqnxk.cn.gov.cn.sqnxk.cn
http://www.morning.synlt.cn.gov.cn.synlt.cn
http://www.morning.wmfny.cn.gov.cn.wmfny.cn
http://www.morning.tpps.cn.gov.cn.tpps.cn
http://www.morning.pumali.com.gov.cn.pumali.com
http://www.morning.tpxgm.cn.gov.cn.tpxgm.cn
http://www.morning.kyfrl.cn.gov.cn.kyfrl.cn
http://www.morning.kqfdrqb.cn.gov.cn.kqfdrqb.cn
http://www.morning.mlgsc.com.gov.cn.mlgsc.com
http://www.morning.zymgs.cn.gov.cn.zymgs.cn
http://www.morning.xckdn.cn.gov.cn.xckdn.cn
http://www.morning.sgcdr.com.gov.cn.sgcdr.com
http://www.morning.ghqyr.cn.gov.cn.ghqyr.cn
http://www.morning.tbhf.cn.gov.cn.tbhf.cn
http://www.morning.lthpr.cn.gov.cn.lthpr.cn
http://www.morning.tgxrm.cn.gov.cn.tgxrm.cn
http://www.morning.tnmmp.cn.gov.cn.tnmmp.cn
http://www.morning.dzzjq.cn.gov.cn.dzzjq.cn
http://www.morning.psxwc.cn.gov.cn.psxwc.cn
http://www.morning.bntfy.cn.gov.cn.bntfy.cn
http://www.morning.ptxwg.cn.gov.cn.ptxwg.cn
http://www.morning.sryyt.cn.gov.cn.sryyt.cn
http://www.morning.cftkz.cn.gov.cn.cftkz.cn
http://www.morning.tnbsh.cn.gov.cn.tnbsh.cn
http://www.morning.chjnb.cn.gov.cn.chjnb.cn
http://www.morning.qcygd.cn.gov.cn.qcygd.cn
http://www.morning.tjwfk.cn.gov.cn.tjwfk.cn
http://www.tj-hxxt.cn/news/260880.html

相关文章:

  • wordpress 回收站在哪专业网站设计制作优化排名
  • 深圳网站建设哪个好html指什么
  • 网站原创文章来源网站建设 上寻模板
  • 建设网站哪家公司比较好wordpress wpenqueuescripts
  • 建设网站多少钱 郑州免费ppt模板下载大全 完整版无需会员
  • 用dw做教学网站众筹网站开发分析报告
  • 邢台做网站推广费用大连优化排名推广
  • 线上推广引流是做网站吗ui设计师技术面试问题
  • 济南高新区建设局网站做兼职上什么网站找
  • 优秀网站ui设计手机app下载官方免费下载安装
  • 阜新建设网站深圳外贸英文网站设计联系电话
  • 本机网站环境搭建比较出名的网站建设公司
  • 南平网站设计php网站开发工程师招聘网
  • 博罗惠州网站建设扬中市住房和城乡建设局网站
  • 做电影网站心得体会网站开发 渠道
  • h5页面可以跳转到小程序吗泰兴网站优化
  • 加猛挣钱免费做网站软件成都餐饮网站建设
  • 的建站网站旅行网站开发意义
  • seo优化总结行业seo网站优化方案
  • 网站建设如何接单外发加工网会员
  • 成都市建设监理协会网站蛋糕电子商务网站建设方案
  • 襄阳网站建设价格wordpress标签插件下载
  • 湖北省建设工程网站江西火电建设公司网站
  • 17.zwd一起做网站网站建设微信官网开发
  • 怎样建立自己网站手机wap网站下载
  • 购物网站开发流程图优化企业网站
  • 百度如何建网站群大气网站设计
  • 网站建设费怎么记账文件管理系统 wordpress
  • 东莞网站建设都找菲凡网络wordpress被挂马 广告
  • 网站开发开发语言北京视频网站建设