Class HospitalView

java.lang.Object
  |
  +--DisplayPanel
        |
        +--HospitalView

public class HospitalView
extends DisplayPanel

Hospital simulation.

See Also:
Serialized Form

Field Summary
protected  Action[] assignPriority
          Send the current patient to the waiting room with a given priority.
protected  Patient[] beds
          Hospital beds in this.
protected  PatientView[] bedViews
          Views for patients in beds.
protected  DisplayPanel controlPanel
          View for control panel.
protected  int emptyBed
          Index of next empty bed in this.
protected  int nextPatientCount
          Time until next new patient.
protected  Vector nextPatients
          Patients needing services.
protected  PatientView nextPatientView
          View for new patient needing services.
protected static String[] PRIORITIES
          Priority descriptors.
protected  int time
          Time for this.
protected  JLabel timeView
          Clock for this.
protected  IPriorityQueue triage
          Waiting room manager for this.
protected  Vector waiting
          List of patients in waiting room.
protected  TablePanel waitingContainer
          Views for patients waiting for beds.
 
Constructor Summary
HospitalView(int aCount)
          Constructs a new emergency room with the given number of beds.
 
Method Summary
protected  boolean aBedIsFree()
          Returns whether or not there is a free bed.
protected  void admit(Patient aPatient)
          Admits the given patient to a bed.
protected  void admitHighest()
          Admits the highest priority waiting patient.
protected  void assignPriority(int priority)
          Sends the new patient to the waiting room with the given priority.
protected  void click()
          Ticks the clock ahead one minute.
protected  void createNextPatientIfNecessary()
          Creates a new patient if it is time to do so.
protected  int nextPatientTime()
          Returns the number of minutes before the next patient will arrive.
protected  void showNextPatient()
          Shows the next patient to admit or make wait.
protected  String timeString()
          Returns the text of the time of this.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRIORITIES

protected static final String[] PRIORITIES
Priority descriptors.


triage

protected IPriorityQueue triage
Waiting room manager for this.


waiting

protected Vector waiting
List of patients in waiting room.


beds

protected Patient[] beds
Hospital beds in this.


emptyBed

protected int emptyBed
Index of next empty bed in this.


time

protected int time
Time for this.


nextPatientCount

protected int nextPatientCount
Time until next new patient.


nextPatients

protected Vector nextPatients
Patients needing services.


nextPatientView

protected PatientView nextPatientView
View for new patient needing services.


timeView

protected JLabel timeView
Clock for this.


bedViews

protected PatientView[] bedViews
Views for patients in beds.


waitingContainer

protected TablePanel waitingContainer
Views for patients waiting for beds.


controlPanel

protected DisplayPanel controlPanel
View for control panel.


assignPriority

protected Action[] assignPriority
Send the current patient to the waiting room with a given priority.

Constructor Detail

HospitalView

public HospitalView(int aCount)
Constructs a new emergency room with the given number of beds.

Parameters:
aCount - number of beds
Method Detail

click

protected void click()
Ticks the clock ahead one minute.


timeString

protected String timeString()
Returns the text of the time of this.


admit

protected void admit(Patient aPatient)
Admits the given patient to a bed.


assignPriority

protected void assignPriority(int priority)
Sends the new patient to the waiting room with the given priority.


aBedIsFree

protected boolean aBedIsFree()
Returns whether or not there is a free bed.


admitHighest

protected void admitHighest()
Admits the highest priority waiting patient.


nextPatientTime

protected int nextPatientTime()
Returns the number of minutes before the next patient will arrive.


createNextPatientIfNecessary

protected void createNextPatientIfNecessary()
Creates a new patient if it is time to do so.


showNextPatient

protected void showNextPatient()
Shows the next patient to admit or make wait.