コード例 #1
0
        /// <summary>
        /// Creates an iterator over the given range with the given step function,
        /// with the specified direction.
        /// </summary>
        public LambdaRangeEnumerator([NotNull] LambdaRange <T> range, [NotNull] Func <T, T> step, bool ascending)
        {
            if (ascending && range.Comparer.Compare(range.Minimum, step(range.Minimum)) >= 0 ||
                !ascending && range.Comparer.Compare(range.Maximum, step(range.Maximum)) <= 0)
            {
                throw new ArgumentException("step does nothing, or progresses the wrong way.");
            }

            _step = step;

            if (ascending)
            {
                _includesStart = range.IncludesStart;
                _includesEnd   = range.IncludesEnd;
                _start         = range.Minimum;
                _end           = range.Maximum;
                _comparer      = range.Comparer;
            }
            else
            {
                _includesStart = range.IncludesEnd;
                _includesEnd   = range.IncludesStart;
                _start         = range.Maximum;
                _end           = range.Minimum;
                _comparer      = range.Comparer.Reverse();
            }
        }
コード例 #2
0
 public Range([NotNull] LambdaRange <T> range)
     : this(range.Minimum, range.Maximum)
 {
 }
コード例 #3
0
ファイル: NumericRange.cs プロジェクト: asm2025/essentialMix
 public NumericRange([NotNull] LambdaRange <T> range)
     : base(range)
 {
 }
コード例 #4
0
 public DateRangeLister([NotNull] LambdaRange <DateTime> range, DateTimeUnit unit)
     : this(range.Minimum, range.Maximum, unit)
 {
 }
コード例 #5
0
 /// <inheritdoc />
 /// <summary>
 /// Creates an ascending iterator over the given range with the given step function
 /// </summary>
 public LambdaRangeEnumerator([NotNull] LambdaRange <T> range, [NotNull] Func <T, T> step)
     : this(range, step, true)
 {
 }
コード例 #6
0
 public LambdaRange([NotNull] LambdaRange <T> range)
     : this(range.Minimum, range.Maximum, Comparer <T> .Default, true, true)
 {
 }
コード例 #7
0
 public static LambdaRangeEnumerator <char> StepChar([NotNull] this LambdaRange <char> range, int step)
 {
     return(range.Step(c => (char)(c + step)));
 }
コード例 #8
0
ファイル: ReadOnlyRange.cs プロジェクト: asm2025/essentialMix
 public ReadOnlyRange([NotNull] LambdaRange <T> range)
     : this(new Range <T>(range.Minimum, range.Maximum))
 {
 }