Ejemplo n.º 1
0
        private PeriodCardsStatus generatePeriods(DateTime start, ref DateTime end, TimeGranularity granularity,
                                                  bool analysisExists, out PeriodCardsStatus lastPeriod, out Dictionary <DateTime, PeriodCardsStatus> result)
        {
            PeriodCardsStatus firstPeriod;
            PeriodCardsStatus period;

            if (analysisExists)
            {
                firstPeriod = _boardAnalysis.Periods.First();
                period      = _boardAnalysis.Periods.Last();
            }
            else
            {
                firstPeriod = new PeriodCardsStatus(_boardAnalysis, start, granularity);
                period      = firstPeriod;
            }
            result = new Dictionary <DateTime, PeriodCardsStatus> {
                { firstPeriod.Start, firstPeriod }
            };
            while (true)
            {
                period = (PeriodCardsStatus)period.Next();
                _boardAnalysis.Periods.Add(period);
                result.Add(period.Start, period);
                if (period.End < end)
                {
                    continue;
                }

                lastPeriod = period;
                end        = lastPeriod.End;
                break;
            }
            return(firstPeriod);
        }
Ejemplo n.º 2
0
        public void LinkPeriods()
        {
            PeriodCardsStatus prev = null;

            foreach (var period in Periods)
            {
                period.SetParent(this);
                period.SetPrevious(prev);
                prev?.SetNext(period);
                prev = period;
            }
        }
Ejemplo n.º 3
0
 internal void SetNext(PeriodCardsStatus next)
 {
     _next = next;
 }
Ejemplo n.º 4
0
 internal void SetPrevious(PeriodCardsStatus prev)
 {
     _previous = prev;
 }