public class TestPriorityQueue {
  public static void main(String[] args) {
    Patient patient1 = new Patient("Jan", 2);
    Patient patient2 = new Patient("Jacek", 1);
    Patient patient3 = new Patient("Tadeusz", 5); 
    Patient patient4 = new Patient("Cecylia", 7);
    
    MyPriorityQueue<Patient> priorityQueue 
      = new MyPriorityQueue<>();
    priorityQueue.enqueue(patient1);
    priorityQueue.enqueue(patient2);
    priorityQueue.enqueue(patient3);
    priorityQueue.enqueue(patient4); 
    
    while (priorityQueue.getSize() > 0) 
      System.out.print(priorityQueue.dequeue() + " ");
  }
  
  static class Patient implements Comparable<Patient> {
    private String name;
    private int priority;
    
    public Patient(String name, int priority) {
      this.name = name;
      this.priority = priority;
    }
    
    @Override
    public String toString() {
      return name + "(priorytet:" + priority + ")";
    }
    
    @Override
    public int compareTo(Patient o) {
      return this.priority - o.priority;
    }
  }
}