Ejemplo n.º 1
0
            public Cd Next()
            {
                Cd cd = CdRack.GetCdAt(Index);

                this.Index++;
                return(cd);
            }
Ejemplo n.º 2
0
 public bool HasNext()
 {
     if (Index < CdRack.GetLength())
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
        public void GenericsIteratorTest2()
        {
            CdRack cdRack = new CdRack();

            cdRack.AppendCd(new Cd("Thriller"));
            cdRack.AppendCd(new Cd("Back in Black"));
            cdRack.AppendCd(new Cd("Bat out of Hell"));
            cdRack.AppendCd(new Cd("The Dark Side of the Moon"));
            IIterator <Cd> it = cdRack.Iterator();

            while (it.HasNext())
            {
                Cd cd = it.Next();
                Debug.WriteLine(cd.Title);
            }
        }
Ejemplo n.º 4
0
 public CdRackIterator(CdRack cdRack)
 {
     this.CdRack = cdRack;
     this.Index  = 0;
 }