Package src.controller
Class SeatManager
Object
SeatManager
Controller class for handling all logic related to
Seat
- Version:
- 1.0
- Author:
- Lee Juin
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
bookSeat
(String seatID, MovieSchedule movieSchedule, ArrayList<Seat> seatingPlan, Cinema cinema, boolean assign) Method to book/unbook seatstatic Seat
Method to create aCoupleSeat
and save to databasestatic Seat
Method to create aStandardSeat
and save to databasestatic String
getNextSeatID
(String seatID, Cinema cinema) Method to get the next seat's ID for couple seatstatic Seat
getSeatBySeatID
(String seatID, ArrayList<Seat> seatingPlan, Cinema cinema) Method to obtainSeat
instance by the front-end displayed seat IDstatic Seat
getSeatByUUID
(String seatUUID) Method to retrieveSeat
instance by its UUIDstatic void
printPlatinumCinemaFloorMap
(ArrayList<Seat> seatingPlan) Method to print the floor map of a platinum cinemastatic void
printStandardCinemaFloorMap
(ArrayList<Seat> seatingPlan) Method to print the floor map of a standard cinema (non-platinum)static int
seatIDConverter
(String seatID, Cinema cinema) Method to convert the front-end displayed seat ID (i.e.static boolean
validateBooking
(Seat seat, boolean booking) Helper function to verify that the act of booking/unbooking is legitimate
-
Constructor Details
-
SeatManager
public SeatManager()Constructor
-
-
Method Details
-
createCoupleSeat
Method to create aCoupleSeat
and save to database- Returns:
- The created
CoupleSeat
instace.
-
createStandardSeat
Method to create aStandardSeat
and save to database- Returns:
- The created
StandardSeat
instace.
-
printStandardCinemaFloorMap
Method to print the floor map of a standard cinema (non-platinum)- Parameters:
seatingPlan
- is the seating plan to be printed
-
printPlatinumCinemaFloorMap
Method to print the floor map of a platinum cinema- Parameters:
seatingPlan
- is the seating plan to be printed
-
seatIDConverter
Method to convert the front-end displayed seat ID (i.e. A1, B3, etc.) into back-end seatID for processing- Parameters:
seatID
- is the front-end displayed seat IDcinema
- is the cinema chosen by the MovieGoer- Returns:
- The back-end convereted seatID
-
validateBooking
Helper function to verify that the act of booking/unbooking is legitimate- Parameters:
seat
- is theSeat
instance to be booked/unbookedbooking
- is the booking statustrue
to represent book andfalse
to represent unbook- Returns:
true
if the act is legitimate,false
otherwise
-
bookSeat
public static boolean bookSeat(String seatID, MovieSchedule movieSchedule, ArrayList<Seat> seatingPlan, Cinema cinema, boolean assign) Method to book/unbook seat- Parameters:
seatID
- is the front-end displayed seat IDmovieSchedule
- is theMovieSchedule
instance of the movieseatingPlan
- is the seating plan selected by the usercinema
- is theCinema
instance the MovieGoer chosenassign
-true
if booking, otherwisefalse
- Returns:
true
if booking/unbooking is successful,false
otherwise
-
getSeatBySeatID
Method to obtainSeat
instance by the front-end displayed seat ID -
getSeatByUUID
Method to retrieveSeat
instance by its UUID- Parameters:
seatUUID
- The target seat's UUID- Returns:
- The target seat
-
getNextSeatID
Method to get the next seat's ID for couple seat- Parameters:
seatID
- is the current seat's IDcinema
- is the target cinema- Returns:
- The next seat's ID
-