Class ERModel

java.lang.Object
  |
  +--ERModel

public class ERModel
extends java.lang.Object

Emergency Room priority queue demo.

Since:
JDK1.2

Method Summary
static void main(java.lang.String[] args)
          This method gets called automatically when you run the ERModel application.
 void schedule(java.lang.String name, int priority)
          Schedules a patient with a specified priority.
 void treatAll()
          Treats all patients.
 void treatNext()
          Treats the next patient in the queue.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

schedule

public void schedule(java.lang.String name,
                     int priority)
Schedules a patient with a specified priority. This method enqueue the patient with the specified priority, and pass an appropriate message string to the ERView's update method.

Parameters:
name - - patient's name
priority - - scheduling priority (1=fair; 2=critical; 3=serious)

treatAll

public void treatAll()
Treats all patients. This method should call ERModel.treatNext until the priority queue is empty.


treatNext

public void treatNext()
Treats the next patient in the queue. This method should dequeue the patient's name, and send an appropriate string to the ERView's update method.


main

public static void main(java.lang.String[] args)
This method gets called automatically when you run the ERModel application.