Root/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | #if WINDOWS_PHONE || XBOX //TODO: FIX using System; using System.Collections; using System.Collections.Generic; namespace FarseerPhysics.Common { public class HashSet<T> : ICollection<T> { private Dictionary<T, short > _dict; public HashSet( int capacity) { _dict = new Dictionary<T, short >(capacity); } public HashSet() { _dict = new Dictionary<T, short >(); } // Methods #region ICollection<T> Members public void Add(T item) { // We don't care for the value in dictionary, Keys matter. _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) { throw new NotImplementedException(); } 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 |
Source at commit c7acc8b3f8c9 created 12 years 7 months ago. By Nathan Adams, Adding region section for changelog |
---|