public bool Equals(Interval other)
{
if (period == other.period)
return (multiplier == other.multiplier);
// Handle 1Y == 12M equivalence
if (period == Period.YEAR) {
if (other.period == Period.MONTH)
return ((multiplier * 12) == other.multiplier);
return (false);
}
if (period == Period.MONTH) {
if (other.period == Period.YEAR)
return (multiplier == (other.multiplier * 12));
return (false);
}
// Handle 1W == 7D equivalence
if (period == Period.WEEK) {
if (other.period == Period.DAY)
return ((multiplier * 7) == other.multiplier);
return (false);
}
if (period == Period.DAY) {
if (other.period == Period.WEEK)
return (multiplier == (other.multiplier * 7));
return (false);
}
return (false);
}