Ejemplo n.º 1
0
        /// <summary>
        /// Возвращает все допустимые варианты
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private IEnumerable <BrickVariant> GetAllVariants(BrickRequest request)
        {
            if (request.MinimalScaleBehavior == MiniamlScaleBehavior.KeepZero)
            {
                if (request.SourceMinValue > 0)
                {
                    request.SourceMinValue = 0;
                }
            }


            if (request.MaxDelimit <= 0)
            {
                request.MaxDelimit = DecideBestMaxDelimit(request.Size);
            }
            if (request.MinDelimit <= 0)
            {
                request.MinDelimit = DecideBestMinDelimit(request.Size);
            }

            foreach (var i in Bricks)
            {
                var variant = new BrickVariant {
                    BrickSize = i, Request = request, Catalog = this
                };
                if (variant.BrickCount <= request.MaxDelimit && variant.BrickCount >= request.MinDelimit)
                {
                    yield return(variant);
                }
            }
        }
Ejemplo n.º 2
0
        private static BrickVariant GetSafeVariant(BrickRequest request)
        {
            var variant = new BrickVariant();

            variant.BuildForEqual(request);
            return(variant);
        }
Ejemplo n.º 3
0
 private static bool WellFormedScale(BrickVariant result)
 {
     if (result.BrickCount <= 2)
     {
         if ((result.Request.MaxValue / result.BrickMaxValue) <= 0.8m)
         {
             return(false);
         }
     }
     return(true);
 }