当前位置: 首页>>代码示例>>C#>>正文


C# IIterator.Next方法代码示例

本文整理汇总了C#中IIterator.Next方法的典型用法代码示例。如果您正苦于以下问题:C# IIterator.Next方法的具体用法?C# IIterator.Next怎么用?C# IIterator.Next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IIterator的用法示例。


在下文中一共展示了IIterator.Next方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrintUsers

 private static void PrintUsers(IIterator iterate)
 {
     while (!iterate.IsDone())
     {
         Console.WriteLine(iterate.Next());
     }
 }
开发者ID:muriloxk,项目名称:csharp-designpatterns-estudo,代码行数:7,代码来源:Program.cs

示例2: IteratorPrinter

 private void IteratorPrinter(IIterator iterator)
 {
     while (iterator.HasNext())
     {
         var menuItem = (MenuItem) iterator.Next();
         Console.WriteLine(String.Format("Name={0} Description={1} Vege?={2} Price={3}", menuItem.Name, menuItem.Description, menuItem.Vegetarian, menuItem.Price));
     }
 }
开发者ID:param2000,项目名称:HeadFirstDesignPattern,代码行数:8,代码来源:NewWaitressWithIterator.cs

示例3: PrintUsers

 public static void PrintUsers(IIterator iterate)
 {
     iterate.First();
     while (!iterate.IsDone())
     {
         Console.WriteLine(iterate.Next());
     }
 }
开发者ID:Karenzuniga,项目名称:pddcsharp,代码行数:8,代码来源:Program.cs

示例4: PrintMenu

 private void PrintMenu(IIterator iterator)
 {
     while (iterator.HasNext())
     {
         MenuItem menuItem = (MenuItem) iterator.Next();
         Console.Write(menuItem.Name + ", ");
         Console.Write(menuItem.Price + " -- ");
         Console.WriteLine(menuItem.Description);
     }
 }
开发者ID:pavelanikhimovski,项目名称:design-patterns,代码行数:10,代码来源:Waitress.cs

示例5: IEnumeratorAdapter

 public IEnumeratorAdapter(IIterator enume)
 {
     if (enume != null)
     {
         this.enume = enume;
         if (enume.HasNext())
         {
             this.current = enume.Next();
         }
     }
 }
开发者ID:207h2Flogintvg,项目名称:LGame,代码行数:11,代码来源:JavaListInterface.cs

示例6: Set

 public void Set(IIterator<string> currentArgument)
 {
     try
     {
         _value = currentArgument.Next();
     }
     catch (InvalidOperationException)
     {
         throw new ArgsException(ErrorCode.MissingString);
     }
 }
开发者ID:Pvlerick,项目名称:CommandLineArgumentParser,代码行数:11,代码来源:StringArgumentMarshaler.cs

示例7: PrintMenu

        public String PrintMenu(IIterator iterator)
        {
            StringBuilder sb = new StringBuilder();
            while (iterator.HasNext()) {
                MenuItem menuItem = (MenuItem)iterator.Next();

                sb.Append(menuItem.Name + ", ");
                sb.Append(menuItem.Price + " -- ");
                sb.Append(menuItem.Description + "\n");
            }
            return sb.ToString();
        }
开发者ID:vmp,项目名称:CSharpExamples,代码行数:12,代码来源:Waitress.cs

示例8: ParseArgumentStrings

        private void ParseArgumentStrings(IList<string> argsList)
        {
            for (_currentArgument = argsList.GetIterator(); _currentArgument.HasNext;)
            {
                var argString = _currentArgument.Next();

                if (argString.StartsWith("-"))
                    ParseArgumentCharacters(argString.Substring(1));
                //else
                //{
                //    _currentArgument.Previous();
                //    break;
                //}

            }
        }
开发者ID:Pvlerick,项目名称:CommandLineArgumentParser,代码行数:16,代码来源:Args.cs

示例9: Set

        public void Set(IIterator<string> currentArgument)
        {
            string parameter = null;

            try
            {
                parameter = currentArgument.Next();
                _value = double.Parse(parameter);
            }
            catch (InvalidOperationException)
            {
                throw new ArgsException(ErrorCode.MissingDouble);
            }
            catch (FormatException)
            {
                throw new ArgsException(ErrorCode.MissingDouble);
            }
        }
