/// <summary>
 /// Returns the zero-based index of the first occurrence of the specified
 /// <see cref="ComplexF"/> in the <see cref="ComplexFArrayList"/>.
 /// </summary>
 /// <param name="value">The <see cref="ComplexF"/> object
 /// to locate in the <see cref="ComplexFArrayList"/>.
 /// </param>
 /// <returns>
 /// The zero-based index of the first occurrence of <paramref name="value"/>
 /// in the <see cref="ComplexFArrayList"/>, if found; otherwise, -1.
 /// </returns>
 /// <remarks>Please refer to <see cref="ArrayList.IndexOf"/> for details.</remarks>
 public virtual int IndexOf(ComplexF value)
 {
     return Array.IndexOf(this._array, value, 0, this._count);
 }
 /// <summary>
 /// Searches the entire sorted <see cref="ComplexFArrayList"/> for an
 /// <see cref="ComplexF"/> element using the default comparer
 /// and returns the zero-based index of the element.
 /// </summary>
 /// <param name="value">The <see cref="ComplexF"/> object
 /// to locate in the <see cref="ComplexFArrayList"/>.
 /// </param>
 /// <returns>The zero-based index of <paramref name="value"/> in the sorted
 /// <see cref="ComplexFArrayList"/>, if <paramref name="value"/> is found;
 /// otherwise, a negative number, which is the bitwise complement of the index
 /// of the next element that is larger than <paramref name="value"/> or, if there
 /// is no larger element, the bitwise complement of <see cref="Count"/>.</returns>
 /// <exception cref="InvalidOperationException">
 /// Neither <paramref name="value"/> nor the elements of the <see cref="ComplexFArrayList"/>
 /// implement the <see cref="IComparable"/> interface.</exception>
 /// <remarks>Please refer to <see cref="ArrayList.BinarySearch"/> for details.</remarks>
 public virtual int BinarySearch(ComplexF value)
 {
     return Array.BinarySearch(this._array, 0, this._count, value);
 }
 /// <overloads>
 /// Copies the <see cref="ComplexFArrayList"/> or a portion of it to a one-dimensional array.
 /// </overloads>
 /// <summary>
 /// Copies the entire <see cref="ComplexFArrayList"/> to a one-dimensional <see cref="Array"/>
 /// of <see cref="ComplexF"/> elements, starting at the beginning of the target array.
 /// </summary>
 /// <param name="array">The one-dimensional <see cref="Array"/> that is the destination of the
 /// <see cref="ComplexF"/> elements copied from the <see cref="ComplexFArrayList"/>.
 /// The <b>Array</b> must have zero-based indexing.</param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="array"/> is a null reference.</exception>
 /// <exception cref="ArgumentException">
 /// The number of elements in the source <see cref="ComplexFArrayList"/> is greater
 /// than the available space in the destination <paramref name="array"/>.</exception>
 /// <remarks>Please refer to <see cref="ArrayList.CopyTo"/> for details.</remarks>
 public virtual void CopyTo(ComplexF[] array)
 {
     CheckTargetArray(array, 0);
     Array.Copy(this._array, array, this._count);
 }
 private void CheckUnique(int index, ComplexF value)
 {
     int existing = IndexOf(value);
     if (existing >= 0 && existing != index)
         throw new NotSupportedException(
             "Unique collections cannot contain duplicate elements.");
 }
        /// <summary>
        /// Adds a <see cref="ComplexF"/> to the end of the <see cref="ComplexFArrayList"/>.
        /// </summary>
        /// <param name="value">The <see cref="ComplexF"/> object
        /// to be added to the end of the <see cref="ComplexFArrayList"/>.
        /// </param>
        /// <returns>The <see cref="ComplexFArrayList"/> index at which the
        /// <paramref name="value"/> has been added.</returns>
        /// <exception cref="NotSupportedException">
        /// <para>The <see cref="ComplexFArrayList"/> is read-only.</para>
        /// <para>-or-</para>
        /// <para>The <b>ComplexFArrayList</b> has a fixed size.</para>
        /// <para>-or-</para>
        /// <para>The <b>ComplexFArrayList</b> already contains the specified
        /// <paramref name="value"/>, and the <b>ComplexFArrayList</b>
        /// ensures that all elements are unique.</para></exception>
        /// <remarks>Please refer to <see cref="ArrayList.Add"/> for details.</remarks>
        public virtual int Add(ComplexF value)
        {
            if (this._count == this._array.Length)
                EnsureCapacity(this._count + 1);

            ++this._version;
            this._array[this._count] = value;
            return this._count++;
        }
 public override int IndexOf(ComplexF value)
 {
     return this._collection.IndexOf(value);
 }
 public override void Remove(ComplexF value)
 {
     this._collection.Remove(value);
 }
 public override void Remove(ComplexF value)
 {
     throw new NotSupportedException(
         "Read-only collections cannot be modified.");
 }
 public override int Add(ComplexF value)
 {
     lock (this._root) return this._collection.Add(value);
 }
 public override void AddRange(ComplexF[] array)
 {
     throw new NotSupportedException(
         "Read-only collections cannot be modified.");
 }
 public override void Insert(int index, ComplexF value)
 {
     throw new NotSupportedException(
         "Read-only collections cannot be modified.");
 }
 /// <summary>
 /// Copies the elements of the <see cref="ComplexFArrayList"/> to a new
 /// <see cref="Array"/> of <see cref="ComplexF"/> elements.
 /// </summary>
 /// <returns>A one-dimensional <see cref="Array"/> of <see cref="ComplexF"/>
 /// elements containing copies of the elements of the <see cref="ComplexFArrayList"/>.</returns>
 /// <remarks>Please refer to <see cref="ArrayList.ToArray"/> for details.</remarks>
 public virtual ComplexF[] ToArray()
 {
     ComplexF[] array = new ComplexF[this._count];
     Array.Copy(this._array, array, this._count);
     return array;
 }
 /// <summary>
 /// Removes the first occurrence of the specified <see cref="ComplexF"/>
 /// from the <see cref="ComplexFArrayList"/>.
 /// </summary>
 /// <param name="value">The <see cref="ComplexF"/> object
 /// to remove from the <see cref="ComplexFArrayList"/>.
 /// </param>
 /// <exception cref="NotSupportedException">
 /// <para>The <see cref="ComplexFArrayList"/> is read-only.</para>
 /// <para>-or-</para>
 /// <para>The <b>ComplexFArrayList</b> has a fixed size.</para></exception>
 /// <remarks>Please refer to <see cref="ArrayList.Remove"/> for details.</remarks>
 public virtual void Remove(ComplexF value)
 {
     int index = IndexOf(value);
     if (index >= 0) RemoveAt(index);
 }
        /// <summary>
        /// Inserts a <see cref="ComplexF"/> element into the
        /// <see cref="ComplexFArrayList"/> at the specified index.
        /// </summary>
        /// <param name="index">The zero-based index at which <paramref name="value"/>
        /// should be inserted.</param>
        /// <param name="value">The <see cref="ComplexF"/> object
        /// to insert into the <see cref="ComplexFArrayList"/>.
        /// </param>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <para><paramref name="index"/> is less than zero.</para>
        /// <para>-or-</para>
        /// <para><paramref name="index"/> is greater than <see cref="Count"/>.</para>
        /// </exception>
        /// <exception cref="NotSupportedException">
        /// <para>The <see cref="ComplexFArrayList"/> is read-only.</para>
        /// <para>-or-</para>
        /// <para>The <b>ComplexFArrayList</b> has a fixed size.</para>
        /// <para>-or-</para>
        /// <para>The <b>ComplexFArrayList</b> already contains the specified
        /// <paramref name="value"/>, and the <b>ComplexFArrayList</b>
        /// ensures that all elements are unique.</para></exception>
        /// <remarks>Please refer to <see cref="ArrayList.Insert"/> for details.</remarks>
        public virtual void Insert(int index, ComplexF value)
        {
            if (index < 0)
                throw new ArgumentOutOfRangeException("index",
                    index, "Argument cannot be negative.");

            if (index > this._count)
                throw new ArgumentOutOfRangeException("index",
                    index, "Argument cannot exceed Count.");

            if (this._count == this._array.Length)
                EnsureCapacity(this._count + 1);

            ++this._version;
            if (index < this._count)
                Array.Copy(this._array, index,
                    this._array, index + 1, this._count - index);

            this._array[index] = value;
            ++this._count;
        }
 public override void CopyTo(ComplexF[] array)
 {
     this._collection.CopyTo(array);
 }
 public override void AddRange(ComplexF[] array)
 {
     lock (this._root) this._collection.AddRange(array);
 }
 public override void CopyTo(ComplexF[] array, int arrayIndex)
 {
     this._collection.CopyTo(array, arrayIndex);
 }
 public override void CopyTo(ComplexF[] array)
 {
     lock (this._root) this._collection.CopyTo(array);
 }
 public override void Insert(int index, ComplexF value)
 {
     CheckUnique(value);
     this._collection.Insert(index, value);
 }
 public override void Insert(int index, ComplexF value)
 {
     lock (this._root) this._collection.Insert(index, value);
 }
 private void CheckUnique(ComplexF value)
 {
     if (IndexOf(value) >= 0)
         throw new NotSupportedException(
             "Unique collections cannot contain duplicate elements.");
 }
 public override void Remove(ComplexF value)
 {
     lock (this._root) this._collection.Remove(value);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ComplexFArrayList"/> class
        /// that contains elements copied from the specified <see cref="ComplexF"/>
        /// array and that has the same initial capacity as the number of elements copied.
        /// </summary>
        /// <param name="array">An <see cref="Array"/> of <see cref="ComplexF"/>
        /// elements that are copied to the new collection.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="array"/> is a null reference.</exception>
        /// <remarks>Please refer to <see cref="ArrayList(ICollection)"/> for details.</remarks>
        public ComplexFArrayList(ComplexF[] array)
        {
            if (array == null)
                throw new ArgumentNullException("array");

            this._array = new ComplexF[array.Length];
            AddRange(array);
        }
 public override int Add(ComplexF value)
 {
     CheckUnique(value);
     return this._collection.Add(value);
 }
        /// <summary>
        /// Adds the elements of a <see cref="ComplexF"/> array
        /// to the end of the <see cref="ComplexFArrayList"/>.
        /// </summary>
        /// <param name="array">An <see cref="Array"/> of <see cref="ComplexF"/> elements
        /// that should be added to the end of the <see cref="ComplexFArrayList"/>.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="array"/> is a null reference.</exception>
        /// <exception cref="NotSupportedException">
        /// <para>The <see cref="ComplexFArrayList"/> is read-only.</para>
        /// <para>-or-</para>
        /// <para>The <b>ComplexFArrayList</b> has a fixed size.</para>
        /// <para>-or-</para>
        /// <para>The <b>ComplexFArrayList</b> already contains one or more elements
        /// in the specified <paramref name="array"/>, and the <b>ComplexFArrayList</b>
        /// ensures that all elements are unique.</para></exception>
        /// <remarks>Please refer to <see cref="ArrayList.AddRange"/> for details.</remarks>
        public virtual void AddRange(ComplexF[] array)
        {
            if (array == null)
                throw new ArgumentNullException("array");

            if (array.Length == 0) return;
            if (this._count + array.Length > this._array.Length)
                EnsureCapacity(this._count + array.Length);

            ++this._version;
            Array.Copy(array, 0, this._array, this._count, array.Length);
            this._count += array.Length;
        }
            public override void AddRange(ComplexF[] array)
            {
                foreach (ComplexF value in array)
                    CheckUnique(value);

                this._collection.AddRange(array);
            }
 /// <summary>
 /// Determines whether the <see cref="ComplexFArrayList"/>
 /// contains the specified <see cref="ComplexF"/> element.
 /// </summary>
 /// <param name="value">The <see cref="ComplexF"/> object
 /// to locate in the <see cref="ComplexFArrayList"/>.
 /// </param>
 /// <returns><c>true</c> if <paramref name="value"/> is found in the
 /// <see cref="ComplexFArrayList"/>; otherwise, <c>false</c>.</returns>
 /// <remarks>Please refer to <see cref="ArrayList.Contains"/> for details.</remarks>
 public bool Contains(ComplexF value)
 {
     return (IndexOf(value) >= 0);
 }
 public override int BinarySearch(ComplexF value)
 {
     return this._collection.BinarySearch(value);
 }
 /// <summary>
 /// Copies the entire <see cref="ComplexFArrayList"/> to a one-dimensional <see cref="Array"/>
 /// of <see cref="ComplexF"/> elements, starting at the specified index of the target array.
 /// </summary>
 /// <param name="array">The one-dimensional <see cref="Array"/> that is the destination of the
 /// <see cref="ComplexF"/> elements copied from the <see cref="ComplexFArrayList"/>.
 /// The <b>Array</b> must have zero-based indexing.</param>
 /// <param name="arrayIndex">The zero-based index in <paramref name="array"/>
 /// at which copying begins.</param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="array"/> is a null reference.</exception>
 /// <exception cref="ArgumentOutOfRangeException">
 /// <paramref name="arrayIndex"/> is less than zero.</exception>
 /// <exception cref="ArgumentException"><para>
 /// <paramref name="arrayIndex"/> is equal to or greater than the length of <paramref name="array"/>.
 /// </para><para>-or-</para><para>
 /// The number of elements in the source <see cref="ComplexFArrayList"/> is greater than the
 /// available space from <paramref name="arrayIndex"/> to the end of the destination
 /// <paramref name="array"/>.</para></exception>
 /// <remarks>Please refer to <see cref="ArrayList.CopyTo"/> for details.</remarks>
 public virtual void CopyTo(ComplexF[] array, int arrayIndex)
 {
     CheckTargetArray(array, arrayIndex);
     Array.Copy(this._array, 0, array, arrayIndex, this._count);
 }
Пример #30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ComplexF"/> class using values from a given complex instance.
 /// </summary>
 /// <param name="c">A complex number to get values from.</param>
 public ComplexF(ComplexF c)
 {
     _real = c.Real;
     _image = c.Imaginary;
 }