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

            Array.Sort(sorted);
            return(sorted);
        }
Ejemplo n.º 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)));
                }
            }
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 4
0
 /// <nodoc />
 public bool IsProperSubsetOf(OrderedSet otherSet)
 {
     Contract.Requires(otherSet != null);
     return(m_set.IsProperSubsetOf(otherSet.m_set));
 }
Ejemplo n.º 5
0
 /// <nodoc />
 public OrderedSet Except(OrderedSet otherSet)
 {
     Contract.Requires(otherSet != null);
     return(new OrderedSet(m_set.Except(otherSet.m_set), m_maxTag));
 }