} // GetStartOfHalfyear // ---------------------------------------------------------------------- private static TimeRange GetPeriodOf(ITimeCalendar calendar, int startYear, YearHalfyear startHalfyear, int halfyearCount) { if (halfyearCount < 1) { throw new ArgumentOutOfRangeException("halfyearCount"); } DateTime start = GetStartOfHalfyear(calendar, startYear, startHalfyear); int endYear; YearHalfyear endHalfyear; TimeTool.AddHalfyear(startYear, startHalfyear, halfyearCount, out endYear, out endHalfyear); DateTime end = GetStartOfHalfyear(calendar, endYear, endHalfyear); return(new TimeRange(start, end)); } // GetPeriodOf
} // EndYearName // ---------------------------------------------------------------------- public ITimePeriodCollection GetHalfyears() { TimePeriodCollection halfyears = new TimePeriodCollection(); for (int i = 0; i < yearCount; i++) { for (int halfyear = 0; halfyear < TimeSpec.HalfyearsPerYear; halfyear++) { int year; YearHalfyear yearHalfyear; TimeTool.AddHalfyear(startYear, YearHalfyear.First, (i * TimeSpec.HalfyearsPerYear) + halfyear, out year, out yearHalfyear); halfyears.Add(new Halfyear(year, yearHalfyear, Calendar)); } } return(halfyears); } // GetHalfyears