namespace BP
{
	abstract class Dictionary
	{
		array<int> _Buckets;
		array<int> _HashCodes;
		array<int> _Next;
		int _Count;
		int _FreeList;
		int _FreeCount;
		//------------------------------------------------------------------------------------------------------------------------
		Dictionary()
		{
			Initialize(0);
		}
		//------------------------------------------------------------------------------------------------------------------------
		void Initialize(int capacity)
		{
			int prime = Math::GetPrime(capacity);

			_Buckets.resize(prime);
			for (uint i = 0; i < _Buckets.length(); i++)
			{
				_Buckets[i] = -1;
			}

			_HashCodes.resize(prime);
			BP::Array::Clear(_HashCodes, 0, prime);
			_Next.resize(prime);
			BP::Array::Clear(_Next, 0, prime);
			
			_FreeList = -1;
		}
		//------------------------------------------------------------------------------------------------------------------------
		int Count
		{
			get const { return _Count - _FreeCount; }
		}
		//------------------------------------------------------------------------------------------------------------------------
	};
}
