Class Project
This class serves as the central model for housing projects in the BTO Management System. It encapsulates all the details about a Build-To-Order housing project including its basic information, location, timeline, and available flat types.
Each Project contains:- Project metadata (ID, name, location)
- Timeline information (launch and application dates)
- A collection of flat types with their associated details
- Visibility control for public listing
Projects serve as the foundation for applications and bookings in the system, representing the housing units that citizens can apply for.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
addApprovedOfficer
(String officerNric) Adds an officer to the list of officers approved to work on this project.boolean
Gets the list of NRICs of HDB officers approved to work on this project.Gets the date when the application period closes.getFlatInfo
(FlatType flatType) Gets information about a specific flat type in this project.Gets the map of flat types available in this project.Gets the NRIC of the manager assigned to this project.int
Gets the maximum number of officer slots available for this project.Gets the neighborhood of this project.Gets the date when the application period opens.Gets the unique identifier for this project.Gets the name of this housing project.int
Gets the remaining number of officer slots available for this project.int
hashCode()
boolean
Gets the visibility status of this project.boolean
removeApprovedOfficer
(String officerNric) Removes an officer from the list of officers approved to work on this project.void
setApprovedOfficerNrics
(List<String> approvedOfficerNrics) Sets the entire list of approved officer NRICs for this project.void
setClosingDate
(LocalDate closingDate) Sets the project closing date.void
setFlatTypes
(Map<FlatType, ProjectFlatInfo> flatTypes) Sets the entire map of flat types for this project.void
setMaxOfficerSlots
(int maxOfficerSlots) Sets the maximum number of officer slots available for this project.void
setNeighborhood
(String neighborhood) Sets the project neighborhood.void
setOpeningDate
(LocalDate openingDate) Sets the project opening date.void
setProjectName
(String projectName) Sets the project name.void
setVisibility
(boolean visible) Sets the visibility status of this project.toString()
-
Constructor Details
-
Project
public Project(String projectId, String projectName, String neighborhood, Map<FlatType, ProjectFlatInfo> flatTypes, LocalDate openingDate, LocalDate closingDate, String managerNric, int maxOfficerSlots) Constructs a new Project with the specified details.- Parameters:
projectId
- The unique identifier for the projectprojectName
- The name of the housing projectneighborhood
- The location or address of the projectflatTypes
- A map of flat types available in this projectopeningDate
- The date when the application period opensclosingDate
- The date when the application period closesmanagerNric
- The NRIC of the manager assigned to this projectmaxOfficerSlots
- The maximum number of officer slots available for this project
-
-
Method Details
-
getProjectId
Gets the unique identifier for this project.- Returns:
- The project ID
-
getProjectName
Gets the name of this housing project.- Returns:
- The project name
-
getNeighborhood
Gets the neighborhood of this project.The neighborhood represents the geographical area where the BTO project is located in Singapore.
- Returns:
- The neighborhood location name
-
getFlatTypes
Gets the map of flat types available in this project.Returns a mapping of each FlatType to its corresponding ProjectFlatInfo object, which contains details like unit count, price, and availability information.
- Returns:
- A map of flat types to their associated information
-
getOpeningDate
Gets the date when the application period opens.This date marks the beginning of the period when applicants can submit their applications for this BTO project.
- Returns:
- The opening date for applications
-
getClosingDate
Gets the date when the application period closes.This date marks the end of the period when applications will be accepted for this BTO project.
- Returns:
- The closing date for applications
-
getManagerNric
Gets the NRIC of the manager assigned to this project.Each BTO project is assigned an HDB manager who has overall responsibility for the project's administration and oversight.
- Returns:
- The manager's NRIC identifier
-
getMaxOfficerSlots
public int getMaxOfficerSlots()Gets the maximum number of officer slots available for this project.This value represents the total number of HDB officers that can be assigned to work on this project simultaneously.
- Returns:
- The maximum number of officer slots
-
getRemainingOfficerSlots
public int getRemainingOfficerSlots()Gets the remaining number of officer slots available for this project.This value represents how many more HDB officers can be assigned to this project before reaching the maximum capacity.
- Returns:
- The remaining number of officer slots
-
isVisible
public boolean isVisible()Gets the visibility status of this project.- Returns:
- true if the project is visible, false otherwise
-
getApprovedOfficerNrics
Gets the list of NRICs of HDB officers approved to work on this project.- Returns:
- The list of approved officer NRICs
-
setVisibility
public void setVisibility(boolean visible) Sets the visibility status of this project.- Parameters:
visible
- The visibility status to set
-
getFlatInfo
Gets information about a specific flat type in this project.- Parameters:
flatType
- The flat type to get information for- Returns:
- The flat type information, or null if the flat type is not available in this project
-
setProjectName
Sets the project name.- Parameters:
projectName
- The new name, must not be null or blank (after trimming).- Throws:
IllegalArgumentException
- if projectName is null or blank.
-
setNeighborhood
Sets the project neighborhood.- Parameters:
neighborhood
- The new neighborhood, must not be null or blank (after trimming).- Throws:
IllegalArgumentException
- if neighborhood is null or blank.
-
setOpeningDate
Sets the project opening date. Ensures the new opening date is not after the current closing date (if set).- Parameters:
openingDate
- The new opening date. Can be null.- Throws:
IllegalArgumentException
- if the new openingDate is after the existing closingDate.
-
setClosingDate
Sets the project closing date. Ensures the new closing date is not before the current opening date (if set).- Parameters:
closingDate
- The new closing date. Can be null.- Throws:
IllegalArgumentException
- if the new closingDate is before the existing openingDate.
-
setMaxOfficerSlots
public void setMaxOfficerSlots(int maxOfficerSlots) Sets the maximum number of officer slots available for this project.- Parameters:
maxOfficerSlots
- The maximum number of officer slots to set
-
setFlatTypes
Sets the entire map of flat types for this project. Used by the repository during loading. Creates defensive copies.- Parameters:
flatTypes
- A map where the key is the FlatType enum and the value is the ProjectFlatInfo object.
-
setApprovedOfficerNrics
Sets the entire list of approved officer NRICs for this project. Used by the repository during loading. Creates defensive copies.- Parameters:
approvedOfficerNrics
- A list of strings containing the NRICs.
-
addApprovedOfficer
Adds an officer to the list of officers approved to work on this project.- Parameters:
officerNric
- The NRIC of the officer to add- Returns:
- true if the officer was added, false otherwise
-
removeApprovedOfficer
Removes an officer from the list of officers approved to work on this project.- Parameters:
officerNric
- The NRIC of the officer to remove- Returns:
- true if the officer was removed, false if the officer was not in the list
-
equals
-
hashCode
public int hashCode() -
toString
-