Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

NextReminder

By: ace on Jan 24th, 2010  |  syntax: None  |  size: 0.78 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public RCalendar getNextReminderDate(String doctorID,
  2.                         RCalendar previousReminderDate) {
  3.                 RCalendar nextR = new RCalendar(previousReminderDate);
  4.                 for(NextReminder nr : reminderList){
  5.                         if(doctorID.equals(nr.doctorID)){
  6.                                 //snip//
  7.                                 //get the integer value for the day of the week
  8.                                 int dayOfWeek = dayToInt(nr.unit);
  9.                                 //if the DAY_OF_WEEK is not already = the dayOfWeek, set it.
  10.                                 if(nextR.get(Calendar.DAY_OF_WEEK) != dayOfWeek){nextR.set(Calendar.DAY_OF_WEEK, dayOfWeek);}
  11.                                 //nr.m = 0 means "every", so "every week" or "every 2nd week" etc.
  12.                                 if(nr.m == 0){nextR.add(Calendar.WEEK_OF_MONTH, nr.n); return nextR;}
  13.                                 //otherwise nr.m indicates how many months between reminders
  14.                                 nextR.add(Calendar.MONTH, nr.m);
  15.                                 nextR.set(Calendar.WEEK_OF_MONTH, nr.n);
  16.                         }