コード例 #1
0
        public static bool TryParse(ReadOnlySpan <char> input, out CompositeInterval <T> interval)
        {
            var result = CompositeInterval <T, DefaultValueComparer <T> > .TryParse(input, out var comparerInterval);

            interval = comparerInterval;
            return(result);
        }
コード例 #2
0
        public static bool TryParse(string input, TryParse <T> elementParser, out CompositeInterval <T> interval)
        {
            var result = CompositeInterval <T, DefaultValueComparer <T> > .TryParse(input, elementParser, out var comparerInterval);

            interval = comparerInterval;
            return(result);
        }
        public static bool TryParse(string input, out CompositeInterval <T, TComparer> interval)
        {
            if (input is null)
            {
                Throw.ArgumentNullException(nameof(input));
            }

            return(Parser.TryParseCompositeInterval(input, ElementParsers.GetTryElementParser <T>(), out interval));
        }
        public static bool TryParse(string input, TryParse <T> elementParser, out CompositeInterval <T, TComparer> interval)
        {
            if (input is null)
            {
                Throw.ArgumentNullException(nameof(input));
            }
            if (elementParser is null)
            {
                Throw.ArgumentNullException(nameof(elementParser));
            }

            throw new NotImplementedException();
            //return Parser.TryParseCompositeInterval(input, elementParser, out interval);
        }
コード例 #5
0
        internal static R CompositeIntervalLength <T, R>(CompositeInterval <T> interval) where T : IComparable <T>
        {
            throw new NotImplementedException("Generic length cannot inferred! This has to be worked around somehow.");

            /*
             * var intervals = interval.CompositeIntervals;
             * var length = GenericSpecializer<R>.ZeroValueOfThisType;
             *
             * for (int i = 0; i < intervals.Count; i++)
             * {
             *  length = Add(length, IntervalLength<T, R>(intervals[i]));
             * }
             *
             * return length;
             */
        }
コード例 #6
0
 /// <summary>
 /// Computes the length of this interval: sum of the lengths of the continuous intervals it represents.
 /// </summary>
 /// <exception cref="ArgumentNullException" />
 public static R Length <T, R>(this CompositeInterval <T> interval) where T : ISubtractable <T, R> where R : IAddable <R> => CompositeIntervalLength <T, R>(interval);
コード例 #7
0
 /// <summary>
 /// Computes the length of this interval: sum of the lengths of the continuous intervals it represents.
 /// </summary>
 /// <exception cref="ArgumentNullException" />
 public static int Length(this CompositeInterval <byte> interval) => CompositeIntervalLength <byte, int>(interval);
コード例 #8
0
 /// <summary>
 /// Returns a new composite interval that contains all values on the number line not present in this interval.
 /// </summary>
 public static CompositeInterval <float> Complement(this CompositeInterval <float> interval) => interval.SymmetricDifference(NumberLineOfSingles);
コード例 #9
0
 /// <summary>
 /// Returns a new composite interval that contains all possible <see cref="decimal"/> values not present in this interval.
 /// </summary>
 public static CompositeInterval <decimal> Complement(this CompositeInterval <decimal> interval) => interval.SymmetricDifference(AllDecimals);
コード例 #10
0
 /// <summary>
 /// Returns a new composite interval that contains all possible <see cref="sbyte"/> values not present in this interval.
 /// </summary>
 public static CompositeInterval <sbyte> Complement(this CompositeInterval <sbyte> interval) => interval.SymmetricDifference(AllSBytes);
コード例 #11
0
 /// <summary>
 /// Computes the length of this interval: sum of the lengths of the continuous intervals it represents.
 /// </summary>
 /// <exception cref="ArgumentNullException" />
 public static int Length(this CompositeInterval <ushort> interval) => CompositeIntervalLength <ushort, int>(interval);
 public static bool TryParse(ReadOnlySpan <char> input, out CompositeInterval <T, TComparer> interval) => Parser.TryParseCompositeInterval(input, ElementParsers.GetTrySpanElementParser <T>(), out interval);
コード例 #13
0
 /// <summary>
 /// Computes the length of this interval: sum of the lengths of the continuous intervals it represents.
 /// </summary>
 /// <exception cref="ArgumentNullException" />
 public static decimal Length <T>(this CompositeInterval <T> interval) where T : ISubtractable <T, decimal> => Lengths.CompositeIntervalLength <T, decimal>(interval);
コード例 #14
0
 /// <summary>
 /// Computes the length of this interval: sum of the lengths of the continuous intervals it represents.
 /// </summary>
 /// <exception cref="ArgumentNullException" />
 public static long Length(this CompositeInterval <uint> interval) => CompositeIntervalLength <uint, long>(interval);
コード例 #15
0
 /// <summary>
 /// Computes the length of this interval: sum of the lengths of the continuous intervals it represents.
 /// </summary>
 /// <exception cref="ArgumentNullException" />
 public static float Length <T>(this CompositeInterval <T> interval) where T : ISubtractable <T, float> => Lengths.CompositeIntervalLength <T, float>(interval);
