Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public ItemPair(T value, SlotId id)
 {
     this.Value = value;
     this.Id    = id;
 }
Exemplo n.º 4
0
        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)));
        }