Exemplo n.º 1
0
        /// <inheritdoc/>
        public RankedTheorem Rank(Theorem theorem, Configuration configuration, TheoremMap allTheorems)
        {
            // Prepare the ranking dictionary by applying every ranker
            var rankings = _rankers.Select(ranker => (ranker.RankedAspect, ranking: ranker.Rank(theorem, configuration, allTheorems)))
                           // And wrapping the result to a dictionary together with the coefficient from the settings
                           .ToDictionary(pair => pair.RankedAspect, pair => new RankingData(pair.ranking, _settings.RankingCoefficients[pair.RankedAspect]));

            // Wrap the final ranking in a ranking object
            var ranking = new TheoremRanking(rankings);

            // Now we can return the ranked theorem
            return(new RankedTheorem(theorem, ranking, configuration));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RankedTheorem"/> class.
 /// </summary>
 /// <param name="theorem">The actual theorem that was ranked.</param>
 /// <param name="ranking">The ranking of the <see cref="Theorem"/> with respect to the configuration where it was discovered.</param>
 /// <param name="configuration">The configuration where the <see cref="Theorem"/> holds.</param>
 public RankedTheorem(Theorem theorem, TheoremRanking ranking, Configuration configuration)
 {
     Theorem       = theorem ?? throw new ArgumentNullException(nameof(theorem));
     Ranking       = ranking ?? throw new ArgumentNullException(nameof(ranking));
     Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
 }