Class TicketList

java.lang.Object
com.example.skeddly.business.TicketList
Direct Known Subclasses:
ParticipantList, WaitingList

public abstract class TicketList extends Object
A list of tickets. This class is extended to make up the participant and final lists.
  • Constructor Details

    • TicketList

      public TicketList(int max)
      Constructor for bounded ticket list
      Parameters:
      max - Maximum number of tickets
    • TicketList

      public TicketList()
      Constructor for unbounded ticket list
  • Method Details

    • addTicket

      public void addTicket(String ticketId)
      Add a ticket to the waiting list
      Parameters:
      ticketId - Ticket to add
      Throws:
      IllegalArgumentException - If the list is already full
    • remove

      public void remove(String ticketId)
      Remove a ticket from the ticket list
      Parameters:
      ticketId - ID of the ticket to remove
    • getMax

      public int getMax()
      Return the maximum number of people allowed in the ticket list
      Returns:
      The maximum length of the list
    • setMax

      public void setMax(int max)
      Set the maximum number of people allowed in the ticket list
      Parameters:
      max - The new limit
    • isFull

      public boolean isFull()
      Gets whether the ticket list is full or not.
      Returns:
      True if the ticket list is full. False otherwise.
    • isEmpty

      public boolean isEmpty()
      Gets whether the ticket list is empty or not.
      Returns:
      True if the waiting list is empty. False otherwise.
    • size

      public int size()
      Gets how many tickets are stored in the waiting list.
      Returns:
      The number of tickets in the waiting list.
    • getTicketIds

      public ArrayList<String> getTicketIds()
      Return the ArrayList of tickets
      Returns:
      The ticketId list
    • setTicketIds

      public void setTicketIds(ArrayList<String> ticketIds)
      Update the ArrayList of tickets
      Parameters:
      ticketIds - The new ticketId list