Esempio n. 1
0
        /// <inheritdoc />
        public bool Remove(CodePoint item)
        {
            if (!Contains(item))
                return false;

            ExceptWith(Enumerables.Of(item));
            return true;
        }
Esempio n. 2
0
        /// <inheritdoc />
        public bool Add(CodePoint item)
        {
            if (Contains(item))
                return false;

            UnionWith(Enumerables.Of(item));
            return true;
        }
Esempio n. 3
0
 /// <inheritdoc/>
 public override IEnumerable <WhereWhy> Validate()
 {
     return(Enumerables.Of <AbstractConfig>(
                ByteOrderMark,
                DiscardingReturnValue,
                LongLine,
                NoDocumentation,
                ThoughtlessName)
            .SelectMany(c => c.Validate()));
 }
Esempio n. 4
0
        /// <summary>
        /// Validates the specified BindEvent&lt;string&gt; object and gets the
        /// tuples representing the error information.
        /// </summary>
        /// <param name="ev">
        /// The BindEvent&lt;string&gt; object.
        /// </param>
        /// <param name="invalidBooleanValueError">
        /// The error message when it is unable to parse a boolean value.
        /// </param>
        /// <returns>
        /// <see cref="NoError"/> if the specified BindEvent&lt;string&gt;
        /// object can be parsed successfully. Otherwise, the errors.
        /// </returns>
        public static IEnumerable <WhereWhy> ValidateBoolean(
            BindEvent <string>?ev,
            string invalidBooleanValueError)
        {
            if (ev is null)
            {
                return(NoError);
            }
            var v = ParseBoolean(ev.Value);

            return(!v.HasValue
                ? Enumerables.Of(ToError(ev, invalidBooleanValueError))
                : NoError);
        }
Esempio n. 5
0
        /// <summary>
        /// Validates the specified BindEvent&lt;string&gt; object and gets the
        /// tuples representing the error information.
        /// </summary>
        /// <param name="ev">
        /// The BindEvent&lt;string&gt; object.
        /// </param>
        /// <param name="isValidValue">
        /// The function that returns whether a value of the argument is valid
        /// or not.
        /// </param>
        /// <param name="invalidIntegerValueError">
        /// The error message when it is unable to parse an integer value.
        /// </param>
        /// <param name="invalidValueRangeError">
        /// The error message when the parsed value is invalid.
        /// </param>
        /// <returns>
        /// <see cref="NoError"/> if the specified BindEvent&lt;string&gt;
        /// object can be parsed successfully. Otherwise, the errors.
        /// </returns>
        public static IEnumerable <WhereWhy> ValidateInt(
            BindEvent <string>?ev,
            Func <int, bool> isValidValue,
            string invalidIntegerValueError,
            string invalidValueRangeError)
        {
            if (ev is null)
            {
                return(NoError);
            }
            var v = ParseInt(ev.Value);

            return(!v.HasValue
                ? Enumerables.Of(ToError(ev, invalidIntegerValueError))
                : !isValidValue(v.Value)
                ? Enumerables.Of(ToError(ev, invalidValueRangeError))
                : NoError);
        }
Esempio n. 6
0
 /// <summary>
 /// Adds a value to the end of the sequence.
 /// </summary>
 /// <typeparam name="T">
 /// The type of the elements of <paramref name="all"/>.
 /// </typeparam>
 /// <param name="all">
 /// A sequence of values.
 /// </param>
 /// <param name="element">
 /// The value to append to <paramref name="all"/>.
 /// </param>
 /// <returns>
 /// A new sequence that ends with <paramref name="element"/>.
 /// </returns>
 public static IEnumerable <T> Append <T>(
     this IEnumerable <T> all, T element)
 {
     return(all.Concat(Enumerables.Of(element)));
 }
Esempio n. 7
0
 /// <summary>
 /// Adds a value to the beginning of the sequence.
 /// </summary>
 /// <typeparam name="T">
 /// The type of the elements of <paramref name="all"/>.
 /// </typeparam>
 /// <param name="all">
 /// A sequence of values.
 /// </param>
 /// <param name="element">
 /// The value to prepend to <paramref name="all"/>.
 /// </param>
 /// <returns>
 /// A new sequence that begins with <paramref name="element"/>.
 /// </returns>
 public static IEnumerable <T> Prepend <T>(
     this IEnumerable <T> all, T element)
 {
     return(Enumerables.Of(element).Concat(all));
 }