package org.treesched.schedules;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

import org.treesched.RegularSchedule;

/**
 * Schedule for monthly events. 
 * <p>
 * Typical configuration is:
 * <code><pre>
 *   &lt;monthly/&gt;
 * </pre></code>
 * 
 * @author Rob Gordon
 */

final public class MonthlySchedule extends RegularSchedule implements Serializable {

    private static final long serialVersionUID = 20050226;
    
    public Date next(Date from) {
        Calendar calendar = new GregorianCalendar();
        calendar.setTime(from);
        calendar.add(Calendar.MONTH, 1);
        return calendar.getTime();
    }
}
