Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 22 additions & 19 deletions TimePeriod/QuarterTimeRange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,25 +91,28 @@ public string EndQuarterOfYearName
get { return Calendar.GetQuarterOfYearName( EndYear, EndQuarter ); }
} // EndQuarterOfYearName

// ----------------------------------------------------------------------
public ITimePeriodCollection GetMonths()
{
TimePeriodCollection months = new TimePeriodCollection();
for ( int i = 0; i < quarterCount; i++ )
{
for ( int month = 0; month < TimeSpec.MonthsPerQuarter; month++ )
{
int year;
YearMonth yearMonth;
TimeTool.AddMonth( startYear, YearBaseMonth, ( i * TimeSpec.MonthsPerQuarter ) + month, out year, out yearMonth );
months.Add( new Month( year, yearMonth, Calendar ) );
}
}
return months;
} // GetMonths

// ----------------------------------------------------------------------
protected override bool IsEqual( object obj )
// ----------------------------------------------------------------------
public ITimePeriodCollection GetMonths()
{
TimePeriodCollection months = new TimePeriodCollection();
YearMonth startMonth = YearBaseMonth;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion for line 98 and 99:

YearMonth startMonth;
TimeTool.AddMonth(startYear, YearBaseMonth, ((int)StartQuarter - 1) * TimeSpec.MonthsPerQuarter, out _, out startMonth);

TimeTool.AddMonth( startYear, startMonth, (((int)StartQuarter) - 1) * TimeSpec.MonthsPerQuarter, out _, out startMonth );

for ( int i = 0; i < quarterCount; i++ )
{
for ( int month = 0; month < TimeSpec.MonthsPerQuarter; month++ )
{
int year;
YearMonth yearMonth;
TimeTool.AddMonth( startYear, startMonth, ( i * TimeSpec.MonthsPerQuarter ) + month, out year, out yearMonth );
months.Add( new Month( year, yearMonth, Calendar ) );
}
}
return months;
} // GetMonths

// ----------------------------------------------------------------------
protected override bool IsEqual( object obj )
{
return base.IsEqual( obj ) && HasSameData( obj as QuarterTimeRange );
} // IsEqual
Expand Down