Exemplo n.º 1
0
        /// <summary>
        /// Returns a span instance that is the union of the two specified span instances.
        /// If <paramref name="span1"/> and <paramref name="span2"/> are both <c>null</c>,
        /// then <c>null</c> is returned.
        /// If <paramref name="span1"/> or <paramref name="span2"/> is null, but the remaining argument is non-null,
        /// then the non-null argument is returned.
        /// If neither <paramref name="span1"/> nor <paramref name="span2"/> are null, a new span instance is returned
        /// that contains the merged span paths from both.
        /// </summary>
        /// <param name="span1">The first span instance from which to include span paths; may be <c>null</c></param>
        /// <param name="span2">The second span instance from which to include span paths; may be <c>null</c></param>
        /// <returns>A span instance representing the union of the two arguments; may be <c>null</c> if both arguments are null</returns>
        internal static Span CopyUnion(Span span1, Span span2)
        {
            if (null == span1)
            {
                return span2;
            }

            if (null == span2)
            {
                return span1;
            }

            var retSpan = span1.Clone();
            foreach (var path in span2.SpanList)
            {
                retSpan.AddSpanPath(path);
            }

            return retSpan;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns a span instance that is the union of the two specified span instances.
        /// If <paramref name="span1"/> and <paramref name="span2"/> are both <c>null</c>,
        /// then <c>null</c> is returned.
        /// If <paramref name="span1"/> or <paramref name="span2"/> is null, but the remaining argument is non-null,
        /// then the non-null argument is returned.
        /// If neither <paramref name="span1"/> nor <paramref name="span2"/> are null, a new span instance is returned
        /// that contains the merged span paths from both.
        /// </summary>
        /// <param name="span1">The first span instance from which to include span paths; may be <c>null</c></param>
        /// <param name="span2">The second span instance from which to include span paths; may be <c>null</c></param>
        /// <returns>A span instance representing the union of the two arguments; may be <c>null</c> if both arguments are null</returns>
        internal static Span CopyUnion(Span span1, Span span2)
        {
            if (null == span1)
            {
                return(span2);
            }

            if (null == span2)
            {
                return(span1);
            }

            Span retSpan = span1.Clone();

            foreach (SpanPath path in span2.SpanList)
            {
                retSpan.AddSpanPath(path);
            }

            return(retSpan);
        }