开发者ID:Pvlerick,项目名称:CommandLineArgumentParser,代码行数:18,代码来源:DoubleArgumentMarshaler.cs

示例10: FinishToArray

 private static Actor[] FinishToArray(Actor[] r, IIterator it)
 {
     int i = r.Length;
     while (it.HasNext())
     {
         int cap = r.Length;
         if (i == cap)
         {
             int newCap = ((cap / 2) + 1) * 3;
             if (newCap <= cap)
             {
                 if (cap == int.MaxValue)
                     newCap = int.MaxValue;
             }
             r = (Actor[])CollectionUtils.CopyOf(r, newCap);
         }
         r[i++] = (Actor)it.Next();
     }
     return (i == r.Length) ? r : (Actor[])CollectionUtils.CopyOf(r, i);
 }
开发者ID:DONGChuan,项目名称:LGame,代码行数:20,代码来源:ActorSet.cs

示例11: IterateChildrenMethod

 /// <summary>Handles the iteration of the children or qualfier</summary>
 /// <param name="iterator">an iterator</param>
 /// <returns>Returns if there are more elements available.</returns>
 private bool IterateChildrenMethod(IIterator iterator)
 {
     if (_enclosing._skipSiblings)
     {
         // setSkipSiblings(false);
         _enclosing._skipSiblings = false;
         _subIterator = Enumerable.Empty<object>().Iterator();
     }
     // create sub iterator for every child,
     // if its the first child visited or the former child is finished
     if ((!_subIterator.HasNext()) && iterator.HasNext())
     {
         var child = (XmpNode)iterator.Next();
         _index++;
         _subIterator = new NodeIterator(_enclosing, child, _path, _index);
     }
     if (_subIterator.HasNext())
     {
         _returnProperty = (IXmpPropertyInfo)_subIterator.Next();
         return true;
     }
     return false;
 }
开发者ID:tehkyle,项目名称:xmp-core-dotnet,代码行数:26,代码来源:XmpIterator.cs

示例12: CreatePreviewImage

		Image CreatePreviewImage(string s)
		{
			int height = 80;
			int width = 530;
			int lineLength = 18;
			int diameter = 30;
			int leftSpan = 3;
			int topSpan = 20;


			IIterator circleNodeIterator;//用于输出结点链表的指针
			IIterator lineNodeIterator;//用于输出连接线链表的指针

			LinkCircleNode headNode = null;
			LinkLineNode   headLineNode = null;
			LinkCircleNode previousNode = null;
			LinkLineNode   previousLineNode = null;
			LinkCircleNode currentNode = null;
			LinkLineNode   currentLineNode = null;
			previousNode = headNode = new LinkCircleNode(leftSpan,topSpan,diameter,Color.Red,"H");
			previousLineNode = headLineNode = new LinkLineNode(leftSpan + diameter,topSpan + diameter/2,leftSpan + diameter + lineLength,topSpan + diameter/2,lineWidth,Color.Red);

			for(int i = 0;i < s.Length;i++)
			{
				currentNode = new LinkCircleNode(leftSpan + (i + 1) * (lineLength + diameter),topSpan,diameter,Color.DarkTurquoise,s[i].ToString());
				currentLineNode = new LinkLineNode(leftSpan + diameter + (i + 1) * (lineLength + diameter),topSpan + diameter/2,leftSpan + diameter + (i + 1) * (lineLength + diameter) + lineLength,topSpan + diameter/2,lineWidth,Color.Red);
				
				previousNode.Next = currentNode;
				previousLineNode.Next = currentLineNode;

				previousNode = currentNode;
				previousLineNode = currentLineNode;

			}

			if(currentNode != null)
			{
				currentNode.Next = null;
				currentLineNode.Next = null;
			}
			circleNodeIterator = headNode.CreateIterator(); 
			lineNodeIterator = headLineNode.CreateIterator();

			Bitmap bmp = new Bitmap(width,height);
			Graphics g = Graphics.FromImage(bmp);

			if(circleNodeIterator != null)
			{
				for(IIterator iterator = circleNodeIterator.First();!circleNodeIterator.IsDone();iterator = circleNodeIterator.Next())
				{
					iterator.CurrentItem.Draw(g);
				}
			}
			if(lineNodeIterator != null)
			{
				for(IIterator iterator = lineNodeIterator.First();!lineNodeIterator.IsDone();iterator = lineNodeIterator.Next())
				{
					iterator.CurrentItem.Draw(g);
				}
			}

			return bmp;

		}
