5.5. Room.rsl
module RoomModule;
from ScheduleModule import Schedule;
export Room;
object RoomDB is
components: Room*;
operations: addRoom, changeRoom, removeRoom;
description: (*
The RoomDB is the repository of Rooms
*);
end RoomDB;
object Room is
components:
build:Building and rnum:RoomNumber and capacity:Capacity and rtime:RoomTime and enhance:Enhancements;
description: (*
A Room contains information about a particular room including its
location, capacity and times when its availiable as well as what is
in the room.
*);
end Room;
object Building is integer;
object RoomNumber is integer;
object Capacity is integer;
object Enhancements is
components:
lab:Lab and Mult:Multimedia and os:OS and db:Database and ai:AI and net:Networks and oth:Other;
description: (*
Enhancements are a collection of Hardware and software in the rooms
*);
end Enhancement;
object Lab is boolean;
object Multimedia is boolean;
object OS is boolean;
object Database is boolean;
object AI is boolean;
object Networks is boolean;
object Other is
components:
chk:check and txt:text;
description: (*
other is a check box that allows the user to enter add things not in the list
*);
end Other;
object check is boolean;
object text is string;
object RoomTime is
components: rday:RoomDay and rtime:RoomTimes and rchoice:RoomChoice;
description: (*
A TimePref is a rating of a time, Choice, for a given Time and Day.
*);
end RoomTime;
object RoomDay is
components:
Mon or Tues or Wed or Thurs or Fri or Sat or Sun;
description: (*
Days of the week
*);
end RoomDay;
object Mon;
object Tues;
object Wed;
object Thurs;
object Fri;
object Sat;
object Sun;
object RoomTimes is string;
object RoomChoice is boolean;
operation AddRoom is
inputs: r:Room, rdb:RoomDB;
outputs: rdb':RoomDB;
precondition: (*
* There is no Room with the same Room Number and Building Number
* as the room to be added
*)
(not (exists (r' in rdb)((r'.build = r.build) and (r'.rnum = r.rnum))))
and
(*
* The Building is not nil and 2 chars long
*)
(r.build != nil)
and
(*
* The room number is not nill and is 3 chars long
*)
(r.rnum != nil);
postcondition: (*
* The given Course is in the output CourseDB iff it is the new one or was
* already in the CourseDB
* )
forall(r':Room)
(r' in rdb') iff ((r' = r) or (r' in rdb));
description: (*
AddRoom adds the particular Room to the Room database,
producing an updated Room database
*);
end AddRoom;
operation ChangeRoom is
inputs: newr:Room, oldr:Room, rdb:RoomDB;
outputs: rdb':RoomDB;
precondition: (*
* The old and new Courses are not the same
*)
(oldr != newr)
and
(*
* The old Course is in the CourseDB
*)
(oldr in rdb)
and
(*
* Ther is no Course with the same Dept and Course #
* as the new Course
*)
(not (exists (newr' in rdb)((newr'.build = newr.build) and (newr'.rnum = newr.rnum))))
and
(*
* The Building is not nil
*)
(newr.build != nil)
and
(*
* The room number is not nill
*)
(newr.rnum != nil);
postcondition: (*
* A Course is in the output db iff it is the new record to be added
* or it was already there and not the same as the old Course
*)
forall (r' in rdb')
(r' in rdb') iff (((r' = newr) or (r' in rdb)) and
(r' != oldr));
description: (*
Change a room that is already in the database
*);
end ChangeRoom;
operation RemoveRoom is
inputs: r:Room, rdb:RoomDB;
outputs: rdb':RoomDB;
precondition: (*
* The Course is in the Database
*)
(r in rdb);
postcondition: (*
* A Course is in output DB only if it is not the input Course
* and if it in the input DB
*)
(forall (r':Room)
(r' in rdb') iff ((r' != r) and (r' in rdb)));
description: (*
RemoveRoom removes the particular Room to the Room database,
producing an updated Room database
*);
end RemoveRoom;
object LocalRoom inherits from Room
components:
RoomUsed and RoomSchedule;
description: (*
A LocalRoom is a room in the local dbase is all the things the room is and if it is being used.
*);
end LocalRoom;
object RoomUsed is boolean;
object RoomSchedule inherits from Schedule;
=======
module RoomModule;
export RoomDB;
export Room;
export Capacity;
object RoomDB is
components: Room*;
operations: addRoom, changeRoom, removeRoom;
description: (*
The RoomDB is the repository of Rooms
*);
end RoomDB;
object Room is
components:
Building and RoomNumber and capac:Capacity and RoomTime and Enhancements; description: (*
A Room contains information about a particular room including its location, capacity and times when its availiable as well as what is in the room.
*);
end Room;
object Building is integer;
object RoomNumber is integer;
object Capacity is integer;
object Enhancements is
components:
Lab and Multimedia and OS and Database and AI and Networks and Other; description: (*
Enhancements are a collection of Hardware and software in the rooms *);
end Enhancement;
object Lab is boolean;
object Multimedia is boolean;
object OS is boolean;
object Database is boolean;
object AI is boolean;
object Networks is boolean;
object Other is
components:
check and text;
description: (*
other is a check box that allows the user to enter add things not in the list
*);
end Other;
object check is boolean;
object text is string;
object RoomTime is
components:
RoomDay and RoomTimes and RoomChoice;
description: (*
A TimePref is a rating of a time, Choice, for a given Time and Day. *);
end RoomTime;
object RoomDay is string;
object RoomTimes is string;
object RoomChoice is boolean;
operation AddRoom is
inputs: Room, RoomDB;
outputs: RoomDB;
description: (* AddRoom adds the particular Room to the Room database,
producing an updated Room database
*);
end AddRoom;
operation RemoveRoom is
inputs: Room, RoomDB;
outputs: RoomDB;
description: (*
RemoveRoom removes the particular Room to the Room database, producing an updated Room database
*);
end RemoveRoom;
object LocalRoom inherits from Room
components:
RoomUsed; description: (*
A LocalRoom is all the things the room is and if it is being used. *);
end LocalRoom;
object RoomUsed is boolean;
end RoomModule;
Prev: Course Listing
| Next: Students
| Up: Specification
| Top: index