scheduler.db.locationdb
Class Location

java.lang.Object
  extended by scheduler.db.locationdb.Location

public class Location
extends java.lang.Object

This class contains the place and informaton about a location.

Author:
Cedric Wienold

Nested Class Summary
 class Location.InvalidDayOfWeekException
          This exception class is thrown when the day of week is not in the Sunday to Saturday format.
 class Location.InvalidTimeInputException
          This exception is raised when invalid time inputs are entered.
private  class Location.ProvidedEquipment
          This class contains the equipment provided at a location.
 
Field Summary
private  boolean adaCompliant
          Whether this location is compliant to those with disabilities.
private  WeekAvail availability
          Represents a location's availabilty throughout the week.
private  java.lang.String building
          Building number of location.
private  int maxOccupancy
          Maximum occupancy of this location.
private  Location.ProvidedEquipment providedEquipment
          Provided equuipment in this location.
private  java.lang.String room
          Room number of location.
static Location TBA
          Represents a location who's identity is not yet known
private  java.lang.String type
          Type of this location.
 
Constructor Summary
Location(int bldg, int room)
          This constructor creates a location at a particular room and building.
Location(Location l)
          Creates a location which is a copy of a given location.
Location(java.lang.String building, java.lang.String room)
          This constructor will make a location at a building and room number.
Location(java.lang.String building, java.lang.String room, int maxOccupancy, java.lang.String type, boolean disabilities, boolean smartroom, boolean laptop, boolean overhead)
          This constructor will make a location at a building and room number with other fields.
 
Method Summary
 boolean equals(java.lang.Object other)
          Returns true if the argument is not null, is an instance of the Location class, and its building and room numbers are the same as this object's.
 java.lang.String getBuilding()
          Returns the building number of this location.
 int getMaxOccupancy()
          Returns the maximum occupancy of this location.
 java.lang.String getRoom()
          Returns the room number of this location.
 java.lang.String getType()
           
 boolean hasLaptopConnectivity()
          This method returns whether this room has laptop connectivity.
 boolean hasOverhead()
          This method returns whether this room has an overhead.
 boolean isADACompliant()
          This method returns whether this room is disabled-accessible.
 boolean isAvailable(int dayOfWeek, Time s, Time e)
          This method will tell whether this location is availble during the given time slot.
 boolean isAvailable(Week week, Time s, Time e)
          Determines whether a location is available during the given span of time, over the given week of days.
 boolean isLab()
          Returns whether this location is a lab room.
 boolean isLecture()
          Returns whether this location is a lecture room.
 boolean isSmartRoom()
          This method returns whether this is a smart room.
 boolean isValidLocation(Location location)
          Returns whether the given location is valid.
 boolean isValidLocationDB()
          Returns whether the currect class is a valid LocationDB.
 boolean providesFor(Course c)
          Determines whether this location provides the required equipment for a given course, and is of a compatible type.
 void setBusy(int dayOfWeek, Time s, Time e)
          This method will take in a day, start time, and end time and set that time interval as busy for this location.
 boolean setBusy(Time s, Time e, Week week)
          Books this location for a given time over a given span of days (Week).
 java.lang.String toString()
          Returns the building-dash-room string representation of this location.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TBA

public static Location TBA
Represents a location who's identity is not yet known


building

private java.lang.String building
Building number of location.


room

private java.lang.String room
Room number of location.


maxOccupancy

private int maxOccupancy
Maximum occupancy of this location.


type

private java.lang.String type
Type of this location.


providedEquipment

private Location.ProvidedEquipment providedEquipment
Provided equuipment in this location.


adaCompliant

private boolean adaCompliant
Whether this location is compliant to those with disabilities.


availability

private WeekAvail availability
Represents a location's availabilty throughout the week.

Constructor Detail

Location

public Location(int bldg,
                int room)
This constructor creates a location at a particular room and building.

Parameters:
bldg - the building number.
room - the room number.

Location

