本文整理汇总了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());
}
}
示例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));
}
}
示例3: PrintUsers
public static void PrintUsers(IIterator iterate)
{
iterate.First();
while (!iterate.IsDone())
{
Console.WriteLine(iterate.Next());
}
}
示例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);
}
}
示例5: IEnumeratorAdapter
public IEnumeratorAdapter(IIterator enume)
{
if (enume != null)
{
this.enume = enume;
if (enume.HasNext())
{
this.current = enume.Next();
}
}
}
示例6: Set
public void Set(IIterator<string> currentArgument)
{
try
{
_value = currentArgument.Next();
}
catch (InvalidOperationException)
{
throw new ArgsException(ErrorCode.MissingString);
}
}
示例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();
}
示例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;
//}
}
}
示例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);
}
}
示例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);
}
示例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;
}
示例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;
}
示例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++;
}
示例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++;
}