Пример #1
0
        public static ITreeAddInterpolator <T> WithFixedNumberOfPointsOnGlobalInventoryRange <T>(
            [NotNull] this ITreeAddInventoryGridCalculation <T> treeAddSpacing, int numGridPointsOverGlobalInventoryRange)
            where T : ITimePeriod <T>
        {
            if (treeAddSpacing == null)
            {
                throw new ArgumentNullException(nameof(treeAddSpacing));
            }
            Func <ICmdtyStorage <T>, IDoubleStateSpaceGridCalc> gridCalcFactory = InventorySpaceGrid.FixedNumberOfPointsOnGlobalInventoryRangeFactory <T>(
                numGridPointsOverGlobalInventoryRange);

            return(treeAddSpacing.WithStateSpaceGridCalculation(gridCalcFactory));
        }
Пример #2
0
        public static ITreeAddInterpolator <T> WithFixedGridSpacing <T>([NotNull] this ITreeAddInventoryGridCalculation <T> treeAddSpacing, double gridSpacing)
            where T : ITimePeriod <T>
        {
            if (treeAddSpacing == null)
            {
                throw new ArgumentNullException(nameof(treeAddSpacing));
            }
            if (gridSpacing <= 0.0)
            {
                throw new ArgumentException($"Parameter {nameof(gridSpacing)} value must be positive.", nameof(gridSpacing));
            }

            return(treeAddSpacing.WithStateSpaceGridCalculation(storage => new FixedSpacingStateSpaceGridCalc(gridSpacing)));
        }