开发者ID:tangxuehua,项目名称:DataStructure,代码行数:64,代码来源:CreateList.cs

示例13: ExecuteAndUpdateCurrentLine

		public override void ExecuteAndUpdateCurrentLine()
		{
			switch (CurrentLine)
			{
				case 0:
					CurrentLine = 2;
					return;
				case 2:  //p = L;j = 0;
					circleNodeIterator1 = circleNodeIterator1.First();//使p指向头结点
					status.CanEdit = true;
					status.J = 0;
					nullIteratorP = new Pointer(circleNodeIterator1.CurrentItem.Bounds.X - 33,circleNodeIterator1.CurrentItem.Bounds.Y - 33,Color.Purple,"p").CreateIterator();
					status.CanEdit = true;
					status.P = "p当前指向结点" + ((LinkCircleNode)circleNodeIterator1.CurrentItem).Text;
					break;
				case 3:  //while(p && j<i-1){
					//判断while语句条件是否成立,如果成立,CurrentLine = 4;不成立,CurrentLine = 6;
					if(circleNodeIterator1 == null || status.J >= status.I - 1)
					{
						CurrentLine = 6;
						return;
					}
					break;
				case 4:  //p = p->next; j++;
					circleNodeIterator1 = circleNodeIterator1.Next();  //p下移一个结点
					((NodeListIterator)circleNodeIterator).SetCurrentItemNewColor(circleNodeIterator1.CurrentItem,status.当前结点颜色,status.结点颜色);
					status.CanEdit = true;
					status.P = "p当前指向结点" + ((LinkCircleNode)circleNodeIterator1.CurrentItem).Text;
					//把指针p设置到新的位置
					((Pointer)nullIteratorP.CurrentItem).SetToNewPosition(circleNodeIterator1.CurrentItem.Bounds.X - 33,circleNodeIterator1.CurrentItem.Bounds.Y - 33);
					status.CanEdit = true;
					status.J++;
					CurrentLine = 3;
					return;
				case 6:  //if(p == NULL)
					CurrentLine = 8;
					return;
				case 8:  //s = (LinkList)malloc(sizeof(LNode));
					x = this.circleNodeIterator1.CurrentItem.Bounds.X + diameter - 5;
					y = this.circleNodeIterator1.CurrentItem.Bounds.Y + diameter;
					iteratorInsertNode = new LinkCircleNode(x,y,diameter,status.插入结点颜色,"").CreateIterator();
					break;
				case 9:  //s->data = e;
					iteratorInsertNode = new LinkCircleNode(x,y,diameter,status.插入结点颜色,status.E.ToString()).CreateIterator();
					break;
				case 10:  //s->next = p->next;
					nullIteratorBezierLine = new BezierLine(new Rectangle(1,1,1,1),GetPoints(),2,Color.Red).CreateIterator();
					break;
				case 11:  //p->next = s;
					int xx1,yy1;
					xx1 = circleNodeIterator1.CurrentItem.Bounds.X + diameter;
					yy1 = circleNodeIterator1.CurrentItem.Bounds.Y + diameter / 2;
					nullIteratorBezierLine = null;
					iteratorInsertNode.CurrentItem.Bounds = new Rectangle(xx1 + lineLength,yy1 - diameter / 2,diameter,diameter);
					((NodeListIterator)circleNodeIterator).InsertNodeAndRefresh(status.I,(INode)iteratorInsertNode.CurrentItem,diameter,lineLength);

					LinkLineNode insertLineNode = new LinkLineNode(xx1 + diameter + lineLength,yy1,xx1 + diameter + 2 * lineLength,yy1,2,Color.Black);
					((NodeListIterator)lineNodeIterator).InsertNodeAndRefresh(status.I,insertLineNode,diameter,lineLength);
					status.CanEdit = true;
					status.L = status.L.Insert(status.I - 1,status.E.ToString());
					status.CanEdit = true;
					status.Length++;
					break;
				case 12:
					return;
			}
			CurrentLine++;
			
		}
