/// <summary> /// Determines whether the current <see cref="T:Academy.Collections.Generic.ReadOnlySortedSet`1"/> is a proper (strict) superset of a specified collection. /// </summary> /// <param name="other">The collection to compare to the current set.</param> /// <returns>true if the current <see cref="T:Academy.Collections.Generic.ReadOnlySortedSet"/> is a proper superset of <paramref name="other"/>; otherwise, false.</returns> public bool IsProperSupersetOf(IEnumerable <T> other) { if (other == null) { Thrower.ArgumentNullException(ArgumentType.other); } if (Count == 0) { return(false); } ICommonSortedSet <T> sortedset = SetHelper <T> .GetSortedSetIfSameComparer(this, Comparer); if (sortedset != null) { if (sortedset.Count >= Count) { return(false); } ReadOnlySortedSet <T> subset = this.GetViewBetween(sortedset.MinValue, sortedset.MaxValue); foreach (T item in sortedset) { if (subset.Contains(item)) { return(false); } } return(true); } return(SetHelper <T> .IsProperSubsetOf(this, other)); }
/// <summary> /// Determines whether the current <see cref="T:Academy.Collections.Generic.ReadOnlySortedSet`1"/> is a superset of a specified collection. /// </summary> /// <param name="other">The collection to compare to the current set.</param> /// <returns>true if the current <see cref="T:Academy.Collections.Generic.ReadOnlySortedSet`1"/> is a superset of <paramref name="other"/>; otherwise, false.</returns> public bool IsSupersetOf(IEnumerable <T> other) { if (other == null) { Thrower.ArgumentNullException(ArgumentType.other); } if (CollectionHelper.IsWellKnownCollection(other, out int num)) { if (num == 0) { return(true); } if (SetHelper <T> .IsWellKnownSet(other)) { if (this.Count < num) { return(false); } } } ICommonSortedSet <T> sortedset = SetHelper <T> .GetSortedSet(other); if ((sortedset == null) || !AreEqualComparers(this._comparer, sortedset.Comparer)) { return(this.ContainsSequence(other)); } ReadOnlySortedSet <T> subset = this.GetViewBetween(sortedset.MinValue, sortedset.MaxValue); foreach (T item in sortedset) { if (!subset.Contains(item)) { return(false); } } return(true); }