Exemplo n.º 1
0
        /// <summary>Calculates and returns statistics for the records collected up to this point.</summary>
        /// <returns></returns>
        public RecordStats <IStat> GetStats()
        {
            RecordStats <IStat> recordStats = new RecordStats <IStat>();

            foreach (var group in _statCollectors.GroupBy(collector => collector.MemberName))
            {
                recordStats.Add(group.SelectMany(collector => collector.GetStats()));
            }

            return(recordStats);
        }
Exemplo n.º 2
0
        /// <summary>Calculates and returns statistics for two sets of records, and returns the comparison of the two sets of statistics.</summary>
        /// <returns></returns>
        public RecordStats <IComparedStat> GetStatsComparedTo(AutoStat <TRECORD> otherAutoStat)
        {
            RecordStats <IComparedStat> recordStats = new RecordStats <IComparedStat>();

            var collectorPairs = _statCollectors.Join(otherAutoStat._statCollectors, collector => collector.GetKey(), collector => collector.GetKey(), (collector1, collector2) => (collector1, collector2));

            foreach (var collectorPair in collectorPairs)
            {
                recordStats.Add(collectorPair.collector1.GetStatsComparedTo(collectorPair.collector2));
            }

            return(recordStats);
        }