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

萝岗哪家网站建设好如何做360搜索网站

萝岗哪家网站建设好,如何做360搜索网站,西部数码网站管理助手,互站源码交易平台文章目录 1. 概念1.1 角色1.2 类图 2. 代码示例2.1 需求2.2 代码2.3 类图 1. 概念 迭代器#xff08;Iterator#xff09;能够在不暴露聚合体内部表示的情况下#xff0c;向客户端提供遍历聚合元素的方法。 1.1 角色 InterfaceAggregate#xff08;抽象聚合#xff09;… 文章目录 1. 概念1.1 角色1.2 类图 2. 代码示例2.1 需求2.2 代码2.3 类图 1. 概念 迭代器Iterator能够在不暴露聚合体内部表示的情况下向客户端提供遍历聚合元素的方法。 1.1 角色 InterfaceAggregate抽象聚合定义存储、添加、删除聚合元素以及创建迭代器对象的接口ConcreteAggregate具体聚合实现抽象聚合类。它的方法可以返回一个具体迭代器的实例Iterator抽象迭代器定义访问和遍历聚合元素的接口通常包含 hasNext()、next() 等方法Concretelterator具体迭代器实现抽象迭代器接口中所定义的方法完成对聚合对象的遍历记录遍历的当前位置。 1.2 类图 #mermaid-svg-80tUvmPRCgZrLjMc {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-80tUvmPRCgZrLjMc .error-icon{fill:#552222;}#mermaid-svg-80tUvmPRCgZrLjMc .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-80tUvmPRCgZrLjMc .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-80tUvmPRCgZrLjMc .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-80tUvmPRCgZrLjMc .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-80tUvmPRCgZrLjMc .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-80tUvmPRCgZrLjMc .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-80tUvmPRCgZrLjMc .marker{fill:#333333;stroke:#333333;}#mermaid-svg-80tUvmPRCgZrLjMc .marker.cross{stroke:#333333;}#mermaid-svg-80tUvmPRCgZrLjMc svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-80tUvmPRCgZrLjMc g.classGroup text{fill:#9370DB;fill:#131300;stroke:none;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:10px;}#mermaid-svg-80tUvmPRCgZrLjMc g.classGroup text .title{font-weight:bolder;}#mermaid-svg-80tUvmPRCgZrLjMc .nodeLabel,#mermaid-svg-80tUvmPRCgZrLjMc .edgeLabel{color:#131300;}#mermaid-svg-80tUvmPRCgZrLjMc .edgeLabel .label rect{fill:#ECECFF;}#mermaid-svg-80tUvmPRCgZrLjMc .label text{fill:#131300;}#mermaid-svg-80tUvmPRCgZrLjMc .edgeLabel .label span{background:#ECECFF;}#mermaid-svg-80tUvmPRCgZrLjMc .classTitle{font-weight:bolder;}#mermaid-svg-80tUvmPRCgZrLjMc .node rect,#mermaid-svg-80tUvmPRCgZrLjMc .node circle,#mermaid-svg-80tUvmPRCgZrLjMc .node ellipse,#mermaid-svg-80tUvmPRCgZrLjMc .node polygon,#mermaid-svg-80tUvmPRCgZrLjMc .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-80tUvmPRCgZrLjMc .divider{stroke:#9370DB;stroke:1;}#mermaid-svg-80tUvmPRCgZrLjMc g.clickable{cursor:pointer;}#mermaid-svg-80tUvmPRCgZrLjMc g.classGroup rect{fill:#ECECFF;stroke:#9370DB;}#mermaid-svg-80tUvmPRCgZrLjMc g.classGroup line{stroke:#9370DB;stroke-width:1;}#mermaid-svg-80tUvmPRCgZrLjMc .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5;}#mermaid-svg-80tUvmPRCgZrLjMc .classLabel .label{fill:#9370DB;font-size:10px;}#mermaid-svg-80tUvmPRCgZrLjMc .relation{stroke:#333333;stroke-width:1;fill:none;}#mermaid-svg-80tUvmPRCgZrLjMc .dashed-line{stroke-dasharray:3;}#mermaid-svg-80tUvmPRCgZrLjMc #compositionStart,#mermaid-svg-80tUvmPRCgZrLjMc .composition{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-80tUvmPRCgZrLjMc #compositionEnd,#mermaid-svg-80tUvmPRCgZrLjMc .composition{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-80tUvmPRCgZrLjMc #dependencyStart,#mermaid-svg-80tUvmPRCgZrLjMc .dependency{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-80tUvmPRCgZrLjMc #dependencyStart,#mermaid-svg-80tUvmPRCgZrLjMc .dependency{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-80tUvmPRCgZrLjMc #extensionStart,#mermaid-svg-80tUvmPRCgZrLjMc .extension{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-80tUvmPRCgZrLjMc #extensionEnd,#mermaid-svg-80tUvmPRCgZrLjMc .extension{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-80tUvmPRCgZrLjMc #aggregationStart,#mermaid-svg-80tUvmPRCgZrLjMc .aggregation{fill:#ECECFF!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-80tUvmPRCgZrLjMc #aggregationEnd,#mermaid-svg-80tUvmPRCgZrLjMc .aggregation{fill:#ECECFF!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-80tUvmPRCgZrLjMc .edgeTerminals{font-size:11px;}#mermaid-svg-80tUvmPRCgZrLjMc :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} Client «interface» Iterator HasNext() : bool First() IsDone() Next() : interface CurrentItem() «interface» Aggregate CreateIterator() : Iterator ConcreteIterator HasNext() : bool First() IsDone() Next() : interface CurrentItem() ConcreteAggregate CreateIterator() : Iterator 2. 代码示例 2.1 需求 实例化一个具体聚合创建一个迭代器实例用迭代器遍历这个聚合。 迭代器通常还会有查看首元素、尾元素、指针位置等方法有兴趣可以自己试一下这个简单示例里不写了。 2.2 代码 代码 package mainimport fmt// 定义抽象迭代器 type Iterator interface {HasNext() boolNext() interface{} }// 定义具体迭代器 type ConcreteIterator struct {//它关联具体聚合aggregate *ConcreteAggregateindex int }// 定义方法查看迭代是否结束 func (i *ConcreteIterator) HasNext() bool {return i.index len(i.aggregate.items) }// 定义方法返回下一个节点 func (i *ConcreteIterator) Next() interface{} {if i.HasNext() {item : i.aggregate.items[i.index]i.indexreturn item}return nil }// 定义抽象聚合 type Aggregate interface {CreateIterator() IteratorAddItem(item interface{}) }// 定义具体聚合 type ConcreteAggregate struct {items []interface{} }// 定义方法创建迭代器 func (a *ConcreteAggregate) CreateIterator() Iterator {return ConcreteIterator{aggregate: a} }// 定义方法添加item为了测试方便和迭代器方法无关 func (a *ConcreteAggregate) AddItem(item interface{}) {a.items append(a.items, item) }func main() {//实例化一个聚合加入三个Item他们的类型可以不同var aggregate Aggregateaggregate ConcreteAggregate{}aggregate.AddItem(Item 1)aggregate.AddItem(2)aggregate.AddItem(Item 3)//实例化一个迭代器iterator : aggregate.CreateIterator()//验证结果for iterator.HasNext() {item : iterator.Next()fmt.Println(item)} }输出 Item 1 2 Item 32.3 类图 #mermaid-svg-gvVKNcs2TFexEK71 {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-gvVKNcs2TFexEK71 .error-icon{fill:#552222;}#mermaid-svg-gvVKNcs2TFexEK71 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-gvVKNcs2TFexEK71 .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-gvVKNcs2TFexEK71 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-gvVKNcs2TFexEK71 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-gvVKNcs2TFexEK71 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-gvVKNcs2TFexEK71 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-gvVKNcs2TFexEK71 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-gvVKNcs2TFexEK71 .marker.cross{stroke:#333333;}#mermaid-svg-gvVKNcs2TFexEK71 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-gvVKNcs2TFexEK71 g.classGroup text{fill:#9370DB;fill:#131300;stroke:none;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:10px;}#mermaid-svg-gvVKNcs2TFexEK71 g.classGroup text .title{font-weight:bolder;}#mermaid-svg-gvVKNcs2TFexEK71 .nodeLabel,#mermaid-svg-gvVKNcs2TFexEK71 .edgeLabel{color:#131300;}#mermaid-svg-gvVKNcs2TFexEK71 .edgeLabel .label rect{fill:#ECECFF;}#mermaid-svg-gvVKNcs2TFexEK71 .label text{fill:#131300;}#mermaid-svg-gvVKNcs2TFexEK71 .edgeLabel .label span{background:#ECECFF;}#mermaid-svg-gvVKNcs2TFexEK71 .classTitle{font-weight:bolder;}#mermaid-svg-gvVKNcs2TFexEK71 .node rect,#mermaid-svg-gvVKNcs2TFexEK71 .node circle,#mermaid-svg-gvVKNcs2TFexEK71 .node ellipse,#mermaid-svg-gvVKNcs2TFexEK71 .node polygon,#mermaid-svg-gvVKNcs2TFexEK71 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-gvVKNcs2TFexEK71 .divider{stroke:#9370DB;stroke:1;}#mermaid-svg-gvVKNcs2TFexEK71 g.clickable{cursor:pointer;}#mermaid-svg-gvVKNcs2TFexEK71 g.classGroup rect{fill:#ECECFF;stroke:#9370DB;}#mermaid-svg-gvVKNcs2TFexEK71 g.classGroup line{stroke:#9370DB;stroke-width:1;}#mermaid-svg-gvVKNcs2TFexEK71 .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5;}#mermaid-svg-gvVKNcs2TFexEK71 .classLabel .label{fill:#9370DB;font-size:10px;}#mermaid-svg-gvVKNcs2TFexEK71 .relation{stroke:#333333;stroke-width:1;fill:none;}#mermaid-svg-gvVKNcs2TFexEK71 .dashed-line{stroke-dasharray:3;}#mermaid-svg-gvVKNcs2TFexEK71 #compositionStart,#mermaid-svg-gvVKNcs2TFexEK71 .composition{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-gvVKNcs2TFexEK71 #compositionEnd,#mermaid-svg-gvVKNcs2TFexEK71 .composition{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-gvVKNcs2TFexEK71 #dependencyStart,#mermaid-svg-gvVKNcs2TFexEK71 .dependency{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-gvVKNcs2TFexEK71 #dependencyStart,#mermaid-svg-gvVKNcs2TFexEK71 .dependency{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-gvVKNcs2TFexEK71 #extensionStart,#mermaid-svg-gvVKNcs2TFexEK71 .extension{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-gvVKNcs2TFexEK71 #extensionEnd,#mermaid-svg-gvVKNcs2TFexEK71 .extension{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-gvVKNcs2TFexEK71 #aggregationStart,#mermaid-svg-gvVKNcs2TFexEK71 .aggregation{fill:#ECECFF!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-gvVKNcs2TFexEK71 #aggregationEnd,#mermaid-svg-gvVKNcs2TFexEK71 .aggregation{fill:#ECECFF!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-gvVKNcs2TFexEK71 .edgeTerminals{font-size:11px;}#mermaid-svg-gvVKNcs2TFexEK71 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} Client «interface» Iterator HasNext() : bool Next() : interface «interface» Aggregate CreateIterator() : Iterator AddItem(item:interface) ConcreteIterator *ConcreteAggregate aggregate Int index HasNext() : bool Next() : interface ConcreteAggregate []interface items CreateIterator() : Iterator GetItem(index int) : interface AddItem(item interface)
http://www.hkea.cn/news/14521768/

