Esempio n. 1
0
 /// <summary>
 /// 迭代器模式的测试
 /// </summary>
 public static void Test()
 {
     Console.WriteLine("==============================Iterator Test==================================");
     Iterator ite;
     Aggregate agg = new ConcreteAggregate();
     ite = agg.CreateIterator();
     while (!ite.IsDone())
     {
         Console.Write(ite.currentItem().ToString());
         ite.Next();
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 针对某个聚集的操作,加载需要操作的聚集
 /// </summary>
 /// <param name="agg"></param>
 public ConcreteIterator(ConcreteAggregate agg)
 {
     this.agg = agg;
     this.size = agg.Size();
     this.index = 0;
 }