// constructor public RowReverseIteractorGeneric(TwoDArrayGeneric <T> collectionIn) { collection = collectionIn; i = 0; j = 0; Console.WriteLine("total col = " + collection.Columns()); Console.WriteLine("total row = " + collection.Rows()); }
// move to the next element of the iteration public void Next() { if (reversed) { j--; if (j < 0) { j = 0; i++; reversed = false; } } else { j++; if (j >= collection.Columns()) { j = collection.Columns() - 1; i++; reversed = true; } } while (!IsDone()) { if (Current() == null) { Next(); } else { break; } } }
// move to the next element of the iteration public void Next() { j++; if (j >= collection.Columns()) { j = 0; i++; } while (!IsDone()) { if (Current() == null) { Next(); } else { break; } } }