public Location(Location l)
Creates a location which is a copy of a given location. Note that a new availability object is created (thus, not copied). Written by: Eric Liebowitz

Parameters:
l - Location to copy

Location

public Location(java.lang.String building,
                java.lang.String room)
This constructor will make a location at a building and room number.

Parameters:
building -
room -

Location

public Location(java.lang.String building,
                java.lang.String room,
                int maxOccupancy,
                java.lang.String type,
                boolean disabilities,
                boolean smartroom,
                boolean laptop,
                boolean overhead)
This constructor will make a location at a building and room number with other fields.

Parameters:
building -
room -
Method Detail

equals

public boolean equals(java.lang.Object other)
Returns true if the argument is not null, is an instance of the Location class, and its building and room numbers are the same as this object's.

Overrides:
equals in class java.lang.Object
Parameters:
other - the object to compare with
Returns:
whether the two objects are equal

getBuilding

public java.lang.String getBuilding()
Returns the building number of this location.

Returns:
the building number of this location.

getMaxOccupancy

public int getMaxOccupancy()
Returns the maximum occupancy of this location.

Returns:
the maximum occupancy of this location.

getRoom

public java.lang.String getRoom()
Returns the room number of this location.

Returns:
the room number of this location.

getType

public java.lang.String getType()

hasLaptopConnectivity

public boolean hasLaptopConnectivity()
This method returns whether this room has laptop connectivity.

Returns:
whether this room has laptop connectivity.

hasOverhead

public boolean hasOverhead()
This method returns whether this room has an overhead.

Returns:
whether this room has an overhead.

isADACompliant

public boolean isADACompliant()
This method returns whether this room is disabled-accessible.

Returns:
whether this rom is disabled-accessible.

isAvailable

public boolean isAvailable(int dayOfWeek,
                           Time s,
                           Time e)
This method will tell whether this location is availble during the given time slot.

Parameters:
dayOfWeek - The day (0 = Sun; 6 = Sat)
s - The start time
e - The end time
Returns:
True if the given span of time is available. False otherwise. Written by: Eric Liebowitz

isAvailable

public boolean isAvailable(Week week,
                           Time s,
                           Time e)
Determines whether a location is available during the given span of time, over the given week of days.

Parameters:
week - The week of days that must be free
s - The start time
e - The end time
Returns:
True if the time between "s" and "e" is free on all days of "week" Written by: Eric Liebowitz

setBusy

public void setBusy(int dayOfWeek,
                    Time s,
                    Time e)
This method will take in a day, start time, and end time and set that time interval as busy for this location.

Parameters:
dayOfWeek - The day (0 = Sun; 6 = Sat)
s - The start time
e - The end time Written by: Eric Liebowitz

setBusy

public boolean setBusy(Time s,
                       Time e,
                       Week week)
Books this location for a given time over a given span of days (Week).

Parameters:
week - The span of days to book
s - The start time
e - The end time
Returns:
if the time was booked, and thus free beforehand. Written by: Eric Liebowitz

isLab

public boolean isLab()
Returns whether this location is a lab room.

Returns:
whether this location is a lab room.

isLecture

public boolean isLecture()
Returns whether this location is a lecture room.

Returns:
whether this location is a lecture room.

isSmartRoom

public boolean isSmartRoom()
This method returns whether this is a smart room.

Returns:
whether this is a smart room.

isValidLocation

public boolean isValidLocation(Location location)
Returns whether the given location is valid.


isValidLocationDB

public boolean isValidLocationDB()
Returns whether the currect class is a valid LocationDB.


toString

public java.lang.String toString()
Returns the building-dash-room string representation of this location.

Overrides:
toString in class java.lang.Object
Returns:
the string representation of this building

providesFor

public boolean providesFor(Course c)
Determines whether this location provides the required equipment for a given course, and is of a compatible type.

Parameters:
c - The course to provide for
Returns:
True if this location all the course's required equipment. False otherwise. Written by: Eric Liebowitz