Esempio n. 1
0
            public bool MoveNext()
            {
                if (_position >= _uniqueKeys.Length)
                {
                    return(false);
                }

                var currentKey = _uniqueKeys.Get(_position);

                var groupLocalList = new LocalList <T>();

                for (var i = 0; i < _values.Length; i++)
                {
                    var value = _values.Get(i);
                    if (_comparer.Equals(currentKey, value.Key))
                    {
                        groupLocalList.Add(value.Value);
                    }
                }

                _current = new LocalGroup(currentKey, groupLocalList);
                _position++;

                return(true);
            }
Esempio n. 2
0
            public LocalList <TResult> Select <TResult>(Selector <TResult> selector)
            {
                var result = new LocalList <TResult>(_uniqueKeys._length);

                while (MoveNext())
                {
                    var element = selector(_current);
                    result.Add(element);
                }

                return(result);
            }
Esempio n. 3
0
            internal GroupEnumerator(LocalList <T> list, Func <T, TKey> keySelector, EqualityComparer <TKey> comparer)
            {
                var values     = new LocalList <Row <TKey, T> >(list.Length);
                var uniqueKeys = new LocalList <TKey>();

                for (var i = 0; i < list.Length; i++)
                {
                    var element = list.Get(i);
                    var key     = keySelector(element);

                    values.Add(new Row <TKey, T>(key, element));

                    if (!uniqueKeys.Contains(key, comparer))
                    {
                        uniqueKeys.Add(key);
                    }
                }

                _comparer   = comparer;
                _current    = default;
                _position   = 0;
                _values     = values;
                _uniqueKeys = uniqueKeys;
            }
Esempio n. 4
0
 public LocalListDebugVisualizer(LocalList <T> list)
 {
     _list = list;
 }
Esempio n. 5
0
 internal LocalGroup(TKey key, LocalList <T> values)
 {
     Key    = key;
     Values = values;
 }