예제 #1
0
        public int Compare(Lst <A> x, Lst <A> y)
        {
            var cmp = x.Count.CompareTo(y.Count);

            if (cmp == 0)
            {
                var enumx = x.GetEnumerator();
                var enumy = y.GetEnumerator();
                var count = x.Count;

                for (int i = 0; i < count; i++)
                {
                    enumx.MoveNext();
                    enumy.MoveNext();
                    cmp = default(ORD).Compare(enumx.Current, enumy.Current);
                    if (cmp != 0)
                    {
                        return(cmp);
                    }
                }
                return(0);
            }
            else
            {
                return(cmp);
            }
        }
예제 #2
0
        public IEnumerator <DependencyNode> GetEnumerator()
        {
            if (_dirty)
            {
                UpdateDependencies();
            }

            return(_nodes.GetEnumerator());
        }
예제 #3
0
        public int Compare(Lst <A> x, Lst <A> y)
        {
            int cmp = x.Count.CompareTo(y.Count);

            if (cmp != 0)
            {
                return(cmp);
            }

            using var iterA = x.GetEnumerator();
            using var iterB = y.GetEnumerator();
            while (iterA.MoveNext() && iterB.MoveNext())
            {
                cmp = default(OrdDefault <A>).Compare(iterA.Current, iterB.Current);
                if (cmp != 0)
                {
                    return(cmp);
                }
            }
            return(0);
        }
예제 #4
0
        public bool Equals(Lst <A> x, Lst <A> y)
        {
            if (x.Count != y.Count)
            {
                return(false);
            }

            var enumx = x.GetEnumerator();
            var enumy = y.GetEnumerator();
            var count = x.Count;

            for (int i = 0; i < count; i++)
            {
                enumx.MoveNext();
                enumy.MoveNext();
                if (!default(EQ).Equals(enumx.Current, enumy.Current))
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #5
0
        public int Compare(Lst <A> mx, Lst <A> my)
        {
            var cmp = mx.Count.CompareTo(my.Count);

            if (cmp == 0)
            {
                using var xiter = mx.GetEnumerator();
                using var yiter = my.GetEnumerator();
                while (xiter.MoveNext() && yiter.MoveNext())
                {
                    cmp = default(OrdA).Compare(xiter.Current, yiter.Current);
                    if (cmp != 0)
                    {
                        return(cmp);
                    }
                }
                return(0);
            }
            else
            {
                return(cmp);
            }
        }