DayOfWeek dow = date.getDayOfWeek();
if (relative < 2 && dow == this.dow) {
return date;
}
if ((relative & 1) == 0) {
int daysDiff = dow.ordinal() - this.dow.ordinal();
return date.plusDays(daysDiff >= 0 ? 7 - daysDiff : -daysDiff);
} else {
int daysDiff = this.dow.ordinal() - dow.ordinal();
return date.minusDays(daysDiff >= 0 ? 7 - daysDiff : -daysDiff);
}