Exemplo n.º 1
0
        /// <summary>
        /// A shallow copy of the list.
        /// </summary>
        /// <returns></returns>
        public virtual object Clone()
        {
            IntegerList result = new IntegerList();

            result.list = (ArrayList)list.Clone();
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns an IntegerList wrapper that is synchronized.
        /// </summary>
        /// <param name="list">The list to synchronize.</param>
        /// <returns>An IntegerList wrapper that is synchronized (thread-safe).</returns>
        public static IntegerList Synchronized(IntegerList list)
        {
            IntegerList result = new IntegerList();

            result.list = ArrayList.Synchronized(list.list);
            return(result);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Inserts the elements of the other integer list into the list at the specified index.
 /// </summary>
 /// <param name="index">The zero-based index at which the new elements should be inserted.</param>
 /// <param name="other">The other list whose elements should be inserted into the list.</param>
 public void InsertRange(int index, IntegerList other)
 {
     for (int i = 0; i < other.Count; i++)
     {
         list[index + i] = other[i];
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Returns an integer list which represents a subset of the elements in
        /// the source list.
        /// </summary>
        /// <param name="index">The zero-based list index at which the range starts.</param>
        /// <param name="count">The number of elements in the range.</param>
        /// <returns>An integer list which represents a subset of the elements
        /// in the source list.</returns>
        public IntegerList GetRange(int index, int count)
        {
            IntegerList result = new IntegerList();

            result.list = this.list.GetRange(index, count);
            return(result);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Returns an IntegerList whose elements are copies of the specified value.
        /// </summary>
        /// <param name="value">The value to copy multiple times in the list.</param>
        /// <param name="count">The number of times value should be copied.</param>
        /// <returns>An IntegerList with count number of elements, all of which are copies of value.</returns>
        public static IntegerList Repeat(int value, int count)
        {
            IntegerList result = new IntegerList();

            for (int i = 0; i < count; i++)
            {
                result.Add(value);
            }
            return(result);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Determines whether the specified Object is equal to the current Object.
        /// </summary>
        /// <param name="obj">The Object to compare with the current Object.</param>
        /// <returns>true if the specified Object is equal to the current Object;
        /// otherwise, false.</returns>
        public override bool Equals(object obj)
        {
            if (!(obj is IntegerList))
            {
                return(false);
            }
            IntegerList otherList = (IntegerList)obj;

            if (otherList.Count != this.Count)
            {
                return(false);
            }
            for (int i = 0; i < this.list.Count; i++)
            {
                if (this[i] != otherList[i])
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 7
0
 /// <summary>
 /// Copies the elements of a collection over a range of elements in the list.
 /// </summary>
 /// <param name="index">The zero-based index at which to start copying the elements
 /// of otherList</param>
 /// <param name="otherList">The other list whose elements to copy to the list.</param>
 public void SetRange(int index, IntegerList otherList)
 {
     list.SetRange(index, otherList.list);
 }