public bool Equals(IEnumerable <Expression> x, IEnumerable <Expression> y)
        {
            if (x == null)
            {
                throw new ArgumentNullException("x");
            }
            if (y == null)
            {
                throw new ArgumentNullException("y");
            }

            var arrayX = x.ToArray();
            var arrayY = y.ToArray();

            if (arrayX.Length != arrayY.Length)
            {
                return(false);
            }

            var expressionComparer = new ExpressionSegmentSetComparer();

            for (var index = 0; index < arrayX.Length; index++)
            {
                if (!expressionComparer.Equals(arrayX[index].Segments, arrayY[index].Segments))
                {
                    return(false);
                }
            }
            return(true);
        }
        public bool Equals(BracketedExpressionSegment x, BracketedExpressionSegment y)
        {
            if (x == null)
            {
                throw new ArgumentNullException("x");
            }
            if (y == null)
            {
                throw new ArgumentNullException("y");
            }

            var expressionSegmentSetComparer = new ExpressionSegmentSetComparer();

            return(expressionSegmentSetComparer.Equals(x.Segments, y.Segments));
        }