Exemple #1
0
            public IReadOnlyCollection <double> Evaluate(Bounds bounds, bool strict)
            {
                if (!bounds.IsProvided(StepValue?.RequiredBound ?? BoundType.None) ||
                    !bounds.IsProvided(StartValue.RequiredBound) || !bounds.IsProvided(EndValue.RequiredBound))
                {
                    if (strict)
                    {
                        throw new ArgumentException("Required bound not provided.");
                    }
                    return(EmptyArray <double> .Instance);
                }
                var startValue = StartValue.Evaluate(bounds);
                var endValue   = EndValue.Evaluate(bounds);

                if (strict)
                {
                    if (!bounds.Check(startValue))
                    {
                        throw new ArgumentException($"Start value '{startValue}' exceed bounds {bounds}.");
                    }
                    if (!bounds.Check(endValue))
                    {
                        throw new ArgumentException($"End value '{endValue}' exceed bounds {bounds}.");
                    }
                }
                return(ArrayUtils.Doubles(startValue, true, endValue, true, StepValue?.Evaluate(bounds) ?? 1));
            }