Beispiel #1
0
        protected override Consideration <TContext> SelectBestConsideration(TContext context)
        {
            base.SelectBestConsideration(context);
            var defaultScore = DefaultConsideration.GetScore(context);

            var first = Considerations
                        .FirstOrDefault(consideration => consideration.GetScore(context) >= defaultScore);

            return(first ?? DefaultConsideration);
        }
Beispiel #2
0
        protected override IConsideration <T> SelectBestConsideration(T context)
        {
            var defaultScore = DefaultConsideration.GetScore(context);

            for (var i = 0; i < _considerations.Count; i++)
            {
                if (_considerations[i].GetScore(context) >= defaultScore)
                {
                    return(_considerations[i]);
                }
            }

            return(DefaultConsideration);
        }
Beispiel #3
0
        protected override IConsideration <T> SelectBestConsideration(T context)
        {
            var highestScore = DefaultConsideration.GetScore(context);
            IConsideration <T> consideration = null;

            for (var i = 0; i < _considerations.Count; i++)
            {
                var score = _considerations[i].GetScore(context);
                if (score > highestScore)
                {
                    highestScore  = score;
                    consideration = _considerations[i];
                }
            }

            if (consideration == null)
            {
                return(DefaultConsideration);
            }

            return(consideration);
        }