Esempio n. 1
0
        public Iδ2ParameterElement Calculate(
            Iδ2ParameterElementFactory δ2ParameterElementFactory,
            IdIndexElement dIndexElement,
            IrIndexElement rIndexElement,
            IsIndexElement sIndexElement,
            It t,
            IW W,
            Iβ β,
            Iγ γ)
        {
            int value = 0;

            int γSum = t.GetNthElementsAt(
                dIndexElement.Value.Value.Value,
                t.GetT() - W.Value.Value.Value + dIndexElement.Value.Value.Value,
                W.Value.Value.Value)
                       .Select(
                y => γ.GetElementAtAsint(
                    rIndexElement,
                    y))
                       .Sum();

            int βAsint = β.GetElementAtAsint(
                sIndexElement,
                rIndexElement,
                dIndexElement);

            if (βAsint > 0)
            {
                // Case (i)
                if ((γSum % βAsint) == 0)
                {
                    value = 1;
                }
                else if ((γSum % βAsint) != 0)
                {
                    // Case (ii)
                    if (βAsint < (γSum / 2))
                    {
                        value = 1;
                    }
                    // Case (iii)
                    else if ((βAsint > (γSum / 2)) && (βAsint < γSum))
                    {
                        value =
                            (int)Math.Floor(
                                (decimal)(γSum / (γSum - βAsint)));
                    }
                }
            }

            return(δ2ParameterElementFactory.Create(
                       sIndexElement,
                       rIndexElement,
                       dIndexElement,
                       value));
        }
Esempio n. 2
0
        public Iδ2ParameterElementFactory Createδ2ParameterElementFactory()
        {
            Iδ2ParameterElementFactory factory = null;

            try
            {
                factory = new δ2ParameterElementFactory();
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(factory);
        }
Esempio n. 3
0
 public Iδ2 Calculate(
     Iδ2ParameterElementFactory δ2ParameterElementFactory,
     Iδ2Factory δ2Factory,
     Iδ2ParameterElementCalculation δ2ParameterElementCalculation,
     Isrd srd,
     It t,
     IW W,
     Iβ β,
     Iγ γ)
 {
     return(δ2Factory.Create(
                srd.Value
                .Select(x =>
                        δ2ParameterElementCalculation.Calculate(
                            δ2ParameterElementFactory,
                            x.dIndexElement,
                            x.rIndexElement,
                            x.sIndexElement,
                            t,
                            W,
                            β,
                            γ))
                .ToImmutableList()));
 }