Exemple #1
0
        private static TaggedEntry[] ToSortedArray(OrderedSet set)
        {
            var sorted = set.m_set.ToArray();

            Array.Sort(sorted);
            return(sorted);
        }
Exemple #2
0
        private static void CheckSet(DsSet set, IEnumerable <object> items, bool exactMatch = true, IEnumerable <object> notExistItems = null)
        {
            Contract.Requires(set != null);
            Contract.Requires(items != null);

            var itemsToo = items as object[] ?? items.ToArray();

            foreach (var item in itemsToo)
            {
                Assert.True(set.Contains(EvaluationResult.Create(item)));
            }

            if (exactMatch)
            {
                Assert.Equal(set.Count, itemsToo.Length);
            }

            if (notExistItems != null)
            {
                foreach (var item in notExistItems)
                {
                    Assert.False(set.Contains(EvaluationResult.Create(item)));
                }
            }
        }
Exemple #3
0
        /// <nodoc />
        public OrderedSet Union(OrderedSet otherSet)
        {
            Contract.Requires(otherSet != null);

            var  sortedOther   = ToSortedArray(otherSet);
            var  retaggedOther = new TaggedEntry[sortedOther.Length];
            long tag           = m_maxTag;

            for (int i = 0; i < sortedOther.Length; ++i)
            {
                retaggedOther[i] = new TaggedEntry(sortedOther[i].Value, tag++);
            }

            return(new OrderedSet(m_set.Union(retaggedOther), tag));
        }
Exemple #4
0
 /// <nodoc />
 public bool IsProperSubsetOf(OrderedSet otherSet)
 {
     Contract.Requires(otherSet != null);
     return(m_set.IsProperSubsetOf(otherSet.m_set));
 }
Exemple #5
0
 /// <nodoc />
 public OrderedSet Except(OrderedSet otherSet)
 {
     Contract.Requires(otherSet != null);
     return(new OrderedSet(m_set.Except(otherSet.m_set), m_maxTag));
 }