Esempio n. 1
0
        public int CompareTo(OrderedTokenSet <T> other)
        {
            if ((other?.Container?.Count ?? 0) == 0)
            {
                if (Container.Count > 0)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }

            int i = 0;

            foreach (var item in Container)
            {
                if (i >= other.Container.Count)
                {
                    return(1);
                }
                var result = item.CompareTo(other.Container[i]);
                if (result != 0)
                {
                    return(result);
                }
                i++;
            }

            return(Container.Count < other.Container.Count ? -1 : 0);
        }
Esempio n. 2
0
        public bool Equals(OrderedTokenSet <T> other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(Container.Count == other.Container.Count && CompareTo(other) == 0);
        }