コード例 #1
0
    public FillPattern MostSuitable(Region r)
    {
        //Get the most suitable regions.
        List <FillPattern> suitables = new List <FillPattern>();
        Suitability        max       = Suitability.Not;
        Suitability        temp;

        foreach (FillPattern fp in FillPatterns)
        {
            temp = Suitability.Min(fp.MaxSuitability, fp.GetSuitability(r));

            //If the current pattern is MORE suitable than the current max,
            //   start a new collection with this pattern.
            if (temp.GreaterThan(max))
            {
                suitables.Clear();
                suitables.Add(fp);
                max = temp;
            }
            //If the current pattern has the same suitability as the current max,
            //   just add it to the collection.
            else if (!max.EqualTo(Suitability.Not) && temp.EqualTo(max))
            {
                suitables.Add(fp);
            }
        }

        //Randomly choose from the most suitable patterns.
        if (suitables.Count == 0)
        {
            return(null);
        }
        return(suitables[R.Next(0, suitables.Count)]);
    }
コード例 #2
0
    public ZipperPattern(PlateauGenerationProperties plateauGen, Interval acceptableRatios, int minArea)
    {
        Generation             = plateauGen;
        AcceptableRegionRatios = acceptableRatios;
        MinArea = minArea;

        MaxSuitability = Suitability.Very;
    }
コード例 #3
0
    public ThickHurdlePattern(PlateauGenerationProperties plateaus, float averageHeightScale, float heightVariance)
    {
        HurdleAverageSpaceScale = averageHeightScale;
        HurdleHeightVariance    = heightVariance;

        PlateauGeneration = plateaus;

        MaxSuitability = Suitability.Very;
    }
コード例 #4
0
    public PlatformsPattern(int spaceBetweenPlatforms, int border, float percentOfPlatformsAreHoles,
                            int minAcceptableArea, Interval acceptableXToYRatios)
    {
        SpaceBetween    = spaceBetweenPlatforms;
        PercentageHoles = percentOfPlatformsAreHoles;
        Border          = border;

        MinArea = minAcceptableArea;
        AcceptableXToYRatios = acceptableXToYRatios;

        MaxSuitability = Suitability.Very;
    }
コード例 #5
0
 public string[] GetProperties() => new string[]
 {
     ID.ToString(),
         Name,
         Suitability.ToShortDateString(),
         View,
         Pressure,
         ExtingushClass,
         Temperature,
         AreaCovered,
         Price.ToString(),
         Count.ToString()
 };
コード例 #6
0
    public Suitability GetSuitability(Region r)
    {
        Generation.BeingFilled = r;

        //Flip the region for the plateau calculations if the region is vertical.
        if (r.Height > r.Width)
        {
            Generation.BeingFilled = new Region(r.X, r.Y, r.Height, r.Width);
        }

        //If the region isn't long/wide enough, exit.
        if (Generation.BeingFilled.Width < Generation.MinRegionWidth)
        {
            return(Suitability.Not);
        }
        if (Generation.BeingFilled.Height < 1)
        {
            return(Suitability.Not);
        }

        //Use the ratio to find the suitability.
        float ratio = (float)r.Width / r.Height;

        if (ratio > 1.0f)
        {
            ratio = 1.0f / ratio;
        }
        Suitability ret = AcceptableRegionRatios.Inside(ratio) ? MaxSuitability : Suitability.Not;

        //If the plateaus won't fit in perfectly, don't use this pattern.

        int space = Generation.BeingFilled.Width + 1;

        space -= 2 * Generation.Border;
        int  plateauSpace = Generation.SpaceBetweenPlateaus;
        int  width        = Generation.PlateauWidth;
        int  numb         = Generation.NumbPlateaus;
        bool bad          = space - (numb * width) - ((numb - 1) * plateauSpace) != 0;

        if (bad)
        {
            return(Suitability.Not);
        }
        else
        {
            return(ret);
        }
    }
        public void SuitabilityData(Suitability suitability)
        {
            if (suitability != null)
            {
                if (suitability.Profile != null)
                {
                    OnbaseStore.AddField("caixadetextoID", suitability.Profile.Id);
                    OnbaseStore.AddField("caixadetextoIDProfile", suitability.Profile.SuitabilityProfile.IdProfile);
                    OnbaseStore.AddField("caixadetextoPontuacaoTotal", suitability.Profile.TotalScore);
                    OnbaseStore.AddField("caixadetextoProfile", suitability.Profile.SuitabilityProfile.Profile);
                    OnbaseStore.AddField("caixadetextoScore", suitability.Profile.SuitabilityProfile.Score);
                    OnbaseStore.AddField("caixadetextodemultilinhasDescricao", suitability.Profile.SuitabilityProfile.Description);
                    OnbaseStore.AddField("caixadetextoDataCriacao", suitability.Profile.SuitabilityProfile.Created);
                    OnbaseStore.AddField("caixadetextoDatadeExpiracao", suitability.Profile.SuitabilityProfile.DtExpiration);
                }

                OnbaseStore.AddField("grupodebotãodeopçãoQualSeuObjetivoaoInvestir", suitability.GetSutiabilityAlternativeByQuestionId(3)?.Alternative);
                OnbaseStore.AddField("grupodebotãodeopçãoPorQuantoTempoPretendeInvestir", suitability.GetSutiabilityAlternativeByQuestionId(1)?.Alternative);
                OnbaseStore.AddField("grupodebotãodeopçãoConhecimentoSobreInvestimentos", suitability.GetSutiabilityAlternativeByQuestionId(8)?.Alternative);
                OnbaseStore.AddField("grupodebotãodeopçãoOqueFariaSeTivessePerdaDe10", suitability.GetSutiabilityAlternativeByQuestionId(2)?.Alternative);
                OnbaseStore.AddField("grupodebotãodeopçãoQuantasVezesMovimentaInvestimentos", suitability.GetSutiabilityAlternativeByQuestionId(7)?.Alternative);
                OnbaseStore.AddField("grupodebotãodeopçãoQualOvalorTotaldeInvestimentos", suitability.GetSutiabilityAlternativeByQuestionId(5)?.Alternative);
                OnbaseStore.AddField("grupodebotãodeopçãoRendaMensal", suitability.GetSutiabilityAlternativeByQuestionId(4)?.Alternative);

                if (suitability.HasForManySutiabilityAlternative(6, 17))
                {
                    OnbaseStore.AddField("caixadeseleçãoAcoesFundosCreditoPrivado", suitability.HasForManySutiabilityAlternative(6, 17).ToString());
                }

                if (suitability.HasForManySutiabilityAlternative(6, 16))
                {
                    OnbaseStore.AddField("caixadeseleçãoRendaFixaTesouroCDBPoupanca", suitability.HasForManySutiabilityAlternative(6, 16).ToString());
                }

                if (suitability.HasForManySutiabilityAlternative(6, 18))
                {
                    OnbaseStore.AddField("caixadeseleçãoDerivativos", suitability.HasForManySutiabilityAlternative(6, 18).ToString());
                }
            }
        }
        private void MapCustomerFieldsToOnbase(CustomerReRegistration customer, StoreNewUnityFormProperties onbaseStore, FormTemplate formTemplate)
        {
            var customerForm = new CustomerReRegistrationForm(onbaseStore, formTemplate);

            customerForm.ApplyBasicData(customer);
            customerForm.ApplyAddress(customer.Addresses);
            customerForm.ApplyAccounts(customer.Accounts);
            customerForm.ApplyWork(customer.Work);
            customerForm.ApplyDeclarations(customer.Declarations);
            customerForm.ApplyInvestiments(customer.Investments);
            customerForm.ApplyFatca(customer.Fatca);
            customerForm.ApplyDocument(customer.Document);


            if (!string.IsNullOrEmpty(customer.IdClient))
            {
                Suitability suitability = this._customerRepository
                                          .GetCustomerSuitability(customer.IdClient)
                                          .GetAwaiter()
                                          .GetResult();

                customerForm.SuitabilityData(suitability);
            }
        }