相关文章:

  • 网站seo啥意思wordpress手机无法访问
  • 徐州有哪些制作网站的公司吗上海注册公司注册地址
  • 网站建设竞标需要怎么做租车网站模版
  • 购物网站开发中查看订单的实现逻辑有什么可以制作图片的软件
  • 东莞网站制作企业网站锦州建设局网站
  • 网站建设的感想和建议海南在线一家
  • 肯德基网站建设苏州网站营销公司
  • 怎么查网站是谁建的网站用什么系统好用
  • 网站数据没有更新株洲公司网站建设
  • 网站建设应注意哪些问题三明交通建设集团网站
  • 合肥网站建设网站制作驻马店网站开发
  • 中国建设服务信息网站电商加盟网站建设
  • 推广网站有多少家网络营销基本含义
  • 银川网站建设报价广东东莞人才市场
  • 医疗网站建设及优化方案服装企业网站建设可行性分析
  • 青岛百度网站建设安康学院的费用
  • c#网站开发技术成都手机网站建设
  • 北仑网站建设29gz优质的常州网站建设
  • 企业网站策划建设方案百度大学生创新创业大赛英文
  • 呼家楼做网站的公司哪家好电商培训机构有哪些?哪家比较好
  • 服务器可以做网站吗河北邯郸房产网
  • 东莞网站建设网络推广绍兴模板建站代理
  • 南宁电商网站建设深圳宝安区网站建设
  • seo还能赚钱吗门户网站优化报价
  • 电商平台网站开发基于html的网站开发
  • 网站 被降权北京网站建设公司收购
  • 阿里云建站文章搜索做音乐 交流网站
  • 温州网站建设(首选国鼎网络)今网科技网站建设
  • 铁岭免费移动网站建设轻量应用服务器做网站
  • 长沙网站优化价格江津网站建设效果好不好