private void getMonthlyAbsoluteDates ( Calendar calendar , int frequency , List < Date > dates ) { int currentDayNumber = calendar . get ( Calendar . DAY_OF_MONTH ) ; calendar . set ( Calendar . DAY_OF_MONTH , 1 ) ; int requiredDayNumber = NumberHelper . getInt ( m_dayNumber ) ; if ( requiredDayNumber < currentDayNumber ) { calendar . add ( Calendar . MONTH , 1 ) ; } while ( moreDates ( calendar , dates ) ) { int useDayNumber = requiredDayNumber ; int maxDayNumber = calendar . getActualMaximum ( Calendar . DAY_OF_MONTH ) ; if ( useDayNumber > maxDayNumber ) { useDayNumber = maxDayNumber ; } calendar . set ( Calendar . DAY_OF_MONTH , useDayNumber ) ; dates . add ( calendar . getTime ( ) ) ; calendar . set ( Calendar . DAY_OF_MONTH , 1 ) ; calendar . add ( Calendar . MONTH , frequency ) ; } }
Calculate start dates for a monthly absolute recurrence .