@Test public void resolveRepeatDow() { now.set(2018, 5, 22); long expectedDur = 7 * 24 * 3600 * 1000; resolver.resolveRepeatDow(3, reminder, now); assertEquals(expectedDur, reminder.repeatDuration, 100); assertEquals(27, now.get(Calendar.DAY_OF_MONTH)); }
void resolveRepeatDow(int dow, ReminderImpl reminder, Calendar now){ dow = (dow + Calendar.MONDAY - now.getFirstDayOfWeek() + 6) % 7 + 1; reminder.repeatDuration += 7* Constants.MUL_DAY; int curDow = now.get(Calendar.DAY_OF_WEEK); int dayDiff = dow - curDow; if(dayDiff < 0) dayDiff += 7; now.add(Calendar.DAY_OF_MONTH, dayDiff); }
ArgumentResolver { void resolveRepeatDow(int dow, ReminderImpl reminder, Calendar now){ dow = (dow + Calendar.MONDAY - now.getFirstDayOfWeek() + 6) % 7 + 1; reminder.repeatDuration += 7* Constants.MUL_DAY; int curDow = now.get(Calendar.DAY_OF_WEEK); int dayDiff = dow - curDow; if(dayDiff < 0) dayDiff += 7; now.add(Calendar.DAY_OF_MONTH, dayDiff); } }
ArgumentResolver { void resolveRepeatDow(int dow, ReminderImpl reminder, Calendar now){ dow = (dow + Calendar.MONDAY - now.getFirstDayOfWeek() + 6) % 7 + 1; reminder.repeatDuration += 7* Constants.MUL_DAY; int curDow = now.get(Calendar.DAY_OF_WEEK); int dayDiff = dow - curDow; if(dayDiff < 0) dayDiff += 7; now.add(Calendar.DAY_OF_MONTH, dayDiff); } ArgumentResolver(Context context); }
ArgumentResolver { void resolveRepeatDow(int dow, ReminderImpl reminder, Calendar now){ dow = (dow + Calendar.MONDAY - now.getFirstDayOfWeek() + 6) % 7 + 1; reminder.repeatDuration += 7* Constants.MUL_DAY; int curDow = now.get(Calendar.DAY_OF_WEEK); int dayDiff = dow - curDow; if(dayDiff < 0) dayDiff += 7; now.add(Calendar.DAY_OF_MONTH, dayDiff); } ArgumentResolver(Context context); Reminder resolve(Map<String, Object> map, String rawText, Calendar now); }
ArgumentResolver { void resolveRepeatDow(int dow, ReminderImpl reminder, Calendar now){ dow = (dow + Calendar.MONDAY - now.getFirstDayOfWeek() + 6) % 7 + 1; reminder.repeatDuration += 7* Constants.MUL_DAY; int curDow = now.get(Calendar.DAY_OF_WEEK); int dayDiff = dow - curDow; if(dayDiff < 0) dayDiff += 7; now.add(Calendar.DAY_OF_MONTH, dayDiff); } ArgumentResolver(Context context); Reminder resolve(Map<String, Object> map, String rawText, Calendar now);  }