本文整理汇总了C#中IIterator.First方法的典型用法代码示例。如果您正苦于以下问题:C# IIterator.First方法的具体用法?C# IIterator.First怎么用?C# IIterator.First使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IIterator
的用法示例。
在下文中一共展示了IIterator.First方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: printMember
public void printMember(IIterator iterate)
{
iterate.First();
while (!iterate.IsDone())
{
//textBox.AppendText("Friend");
}
}
示例2: PrintUsers
public static void PrintUsers(IIterator iterate)
{
iterate.First();
while (!iterate.IsDone())
{
Console.WriteLine(iterate.Next());
}
}
示例3: 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;
}
示例4: ExecuteAndUpdateCurrentLine
public override void ExecuteAndUpdateCurrentLine()
{
switch (CurrentLine)
{
case 0:
CurrentLine = 3;
return;
case 3: //L=(LinkList)malloc(sizeof(Lnode)); L->next=NULL;
//生成一个头节点
LinkCircleNode headNode = null;
LinkLineNode headLineNode = null;
headNode = new LinkCircleNode(40,50,diameter,status.头结点颜色,"H");
headLineNode = new LinkLineNode(40 + diameter,50 + diameter/2,40 + diameter + lineLength,50 + diameter/2,lineWidth,Color.Red);
headNode.Next = null;
headLineNode.Next = null;
circleNodeIterator = headNode.CreateIterator();
lineNodeIterator = headLineNode.CreateIterator();
break;
case 4: //for(i=n;i>0;i--){
if(status.I == 0)
{
CurrentLine = 9;
return;
}
break;
case 5: //p=(LinkList)malloc(sizeof(Lnode)); scanf(&p->data);
if(iteratorInsertNode != null)
{
((NodeListIterator)circleNodeIterator).RefreshAllNodes((LinkCircleNode)iteratorInsertNode.First().CurrentItem,40,50,diameter,lineLength,status.结点颜色);
}
iteratorInsertNode = new LinkCircleNode(40 + diameter - 4,50 + diameter,diameter,status.插入结点颜色,status.L[status.I - 1].ToString()).CreateIterator();
status.CanEdit = true;
status.P = "p当前指向结点" + ((LinkCircleNode)iteratorInsertNode.First().CurrentItem).Text;
break;
case 6: //p->next=L->next;
((LinkCircleNode)iteratorInsertNode.First().CurrentItem).Next = ((LinkCircleNode)circleNodeIterator.First().CurrentItem).Next;
//生成贝赛尔曲线
nullIteratorBezierLine = new BezierLine(new Rectangle(1,1,1,1),GetPoints(),lineWidth,Color.Red).CreateIterator();
break;
case 7: //L->next=p;
((LinkCircleNode)circleNodeIterator.First().CurrentItem).Next = (LinkCircleNode)iteratorInsertNode.First().CurrentItem;
//刷新所有的结点的位置
((NodeListIterator)circleNodeIterator).RefreshAllNodes((LinkCircleNode)iteratorInsertNode.First().CurrentItem,40,50,diameter,lineLength,status.结点颜色);
//设置当前结点的颜色
((NodeListIterator)circleNodeIterator).SetCurrentItemNewColor(iteratorInsertNode.First().CurrentItem,status.插入结点颜色,status.结点颜色);
//以下是生成一个箭头,并把它插入到箭头链表,最后刷新这个箭头链表
LinkLineNode lineNode = new LinkLineNode(1,1,1 + lineLength,1,2,Color.Red);
lineNode.Next = ((LinkLineNode)lineNodeIterator.First().CurrentItem).Next;
((LinkLineNode)lineNodeIterator.First().CurrentItem).Next = lineNode;
((NodeListIterator)lineNodeIterator).RefreshAllNodes((LinkLineNode)lineNodeIterator.First().CurrentItem,40 - lineLength,50 + diameter/2,diameter,lineLength,Color.Red);
//删除贝赛尔曲线
nullIteratorBezierLine = null;
//i--
status.CanEdit = true;
status.I--;
CurrentLine = 4;
return;
case 9:
return;
}
CurrentLine++;
}
示例5: ExecuteAndUpdateCurrentLine
public override void ExecuteAndUpdateCurrentLine()
{
switch (CurrentLine)
{
case 0:
CurrentLine = 2;
return;
case 2: //InitStack(S); p = T;
currentIterator = new BiTreePreOrderIterator(biTreeGenerator.RootNode);
currentIterator = currentIterator.First();
status.CanEdit = true;
status.P = ((IBiTreeNode)currentIterator.CurrentItem).Text;
break;
case 3: //while(p || !StackEmpty(S)){
if(currentIterator.CurrentItem == null && ((BiTreePreOrderIterator)currentIterator).NodesStack.Count == 0)
{
CurrentLine = 16;
return;
}
break;
case 4: //if(p){
if(currentIterator.CurrentItem == null)
{
CurrentLine = 12;
return;
}
break;
case 5: //if(!Visit(p->data)){
visiting = true;
CurrentLine = 8;
((ArrayIterator)visitedIterator).InsertGlyph(CreateVisitedGlyph(currentIterator.CurrentItem));
return;
case 8: //Push(S,p);
((BiTreePreOrderIterator)currentIterator).PushCurrentNode();
((StackIterator)stackIterator).PushGlyph(CreateStackItem(currentIterator.CurrentItem));
break;
case 9: //p = p->lchild;
((BiTreePreOrderIterator)currentIterator).SetToLeftChild();
CurrentLine = 3;
visiting = false;
if(currentIterator.CurrentItem == null)
{
status.CanEdit = true;
status.P = null;
}
else
{
status.CanEdit = true;
status.P = ((IBiTreeNode)currentIterator.CurrentItem).Text;
}
return;
case 12: //Pop(S,p);
((BiTreePreOrderIterator)currentIterator).PopupToCurrentNode();
((StackIterator)stackIterator).Pop();
visiting = false;
status.CanEdit = true;
status.P = ((IBiTreeNode)currentIterator.CurrentItem).Text;
break;
case 13: //p = p->rchild;
((BiTreePreOrderIterator)currentIterator).SetToRightChild();
CurrentLine = 3;
visiting = false;
if(currentIterator.CurrentItem == null)
{
status.CanEdit = true;
status.P = null;
}
else
{
status.CanEdit = true;
status.P = ((IBiTreeNode)currentIterator.CurrentItem).Text;
}
return;
case 16:
return;
}
CurrentLine++;
}