public SuggestItemEnumerator(CompoundSuggestItemCollection container) { _container = container; _containerIndex = 0; _innerIndex = 0; _currentList = _container.Bags[0]; }
public SuggestItemEnumerator(SuggestItemCollection myList) { _myList = myList; _items = _myList.Items; _index = 0; _count = _myList.Count; Current = default; }
// TODO: This is only for the test data. Should revert to auto-increasing lists. // private static readonly int[] SublistCounts = { 6441, 5719, 4718, 5031, 5778, 4072, 5311, 4011, 3801, 3730, 3357, 4469, 5018, 3325, 3897, 3414, 2240, 2938, 2627, 2260, 1764, 2466, 728, 754, 1000, 615, 24, 23, 13, 18, 7, 3, 17, 10, 12, 10, 4, 10, 7, 10, 6, 3, 9, 8, 4, 7, 5, 3, 6, 2, 2, 2, 7, 4, 3, 4, 3, 3, 2, 2, 2, 3, 3, 2, 0, 2, 2, 1, 1, 1, 1, 1, 0, 1, 1 }; public CompoundSuggestItemCollection(uint count) { _bagCount = count; Bags = new SuggestItemCollection[count]; for (var i = 0; i < Bags.Length; i++) { //Bags[i] = new SuggestItemCollection(SublistCounts[i]); Bags[i] = new SuggestItemCollection(6441); } _myEnumerator = new SuggestItemEnumerator(this); #if DEBUG MaximumLengths = new int[count]; MaximumBuffers = new long[count]; #endif }
public bool MoveNext() { if (_innerIndex < _currentList.Count) { Current = _currentList.Items[_innerIndex++]; return(true); } while (++_containerIndex < _container._bagCount) { _currentList = _container.Bags[_containerIndex]; if (_currentList == null || _currentList.Count <= 0) { continue; } _innerIndex = 0; Current = _currentList.Items[_innerIndex++]; return(true); } return(false); }
public void Reset() { _containerIndex = 0; _innerIndex = 0; _currentList = _container.Bags[0]; }