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

建筑公司企业网站WordPress mx 主题

建筑公司企业网站,WordPress mx 主题,网站打印模板制作,网页制作价格iOS设计模式 - 迭代器 原理图 说明 提供一种方法顺序访问一个聚合对象中的各种元素#xff0c;而又不暴露该对象的内部表示。 源码 https://github.com/YouXianMing/iOS-Design-Patterns // // Node.h // IteratorPattern // // Created by YouXianMing on 15/10/26. // … iOS设计模式 - 迭代器   原理图    说明 提供一种方法顺序访问一个聚合对象中的各种元素而又不暴露该对象的内部表示。    源码 https://github.com/YouXianMing/iOS-Design-Patterns // // Node.h // IteratorPattern // // Created by YouXianMing on 15/10/26. // Copyright © 2015年 YouXianMing. All rights reserved. //#import Foundation/Foundation.hinterface Node : NSObject/*** 下一个节点*/ property (nonatomic, strong) Node *nextNode;/*** 节点里面的内容*/ property (nonatomic, strong) id item;/*** 初始化节点** param item 节点携带的内容** return 节点*/ - (instancetype)initWithItem:(id)item;end // // Node.m // IteratorPattern // // Created by YouXianMing on 15/10/26. // Copyright © 2015年 YouXianMing. All rights reserved. //#import Node.himplementation Node- (instancetype)initWithItem:(id)item {self [super init];if (self) {self.item item;}return self; }end // // LinkedList.h // IteratorPattern // // Created by YouXianMing on 15/10/26. // Copyright © 2015年 YouXianMing. All rights reserved. //#import Foundation/Foundation.h #import Node.h#import IteratorProtocol.h #import LinkedListIterator.hinterface LinkedList : NSObject/*** 头结点*/ property (nonatomic, strong, readonly) Node *headNode;/*** 节点的数目*/ property (nonatomic, assign, readonly) NSInteger numberOfNodes;/*** 添加数据** param item 数据*/ - (void)addItem:(id)item;/*** 创建迭代器对象** return 迭代器对象*/ - (id IteratorProtocol)createIterator;end // // LinkedList.m // IteratorPattern // // Created by YouXianMing on 15/10/26. // Copyright © 2015年 YouXianMing. All rights reserved. //#import LinkedList.hinterface LinkedList ()/*** 头结点*/ property (nonatomic, strong, readwrite) Node *headNode;/*** 节点的数量*/ property (nonatomic, assign, readwrite) NSInteger numberOfNodes;endimplementation LinkedList- (void)addItem:(id)item {if (self.headNode nil) {self.headNode [[Node alloc] initWithItem:item];} else {[self addItem:item node:self.headNode];}self.numberOfNodes; }- (id IteratorProtocol)createIterator {return [[LinkedListIterator alloc] initWithLinkedList:self]; }#pragma mark - Private Methods - (void)addItem:(id)item node:(Node *)node {if (node.nextNode nil) {node.nextNode [[Node alloc] initWithItem:item];} else {[self addItem:item node:node.nextNode];} }end // // LinkedListIterator.h // IteratorPattern // // Created by YouXianMing on 15/10/26. // Copyright © 2015年 YouXianMing. All rights reserved. //#import Foundation/Foundation.h #import IteratorProtocol.h class LinkedList;interface LinkedListIterator : NSObject IteratorProtocol/*** 由链表进行初始化** param linkedList 链表对象** return 迭代器工具*/ - (id)initWithLinkedList:(LinkedList *)linkedList;end // // LinkedListIterator.m // IteratorPattern // // Created by YouXianMing on 15/10/26. // Copyright © 2015年 YouXianMing. All rights reserved. //#import LinkedListIterator.h #import LinkedList.hinterface LinkedListIterator ()property (nonatomic, weak) LinkedList *linkedList; property (nonatomic, weak) Node *currentNode;endimplementation LinkedListIterator- (id)initWithLinkedList:(LinkedList *)linkedList {if (self [super init]) {self.linkedList linkedList;self.currentNode linkedList.headNode;}return self; }- (id)next {id item self.currentNode.item;self.currentNode self.currentNode.nextNode;return item; }- (BOOL)hasNext {if (self.currentNode nil) {return NO;} else {return YES;} }- (id)item {return self.currentNode.item; }end // // IteratorProtocol.h // IteratorPattern // // Created by YouXianMing on 15/10/26. // Copyright © 2015年 YouXianMing. All rights reserved. //#import Foundation/Foundation.hprotocol IteratorProtocol NSObject/*** 下一个对象** return 对象*/ - (id)next;/*** 是否存在下一个对象** return 对象*/ - (BOOL)hasNext;/*** 内容** return 返回内容*/ - (id)item;end // // ViewController.m // IteratorPattern // // Created by YouXianMing on 15/10/26. // Copyright © 2015年 YouXianMing. All rights reserved. //#import ViewController.h#import LinkedList.h #import LinkedListIterator.hinterface ViewController ()property (nonatomic, strong) LinkedList *linkedList;endimplementation ViewController- (void)viewDidLoad {[super viewDidLoad];// 创建链表结构self.linkedList [[LinkedList alloc] init];// 添加链表元素[self.linkedList addItem:1];[self.linkedList addItem:2];[self.linkedList addItem:3];[self.linkedList addItem:4];[self.linkedList addItem:5];// 创建迭代器id IteratorProtocol iterator [self.linkedList createIterator];// 进行元素迭代while ([iterator hasNext]) {NSLog(%, iterator.item);[iterator next];} }end   细节 转载于:https://www.cnblogs.com/YouXianMing/p/4911148.html
http://wiki.neutronadmin.com/news/185713/

相关文章:

  • 建站模板招募设计师什么是网络营销服务?网络营销服务有哪些特点?
  • 表白网站在线制作软件计算机语言入门先学什么
  • 网站开发 pdf 文字版wordpress data
  • 网站推广方法主要有哪几种秦皇岛金洋建设集团网站
  • 做微网站需要什么海外推广服务
  • 北京网站优化招聘免费做产品宣传的网站
  • 免费建站哪家好重庆欧勒精细有限公司网站策划书
  • 公司网站非响应式外文网站做t检验分析
  • 海南省建设工程质量监督网站网页制作wordpress模板下载
  • 网络策略seo关键词排名优化怎么样
  • 商业网站开发模式wordpress评论删除站点
  • 做衣服网站coding wordpress
  • 哪个网站做的最好网站被k怎么恢复
  • 企业展示型网站建设wordpress主题压缩包
  • 个体工商注册查询平台seo 专业
  • 如何免费做网站邢台信息港二手房出售
  • 做网站好的网站建设公司排名网站静态和伪静态意思
  • 做影视网站有什么风险大学生网站建设与网页设计报告
  • 高端网站开发程资讯网站的好处
  • 如何建设内部网站顺德做网站
  • 哈尔滨营销型网站制作什么网站可以找手工活做
  • wordpress建站全教程无锡网站制作价格
  • 武进建设局网站为何老是打不开网站做锚点
  • 石家庄 外贸网站建设公司排名网络营销包括哪些策略
  • 房产中介 网站模板石家庄专业网站设计电话
  • 精品课程网站建设开题报告重庆最有效的网站推广
  • 韩都衣舍网站建设方案网站开发的初始密码
  • 模板网站的缺点建网站需要有啥能力
  • 一个网站是如何知道是谁来访问青岛网站推广外包
  • 江门网页建站模板汉口江岸区城市建设局网站