} // GetNextQuarter // ---------------------------------------------------------------------- public Quarter AddQuarters(int count) { int year; YearQuarter quarter; TimeTool.AddQuarter(BaseYear, StartQuarter, count, out year, out quarter); return(new Quarter(year, quarter, Calendar)); } // AddQuarters
} // QuarterTimeRange // ---------------------------------------------------------------------- protected QuarterTimeRange(int startYear, YearQuarter startQuarter, int quarterCount, ITimeCalendar calendar) : base(GetPeriodOf(calendar, startYear, startQuarter, quarterCount), calendar) { this.startYear = startYear; this.startQuarter = startQuarter; this.quarterCount = quarterCount; TimeTool.AddQuarter(startYear, startQuarter, quarterCount - 1, out endYear, out endQuarter); } // QuarterTimeRange
} // Quarters // ---------------------------------------------------------------------- public ITimePeriodCollection GetQuarters() { TimePeriodCollection quarters = new TimePeriodCollection(); for (int i = 0; i < QuarterCount; i++) { int year; YearQuarter quarter; TimeTool.AddQuarter(BaseYear, StartQuarter, i, out year, out quarter); quarters.Add(new Quarter(year, quarter, Calendar)); } return(quarters); } // GetQuarters
} // GetStartOfQuarter // ---------------------------------------------------------------------- private static TimeRange GetPeriodOf(ITimeCalendar calendar, int startYear, YearQuarter startQuarter, int quarterCount) { if (quarterCount < 1) { throw new ArgumentOutOfRangeException("quarterCount"); } DateTime start = GetStartOfQuarter(calendar, startYear, startQuarter); int endYear; YearQuarter endQuarter; TimeTool.AddQuarter(startYear, startQuarter, quarterCount, out endYear, out endQuarter); DateTime end = GetStartOfQuarter(calendar, endYear, endQuarter); return(new TimeRange(start, end)); } // GetPeriodOf
} // GetHalfyears // ---------------------------------------------------------------------- public ITimePeriodCollection GetQuarters() { TimePeriodCollection quarters = new TimePeriodCollection(); for (int i = 0; i < yearCount; i++) { for (int quarter = 0; quarter < TimeSpec.QuartersPerYear; quarter++) { int year; YearQuarter yearQuarter; TimeTool.AddQuarter(startYear, YearQuarter.First, (i * TimeSpec.QuartersPerYear) + quarter, out year, out yearQuarter); quarters.Add(new Quarter(year, yearQuarter, Calendar)); } } return(quarters); } // GetQuarters