Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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;
             */
        }
Ejemplo n.º 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);
Ejemplo n.º 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);
 /// <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);
 /// <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);
 /// <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);
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
 /// <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);
 /// <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);
Ejemplo n.º 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);
 /// <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);
Ejemplo n.º 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);
 /// <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);
Ejemplo n.º 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);
 /// <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);
Ejemplo n.º 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);
 /// <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);
Ejemplo n.º 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);