/** PersonnelOffice represents an office at UW that holds information * on all of the people at UW, such as where they live and what buildings * they have access to. **/ public class PersonnelOffice { private static HashMap privileges = new HashMap(); /** * @throws NotAStudentException if there is no student whose id number * is idNumber * @return the BuildingID to the dorm that the student with * idNumber lives in, or null if the student does not live in a dorm. **/ public static BuildingID getDorm(String idNumber) throws NotAStudentException; /** * @throws NoSuchEmployeeException if there is no student whose id number * is idNumber * @return the BuildingID to the building where the employee with * idNumber works **/ public static BuildingID getWorkLocation(String idNumber) throws NoSuchEmployeeException; /** * @return the AccessPrivilege for the building if the person with * idNumber should have access to that building; else returns null. **/ public static AccessPrivilege getBuildingAccess(String idNumber, BuildingID building) { if (hasBuildingPrivilege(idNumber, building)) { AccessPrivilege priv = new AccessPrivilege(building); if (privileges.containsKey(priv)) { return (AccessPrivilege)privileges.get(priv); } else { privileges.put(priv, priv); return priv; } } return null; } /** * @throws NotFacultyException if there is no faculty member whose * id number is idNumber * @return a Vector contains AccessPrivileges that represent all * of the buildings that the faculty member with idNumber has * access to **/ public static List getFacultyPrivileges(String idNumber) throws NotFacultyException { // implementation omitted. } }