package database; import java.util.Collection; /** * This class contains important metadata about a building. The key value here * is the building number. Note that a building will contain a collection of many different rooms. * A building's department can be null in certain cases. The building's location is important * to the system's scheduling algorithm. The clearRooms method should be called before removing a * building, as it will wipe out all the associated rooms. * @author jroll * */ public abstract class Building extends DataItem { public Collection rooms; public int buildingNumber; public String name; public Department department; public Location location; /** * "Add" button * The user wants to add another Room to the * current list of rooms for the building. * The room is now in the collection of rooms * for the building. * @param room the room to be added to the * collection of rooms for a building **/ /*@ requires !(this.rooms.contains(room)); */ /*@ ensures (this.rooms.contains(room)); */ public abstract void addRoom(Room room); /** * "Set Location" of a building * Location on a Map. Contains longitude * and latitude. A building's location * will now be set to the value of location. * @param location the longitude and latitude * of where the building is located. **/ /*@ requires (location != null); */ /*@ ensures (this.location == location); */ public abstract void setLocation(Location location); /** * Removes all of the rooms in a building. * The collection containing rooms will be empty. **/ /*@ ensures (this.rooms.size() == 0); */ public abstract void clearRooms(); /** * Removes a single room from a list of rooms. * The room no longer exists in the collection of * rooms in the building. **/ /*@ requires (this.rooms.contains(room)); */ /*@ ensures (! this.rooms.contains(room)); */ public abstract void removeRoom(Room room); }