Example #1
0
        /// <summary>Ensures set contain only elements that are present either in the current columns or in the specified columns, but not both.</summary>
        /// <param name="source">The current columns.</param>
        /// <param name="other">The columns to compare to the current columns.</param>
        /// <returns>A new set if there is any modification to current sealed set; otherwise, the current set.</returns>
        public static IColumns SymmetricExcept(this IColumns source, IColumns other)
        {
            source.VerifyNotNull(nameof(source));
            other.VerifyNotNull(nameof(other));

            IColumns removedColumnSet = Columns.Empty;

            foreach (var column in source)
            {
                if (other.Contains(column))
                {
                    removedColumnSet = removedColumnSet.Add(column);
                    source           = source.Remove(column);
                }
            }

            foreach (var column in other)
            {
                if (removedColumnSet.Contains(column))
                {
                    source = source.Add(column);
                }
            }

            return(source);
        }
Example #2
0
 private static bool ContainsAll(this IColumns source, IColumns other)
 {
     foreach (var column in other)
     {
         if (!source.Contains(column))
         {
             return(false);
         }
     }
     return(true);
 }
Example #3
0
        /// <summary>Determines whether the current columns overlaps with the specified columns.</summary>
        /// <param name="source">The current columns.</param>
        /// <param name="other">The columns to compare to the current columns.</param>
        /// <returns><see langword="true"/> if the current set overlaps with the specified columns; otherwise, <see langword="false" />.</returns>
        public static bool Overlaps(this IColumns source, IColumns other)
        {
            source.VerifyNotNull(nameof(source));
            other.VerifyNotNull(nameof(other));

            foreach (var column in source)
            {
                if (other.Contains(column))
                {
                    return(true);
                }
            }
            return(false);
        }
Example #4
0
        /// <summary>Removes the columns to ensure the set contains only columns both exist in the current columns and the specified columns.</summary>
        /// <param name="source">The current columns.</param>
        /// <param name="other">The columns to compare to the current columns.</param>
        /// <returns>A new set of columns if there is any modification to current sealed set; otherwise, the current set.</returns>
        public static IColumns Intersect(this IColumns source, IColumns other)
        {
            source.VerifyNotNull(nameof(source));
            other.VerifyNotNull(nameof(other));

            foreach (var column in source)
            {
                if (!other.Contains(column))
                {
                    source = source.Remove(column);
                }
            }
            return(source);
        }
Example #5
0
        private bool AffectsRowMatch(IColumns columns)
        {
            if (columns == null || columns.Count == 0 || _rowMapper == null || !_rowMapper.CanMatchRow)
            {
                return(false);
            }

            var rowMatchColumns = _rowMapper.RowMatchColumns;

            for (int i = 0; i < rowMatchColumns.Count; i++)
            {
                if (columns.Contains(rowMatchColumns[i]))
                {
                    return(true);
                }
            }
            return(false);
        }
 private bool Check(IColumns validatorSourceColumns, Column column)
 {
     return(validatorSourceColumns.Contains(column));
 }