コード例 #16
0
 /// <summary>
 /// Computes the length of this interval: sum of the lengths of the continuous intervals it represents.
 /// </summary>
 /// <exception cref="ArgumentNullException" />
 public static ulong Length <T>(this CompositeInterval <T> interval) where T : ISubtractable <T, ulong> => Lengths.CompositeIntervalLength <T, ulong>(interval);
コード例 #17
0
 /// <summary>
 /// Computes the length of this interval: sum of the lengths of the continuous intervals it represents.
 /// </summary>
 /// <exception cref="ArgumentNullException" />
 public static byte Length <T>(this CompositeInterval <T> interval) where T : ISubtractable <T, byte> => Lengths.CompositeIntervalLength <T, byte>(interval);
        public static bool TryParse(ReadOnlySpan <char> input, TryParseSpan <T> elementParser, out CompositeInterval <T, TComparer> interval)
        {
            if (elementParser is null)
            {
                Throw.ArgumentNullException(nameof(elementParser));
            }

            return(Parser.TryParseCompositeInterval(input, elementParser, out interval));
        }
コード例 #19
0
 /// <summary>
 /// Computes the length of this interval: sum of the lengths of the continuous intervals it represents.
 /// </summary>
 /// <exception cref="ArgumentNullException" />
 public static TimeSpan Length <T>(this CompositeInterval <T> interval) where T : ISubtractable <T, TimeSpan> => Lengths.CompositeIntervalLength <T, TimeSpan>(interval);
コード例 #20
0
 /// <summary>
 /// Returns a new composite interval that contains all possible <see cref="short"/> values not present in this interval.
 /// </summary>
 public static CompositeInterval <short> Complement(this CompositeInterval <short> interval) => interval.SymmetricDifference(AllInt16s);
コード例 #21
0
 /// <summary>
 /// Returns a new composite interval that contains all possible <see cref="ulong"/> values not present in this interval.
 /// </summary>
 public static CompositeInterval <ulong> Complement(this CompositeInterval <ulong> interval) => interval.SymmetricDifference(AllUInt64s);
コード例 #22
0
 /// <summary>
 /// Computes the length of this interval: sum of the lengths of the continuous intervals it represents.
 /// </summary>
 /// <exception cref="ArgumentNullException" />
 public static ulong Length(this CompositeInterval <ulong> interval) => CompositeIntervalLength <ulong, ulong>(interval);
コード例 #23
0
 /// <summary>
 /// Returns a new composite interval that contains all possible <see cref="DateTimeOffset"/> values not present in this interval.
 /// </summary>
 public static CompositeInterval <DateTimeOffset> Complement(this CompositeInterval <DateTimeOffset> interval) => interval.SymmetricDifference(AllDateTimeOffsets);
コード例 #24
0
 /// <summary>
 /// Computes the length of this interval: sum of the lengths of the continuous intervals it represents.
 /// </summary>
 /// <exception cref="ArgumentNullException" />
 public static float Length(this CompositeInterval <float> interval) => CompositeIntervalLength <float, float>(interval);
コード例 #25
0
 /// <summary>
 /// Returns a new composite interval that contains all possible <see cref="Char"/> values not present in this interval.
 /// </summary>
 public static CompositeInterval <char> Complement(this CompositeInterval <char> interval) => interval.SymmetricDifference(AllChars);
コード例 #26
0
 /// <summary>
 /// Computes the length of this interval: sum of the lengths of the continuous intervals it represents.
 /// </summary>
 /// <exception cref="ArgumentNullException" />
 public static double Length(this CompositeInterval <double> interval) => CompositeIntervalLength <double, double>(interval);
コード例 #27
0
 /// <summary>
 /// Returns a new composite interval that contains all values on the number line not present in this interval.
 /// </summary>
 public static CompositeInterval <double> Complement(this CompositeInterval <double> interval) => interval.SymmetricDifference(NumberLineOfDoubles);
コード例 #28
0
 /// <summary>
 /// Computes the length of this interval: sum of the lengths of the continuous intervals it represents. May overflow!
 /// </summary>
 /// <exception cref="ArgumentNullException" />
 /// <exception cref="OverflowException" />
 public static decimal Length(this CompositeInterval <decimal> interval) => CompositeIntervalLength <decimal, decimal>(interval);
コード例 #29
0
 /// <summary>
 /// Returns a new composite interval that contains all possible <see cref="uint"/> values not present in this interval.
 /// </summary>
 public static CompositeInterval <uint> Complement(this CompositeInterval <uint> interval) => interval.SymmetricDifference(AllUInt32s);
コード例 #30
0
 /// <summary>
 /// Computes the length of this interval: sum of the lengths of the continuous intervals it represents.
 /// </summary>
 /// <exception cref="ArgumentNullException" />
 public static TimeSpan Length(this CompositeInterval <DateTimeOffset> interval) => CompositeIntervalLength <DateTimeOffset, TimeSpan>(interval);