public T this[SlotId id] { get { uint index = id.Index; if ((long)index >= (long)this._array.Length) { throw new IndexOutOfRangeException(); } if (!this._array[index].Id.IsActive || id != this._array[index].Id) { throw new KeyNotFoundException(); } return(this._array[index].Value); } set { uint index = id.Index; if ((long)index >= (long)this._array.Length) { throw new IndexOutOfRangeException(); } if (!this._array[index].Id.IsActive || id != this._array[index].Id) { throw new KeyNotFoundException(); } this._array[index] = new SlotVector <T> .ItemPair(value, id); } }
public bool Remove(SlotId id) { if (!id.IsActive) { return(false); } uint index = id.Index; this._array[index] = new SlotVector <T> .ItemPair(default(T), id.ToInactive(this._freeHead)); this._freeHead = index; --this._count; return(true); }
public ItemPair(T value, SlotId id) { this.Value = value; this.Id = id; }
public bool Has(SlotId id) { uint index = id.Index; return((long)index < (long)this._array.Length && (this._array[index].Id.IsActive && !(id != this._array[index].Id))); }