コード例 #9
0
 public BlankRegionPattern(float maxRegionArea)
 {
     MaxRegionArea  = maxRegionArea;
     MaxSuitability = Suitability.Very;
 }
コード例 #10
0
 public ConcentricSquaresPattern()
 {
     MaxSuitability = Suitability.Very;
 }
コード例 #11
0
 public CirclePattern(int innerRadius)
 {
     InnerCircle    = innerRadius;
     MaxSuitability = Suitability.Very;
 }
コード例 #12
0
    public Suitability GetSuitability(Region r)
    {
        PlateauGeneration.BeingFilled = r;

        bool horizontal = r.Height <= r.Width;
        bool vertical   = r.Width < r.Height;

        if (vertical)
        {
            PlateauGeneration.BeingFilled = new Region(r.X, r.Y, r.Height, r.Width);
        }
        else if (!horizontal)
        {
            return(Suitability.Not);
        }

        //Plateau data.
        int space = PlateauGeneration.BeingFilled.Width + 1;

        space -= 2 * PlateauGeneration.Border;
        int plateauSpace = PlateauGeneration.SpaceBetweenPlateaus;
        int width        = PlateauGeneration.PlateauWidth;
        int numb         = PlateauGeneration.NumbPlateaus;

        //If the plateaus won't fit in perfectly, lower the suitability.
        bool perfectFit = (space - (numb * width) - ((numb - 1) * plateauSpace) == 0);

        if (horizontal)
        {
            //Make sure it's within acceptable bounds.
            if (r.Height < 1 || r.Width < PlateauGeneration.MinRegionWidth)
            {
                return(Suitability.Not);
            }

            //Get a suitability based on the height of the region.
            Suitability ret = (new Interval(IdealHeight * 2, IdealHeight, 3).Inside(r.Height)) ?
                              MaxSuitability :
                              Suitability.Not;

            //Check to see if the plateaus will fit perfectly.
            if (!perfectFit)
            {
                return(Suitability.Not);
            }
            else
            {
                return(ret);
            }
        }

        if (vertical)
        {
            //Make sure it's within acceptable bounds.
            if (r.Width < 1 || r.Height < PlateauGeneration.MinRegionWidth)
            {
                return(Suitability.Not);
            }

            //Get a value based on the width of the region (too wide and the region will be rejected).
            Suitability ret = (new Interval(IdealHeight * 2, IdealHeight, 3).Inside(r.Width)) ?
                              MaxSuitability :
                              Suitability.Not;

            //Check to see if the plateaus will fit perfectly.
            if (!perfectFit)
            {
                return(Suitability.Not);
            }
            else
            {
                return(ret);
            }
        }

        throw new InvalidOperationException("wat");
    }
コード例 #13
0
 public CarvedPlusPattern()
 {
     MaxSuitability = Suitability.Very;
 }