/// <summary> /// Returns an enumerator that iterates through the collection. /// </summary> public IEnumerator <double> GetEnumerator() { if (this.Cache == null) { this.Cache = new BoxAndWhiskersCache(this.Items); } //to sort items (by cache) return(this.Items.GetEnumerator()); }
/// <summary> /// Enumerates upper extremes. /// </summary> public IEnumerable <double> EnumerateUpperExtremes() { if (Cache == null) { Cache = new BoxAndWhiskersCache(Items); } return(Cache.EnumerateUpperExtremes()); }
/// <summary> /// Enumerates lower outliers. /// </summary> /// <returns></returns> public IEnumerable <double> EnumerateLowerOutliers() { if (Cache == null) { Cache = new BoxAndWhiskersCache(Items); } return(Cache.EnumerateLowerOutliers()); }
/// <summary> /// Adds an item to the collection. /// </summary> /// <param name="item">The number to add.</param> /// <exception cref="ArgumentOutOfRangeException">Must use a real number.</exception> public void Add(double item) { this.Items.Add(item); if (double.IsInfinity(item) || double.IsNaN(item)) { throw new ArgumentOutOfRangeException(nameof(item), "Must use a real number."); } this.Cache = null; }
bool ICollection <double> .Remove(double item) { if (this.Items.Remove(item)) { this.Cache = null; return(true); } else { return(false); } }
/// <summary> /// Adds multiple items to the collection. /// </summary> /// <param name="items">The numbers to add.</param> /// <exception cref="ArgumentOutOfRangeException">Must use real numbers.</exception> public void AddRange(IEnumerable <double> items) { if (items == null) { throw new ArgumentNullException(nameof(items), "Items cannot be null."); } foreach (var item in items) { if (double.IsInfinity(item) || double.IsNaN(item)) { throw new ArgumentOutOfRangeException(nameof(items), "Must use real numbers."); } } this.Items.AddRange(items); this.Cache = null; }
void ICollection <double> .Clear() { this.Items.Clear(); this.Cache = null; }
void ICollection <double> .Clear() { Items.Clear(); Cache = null; }