开发者ID:tangxuehua,项目名称:DataStructure,代码行数:69,代码来源:ListInsert.cs

示例14: ExecuteAndUpdateCurrentLine

		public override void ExecuteAndUpdateCurrentLine()
		{
			switch (CurrentLine)
			{
				case 0:
					CurrentLine = 2;
					return;
				case 2:
					circleNodeIterator1 = circleNodeIterator1.First();//使p指向头结点
					status.CanEdit = true;
					status.J = 0;
					nullIteratorP = new Pointer(circleNodeIterator1.CurrentItem.Bounds.X - 33,circleNodeIterator1.CurrentItem.Bounds.Y - 33,Color.Purple,"p").CreateIterator();
					status.CanEdit = true;
					status.P = "p当前指向结点" + ((LinkCircleNode)circleNodeIterator1.CurrentItem).Text;
					break;
				case 3:  //while(p->next && j<i-1)
					//判断while语句条件是否成立,如果成立,CurrentLine = 4;不成立,CurrentLine = 6;
					if(circleNodeIterator1 == null || status.J >= status.I - 1)
					{
						CurrentLine = 6;
						return;
					}
					break;
				case 4:  //p = p->next; j++;
					circleNodeIterator1 = circleNodeIterator1.Next();  //p下移一个结点
					((NodeListIterator)circleNodeIterator).SetCurrentItemNewColor(circleNodeIterator1.CurrentItem,status.当前结点颜色,status.结点颜色);
					status.CanEdit = true;
					status.P = "p当前指向结点" + ((LinkCircleNode)circleNodeIterator1.CurrentItem).Text;
					//把指针p设置到新的位置
					((Pointer)nullIteratorP.CurrentItem).SetToNewPosition(circleNodeIterator1.CurrentItem.Bounds.X - 33,circleNodeIterator1.CurrentItem.Bounds.Y - 33);
					status.CanEdit = true;
					status.J++;
					CurrentLine = 3;
					return;
				case 6:
					CurrentLine = 8;
					return;
				case 8:  //q = p->next;
					IGlyph glyph = ((NodeListIterator)circleNodeIterator1).GetNextGlyph();//注意:这里不仅取出p所指的图元,而且把p指针下移一个
					nullIteratorQ = new Pointer(glyph.Bounds.X - 33,glyph.Bounds.Y - 33,Color.Red,"q").CreateIterator();
					break;
				case 9:  //p->next = q->next;
					int x,y,width,height;
					x = circleNodeIterator1.CurrentItem.Bounds.X + diameter + lineLength / 2;
					y = circleNodeIterator1.CurrentItem.Bounds.Y + diameter / 2;
					width = diameter + lineLength;
					height = diameter;
					swerveLineIterator = new SwerveLine(new Rectangle(x,y,width,height),GetPoints(x,y,width,height),2,Color.Red).CreateIterator();
					((NodeListIterator)lineNodeIterator).SetNodeUnVisible(status.I - 1);
					status.CanEdit = true;
					status.L = status.L.Remove(status.I - 1,1);
					status.CanEdit = true;
					status.Length -= 1; 
					break;
				case 10:  //e = q->data; free(q);
					status.CanEdit = true;
					status.E = ((LinkCircleNode)((NodeListIterator)circleNodeIterator1).GetNextGlyph()).Text[0];
					//删除q所指的结点
					((NodeListIterator)circleNodeIterator).DeleteNodeAndRefresh(status.I,diameter,lineLength);
					//删除一条连接线,这里因为所有的连接线都一样,所以随便指定一个删除的索引即可,这里,我总是指定为status.Length,即删除最后一条线
					((NodeListIterator)lineNodeIterator).DeleteNodeAndRefresh(status.Length,diameter,lineLength);
					//删除q指针
					nullIteratorQ = null;
					//将刚才设置为透明的线重新显示出来
					((NodeListIterator)lineNodeIterator).SetNodeVisible(status.I - 1,Color.Red);
					//删除转弯的线
					swerveLineIterator = null;
					break;
				case 11:
					return;
			}
			CurrentLine++;
		}
开发者ID:tangxuehua,项目名称:DataStructure,代码行数:73,代码来源:ListDelete.cs


注:本文中的IIterator.Next方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。