예제 #1
0
 public void Init()
 {
     _statisticGenerator = InitializeStatisticGeneratorWithTwoCalculators();
     _events             = InitializeEvents();
     _eventRepository.AddRangeOfEvents(_events);
     _trackerRepository.SaveTracker(_tracker);
 }
예제 #2
0
        public IBasicStatistics AnaliseRolls(IRouletteRolls rouletteRolls)
        {
            var statistic = new StatisticGenerator().Analise(rouletteRolls);

            return(statistic);
        }
예제 #3
0
        /// <summary>
        /// Asynchronously generates a component from a report definition and filter
        /// </summary>
        /// <param name="definition">The component definition</param>
        /// <param name="sectionType">The report section type</param>
        /// <param name="filter">The report filter</param>
        /// <returns>The report component generated</returns>
        public override async Task <IReportComponent> GenerateAsync
        (
            IReportComponentDefinition definition,
            ReportSectionType sectionType,
            ReportFilter filter
        )
        {
            Validate.IsNotNull(definition);
            Validate.IsNotNull(filter);

            var graphicDefinition = definition.As <GraphicDefinition>();

            var graphic = new Graphic
                          (
                graphicDefinition
                          );

            if (graphicDefinition.OverlayStatistics.Any())
            {
                var statisticGenerator = new StatisticGenerator();

                var statisticDefinitions = graphicDefinition.OverlayStatistics.SelectMany
                                           (
                    pair => pair.Value.Select
                    (
                        item => item
                    )
                                           );

                var statisticTasks = new List <Task <IReportComponent> >();

                foreach (var item in statisticDefinitions)
                {
                    statisticTasks.Add
                    (
                        statisticGenerator.GenerateAsync
                        (
                            item,
                            sectionType,
                            filter
                        )
                    );
                }

                await Task.WhenAll(statisticTasks).ConfigureAwait
                (
                    false
                );

                var taskIndex = 0;

                foreach (var item in graphicDefinition.OverlayStatistics)
                {
                    var statisticList = new List <Statistic>();

                    foreach (var statisticDefinition in item.Value)
                    {
                        var task = statisticTasks.ElementAt
                                   (
                            taskIndex
                                   );

                        var statistic = await task.ConfigureAwait(false) as Statistic;

                        statisticList.Add(statistic);

                        taskIndex++;
                    }

                    graphic.OverlayStatistics.Add
                    (
                        item.Key,
                        statisticList
                    );
                }
            }

            return(graphic);
        }
예제 #4
0
파일: Finder.cs 프로젝트: Therlys/tp1
 public static StatisticGenerator GetStatisticGenerator()
 {
     return(statisticGenerator ?? (statisticGenerator = GameObject.FindWithTag(Tags.MAIN_CONTROLLER).GetComponent <StatisticGenerator>()));
 }