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 yearly events. This schedule will schedule it's sub schedules yearly.
 * 
 * @author Rob Gordon
 */

final public class YearlySchedule extends RegularSchedule implements Serializable {

    private static final long serialVersionUID = 20050226;
    
    /*
     *  (non-Javadoc)
     * @see org.treesched.RegularSchedule#next(java.util.Date)
     */
    public Date next(Date from) {
        Calendar calendar = new GregorianCalendar();
        calendar.setTime(from);
        calendar.add(Calendar.YEAR, 1);
        return calendar.getTime();
    }
}
