Example #1
0
 /**
  * This method is used for the UI to display the list of movies in priority order.
  *
  * @pre
  * @post the movies will be in the order of the priority the user queued them in, if two movies
  *     have the same priority then they appear in FIFO order
  * @return an array of {@link Movie} objects that are in priority order
  */
 public Movie[] displayWaitingMoviesByPriority() {
   @SuppressWarnings("unchecked")
   PriorityQueue<Movie> cloneOfP = (PriorityQueue<Movie>) DeepCopier.copy(waitingQueue);
   Movie[] movieList = new Movie[cloneOfP.getSize()];
   int i = 0;
   while (!cloneOfP.isEmpty()) {
     movieList[i] = cloneOfP.dequeueByPriority();
     i++;
   }
   return movieList;
 }