package schedule;

/**
 * A Schedule object is generated from the 
 * Schedule generator. 
 * @author ldavid
 */ 

public abstract class Schedule {
	/**
	 * The schedule name, i.e. Fall 2013 Schedule 1
	 */
    String scheduleName;
    
    /**
     * The collection of days in a schedule. There should be 5 days -
     * Monday, Tuesday, Wednesday, Thursday, and Friday
     */
    public Day[] days;
    
    /**
	 * Function that will add a course to the schedule.
	 */
	/*@
	 requires
	   // 
	   // The given Day is not null and is a valid day
	   //
	   (day != null && day.isValid());
	     
	 ensures 
	   //
       // If preconditions are met, a new ScheduleItem is added if
       // and only if it is the new ScheduledItem to be added or
       // if it is in the old schedule.
       //   
   		(\forall ScheduledItem item;
   			(day.contains(item) <==>
   				((\old(day.contains(item))) || item == scheduledItem)
   			));
       			
	@*/
    public abstract void addScheduledItem(Day day, ScheduledItem scheduledItem);
    
    /**
     * Removes the given ScheduledItem from the schedule
     */
    /*@
     requires
     	// 
     	// The given Day is not empty and is valid
     	//
     	(day != null && day.isValid())
     
     		&&
     	
     	// 
     	// The given ScheduledItem is in the schedule and is not null
     	//
     	(scheduledItem != null && 
     	(\forall int i; (i >= 0 && i < days.length); days[i].contains(scheduledItem)));
     	
     ensures
     	//
     	// A ScheduledItem is in the output data if and only if it is not
     	// the current ScheduledItem being deleted and it was in the input
     	// data
     	//
     	(\forall int i; (i >= 0 && i < days.length); 
     	    (\forall int j; (j >= 0 && j < days[i].scheduledItems.length); 
     			days[i].contains(\old(days[i].scheduledItems[j])) <==> 
 					(!\old(days[i].scheduledItems[j]).equals(scheduledItem))));
     		
     
     @*/
    public abstract void removeScheduledItem(Day day, ScheduledItem scheduledItem);
}