Exemple #1
0
        public bool Intersects(OrderedSet <T> otherSet)
        {
            if (otherSet == null)
            {
                throw new ArgumentNullException(nameof(otherSet));
            }

            return(IsOverlapping(_values, otherSet._values));
        }
Exemple #2
0
        public bool IsSupersetOf(OrderedSet <T> otherSet)
        {
            if (otherSet == null)
            {
                throw new ArgumentNullException(nameof(otherSet));
            }

            return(IsSuperSetOf(_values, otherSet._values));
        }
Exemple #3
0
        public OrderedSet <T> Subtract(OrderedSet <T> otherSet)
        {
            if (otherSet == null)
            {
                throw new ArgumentNullException(nameof(otherSet));
            }

            if (Length == 0 || otherSet.Length == 0)
            {
                return(this);
            }
            else
            {
                return(new OrderedSet <T>(Subtract(_values, otherSet._values)));
            }
        }
Exemple #4
0
        public bool Equals(OrderedSet <T> other)
        {
            if (other == null ||
                other._cachedHashCode != _cachedHashCode ||
                other._values.Length != _values.Length)
            {
                return(false);
            }

            for (var i = 0; i < _values.Length; i++)
            {
                if (_values[i].CompareTo(other._values[i]) != 0)
                {
                    return(false);
                }
            }

            return(true);
        }