/// <summary> /// Removes the first occurrence of a specific <see cref="FinitePoint{TNumber}"/> from the <see cref="Shares{TNumber}"/> collection. /// </summary> /// <param name="item">The <see cref="FinitePoint{TNumber}"/> to remove from the <see cref="Shares{TNumber}"/> collection.</param> /// <returns></returns> /// <remarks>This method is implemented. However this method does nothing as long as the property <see cref="IsReadOnly"/> is /// set to <see langword="true"/>.</remarks> /// <exception cref="NotSupportedException">The <see cref="Shares{TNumber}"/> collection is read-only.</exception> public bool Remove(FinitePoint <TNumber> item) { if (this.IsReadOnly) { throw new NotSupportedException(string.Format(ErrorMessages.ReadOnlyCollection, nameof(Shares <TNumber>))); } return(this.shareList.Remove(item)); }
/// <summary> /// Adds an <see cref="FinitePoint{TNumber}"/> to the <see cref="Shares{TNumber}"/> collection. /// </summary> /// <param name="item">The <see cref="FinitePoint{TNumber}"/> to add to the <see cref="Shares{TNumber}"/> collection.</param> /// <remarks>This method is implemented. However this method does nothing as long as the property <see cref="IsReadOnly"/> is /// set to <see langword="true"/>.</remarks> /// <exception cref="NotSupportedException">The <see cref="Shares{TNumber}"/> collection is read-only.</exception> public void Add(FinitePoint <TNumber> item) { if (this.IsReadOnly) { throw new NotSupportedException(string.Format(ErrorMessages.ReadOnlyCollection, nameof(Shares <TNumber>))); } if (!this.Contains(item)) { this.shareList.Add(item); } }
/// <summary> /// Determines whether this <see cref="FinitePoint{TNumber}"/> and a specified <see cref="FinitePoint{TNumber}"/> have the same value. /// </summary> /// <param name="other">The <see cref="FinitePoint{TNumber}"/> to compare to this instance.</param> /// <returns><see langword="true"/> if the value of the value parameter is the same as this <see cref="FinitePoint{TNumber}"/>; otherwise, <see langword="false"/>.</returns> public bool Equals(FinitePoint <TNumber> other) { return(this.X.Equals(other.X) && this.Y.Equals(other.Y)); }
/// <summary> /// Determines whether the <see cref="Shares{TNumber}"/> collection contains a specific <see cref="FinitePoint{TNumber}"/>. /// </summary> /// <param name="item">The <see cref="FinitePoint{TNumber}"/> to locate in the <see cref="Shares{TNumber}"/> collection.</param> /// <returns><see langword="true"/> if item is found in the <see cref="Shares{TNumber}"/> collection; otherwise, <see langword="false"/>.</returns> public bool Contains(FinitePoint <TNumber> item) => this.shareList.Any(share => share.Equals(item));
/// <summary> /// /// </summary> /// <param name="other"></param> /// <returns></returns> public int CompareTo(FinitePoint <TNumber> other) { return(((this.X.Pow(2) + this.Y.Pow(2)).Sqrt - (other.X.Pow(2) + other.Y.Pow(2)).Sqrt).Sign); }