Class SeatManager

Object
SeatManager

public class SeatManager extends Object
Controller class for handling all logic related to Seat
Version:
1.0
Author:
Lee Juin
  • Constructor Details

    • SeatManager

      public SeatManager()
      Constructor
  • Method Details

    • createCoupleSeat

      public static Seat createCoupleSeat()
      Method to create a CoupleSeat and save to database
      Returns:
      The created CoupleSeat instace.
    • createStandardSeat

      public static Seat createStandardSeat()
      Method to create a StandardSeat and save to database
      Returns:
      The created StandardSeat instace.
    • printStandardCinemaFloorMap

      public static void printStandardCinemaFloorMap(ArrayList<Seat> seatingPlan)
      Method to print the floor map of a standard cinema (non-platinum)
      Parameters:
      seatingPlan - is the seating plan to be printed
    • printPlatinumCinemaFloorMap

      public static void printPlatinumCinemaFloorMap(ArrayList<Seat> seatingPlan)
      Method to print the floor map of a platinum cinema
      Parameters:
      seatingPlan - is the seating plan to be printed
    • seatIDConverter

      public static int seatIDConverter(String seatID, Cinema cinema)
      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 ID
      cinema - is the cinema chosen by the MovieGoer
      Returns:
      The back-end convereted seatID
    • validateBooking

      public static boolean validateBooking(Seat seat, boolean booking)
      Helper function to verify that the act of booking/unbooking is legitimate
      Parameters:
      seat - is the Seat instance to be booked/unbooked
      booking - is the booking status true to represent book and false 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 ID
      movieSchedule - is the MovieSchedule instance of the movie
      seatingPlan - is the seating plan selected by the user
      cinema - is the Cinema instance the MovieGoer chosen
      assign - true if booking, otherwise false
      Returns:
      true if booking/unbooking is successful, false otherwise
    • getSeatBySeatID

      public static Seat getSeatBySeatID(String seatID, ArrayList<Seat> seatingPlan, Cinema cinema)
      Method to obtain Seat instance by the front-end displayed seat ID
      Parameters:
      seatID - is the front-end displayed seat ID
      seatingPlan - is the seating plan that the Movie Goer chosen
      cinema - is the Cinema that the Movie Goer chosen
      Returns:
      The Seat instance
    • getSeatByUUID

      public static Seat getSeatByUUID(String seatUUID)
      Method to retrieve Seat instance by its UUID
      Parameters:
      seatUUID - The target seat's UUID
      Returns:
      The target seat
    • getNextSeatID

      public static String getNextSeatID(String seatID, Cinema cinema)
      Method to get the next seat's ID for couple seat
      Parameters:
      seatID - is the current seat's ID
      cinema - is the target cinema
      Returns:
      The next seat's ID