Ejemplo n.º 1
0
        protected void SerializeOther(IJsonWriter writer, OtherModel model, String discriminator, CalculationTicket ticket)
        {
            this.AddDiscriminatorIfAny(writer, discriminator);
            this.expressionWriter.SerializeOnceResolved(model.Benchmark, JsonNames.Benchmark, writer, ticket);
            this.expressionWriter.SerializeOnceResolved(model.Base, JsonNames.Base, writer, ticket);
            this.expressionWriter.SerializeOnceResolved(model.BaseActive, JsonNames.BaseActive, writer, ticket);
            this.expressionWriter.SerializeOnceResolved(model.Overlay, JsonNames.Overlay, writer, ticket);
            this.expressionWriter.SerializeOnceResolved(model.PortfolioAdjustment, JsonNames.PortfolioAdjustment, writer, ticket);
            this.expressionWriter.SerializeOnceResolved(model.PortfolioScaled, JsonNames.PortfolioScaled, writer, ticket);
            this.expressionWriter.SerializeOnceResolved(model.TrueExposure, JsonNames.TrueExposure, writer, ticket);
            this.expressionWriter.SerializeOnceResolved(model.TrueActive, JsonNames.TrueActive, writer, ticket);

            writer.WriteArray(model.BasketCountries, JsonNames.BasketCountries, basketCountry =>
            {
                writer.Write(delegate
                {
                    this.SerializeBasketCountry(writer, basketCountry, JsonNames.BasketCountry, ticket);
                });
            });

            writer.WriteArray(model.UnsavedBasketCountries, JsonNames.UnsavedBasketCountries, unsavedBasketCountry =>
            {
                writer.Write(delegate
                {
                    this.SerializeUnsavedBasketCountry(writer, unsavedBasketCountry, JsonNames.UnsavedBasketCountry, ticket);
                });
            });
        }
Ejemplo n.º 2
0
        public OtherModel CreateOtherModel(List <BasketCountryModel> basketCountries, List <UnsavedBasketCountryModel> unsavedBasketCountries)
        {
            var result = new OtherModel(
                new SumExpression(
                    ValueNames.Benchmark,
                    basketCountries.Select(x => x.Benchmark).Union(unsavedBasketCountries.Select(x => x.Benchmark)),
                    this.defaultValues.DefaultBenchmark,
                    this.commonParts.ValidateWhatever
                    ),
                new NullableSumExpression(
                    ValueNames.Base,
                    basketCountries.Select(x => x.Base).Union(unsavedBasketCountries.Select(x => x.Base)),
                    this.defaultValues.DefaultBase,
                    this.commonParts.ValidateWhatever
                    ),
                new NullableSumExpression(
                    ValueNames.BaseActive,
                    basketCountries.Select(x => x.BaseActive).Union(unsavedBasketCountries.Select(x => x.BaseActive)),
                    this.defaultValues.DefaultBaseActive,
                    this.commonParts.ValidateWhatever
                    ),
                new SumExpression(
                    ValueNames.Overlay,
                    basketCountries.Select(x => x.Overlay).Union(unsavedBasketCountries.Select(x => x.Overlay)),
                    this.defaultValues.DefaultOverlay,
                    this.commonParts.ValidateWhatever
                    ),
                new NullableSumExpression(
                    ValueNames.PortfolioAdjsutment,
                    basketCountries.Select(x => x.PortfolioAdjustment).Union(unsavedBasketCountries.Select(x => x.PortfolioAdjustment)),
                    this.defaultValues.DefaultPortfolioAdjustment,
                    this.commonParts.ValidateWhatever
                    ),
                new NullableSumExpression(
                    ValueNames.PortfolioScaled,
                    basketCountries.Select(x => x.PortfolioScaled).Union(unsavedBasketCountries.Select(x => x.PortfolioScaled)),
                    this.defaultValues.DefaultPortfolioScaled,
                    this.commonParts.ValidateWhatever
                    ),
                new NullableSumExpression(
                    ValueNames.TrueExposure,
                    basketCountries.Select(x => x.TrueExposure).Union(unsavedBasketCountries.Select(x => x.TrueExposure)),
                    this.defaultValues.DefaultTrueExposure,
                    this.commonParts.ValidateWhatever
                    ),
                new NullableSumExpression(
                    ValueNames.TrueActive,
                    basketCountries.Select(x => x.TrueActive).Union(unsavedBasketCountries.Select(x => x.TrueActive)),
                    this.defaultValues.DefaultTrueActive,
                    this.commonParts.ValidateWhatever
                    ),
                basketCountries,
                unsavedBasketCountries
                );

            return(result);
        }
 protected void TraverseOther(OtherModel model, List <IExpression> result)
 {
     result.Add(model.Base);
     result.Add(model.BaseActive);
     result.Add(model.Benchmark);
     result.Add(model.Overlay);
     result.Add(model.PortfolioAdjustment);
     result.Add(model.PortfolioScaled);
     result.Add(model.TrueActive);
     result.Add(model.TrueExposure);
 }
