package database;

import java.util.Collection;

/**
 * This class is derived from section 2.3.1.  
 * 
 * InstructorList is the repository of Instructors.
 * @author kdavis22
 */
public abstract class InstructorList {
   
   /**
    * The collection of Instructors.
    */
   Collection<Instructor> data;

   /**
    * Add the given Instructor to the given InstructorList. The alias of the Instructor 
    * must not be the same as an Instructor already on the InstructorList. The Instructor 
    * must have a name, office, phone, wtus, title, and emplId.
    */ 
  /*@
     ensures
       //
       // A Instructor is on the output InstructorList if and only if it is the new Instructor
       // to be added or it is in the input InstructorList.
       //
       (\forall Instructor instOther ;
           data.contains(instOther) <==>
               instOther.equals(inst) || \old(data).contains(instOther));
     @*/  
   abstract void add(Instructor inst);

   /**
    * Remove the given Instructor from the given InstructorList. The given Instructor 
    * must already by on the InstructorList.
    */
  /*@
      requires
        //
        // The given Instructor is in the given InstructorList.
        //
        data.contains(inst);

      ensures
        //
        // A Instructor is in the output InstructorList if and only if it is not the existing
        // Instructor to be deleted and it is in the input InstructorList.
        //
        (\forall Instructor instOther ;
            data.contains(instOther) <==>
                !instOther.equals(inst) && \old(data).contains(instOther));
     @*/
   abstract void remove(Instructor inst);

   /**
    * Change the given old Instructor to the given new Instructor. The old and new 
    * Instructors must not be the same. The old Instructor must already be on the 
    * InstructorList. The new Instructor must meet the same conditions as for the input
    * to the AddInstructor operation.
    */
   /*@
      requires
        //
        // The old and new Instructors are not the same.
        //
        !oldInst.equals(newInst);

       ensures
         //
         // A Instructor is in the output InstructorList if and only if it is the new Instructor
         // to be added or it is in the input InstructorList, and it is not the old Instructor.
         //
         (\forall Instructor instOther ;
             data.contains(instOther) <==>
                instOther.equals(newInst) || 
                    \old(data).contains(instOther) &&
                        !instOther.equals(oldInst));
     @*/
   abstract void change(Instructor oldInst, Instructor newInst);
}