<commit_before>﻿using System;

namespace Nimbus.ConcurrentCollections
{
    public class RoundRobin<T>
    {
        private readonly T[] _items;
        private int _index;

        public RoundRobin(T[] items)
        {
            if (items.Length == 0) throw new ArgumentException("items");

            _items = items;
            _index = -1;
        }

        public T GetNext()
        {
            lock (_items)
            {
                _index++;
                _index %= _items.Length;
                return _items[_index];
            }
        }

        private void ReturnToPool(Wrapper wrapper)
        {
            throw new NotImplementedException();
        }


        public class Wrapper: IDisposable
        {
            private readonly T _value;
            private readonly RoundRobin<T> _owner;
            private bool _isFaulted;

            public Wrapper(T value, RoundRobin<T> owner )
            {
                _value = value;
                _owner = owner;
            }

            public T Value
            {
                get { return _value; }
            }

            public bool IsFaulted
            {
                get { return _isFaulted; }
            }

            public void MarkAsFaulted()
            {
                _isFaulted = true;
            }

            public void Dispose()
            {
                Dispose(true);
            }

            protected virtual void Dispose(bool disposing)
            {
                if (!disposing) return;

                _owner.ReturnToPool(this);
            }
        }

    }

}<commit_msg>Fixed parameter order. Damn you, R# test runner.<commit_after>﻿using System;

namespace Nimbus.ConcurrentCollections
{
    public class RoundRobin<T>
    {
        private readonly T[] _items;
        private int _index;

        public RoundRobin(T[] items)
        {
            if (items.Length == 0) throw new ArgumentException("items");

            _items = items;
            _index = -1;
        }

        public T GetNext()
        {
            lock (_items)
            {
                _index++;
                _index %= _items.Length;
                return _items[_index];
            }
        }

        private void ReturnToPool(Wrapper wrapper)
        {
            throw new NotImplementedException();
        }

        public class Wrapper : IDisposable
        {
            private readonly T _value;
            private readonly RoundRobin<T> _owner;
            private bool _isFaulted;

            public Wrapper(RoundRobin<T> owner, T value)
            {
                _value = value;
                _owner = owner;
            }

            public T Value
            {
                get { return _value; }
            }

            public bool IsFaulted
            {
                get { return _isFaulted; }
            }

            public void MarkAsFaulted()
            {
                _isFaulted = true;
            }

            public void Dispose()
            {
                Dispose(true);
            }

            protected virtual void Dispose(bool disposing)
            {
                if (!disposing) return;

                _owner.ReturnToPool(this);
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.07203907203907203, 'fraction_numerical': 0.001221001221001221, 'mean_word_length': 1.0597108736643621, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3425882', 'n_tokens_mistral': 857, 'n_tokens_neox': 803, 'n_words': 203}