package database;

import java.util.Collection;

/**
 * This class is derived from section 2.3.4.
 *
 * BuildingList is the repository of Building information. 
 * @author kdavis22
 */
abstract class BuildingList {
   
   /**
     * The collection of buildings.
     */  
   Collection<Building> data;

   /**
    * Add the given Building to the given BuildingList. The buildingNumber of the given 
    * building must not be the same as a building already in the buildingList. Each 
    * building must have a name and location. 
    */ 
   /*@
     ensures
       //
       // A Building is on the output BuildingList if and only if it is the new Building
       // to be added or it is in the input BuildingList.
       //
       (\forall Building bdOther ;
           data.contains(bdOther) <==>
               bdOther.equals(bd) || \old(data).contains(bdOther));
     @*/
   abstract void add(Building bd);

   /**
    * Delete the given Building from the given BuildingList. The given Building must 
    * already be on the BuildingList.  
    */
    /*@
      requires
        //
        // The given Building is in the given BuildingList.
        //
        data.contains(bd);

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