Files
LuaCsForBarotraumaEP/Libraries/Farseer Physics Engine 3.5/Common/HashSet.cs
juanjp600 4d225c65f2 Updated to MonoGame 3.6 + Directory refactor
- Barotrauma's projects are in the Barotrauma directory
- All libraries are in the Libraries directory
- MonoGame is now managed by NuGet, rather than referenced from the installed files (TODO: consider using PCL for easier cross-platform development?)
- NuGet libraries are not included in the repo, as getting the latest versions automatically should be preferred
- Removed Content/effects.mgfx as it didn't seem to be used anywhere
- Removed some references to Subsurface directory
- Renamed Launcher2 to Launcher
2017-06-27 09:52:57 -03:00

78 lines
1.6 KiB
C#

#if WINDOWS_PHONE || XBOX
using System.Collections;
using System.Collections.Generic;
namespace FarseerPhysics.Common
{
public class HashSet<T> : ICollection<T>
{
private Dictionary<T, byte> _dict;
public HashSet(int capacity)
{
_dict = new Dictionary<T, byte>(capacity);
}
public HashSet()
{
_dict = new Dictionary<T, byte>();
}
#region ICollection<T> Members
public void Add(T item)
{
// We don't care for the value in dictionary, only keys matter.
if (!_dict.ContainsKey(item))
_dict.Add(item, 0);
}
public void Clear()
{
_dict.Clear();
}
public bool Contains(T item)
{
return _dict.ContainsKey(item);
}
public void CopyTo(T[] array, int arrayIndex)
{
foreach (var item in _dict.Keys)
{
array[arrayIndex++] = item;
}
}
public bool Remove(T item)
{
return _dict.Remove(item);
}
public IEnumerator<T> GetEnumerator()
{
return _dict.Keys.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return _dict.Keys.GetEnumerator();
}
// Properties
public int Count
{
get { return _dict.Keys.Count; }
}
public bool IsReadOnly
{
get { return false; }
}
#endregion
}
}
#endif