question: private Date advanceToNextDayOfWeekIfNecessary ( Date fireTime , boolean forceToAdvanceNextDay ) { TimeOfDay sTimeOfDay = getStartTimeOfDay ( ) ; Date fireTimeStartDate = sTimeOfDay . getTimeOfDayForDate ( fireTime ) ; Calendar fireTimeStartDateCal = createCalendarTime ( fireTimeStartDate ) ; int dayOfWeekOfFireTime = fireTimeStartDateCal . get ( Calendar . DAY_OF_WEEK ) ; Set < Integer > daysOfWeekToFire = getDaysOfWeek ( ) ; if ( forceToAdvanceNextDay || ! daysOfWeekToFire . contains ( dayOfWeekOfFireTime ) ) { for ( int i = 1 ; i <= 7 ; i ++ ) { fireTimeStartDateCal . add ( Calendar . DATE , 1 ) ; dayOfWeekOfFireTime = fireTimeStartDateCal . get ( Calendar . DAY_OF_WEEK ) ; if ( daysOfWeekToFire . contains ( dayOfWeekOfFireTime ) ) { fireTime = fireTimeStartDateCal . getTime ( ) ; break ; } } } Date eTime = getEndTime ( ) ; if ( eTime != null && fireTime . getTime ( ) > eTime . getTime ( ) ) { return null ; } return fireTime ; }
target:  Given fireTime time determine if it is on a valid day of week. If so, simply return it unaltered, if not, advance to the next valid week day, and set the time of day to the start time of day