Ejemplo n.º 4
0
        public OtherNode CreateNode(OtherModel otherModel)
        {
            if (otherModel.UnsavedBasketCountries.Any())
            {
                throw new ApplicationException("Unable to create a taxonomy because the model has unsaved countries.");
            }

            var result = new OtherNode();

            foreach (var basketCountry in otherModel.BasketCountries)
            {
                var node = this.CreateBasketCountry(basketCountry);
                result.RegisterResident(node);
            }
            return(result);
        }
Ejemplo n.º 5
0
        protected IEnumerable <IModel> TraverseOther(OtherModel otherModel)
        {
            yield return(otherModel);

            foreach (var basketCountry in otherModel.BasketCountries)
            {
                var models = this.TraverseBasketCountry(basketCountry);
                foreach (var model in models)
                {
                    yield return(model);
                }
            }

            foreach (var unsavedBasketCountry in otherModel.UnsavedBasketCountries)
            {
                var models = this.TraverseUnsavedBasketCountry(unsavedBasketCountry);
                foreach (var model in models)
                {
                    yield return(model);
                }
            }
        }
Ejemplo n.º 6
0
 public void Resolve(OtherModel model)
 {
     this.ResultOpt = model.TrueActive;
 }
Ejemplo n.º 7
0
 public void Resolve(OtherModel model)
 {
     this.ResultOpt = model.TrueExposure;
 }
Ejemplo n.º 8
0
 public void Resolve(OtherModel model)
 {
     this.ResultOpt = model.PortfolioScaled;
 }
Ejemplo n.º 9
0
 public void Resolve(OtherModel model)
 {
     this.ResultOpt = model.PortfolioAdjustment;
 }
Ejemplo n.º 10
0
 public void Resolve(OtherModel model)
 {
     this.Result = model.Overlay;
 }
Ejemplo n.º 11
0
 public void Resolve(OtherModel model)
 {
     this.ResultOpt = model.Base;
 }
Ejemplo n.º 12
0
 public void Resolve(OtherModel model)
 {
     this.Result = this.builder.CreateNode(model);
 }
 public void Resolve(OtherModel model)
 {
     this.traverser.TraverseOther(model, this.result);
 }
Ejemplo n.º 14
0
 public void Resolve(OtherModel model)
 {
     this.Result = No.ValidationIssues;
 }
Ejemplo n.º 15
0
 public void Resolve(OtherModel other)
 {
     this.parent.SerializeOther(writer, other, JsonNames.Other, this.ticket);
 }
Ejemplo n.º 16
0
 public void Resolve(OtherModel model)
 {
     this.Result = model.Benchmark;
 }
Ejemplo n.º 17
0
 public void Resolve(OtherModel model)
 {
     // do nothing
 }
Ejemplo n.º 18
0
 public void Resolve(OtherModel model)
 {
     this.OtherModelOpt = model;
 }