// move to the next element of the iteration public void Next() { // Console.WriteLine("row = " + i + " col = " + j); if (i % 2 == 0) { if (j >= collection.Rows()) { i++; j = 2; } else { j++; } } else { if (j == 0) { i++; j = 0; } else { j--; } } }
// constructor public RowReverseIteractorGeneric(TwoDArrayGeneric <T> collectionIn) { collection = collectionIn; i = 0; j = 0; Console.WriteLine("total col = " + collection.Columns()); Console.WriteLine("total row = " + collection.Rows()); }
// test whether or not the iteration has finished public bool IsDone() { return(i >= collection.Rows()); }