Esempio n. 1
0
        object IList.this[int index]
        {
            get
            {
                CheckAndGrow(index);
                //int diff = index + 1 - _size;
                //for (int i = 0; i < diff; ++i)
                //{
                //    Add(new T());
                //}

                return(this[index]);
            }
            set
            {
                CheckAndGrow(index);
                //int diff = index + 1 - _size;
                //for (int i = 0; i < diff; ++i)
                //{
                //    Add(new T());
                //}

                ObjectArray <T> .VerifyValueType(value);

                this[index] = (T)value;
            }
        }
Esempio n. 2
0
 void IList.Remove(object item)
 {
     if (ObjectArray <T> .IsCompatibleObject(item))
     {
         this.Remove((T)item);
     }
 }
Esempio n. 3
0
 private static void VerifyValueType(object value)
 {
     if (!ObjectArray <T> .IsCompatibleObject(value))
     {
         throw new Exception("ThrowHelper.ThrowWrongValueTypeArgumentException(value, typeof(T)");
     }
 }
Esempio n. 4
0
        int IList.Add(object item)
        {
            ObjectArray <T> .VerifyValueType(item);

            this.Add((T)item);
            return(this.Count - 1);
        }
Esempio n. 5
0
 internal Enumerator(ObjectArray <T> list)
 {
     this.list    = list;
     this.index   = 0;
     this.version = list._version;
     this.current = default(T);
 }
Esempio n. 6
0
        public void ResetWorld()
        {
            lock (addRemoveLock)
            {
                m_removeList.Clear();
                ObjectArray <CollisionObject> allObjects = new ObjectArray <CollisionObject>();
                allObjects.AddRange(_world.GetCollisionObjectArray());
                foreach (CollisionObject co in allObjects)
                {
                    if (co is RigidBody)
                    {
                        _world.RemoveRigidBody(co as RigidBody);
                    }
                    else
                    {
                        _world.RemoveCollisionObject(co);
                    }
                }

                ObjectArray <TypedConstraint> allConstraints = new ObjectArray <TypedConstraint>();
                allConstraints.AddRange(_world.GetConstraintsObjectArray());
                foreach (TypedConstraint typedConstraint in allConstraints)
                {
                    _world.RemoveConstraint(typedConstraint);
                }
            }
            // that should be it..... but we may want to re-create broadphases and the like...
        }
Esempio n. 7
0
 int IList.IndexOf(object item)
 {
     if (ObjectArray <T> .IsCompatibleObject(item))
     {
         return(this.IndexOf((T)item));
     }
     return(-1);
 }
Esempio n. 8
0
            public bool MoveNext()
            {
                ObjectArray <T> list = this.list;

                if ((this.version == list._version) && (this.index < list._size))
                {
                    this.current = list._items[this.index];
                    this.index++;
                    return(true);
                }
                return(this.MoveNextRare());
            }
Esempio n. 9
0
        public void Sort(Comparison <T> comparison)
        {
            if (comparison == null)
            {
                throw new Exception("ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match");
            }
            if (this._size > 0)
            {
                IComparer <T> comparer = new ObjectArray <T> .FunctorComparer <T>(comparison);

                Array.Sort <T>(this._items, 0, this._size, comparer);
            }
        }
Esempio n. 10
0
        public ObjectArray <TOutput> ConvertAll <TOutput>(Converter <T, TOutput> converter) where TOutput : new()
        {
            if (converter == null)
            {
                throw new Exception("ThrowHelper.ThrowArgumentNullException(ExceptionArgument.converter");
            }
            ObjectArray <TOutput> list = new ObjectArray <TOutput>(this._size);

            for (int i = 0; i < this._size; i++)
            {
                list._items[i] = converter(this._items[i]);
            }
            list._size = this._size;
            return(list);
        }
Esempio n. 11
0
        //public Enumerator<T> GetEnumerator()
        //{
        //    return new Enumerator<T>((ObjectArray<T>)this);
        //}

        public ObjectArray <T> GetRange(int index, int count)
        {
            if ((index < 0) || (count < 0))
            {
                throw new Exception("ThrowHelper.ThrowArgumentOutOfRangeException((index < 0) ? ExceptionArgument.index : ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum");
            }
            if ((this._size - index) < count)
            {
                throw new Exception("ExceptionResource  - Offlen");
            }
            ObjectArray <T> list = new ObjectArray <T>(count);

            Array.Copy(this._items, index, list._items, 0, count);
            list._size = count;
            return(list);
        }
Esempio n. 12
0
        public ObjectArray <T> FindAll(Predicate <T> match)
        {
            if (match == null)
            {
                throw new Exception("ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match");
            }
            ObjectArray <T> list = new ObjectArray <T>();

            for (int i = 0; i < this._size; i++)
            {
                if (match(this._items[i]))
                {
                    list.Add(this._items[i]);
                }
            }
            return(list);
        }
Esempio n. 13
0
        void IList.Insert(int index, object item)
        {
            ObjectArray <T> .VerifyValueType(item);

            this.Insert(index, (T)item);
        }
Esempio n. 14
0
 bool IList.Contains(object item)
 {
     return(ObjectArray <T> .IsCompatibleObject(item) && this.Contains((T)item));
 }