Beispiel #1
0
 /// <summary>
 /// Removes the first occurrence of a specific item from the list
 /// </summary>
 /// <param name="value">Item</param>
 void IList.Remove(object value)
 {
     if (CircularList <T> .IsCompatibleObject(value))
     {
         this.Remove((T)((object)value));
     }
 }
Beispiel #2
0
 /// <summary>
 /// Enumerator constructor
 /// </summary>
 /// <param name="srcList">Source CircularList to enumerate</param>
 internal Enumerator(CircularList <T> srcList)
 {
     Contract.Requires(srcList != null);
     _srcList        = srcList;
     _version        = _srcList._version;
     _index          = -1;
     _currentElement = default(T);
 }
Beispiel #3
0
 /// <summary>
 /// Searches for the specified 'item' and returns the index of the first occurrence of the item inside list
 /// </summary>
 /// <param name="value">The item to locate inside the list</param>
 /// <returns>The index of element inside the list, if found. -1 otherwise</returns>
 int IList.IndexOf(object value)
 {
     if (CircularList <T> .IsCompatibleObject(value))
     {
         return(this.IndexOf((T)((object)value)));
     }
     return(-1);
 }
Beispiel #4
0
        /// <summary>
        /// OutOfTurnQueue constructor
        /// </summary>
        /// <param name="collection">The collection whose elements are copied to the new queue</param>
        public OutOfTurnQueue(IEnumerable <T> collection)
        {
            if (collection == null)
            {
                throw new ArgumentNullException(nameof(collection));
            }

            _circularList = new CircularList <T>(collection);
        }
Beispiel #5
0
        /// <summary>
        /// OutOfTurnQueue constructor
        /// </summary>
        /// <param name="capacity">Initial capacity</param>
        public OutOfTurnQueue(int capacity)
        {
            if (capacity < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(capacity), "capacity cannot be negative");
            }

            _circularList = new CircularList <T>(capacity);
        }
Beispiel #6
0
            /// <summary>
            /// Enumerator constructor
            /// </summary>
            /// <param name="srcList">Source CircularList to enumerate</param>
            internal Enumerator(CircularList <T> srcList)
            {
                TurboContract.Requires(srcList != null, conditionString: "srcList != null");

                _srcList        = srcList;
                _version        = _srcList._version;
                _index          = -1;
                _currentElement = default(T);
            }
Beispiel #7
0
 /// <summary>
 /// OutOfTurnQueue constructor
 /// </summary>
 public OutOfTurnQueue()
 {
     _circularList = new CircularList <T>();
 }
Beispiel #8
0
        /// <summary>
        /// Deque constructor
        /// </summary>
        /// <param name="collection">The collection whose elements are copied to the new deque</param>
        public Deque(IEnumerable <T> collection)
        {
            Contract.Requires <ArgumentNullException>(collection != null);

            _circularList = new CircularList <T>(collection);
        }
Beispiel #9
0
        /// <summary>
        /// Deque constructor with specified initial capacity
        /// </summary>
        /// <param name="capacity">Initial capacity</param>
        public Deque(int capacity)
        {
            Contract.Requires <ArgumentOutOfRangeException>(capacity >= 0);

            _circularList = new CircularList <T>(capacity);
        }
Beispiel #10
0
 /// <summary>
 /// Deque constructor
 /// </summary>
 public Deque()
 {
     _circularList = new CircularList <T>();
 }
Beispiel #11
0
 /// <summary>
 /// Determines whether an element is in the List
 /// </summary>
 /// <param name="value">The object to locate in the List</param>
 /// <returns>True if item is found</returns>
 bool IList.Contains(object value)
 {
     return(CircularList <T> .IsCompatibleObject(value) && this.Contains((T)((object)value)));
 }
Beispiel #12
0
        /// <summary>
        /// OutOfTurnQueue constructor
        /// </summary>
        /// <param name="capacity">Initial capacity</param>
        public OutOfTurnQueue(int capacity)
        {
            Contract.Requires <ArgumentException>(capacity >= 0);

            _circularList = new CircularList <T>(capacity);
        }